Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingComponents = errors.New("missing required components") ErrEntityIDExists = errors.New("entity ID already in use") )
Engine errors.
Functions ¶
This section is empty.
Types ¶
type Actionable ¶
type Actionable interface { Identifier Action() }
Actionable is the interface for entity actions. TODO: this is where we can animate entities. Check how this will need to be implemented.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the central struct from which the entire engine can be controlled.
func Build ¶
func Build() (*Controller, error)
Build creates a Controller struct. NOTE: locks the OS thread. Make sure to call all Controller.func from the exact same goroutine, otherwise the SDL context may crash!
func (*Controller) AddEntity ¶
func (c *Controller) AddEntity(entity Identifier) error
AddEntity will add the entity to the controller. If the entity does not match any orbengine interface, an error is returned.
func (*Controller) Iterate ¶
func (c *Controller) Iterate()
Iterate advances the controller by one step.
TODO make engine handle game loop... :P
func (*Controller) RegisterKey ¶
func (c *Controller) RegisterKey(key string, onPress, onRelease func()) error
RegisterKey allows entities to receive key presses by registering the functions to execute when a key is either pressed or released.
type Identifier ¶
type Identifier interface {
Identification() string
}
Identifier is the base interface all entites must match. It allows the engine to reference entities as specified by the application.
type Placeable ¶
type Placeable interface { Identifier Position() *sdl.Point Offset() *sdl.Point // Offset is center of orientation offset from position. FIXME use and apply Scale() int Width() int Height() int Rotation() float64 Layer() int Redraw() bool // TODO this should be somewhere else, but for now... }
Placeable is the interface used to determine where to place an object.
type Renderable ¶
Renderable is an alternative interface for Drawable for manually drawing entities.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer wraps the sdl.Renderer to control what methods are available for drawing interfaces.