1
0
Fork 0

feat: draw next shape

This commit is contained in:
Henrik Hautakoski 2025-09-17 06:33:45 +02:00
parent be57dd8231
commit 12712e0172

View file

@ -21,7 +21,7 @@ var (
dropTimer = core.NewIntervalTimer(0.3)
moveTimer = core.NewIntervalTimer(0.1)
grid = game.Grid{}
nextShape game.ShapeType
nextShape = game.NewShape(game.SHAPE_O)
r = draw.Renderer{
Theme: &draw.Theme{
@ -35,9 +35,9 @@ var (
)
func SpawnShape() {
shape = game.NewShape(nextShape)
shape = nextShape
shape_pos = core.Vec2i8{X: 4, Y: 0}
nextShape = (nextShape + 1) % 7
nextShape = game.NewShape((nextShape.Type() + 1) % 7)
}
func LockShape() {
@ -100,6 +100,8 @@ func Render() {
r.DrawHeaderText(410, 30, "Score")
r.DrawText(410, 65, fmt.Sprintf("%.7d", score))
r.DrawFrame(rl.RectangleInt32{X: 400, Y: 150, Width: 250, Height: 200})
r.DrawHeaderText(410, 155, "Next")
draw.DrawShape(rl.NewVector2(450, 150), core.NewVec2[int8](1, 3), nextShape)
render.End()
}