ui

package
v0.0.0-...-07254f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2015 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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 HandleEvents

func HandleEvents() bool

HandleEvents is a skeleton UI event handler.

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

type SpriteFile struct {
	Filename string
	Sprites  []SpriteDef
}

SpriteFile represents the sprites in a single graphics file as loaded from tiles.json.

type SpriteFrame

type SpriteFrame struct {
	X int32
	Y int32
	W int32
	H int32
}

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

func ParseTileDefinitions(filename string) *TilesFile

ParseTileDefinitions parses a given filename and turns it into a TilesFile structure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL