#pragma once #include #include "../../gameplay/core/Game.h" // Forward declarations class FontAtlas; class LineEffect; /** * GameRenderer - Utility class for rendering the Tetris game board and HUD. * * This class encapsulates all the game-specific rendering logic that was * previously in main.cpp, making it reusable across different contexts. */ class GameRenderer { public: // Render the complete playing state including game board, HUD, and effects static void renderPlayingState( SDL_Renderer* renderer, Game* game, FontAtlas* pixelFont, LineEffect* lineEffect, SDL_Texture* blocksTex, float logicalW, float logicalH, float logicalScale, float winW, float winH ); // Render the pause overlay (full screen) static void renderPauseOverlay( SDL_Renderer* renderer, FontAtlas* pixelFont, float winW, float winH, float logicalScale ); // Render the exit confirmation popup static void renderExitPopup( SDL_Renderer* renderer, FontAtlas* pixelFont, float winW, float winH, float logicalScale, int selectedButton ); private: // Helper functions for drawing game elements static void drawBlockTexture(SDL_Renderer* renderer, SDL_Texture* blocksTex, float x, float y, float size, int blockType); static void drawPiece(SDL_Renderer* renderer, SDL_Texture* blocksTex, const Game::Piece& piece, float ox, float oy, float tileSize, bool isGhost = false, float pixelOffsetX = 0.0f, float pixelOffsetY = 0.0f); static void drawSmallPiece(SDL_Renderer* renderer, SDL_Texture* blocksTex, PieceType pieceType, float x, float y, float tileSize); // Helper function for drawing rectangles static void drawRect(SDL_Renderer* renderer, float x, float y, float w, float h, SDL_Color c); };