feat: draw next shape
This commit is contained in:
parent
be57dd8231
commit
12712e0172
1 changed files with 5 additions and 3 deletions
8
main.go
8
main.go
|
|
@ -21,7 +21,7 @@ var (
|
||||||
dropTimer = core.NewIntervalTimer(0.3)
|
dropTimer = core.NewIntervalTimer(0.3)
|
||||||
moveTimer = core.NewIntervalTimer(0.1)
|
moveTimer = core.NewIntervalTimer(0.1)
|
||||||
grid = game.Grid{}
|
grid = game.Grid{}
|
||||||
nextShape game.ShapeType
|
nextShape = game.NewShape(game.SHAPE_O)
|
||||||
|
|
||||||
r = draw.Renderer{
|
r = draw.Renderer{
|
||||||
Theme: &draw.Theme{
|
Theme: &draw.Theme{
|
||||||
|
|
@ -35,9 +35,9 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func SpawnShape() {
|
func SpawnShape() {
|
||||||
shape = game.NewShape(nextShape)
|
shape = nextShape
|
||||||
shape_pos = core.Vec2i8{X: 4, Y: 0}
|
shape_pos = core.Vec2i8{X: 4, Y: 0}
|
||||||
nextShape = (nextShape + 1) % 7
|
nextShape = game.NewShape((nextShape.Type() + 1) % 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
func LockShape() {
|
func LockShape() {
|
||||||
|
|
@ -100,6 +100,8 @@ func Render() {
|
||||||
r.DrawHeaderText(410, 30, "Score")
|
r.DrawHeaderText(410, 30, "Score")
|
||||||
r.DrawText(410, 65, fmt.Sprintf("%.7d", score))
|
r.DrawText(410, 65, fmt.Sprintf("%.7d", score))
|
||||||
r.DrawFrame(rl.RectangleInt32{X: 400, Y: 150, Width: 250, Height: 200})
|
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()
|
render.End()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue