Documentation ¶
Index ¶
- func HexColorToRGBA(color int) *sdl.Color
- type Actor
- type Actors
- type AtlasCoord
- type Bitmap
- type BitmapAtlas
- type Drawable
- type KBState
- type Prop
- type Scene
- func (s *Scene) AddActor(actor Actors)
- func (s *Scene) ClearActors()
- func (s *Scene) Draw()
- func (s *Scene) ElapsedTime() float32
- func (s *Scene) FireKeyboardEvent(e *sdl.KeyboardEvent)
- func (s *Scene) FireUpdateEvent(ticks uint32)
- func (s *Scene) KBState() *KBState
- func (s *Scene) RemoveActor(actor Actors)
- func (s *Scene) Renderer() *sdl.Renderer
- func (s *Scene) Scale() float32
- func (s *Scene) Start(stage *Stage)
- func (s *Scene) Stop()
- type Stage
- func (s *Stage) Destroy()
- func (s *Stage) DumpActors()
- func (s *Stage) FireKeyboardEvent(e *sdl.KeyboardEvent)
- func (s *Stage) NewSinglePixelTexture(r, g, b, a uint8) (*sdl.Texture, error)
- func (s *Stage) SetBackgroundColor(color sdl.Color)
- func (s *Stage) Start()
- func (s *Stage) StartScene(scene *Scene)
- func (s *Stage) Stop()
- func (s *Stage) StopScene()
- func (s *Stage) WindowSize() (w, h int32)
- type TransformXYZFunc
- type Vec3
- func (p *Vec3) Float32() (x, y, z float32)
- func (p *Vec3) Int32() (x, y, z int32)
- func (p *Vec3) MoveVec3(x, y, z float32)
- func (p *Vec3) MoveX(x float32)
- func (p *Vec3) MoveY(y float32)
- func (p *Vec3) MoveZ(z float32)
- func (p *Vec3) Set(x, y, z float32)
- func (p *Vec3) SetInt32(x, y, z int32)
- func (p *Vec3) SetX(x float32)
- func (p *Vec3) SetY(y float32)
- func (p *Vec3) SetZ(z float32)
- func (p *Vec3) Vec3Float32() (x, y, z float32)
- func (p *Vec3) Vec3Int32() (x, y, z int32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HexColorToRGBA ¶
HexColorToRGBA converts a colour stored in an int to RGBA values
Types ¶
type Actor ¶
type Actor struct { Name string Scene *Scene // Props []*Prop Visible bool Scale float32 Pos Vec3 Speed Vec3 }
Actor represents a specific Actor in a game
type AtlasCoord ¶
type AtlasCoord struct {
X, Y int
}
AtlasCoord indicates the location in bitmap/texture atlas
type BitmapAtlas ¶
type BitmapAtlas struct { Bitmap Keys map[string]AtlasCoord Pitch int // The width of the atlas TileWidth int // The width of a tile TileHeight int // The height of a tile }
BitmapAtlas represents an array of bitmap addressable by a key
func (*BitmapAtlas) GetBitmap ¶
func (bma *BitmapAtlas) GetBitmap(key string) (*Bitmap, error)
GetBitmap returns the bitmap tile for key speified
func (*BitmapAtlas) GetKeys ¶
func (bma *BitmapAtlas) GetKeys() []string
GetKeys returns a []rune of keys in the atlas
func (*BitmapAtlas) GetTexture ¶
GetTexture returns a texuter for the bitmap at the position associated witht he key
type Drawable ¶
type Drawable interface { Texture() *sdl.Texture Vec3() (x, y, z int32) Scale() float32 IsVisible() bool }
Drawable represents nd object that can be drawn by a renderer
type KBState ¶
type KBState struct {
// contains filtered or unexported fields
}
KBState represents the state of the keyboard
type Prop ¶
type Prop struct { Name string Pos Vec3 Texture *sdl.Texture Scale float32 Width int32 Height int32 TransformXYZFunc }
Prop represents an on-screen item.
type Scene ¶
type Scene struct { Name string Stage *Stage Actors []Actors KeyboardEventHandler func(e *sdl.KeyboardEvent) MouseButtonEventHandler func(e *sdl.MouseButtonEvent) MouseMotionEventHandler func(e *sdl.MouseMotionEvent) MouseWheelEventHandler func(e *sdl.MouseWheelEvent) StartEventHandler func() UpdateEventHandler func(ticks uint32) StopEventHandler func() }
Scene represents a specific Scene in a game
func (*Scene) ElapsedTime ¶
ElapsedTime returns the legnth of the last from in MS
func (*Scene) FireKeyboardEvent ¶
func (s *Scene) FireKeyboardEvent(e *sdl.KeyboardEvent)
FireKeyboardEvent triggers the keyboard event handler for the director and the current scene
func (*Scene) FireUpdateEvent ¶
FireUpdateEvent triggers the update event handler for the director and the current scene
func (*Scene) RemoveActor ¶
RemoveActor removes a actor from the scene
type Stage ¶
type Stage struct { Title string Window *sdl.Window Renderer *sdl.Renderer KBState *KBState Top int32 Left int32 Width int32 Height int32 Scale float32 ElapsedTime float32 FPSStart time.Time FPSCount int FPS int Stopping bool KeyboardEventHandler func(e *sdl.KeyboardEvent) Scene *Scene }
Stage represents a single Window
func (*Stage) DumpActors ¶
func (s *Stage) DumpActors()
DumpActors dumps out basic details about loaded props
func (*Stage) FireKeyboardEvent ¶
func (s *Stage) FireKeyboardEvent(e *sdl.KeyboardEvent)
FireKeyboardEvent triggers the keyboard event handler for the director and the current scene
func (*Stage) NewSinglePixelTexture ¶
NewSinglePixelTexture returns a new texture comprising a single pixel
func (*Stage) SetBackgroundColor ¶
SetBackgroundColor sets the background color
func (*Stage) StartScene ¶
StartScene starts the supplied scene
func (*Stage) WindowSize ¶
WindowSize returns the width and height of the widow
type TransformXYZFunc ¶
TransformXYZFunc transforms game X, Y, Z to diplay X, Y, Z