forked from DKU-EmbeddedSystem-Lab/2025_DKU_OpenSourceBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameRenderer.hpp
More file actions
41 lines (31 loc) · 1023 Bytes
/
GameRenderer.hpp
File metadata and controls
41 lines (31 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// GameRenderer.hpp
#ifndef GAMERENDERER_HPP
#define GAMERENDERER_HPP
#include "renderer.hpp"
#include "texture.hpp"
#include "piece.hpp"
#include "board.hpp"
#include "config.hpp"
class GameRenderer {
public:
GameRenderer(Renderer* renderer);
~GameRenderer();
void loadAssets();
void render(const Board* board, const Piece& current, const Piece& next, const Piece& hold, bool showGhost, int score, int stage);
private:
Renderer* renderer;
Texture* tetrominoSprites;
SDL_Rect tetrominoSpriteClips[7];
Texture* playfieldFrame;
SDL_Rect playfieldFrameClips[4];
Texture* stageTextTexture;
Texture* scoreTextTexture;
void drawBoard(const Board* board);
void drawPiece(const Piece& p, int offsetX, int offsetY);
void drawCurrentPiece(const Piece& p);
void drawNextPiece(const Piece& p);
void drawHoldPiece(const Piece& p);
void drawGhostPiece(const Piece& p, const Board* board);
SDL_Color getStageColor(int stage);
};
#endif // GAMERENDERER_HPP