fixed statistics

This commit is contained in:
2025-12-07 17:30:18 +01:00
parent 24779755a5
commit 2b4b07ae6a
10 changed files with 424 additions and 125 deletions

View File

@ -21,6 +21,7 @@ public:
FontAtlas* pixelFont,
LineEffect* lineEffect,
SDL_Texture* blocksTex,
SDL_Texture* statisticsPanelTex,
SDL_Texture* scorePanelTex,
float logicalW,
float logicalH,
@ -52,6 +53,16 @@ public:
// calling from non-member helper functions (e.g. visual effects) that cannot
// access private class members.
static void drawBlockTexturePublic(SDL_Renderer* renderer, SDL_Texture* blocksTex, float x, float y, float size, int blockType);
// Transport/teleport visual effect API (public): start a sci-fi "transport" animation
// moving a visual copy of `piece` from screen pixel origin (startX,startY) to
// target pixel origin (targetX,targetY). `tileSize` should be the same cell size
// used for the grid. Duration is seconds.
static void startTransportEffect(const Game::Piece& piece, float startX, float startY, float targetX, float targetY, float tileSize, float durationSeconds = 0.6f);
// Convenience: compute the preview & grid positions using the same layout math
// used by `renderPlayingState` and start the transport effect for the current
// `game` using renderer layout parameters.
static void startTransportEffectForGame(Game* game, SDL_Texture* blocksTex, float logicalW, float logicalH, float logicalScale, float winW, float winH, float durationSeconds = 0.6f);
static bool isTransportActive();
private:
// Helper functions for drawing game elements
@ -59,11 +70,6 @@ private:
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);
static void renderNextPanel(SDL_Renderer* renderer, FontAtlas* pixelFont, SDL_Texture* blocksTex, const Game::Piece& nextPiece, float panelX, float panelY, float panelW, float panelH, float tileSize);
// Transport/teleport visual effect: start a sci-fi "transport" animation moving
// a visual copy of `piece` from screen pixel origin (startX,startY) to
// target pixel origin (targetX,targetY). `tileSize` should be the same cell size
// used for the grid. Duration is seconds.
static void startTransportEffect(const Game::Piece& piece, float startX, float startY, float targetX, float targetY, float tileSize, float durationSeconds = 0.6f);
// Helper function for drawing rectangles
static void drawRect(SDL_Renderer* renderer, float x, float y, float w, float h, SDL_Color c);