Advertisement
Amorf

Untitled

Dec 14th, 2021
791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. void DrawEngine::drawBlock(int x, int y, COLORREF color)
  2. {
  3.     HBRUSH hBrush = CreateSolidBrush(color);
  4.     rect.left = x;
  5.     rect.right = x + 1;
  6.     rect.top = y;
  7.     rect.bottom = y + 1;
  8.     FillRect(hdc, &rect, hBrush);
  9.     MoveToEx(hdc, x, y + 1, NULL);
  10.     LineTo(hdc, x, y);
  11.     LineTo(hdc, x + 1, y);
  12.     DeleteObject(hBrush);
  13. }
  14. void DrawEngine::drawInterface()
  15. {
  16.     HBRUSH hBrush = CreateSolidBrush(RGB(70,70,70));
  17.     rect.top = height;
  18.     rect.left = width;
  19.     rect.bottom = 0;
  20.     rect.right = width + 8;
  21.     FillRect(hdc, &rect, hBrush);
  22.     DeleteObject(hBrush);
  23. }
  24. void DrawEngine::drawNextPiece(Piece &piece, int x, int y)
  25. {
  26.     TCHAR szBuffer[] = TEXT("Next:");
  27.     TextOut(hdc, x, y + 5, szBuffer, lstrlen(szBuffer));
  28.     COLORREF color = piece.getColor();
  29.     for (int i = 0; i < 4; i++)
  30.     {
  31.         for (int j = 0; j < 4; j++)
  32.         {
  33.             if (piece.isPointExists(i, j))
  34.                 drawBlock(i + x, j + y, color);
  35.             else
  36.                 drawBlock(i + x, j + y, RGB(0,0,0));
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement