feat(menu): draw logo
This commit is contained in:
parent
dc83316886
commit
9b11f3b220
1 changed files with 26 additions and 0 deletions
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue