diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-09-29 13:20:43 +0200 | 
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-09-29 13:20:43 +0200 | 
| commit | 9d72ed2d5801b1506158082f08bd0b47e58db17f (patch) | |
| tree | 1fe30ab6dae55db5a3faaac6b8d54f67a31255d3 /src/games/tetris/Tetromino.cpp | |
| parent | d793b79dea7d5e19982128528276cf05d6c23b5d (diff) | |
renderer: major refactor; vectors: now aggregates
Diffstat (limited to 'src/games/tetris/Tetromino.cpp')
| -rw-r--r-- | src/games/tetris/Tetromino.cpp | 12 | 
1 files changed, 7 insertions, 5 deletions
diff --git a/src/games/tetris/Tetromino.cpp b/src/games/tetris/Tetromino.cpp index a77fa57..94343c0 100644 --- a/src/games/tetris/Tetromino.cpp +++ b/src/games/tetris/Tetromino.cpp @@ -1,6 +1,8 @@  #include <games/tetris/Tetromino.hpp> +#include <renderer/Renderer.hpp> +  #include <random> -#include <stdlib.h> +#include <cstdlib>  // layout of a left_aligned_bitmap: xxxx000000000000  // layout of a board_bitmap is 111xxxxxxxxxx111 @@ -119,7 +121,7 @@ bool Tetromino::MaybeMoveDown() {      return false;  } -void Tetromino::Draw(RenderGroup &render_group) const { +void Tetromino::Draw() const {      float world_width = 4.0f;      float world_height = 3.0f;      float tetromino_size_with_border = world_height / 20.0f; @@ -132,7 +134,7 @@ void Tetromino::Draw(RenderGroup &render_group) const {          y0 * tetromino_size_with_border      }; -    Tetromino::Draw(m_Id, m_Ori, world_pos, 1.0f, render_group); +    Tetromino::Draw(m_Id, m_Ori, world_pos, 1.0f);  }  bool Tetromino::IsCollisionWithBoard(TetrominoId id, BoardPos pos, int32_t ori, uint16_t *board_bitmap) { @@ -175,7 +177,7 @@ Color Tetromino::GetColor(TetrominoId id) {      return color;  } -void Tetromino::Draw(TetrominoId id, int32_t ori, V2F32 pos, float scale, RenderGroup &render_group) { +void Tetromino::Draw(TetrominoId id, int32_t ori, V2F32 pos, float scale) {      int32_t id_ = static_cast<int32_t>(id);      float world_height = 3.0f; @@ -209,7 +211,7 @@ void Tetromino::Draw(TetrominoId id, int32_t ori, V2F32 pos, float scale, Render                  Color color = GetColor(id); -                render_group.PushRectangle(world_rect, world_pos.z, color); +                g_renderer.PushRectangle(world_rect, world_pos.z, color);              }          }      }  | 
