From 02157a12eadc96a6be8e6212c7fe8357a290c432 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 14 Sep 2025 21:49:52 +0200 Subject: [PATCH] feat(draw): add DrawShape() --- game/draw/shape.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 game/draw/shape.go diff --git a/game/draw/shape.go b/game/draw/shape.go new file mode 100644 index 0000000..8913b41 --- /dev/null +++ b/game/draw/shape.go @@ -0,0 +1,23 @@ +package draw + +import ( + "tetris/engine/core" + "tetris/engine/graphics" + "tetris/game/draw/grid" + + rl "github.com/gen2brain/raylib-go/raylib" +) + +type Shape interface { + Tile() graphics.Tile + Coordinates() [4]core.Vec2i8 +} + +func DrawShape(offset rl.Vector2, pos core.Vec2i8, shape Shape) { + tile := shape.Tile() + + for _, coord := range shape.Coordinates() { + block := pos.Add(coord) + grid.DrawBlock(offset, byte(block.X), byte(block.Y), tile) + } +}