hschumann2/TempleOS-Source-Code
0847
1 2//This is a drawing program3 4public U0 SpeedLineDemo()5{6 I64 msg_code,cnt,x1,y1,x2,y2,arg1,arg2,color=BLACK;7 CDC *dc=DCAlias;8 dc->color=color;9 10 SettingsPush; //See SettingsPush11 Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;12 13 AutoComplete;14 WinBorder;15 WinMax;16 DocClear;17 DCFill;18 do {19 msg_code=GetMsg(&arg1,&arg2,20 1<<MSG_KEY_DOWN+1<<MSG_MS_L_DOWN+1<<MSG_MS_R_UP);21 switch (msg_code) {22 case MSG_MS_R_UP:23 color=PopUpColor;24 if (color>=0)25 dc->color=color;26 break;27 case MSG_MS_L_DOWN:28 x1=arg1; y1=arg2;29 x2=arg1; y2=arg2;30 cnt=0;31 while (msg_code!=MSG_MS_L_UP) {32 dc->thick=0.04*ms.speed;33 GrLine3(dc,x1,y1,0,x2,y2,0);34 msg_code=GetMsg(&arg1,&arg2,35 1<<MSG_MS_L_UP+1<<MSG_MS_MOVE);36 x1=x2; y1=y2;37 x2=arg1; y2=arg2;38 }39 GrLine3(dc,x1,y1,0,x2,y2,0);40 break;41 case MSG_KEY_DOWN:42 break;43 }44 } while (msg_code!=MSG_KEY_DOWN || !arg1);45 GetMsg(,,1<<MSG_KEY_UP);46 DCFill;47 DCDel(dc);48 SettingsPop;49}50 51SpeedLineDemo; //Execute when #included52 