// back-end static void DrawSeparator (int index, int x) { if( index > 0 ) { if( index == currCurrent ) { DrawLineEx( x, MarginH, x, nHeightPB - MarginH, PEN_BLUEDOTTED ); } else if( (index % 20) == 0 ) { DrawLineEx( x, MarginH, x, nHeightPB - MarginH, PEN_DOTTED ); } } }
static BOOL FAR MazeToolProc (HWND hWnd,LONG lParam,WORD wMsg) { HDC hDC; LPFRAME lpFrame; LPTR lpLine; POINT pt; RGBS Pixel; static int x1,y1; pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); switch (wMsg) { case WM_LBUTTONDOWN: if (!bTrack) { lpFrame = ImgGetBaseEditFrame (lpImage); lpLine = FramePointer (lpFrame,pt.x,pt.y,FALSE); FrameGetRGB (lpFrame,lpLine,&Pixel,1); if (Pixel.green && !(Pixel.red & Pixel.blue)) // start green pel { // SoundStartID (IDC_LINES,NO,0); SoundStartResource ("icons",NO,0); MazeTrailPoints[0].x = x1 = pt.x; MazeTrailPoints[0].y = y1 = pt.y; nNumTrailPoints = 1; if (bShowSolution || bSolved) { bShowSolution = bSolved = FALSE; InvalidateRect (hWnd,NULL,FALSE); UpdateWindow (hWnd); } bTrack = TRUE; } else if (!AnimateProc(hWnd,lParam,wMsg)) SoundStartResource ("WRONGANSWER1",NO,0); } break; case WM_MOUSEMOVE: if (!bTrack) break; if (!fAppActive || GetUpdateRect (hWnd,NULL,FALSE)) { InvertLine (hWnd,x1,y1,x1,y1); break; } InvertLine (hWnd,x1,y1,pt.x,pt.y); if (!LBUTTON || (pt.x == x1 && pt.y == y1)) break; // else button is down, so fall through to anchor a point case WM_LBUTTONUP: if (bTrack) { if (PathIsClear (x1,y1,pt.x,pt.y)) { lpFrame = ImgGetBaseEditFrame (lpImage); lpLine = FramePointer (lpFrame,pt.x,pt.y,FALSE); FrameGetRGB (lpFrame,lpLine,&Pixel,1); if (Pixel.red && !(Pixel.green & Pixel.blue)) // end red pel { SoundStartResource ("GOODANSWER1",NO,0); StartAnimation(hWnd); bSolved = TRUE; bTrack = FALSE; } else { hDC = GetDC (hWnd); DrawLineEx (hDC,x1,y1,pt.x,pt.y, hMazePen ? hMazePen : (HPEN)GetStockObject (BLACK_PEN),FALSE); ReleaseDC (hWnd,hDC); x1 = pt.x; y1 = pt.y; if (nNumTrailPoints < MAX_LINEPOINTS) { MazeTrailPoints[nNumTrailPoints].x = x1; MazeTrailPoints[nNumTrailPoints].y = y1; nNumTrailPoints++; } } } else SoundStartResource ("WRONGANSWER1",NO,0); } break; case WM_PAINT: if (bTrack) { int i; hDC = GetDC (hWnd); pt.x = MazeTrailPoints[0].x; pt.y = MazeTrailPoints[0].y; for (i = 1; i < nNumTrailPoints; i++) { DrawLineEx (hDC,pt.x,pt.y, MazeTrailPoints[i].x,MazeTrailPoints[i].y, hMazePen ? hMazePen : (HPEN)GetStockObject (BLACK_PEN),FALSE); pt.x = MazeTrailPoints[i].x; pt.y = MazeTrailPoints[i].y; } ReleaseDC (hWnd,hDC); } break; } return TRUE; }