28 lines
854 B
Go
28 lines
854 B
Go
package render
|
|
|
|
import (
|
|
"pacman/game/assets"
|
|
|
|
rl "github.com/gen2brain/raylib-go/raylib"
|
|
)
|
|
|
|
// DrawTile draws a single tile at the specified tile coordinates (x, y).
|
|
//
|
|
// The coordinates are in tile space, not pixels. The top-left tile is (0, 0),
|
|
// and the bottom-right is (27, 35) given the fixed resolution and tile size.
|
|
//
|
|
// The appearance of the tile is determined by the provided assets.Tile value.
|
|
func DrawTile(x, y uint8, tile assets.Tile) {
|
|
px := int32(x) * TileSize
|
|
py := int32(y) * TileSize
|
|
|
|
// For now, just draw simple circles and rectangles.
|
|
switch tile {
|
|
case assets.TILE_PELLET:
|
|
rl.DrawCircle(px+(TileSize/2), py+(TileSize/2), 1, rl.Beige)
|
|
case assets.TILE_POWER_PELLET:
|
|
rl.DrawCircle(px+(TileSize/2), py+(TileSize/2), 2, rl.Beige)
|
|
case assets.TILE_WALL:
|
|
rl.DrawRectangle(px, py, TileSize, TileSize, rl.DarkBlue)
|
|
}
|
|
}
|