Advertisement
Amorf

Untitled

Dec 14th, 2021
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #ifndef DRAW_ENGINE_H
  2. #define DRAW_ENGINE_H
  3.  
  4. #include "Piece.h"
  5. #include <windows.h>
  6.  
  7. //
  8. // Draw engine implemented with Win32 API GDI.
  9. //
  10. class DrawEngine
  11. {
  12. public:
  13.     // hdc: handle to DC
  14.     // hwnd: handle to window
  15.     // pxPerBlock: cell size in pixels
  16.     // width & height: level width and height
  17.     DrawEngine(HDC hdc, HWND hwnd, int pxPerBlock = 25,
  18.                int width = 10, int height = 20);
  19.     ~DrawEngine();
  20.  
  21.     // Fills a cell
  22.     void drawBlock(int x, int y, COLORREF color);
  23.  
  24.     // Draws UI (gray area)
  25.     void drawInterface();
  26.  
  27.     // Draws a text message
  28.     void drawText(TCHAR *szText, int x, int y) const;
  29.  
  30.     // Draws all kinds of info
  31.     void drawScore(int score, int x, int y) const;
  32.     void drawSpeed(int speed, int x, int y) const;
  33.     void drawNextPiece(Piece &piece, int x, int y);
  34.  
  35. protected:
  36.     HDC hdc;     // Handle to DC
  37.     HWND hwnd;   // Handle to window
  38.     RECT rect;   // For internal temporary usage
  39.     int width;   // Level width in cells
  40.     int height;  // Level height
  41. };
  42.  
  43. #endif // DRAW_ENGINE_H
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement