Documentation ¶
Index ¶
Constants ¶
const ( // ColorDepth8 indicates 8-bit color. ColorDepth8 = 8 // ColorDepth15 indicates 15-bit color. ColorDepth15 = 15 // ColorDepth16 indicates 16-bit color. ColorDepth16 = 16 // ColorDepth24 indicates 24-bit color. ColorDepth24 = 24 // ScreenOriginUndefined is a magic value that the program to render the game window in the center. ScreenOriginUndefined = 0xFFFFFF )
Variables ¶
var ( Black = sdl.Color{R: 0, G: 0, B: 0, A: 255} Green = sdl.Color{R: 0, G: 255, B: 0, A: 255} Red = sdl.Color{R: 255, G: 0, B: 0, A: 255} Yellow = sdl.Color{R: 255, G: 255, B: 0, A: 255} White = sdl.Color{R: 255, G: 255, B: 255, A: 255} Blue = sdl.Color{R: 0, G: 0, B: 255, A: 255} Purple = sdl.Color{R: 255, G: 0, B: 255, A: 255} )
color definitions
Functions ¶
func InitRenderer ¶
func InitRenderer(screen *Screen)
InitRenderer initializes the game rendering structures and window.
func LoadTiles ¶
func LoadTiles(filename string)
LoadTiles loads the tiles in the given JSDON filename, typically tiles.json.
func ShutdownRenderer ¶
func ShutdownRenderer()
ShutdownRenderer is called to release window and UI resources when the game is exiting.
func UpdateScreen ¶
func UpdateScreen()
UpdateScreen is called once per frame or tick to redraw the screen.
Types ¶
type Screen ¶
type Screen struct { OriginX int32 OriginY int32 Width int32 Height int32 Depth uint8 // not used Windowed bool Title string }
Screen provides a portable screen definition for callers.
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
Sprite represents a renderable, animated sprite.
type SpriteDef ¶
type SpriteDef struct { Name string Frames []*SpriteFrame }
SpriteDef represents a sprite definition as loaded from tiles.json.
type SpriteFile ¶
SpriteFile represents the sprites in a single graphics file as loaded from tiles.json.
type SpriteFrame ¶
SpriteFrame represents a single frame of a sprite definition.
type TilesFile ¶
type TilesFile struct {
Files []SpriteFile
}
TilesFile represents the sprite definitions in tiles.json.
func ParseTileDefinitions ¶
ParseTileDefinitions parses a given filename and turns it into a TilesFile structure.