home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / wpj_mag / wpjv1n8.zip / GDI.ZIP / PBALL.ZIP / PBALL.H < prev    next >
Text File  |  1993-08-10  |  2KB  |  63 lines

  1. // Menu ID's
  2. #define IDM_ABOUT 100
  3. #define IDM_SPEED1            200
  4. #define IDM_SPEED2            201
  5. #define IDM_SPEED3            202
  6. #define IDM_SPEED4            203
  7.  
  8. // added these defines so that code is easy to read
  9. #define LEFT    1
  10. #define RIGHT    0
  11. #define UP        1
  12. #define DOWN    0
  13.  
  14. // function prototypes
  15. int PASCAL WinMain(HANDLE, HANDLE, LPSTR, int);
  16. BOOL InitApplication(HANDLE);
  17. BOOL InitInstance(HANDLE, int);
  18. long FAR PASCAL MainWndProc(HWND, unsigned, WORD, LONG);
  19. BOOL FAR PASCAL About(HWND, unsigned, WORD, LONG);
  20. void DrawBitmap (HBITMAP hBitmap, int xStart, int yStart);
  21.  
  22. void DrawBall(void);
  23. void MoveBall(void);
  24. void EraseOldBall(void);
  25.  
  26. // Variables to keep track of which menu item is checked
  27. WORD wPrevSpeed = IDM_SPEED2;
  28. WORD wPrevItem;
  29.  
  30.  
  31. // Keep track of Windows variables
  32. HWND    hWnd;    // handle to the window
  33. HANDLE hInst;    // current instance
  34. HDC        hDC;    // handle to the device context for the window
  35.  
  36. HBITMAP hbBall;
  37. BITMAP bmBall;
  38. HDC hMemoryDC;
  39.  
  40.  
  41. // variables to track position and direction of the ball
  42. int x=10;
  43. int xdirection=DOWN;
  44. int y=10;
  45. int ydirection=RIGHT;
  46. // how many pixels the ball is moved every time a timer message
  47. // is received
  48. int AnimeStep=5;
  49.  
  50.  
  51. PAINTSTRUCT ps;
  52. DWORD dwSize;
  53. WORD wHeight, wWidth;
  54. int nWidth;
  55. int nHeight;
  56.  
  57. RECT r;        // Storage for window dimensions and invalid region
  58. RECT rect1; // before moving
  59. RECT rect2; // after moving
  60. RECT rect3; // intersection of rect1 and rect2
  61. RECT rect4;    // first part of erasing region
  62. RECT rect5;    // second part of erasing region
  63.