Last updated on 2 years ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| #include <stdio.h> #include <graphics.h> void start() { outtextxy(500,300,"start"); rectangle(370,290,650,320); } void startif() { ExMessage msg ; while(1) { do { peekmessage(&msg); if(msg.x >= 370 && msg.x <= 650 && msg.y >= 290 && msg.y <= 320) { cleardevice(); BeginBatchDraw(); settextcolor(RED); setlinecolor(RED); start(); FlushBatchDraw(); } else { cleardevice(); settextcolor(WHITE); setlinecolor(WHITE); start(); FlushBatchDraw(); }
}while(!msg.lbutton || !(msg.x >= 370 && msg.x <= 650 && msg.y >= 290 && msg.y <= 320)); printf("开始"); break; } }
|


不难写,但要注意BeginBatchDraw() 和 FludBatchDraw() 的位置,不加会闪。