- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
void CMainWindow::OnTimer(UINT_PTR id){
switch(id){
case IDT_TIMER1:
CClientDC dc(this);
dc.SetMapMode(MM_ISOTROPIC);
GetClientRect(&rcClient);
dc.SetWindowExt(CONSTANT,CONSTANT);
dc.SetViewportExt(rcClient.right,rcClient.bottom);
dc.SelectObject(GetStockObject(NULL_BRUSH));
dc.SetROP2(R2_NOTXORPEN);
wsprintf(buff,L"Score: %d ", score);
dc.TextOut(5,5,buff,15);
if(!won || resized)dc.Ellipse(ptsBegin0.x-RAD,ptsBegin0.y-RAD,ptsBegin0.x+RAD,ptsBegin0.y+RAD);
ptsBegin0.x = rand() % (CONSTANT-RAD) + RAD;
ptsBegin0.y = rand() % (CONSTANT -RAD)+ RAD;
dc.DPtoLP(&ptsBegin0,1);
dc.Ellipse(ptsBegin0.x-RAD,ptsBegin0.y-RAD,ptsBegin0.x+RAD,ptsBegin0.y+RAD);
if(!won || resized)dc.Ellipse(ptsEnd0.x-RAD,ptsEnd0.y-RAD,ptsEnd0.x+RAD,ptsEnd0.y+RAD);
ptsEnd0.x = rand() % (CONSTANT - RAD) + RAD;
ptsEnd0.y = rand() % (CONSTANT - RAD) + RAD;
dc.DPtoLP(&ptsEnd0,1);
dc.Ellipse(ptsEnd0.x-RAD,ptsEnd0.y-RAD,ptsEnd0.x+RAD,ptsEnd0.y+RAD);
won = resized = false;
}
}