feat: draw shape on grid.
This commit is contained in:
parent
02157a12ea
commit
63a3662dbe
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"image/color"
|
||||
|
||||
"tetris/assets"
|
||||
"tetris/engine/core"
|
||||
"tetris/engine/graphics"
|
||||
"tetris/engine/render"
|
||||
"tetris/game"
|
||||
|
|
@ -18,7 +19,7 @@ func createGrid() *game.Grid {
|
|||
grid := &game.Grid{}
|
||||
|
||||
c := 0
|
||||
for y := range byte(grid.Height() - 2) {
|
||||
for y := range byte(grid.Height() - 4) {
|
||||
for x := range byte(grid.Width()) {
|
||||
grid.Set(x, y, game.Block((c%7)+1))
|
||||
c++
|
||||
|
|
@ -29,6 +30,8 @@ func createGrid() *game.Grid {
|
|||
}
|
||||
|
||||
func main() {
|
||||
shape := game.NewShape(game.SHAPE_O)
|
||||
shape_pos := core.Vec2i8{X: 1, Y: 13}
|
||||
grid := createGrid()
|
||||
|
||||
// Set random blocks to test
|
||||
|
|
@ -61,6 +64,7 @@ func main() {
|
|||
for !rl.WindowShouldClose() {
|
||||
render.Begin(r.Theme.GridBackground)
|
||||
r.DrawGrid(rl.NewVector2(25, 25), grid)
|
||||
draw.DrawShape(rl.NewVector2(25, 25), shape_pos, shape)
|
||||
r.DrawFrame(rl.RectangleInt32{X: 400, Y: 25, Width: 250, Height: 100})
|
||||
r.DrawHeaderText(410, 30, "Score")
|
||||
r.DrawText(410, 65, "999999")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue