func renderBoard(g *game.Game, x, y, dx, dy int) { tx := dx / len(g.Level.Tiles) ty := dy / len(g.Level.Tiles[0]) gl.Enable(gl.TEXTURE_2D) gl.Color4ub(255, 255, 255, 255) for i := range g.Level.Tiles { for j := range g.Level.Tiles[i] { if g.Level.Tiles[i][j].Type == game.TileEmpty { tilePath := filepath.Join(base.GetDataDir(), fmt.Sprintf("textures/tile%d.png", (i+j)%4+1)) tile := texture.LoadFromPath(tilePath) tile.Render(float64(x+i*tx), float64(y+j*ty), float64(tx), float64(ty)) } } } }
func renderCards(cards []game.Card, cardSize, ulx, uly, cols int, cs *cardSelections) { gl.Enable(gl.TEXTURE_2D) x, y := -1, 0 for i := range cards { if x == cols-1 { x = -1 y++ } x++ cx := cardSize * x cy := cardSize * y var tile *texture.Data switch cards[i] { case game.CardForward1: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/move1.png")) case game.CardForward2: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/move2.png")) case game.CardForward3: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/move3.png")) case game.CardReverse1: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/reverse1.png")) case game.CardTurnLeft: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/turn-left.png")) case game.CardTurnRight: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/turn-right.png")) case game.CardUTurn: tile = texture.LoadFromPath(filepath.Join(base.GetDataDir(), "textures/u-turn.png")) } gl.Color4ub(255, 255, 255, 255) tile.Render(float64(cx+ulx), float64(cy+uly), float64(cardSize), float64(cardSize)) if cs != nil && cs.used[i] != -1 { setColorForIndex(cs.used[i]) renderCardReticle(true, cardSize, x, y, 400, 400) } } }