Documentation ¶
Index ¶
- Constants
- type ActionFn
- type AnimationComponent
- type AnimationEngine
- type CollisionComponent
- type CollisionEngine
- type ControllerComponent
- type ControllerComponentBase
- func (b *ControllerComponentBase) AddAction(action ActionFn)
- func (b *ControllerComponentBase) ClearActions()
- func (b *ControllerComponentBase) GetValue(ref ValueRef) interface{}
- func (b *ControllerComponentBase) ProcessActions(e *Engine) error
- func (b *ControllerComponentBase) SetValue(ref ValueRef, value interface{})
- type ControllerEngine
- func (e *ControllerEngine) ConsumeGamepadEvents(_ time.Duration)
- func (e *ControllerEngine) ConsumeKeyboardEvents(_ time.Duration)
- func (e *ControllerEngine) ProcessActions(engine *Engine, duration time.Duration)
- func (e *ControllerEngine) SetActiveController(controller ControllerComponent)
- func (e *ControllerEngine) Start()
- func (e *ControllerEngine) Stop()
- type Engine
- func (e *Engine) Exit()
- func (e *Engine) GetEntity(ref EntityRef) Entity
- func (e *Engine) LoadGame(game Game)
- func (e *Engine) Run(matrixDone chan struct{})
- func (e *Engine) SetActiveController(controllerComponent ControllerComponent)
- func (e *Engine) UpdateBucket(bucket *EntityBucket, dt time.Duration) bool
- type Entity
- type EntityBase
- type EntityBucket
- type EntityRef
- type EntityValues
- type Game
- type GraphicComponent
- type GraphicComponentBase
- func (b *GraphicComponentBase) Disable()
- func (b *GraphicComponentBase) DisableDrawable(drawable components.Drawable)
- func (b *GraphicComponentBase) Draw(canvas canvas.Canvas) error
- func (b *GraphicComponentBase) Enable()
- func (b *GraphicComponentBase) EnableDrawable(drawable components.Drawable)
- func (b *GraphicComponentBase) GetValue(ref ValueRef) interface{}
- func (b *GraphicComponentBase) Hide()
- func (b *GraphicComponentBase) IsEnabled() bool
- func (b *GraphicComponentBase) IsVisible() bool
- func (b *GraphicComponentBase) RegisterDrawable(drawable components.Drawable)
- func (b *GraphicComponentBase) SetValue(ref ValueRef, value interface{})
- func (b *GraphicComponentBase) Show()
- type GraphicEngine
- type PhysicsComponent
- type PhysicsEngine
- type ValueRef
Constants ¶
View Source
const NoParent = -1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnimationComponent ¶
type AnimationEngine ¶
type AnimationEngine struct{}
func NewAnimationEngine ¶
func NewAnimationEngine() *AnimationEngine
func (AnimationEngine) CalculateIntermediatePoses ¶
func (e AnimationEngine) CalculateIntermediatePoses(bucket *EntityBucket, dt time.Duration)
play animation (ie: depending on time only)
func (AnimationEngine) FinalizePoseAndMatrixPalette ¶
func (e AnimationEngine) FinalizePoseAndMatrixPalette(bucket *EntityBucket)
correct animation parameters with previous effects
type CollisionComponent ¶
type CollisionEngine ¶
type CollisionEngine struct{}
func NewCollisionEngine ¶
func NewCollisionEngine() *CollisionEngine
func (CollisionEngine) DetectAndResolveCollisions ¶
func (e CollisionEngine) DetectAndResolveCollisions(bucket *EntityBucket, dt time.Duration)
fix moves and produces fixed NextPositions
type ControllerComponent ¶
type ControllerComponent interface { ConsumeGamepadEvents(events *[]controller.GamepadEvent, projection controller.GamepadProjection) ConsumeKeyboardEvents(events *[]controller.KeyboardEvent, projection controller.KeyboardProjection) ProcessActions(*Engine) error }
type ControllerComponentBase ¶
type ControllerComponentBase struct {
// contains filtered or unexported fields
}
func NewControllerComponentBase ¶
func NewControllerComponentBase(values *EntityValues) *ControllerComponentBase
func (*ControllerComponentBase) AddAction ¶
func (b *ControllerComponentBase) AddAction(action ActionFn)
func (*ControllerComponentBase) ClearActions ¶
func (b *ControllerComponentBase) ClearActions()
func (*ControllerComponentBase) GetValue ¶
func (b *ControllerComponentBase) GetValue(ref ValueRef) interface{}
func (*ControllerComponentBase) ProcessActions ¶
func (b *ControllerComponentBase) ProcessActions(e *Engine) error
func (*ControllerComponentBase) SetValue ¶
func (b *ControllerComponentBase) SetValue(ref ValueRef, value interface{})
type ControllerEngine ¶
type ControllerEngine struct {
// contains filtered or unexported fields
}
func NewControllerEngine ¶
func NewControllerEngine(keyboardChannel *controller.KeyboardEventChannel) *ControllerEngine
func (*ControllerEngine) ConsumeGamepadEvents ¶
func (e *ControllerEngine) ConsumeGamepadEvents(_ time.Duration)
func (*ControllerEngine) ConsumeKeyboardEvents ¶
func (e *ControllerEngine) ConsumeKeyboardEvents(_ time.Duration)
func (*ControllerEngine) ProcessActions ¶
func (e *ControllerEngine) ProcessActions(engine *Engine, duration time.Duration)
func (*ControllerEngine) SetActiveController ¶
func (e *ControllerEngine) SetActiveController(controller ControllerComponent)
func (*ControllerEngine) Start ¶
func (e *ControllerEngine) Start()
func (*ControllerEngine) Stop ¶
func (e *ControllerEngine) Stop()
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func NewGameEngine ¶
func NewGameEngine(canvas canvas.Canvas, keyboardEventChannel *controller.KeyboardEventChannel) *Engine
func (*Engine) SetActiveController ¶
func (e *Engine) SetActiveController(controllerComponent ControllerComponent)
func (*Engine) UpdateBucket ¶
func (e *Engine) UpdateBucket(bucket *EntityBucket, dt time.Duration) bool
type Entity ¶
type Entity interface { Parent() EntityRef // Update consumes controller gamepadEvents & set directions/velocity Update(engine *Engine, dt time.Duration) bool // FinalUpdate apply computed positions to entities, if any FinalUpdate(dt time.Duration) bool Enable() Disable() GetController() ControllerComponent }
type EntityBase ¶
type EntityBase struct { Values EntityValues ParentRef EntityRef }
func NewEntityBase ¶
func NewEntityBase() *EntityBase
func (EntityBase) GetValue ¶
func (b EntityBase) GetValue(ref ValueRef) interface{}
func (EntityBase) Parent ¶
func (b EntityBase) Parent() EntityRef
func (EntityBase) SetValue ¶
func (b EntityBase) SetValue(ref ValueRef, value interface{})
type EntityBucket ¶
type EntityBucket struct { Entities map[EntityRef]Entity ControllerComponents []ControllerComponent AnimationComponents []AnimationComponent PhysicsComponents []PhysicsComponent CollisionComponents []CollisionComponent GraphicComponents []GraphicComponent }
type EntityValues ¶
type EntityValues map[ValueRef]interface{}
func (EntityValues) Get ¶
func (v EntityValues) Get(ref ValueRef) interface{}
func (EntityValues) Set ¶
func (v EntityValues) Set(ref ValueRef, value interface{})
type Game ¶
type Game interface { Name() string // InitializeBuckets allow loading game components into engine InitializeBuckets() []EntityBucket // InitializeGame lets you load 1st scene (enable entity) InitializeGame(engine *Engine) }
Game describes a complete game content (graphics, controller, etc...)
type GraphicComponent ¶
type GraphicComponentBase ¶
type GraphicComponentBase struct {
// contains filtered or unexported fields
}
func NewGraphicComponentBase ¶
func NewGraphicComponentBase(values *EntityValues, graphic *components.Graphic, enabled, visible bool) *GraphicComponentBase
func (*GraphicComponentBase) Disable ¶
func (b *GraphicComponentBase) Disable()
func (*GraphicComponentBase) DisableDrawable ¶
func (b *GraphicComponentBase) DisableDrawable(drawable components.Drawable)
func (*GraphicComponentBase) Enable ¶
func (b *GraphicComponentBase) Enable()
func (*GraphicComponentBase) EnableDrawable ¶
func (b *GraphicComponentBase) EnableDrawable(drawable components.Drawable)
func (*GraphicComponentBase) GetValue ¶
func (b *GraphicComponentBase) GetValue(ref ValueRef) interface{}
func (*GraphicComponentBase) Hide ¶
func (b *GraphicComponentBase) Hide()
func (*GraphicComponentBase) IsEnabled ¶
func (b *GraphicComponentBase) IsEnabled() bool
func (*GraphicComponentBase) IsVisible ¶
func (b *GraphicComponentBase) IsVisible() bool
func (*GraphicComponentBase) RegisterDrawable ¶
func (b *GraphicComponentBase) RegisterDrawable(drawable components.Drawable)
func (*GraphicComponentBase) SetValue ¶
func (b *GraphicComponentBase) SetValue(ref ValueRef, value interface{})
func (*GraphicComponentBase) Show ¶
func (b *GraphicComponentBase) Show()
type GraphicEngine ¶
type GraphicEngine struct {
// contains filtered or unexported fields
}
func NewGraphicEngine ¶
func NewGraphicEngine(canvas canvas.Canvas) *GraphicEngine
func (GraphicEngine) RenderSceneAndSwapBuffers ¶
func (e GraphicEngine) RenderSceneAndSwapBuffers(buckets *[]EntityBucket)
type PhysicsComponent ¶
type PhysicsEngine ¶
type PhysicsEngine struct{}
func NewPhysicsEngine ¶
func NewPhysicsEngine() *PhysicsEngine
func (PhysicsEngine) Simulate ¶
func (e PhysicsEngine) Simulate(bucket *EntityBucket, dt time.Duration)
Simulate apply physics (compute next positions & velocities)
Click to show internal directories.
Click to hide internal directories.