From 9b11f3b2200983d36dff0e0d5ef18619e608619d Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 6 Oct 2025 18:47:40 +0200 Subject: [PATCH] feat(menu): draw logo --- game/state/handlers/menu.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/game/state/handlers/menu.go b/game/state/handlers/menu.go index b73b661..bed3e53 100644 --- a/game/state/handlers/menu.go +++ b/game/state/handlers/menu.go @@ -4,6 +4,7 @@ import ( "tetris/assets" "tetris/engine/audio" "tetris/engine/render" + "tetris/game" "tetris/game/state" rl "github.com/gen2brain/raylib-go/raylib" @@ -53,8 +54,33 @@ func (menu *Menu) Update(fsm state.Transitioner, delta float32) { } } +func (Menu) renderLogo(offset_x, offset_y int32) { + for y := range assets.LOGO_HEIGHT { + for x := range assets.LOGO_STRIDE { + index := assets.Logo[x+(y*assets.LOGO_STRIDE)] + block := game.Block(index) + + if block == game.BLOCK_EMPTY { + continue + } + + src := block.Tile().GetTexRect() + + render.DrawTextureRec(src, rl.Rectangle{ + X: float32(offset_x) + (float32(x) * src.Width * 2), + Y: float32(offset_y) + (float32(y) * src.Height * 2), + Width: src.Width * 2, + Height: src.Height * 2, + }) + } + } +} + func (menu Menu) Render() { render.Begin(rl.Black) + + menu.renderLogo(20, 150) + y := int32(400) for i, entry := range menu.entries {