Documentation ¶
Overview ¶
Package engine orchestrates all the platforms, systems, entities, assets, and deploy procedures of an application.
ECS ¶
Playthos uses the ECS pattern to manage how objects are perceived in the virtual space. ECS stands for Entity-component-system. What this means is that as a developer, you will be working with these in order to build an application and manipulate objects at runtime.
Index ¶
- func LoadAsset(path string)
- func NewIntegrant(i IntegrantRoutine)
- func NewSystem(s SystemRoutine)
- func RegisterPackage(pckg *Package)
- func RegisterPlatform(n string, p *Platform)
- type Component
- type ComponentRoutine
- type Desktoper
- type Drawer
- type Engine
- func (e *Engine) DeleteEntity(entity *Entity)
- func (e *Engine) Drawer() Drawer
- func (e *Engine) Entities() []*Entity
- func (e *Engine) Entity(id uint) *Entity
- func (e *Engine) Integrant(lookup IntegrantRoutine) IntegrantRoutine
- func (e *Engine) Listener(lookup Listener) Listener
- func (e *Engine) Listeners() []Listener
- func (e *Engine) NewEntity() *Entity
- func (e *Engine) Once()
- func (e *Engine) Platformer() Platformer
- func (e *Engine) SetSettings(settings *Settings)
- func (e *Engine) Settings() *Settings
- func (e *Engine) Start()
- func (e *Engine) Stop()
- func (e *Engine) UPS() float64
- func (e *Engine) Updaters() []Updater
- type Entity
- func (u Entity) Active() bool
- func (e *Entity) AddComponent(component ComponentRoutine)
- func (e *Entity) Component(lookup interface{}) ComponentRoutine
- func (e *Entity) Components() []ComponentRoutine
- func (u Entity) Engine() *Engine
- func (e *Entity) ID() uint
- func (u Entity) SetActive(active bool)
- func (u Entity) SetTag(t uint)
- func (u Entity) Tag() uint
- type Integrant
- type IntegrantRoutine
- type Listener
- type Package
- type Platform
- type Platformer
- type Settings
- type System
- type SystemRoutine
- type Updater
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadAsset ¶
func LoadAsset(path string)
LoadAsset instructs the current platform to load the asset correctly to be used for the application (binary, blob, etc.).
func NewIntegrant ¶
func NewIntegrant(i IntegrantRoutine)
NewIntegrant registers and organises the integrant into its appropriate registries (Platformer, Listener).
func NewSystem ¶
func NewSystem(s SystemRoutine)
NewSystem registers and organises the system into its appropriate registries (Drawer, Updater).
func RegisterPackage ¶
func RegisterPackage(pckg *Package)
RegisterPackage adds a Package to engine's package registry.
TODO(F): Create a database of official package names.
func RegisterPlatform ¶
RegisterPlatform adds a Platform to engine's platform registry.
TODO(F): Create a database of official platform names.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component is added to an entity and used by systems to simulate the scene
type ComponentRoutine ¶
type ComponentRoutine interface { SetActive(bool) // contains filtered or unexported methods }
ComponentRoutine interface allows for generic component types to be handled by the engine
type Desktoper ¶
type Desktoper interface { Platformer Asset(string) []byte }
Desktoper interface used to load Assets for desktops and return []byte
type Drawer ¶
type Drawer interface { SystemRoutine Draw() }
Drawer interface used on components that render on screen.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine ties the ECS pattern together, manages application running state, and stores meta information.
func New ¶
New initializes an Engine instance that could either deploy (platforms and packages are detected automatically) or run the application with an optional Settings parameter.
func (*Engine) DeleteEntity ¶
DeleteEntity removes entity from all systems (also empties its components) and the engine's registry
func (*Engine) Entity ¶
Entity returns Entity pointer by given ID
TODO(F): Find better way of searching entities by ID
func (*Engine) Integrant ¶
func (e *Engine) Integrant(lookup IntegrantRoutine) IntegrantRoutine
Integrant returns an Integrant based on the given Integrant type
func (*Engine) NewEntity ¶
NewEntity initializes and returns an empty Entity
TODO(F): Generate unique entity ID in "NewEntity()"
func (*Engine) Platformer ¶
func (e *Engine) Platformer() Platformer
Platformer returns platformer integrant pointer
func (*Engine) SetSettings ¶
SetSettings overwrites the engines settings
func (*Engine) Start ¶
func (e *Engine) Start()
Start updates engine state and executes the first update call.
func (*Engine) Stop ¶
func (e *Engine) Stop()
Stop updates engine state in order to commence gracefully shutdown
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
Entity is used to group components with an unique identifier in order to form a virtual/game object
func (*Entity) AddComponent ¶
func (e *Entity) AddComponent(component ComponentRoutine)
AddComponent adds a new component to an entity
func (*Entity) Component ¶
func (e *Entity) Component(lookup interface{}) ComponentRoutine
func (*Entity) Components ¶
func (e *Entity) Components() []ComponentRoutine
ID returns unique entity identifier
type Integrant ¶
type Integrant struct {
// contains filtered or unexported fields
}
Integrant used to sporadically execute with engine.
type IntegrantRoutine ¶
type IntegrantRoutine interface { InitIntegrant() AddIntegrant(IntegrantRoutine) SetActive(bool) Destroy() // contains filtered or unexported methods }
IntegrantRoutine plugs into engine to sporadically alter components.
type Listener ¶
type Listener interface { IntegrantRoutine On(int, func(...int)) IsDeploy() IsSet(int) bool Emit(int, int) }
Listener interface used to listen and emit engine events.
type Package ¶
Package defines a package name, it's dependencies on other packages, what it resolves, and the platforms it is targeted for.
type Platform ¶
type Platform struct { Command string Args []string TagsArg string Tags []string GOOS string CC string ARCH string DeployFileExtension string BuildDependency string }
Platform defines how a platform is identified, deployed against, and packaged.
type Platformer ¶
type Platformer interface { IntegrantRoutine IsDeploy() LoadAsset(string) }
Platformer interface used to load and retrieve platform specific assets.
type System ¶
type System struct {
// contains filtered or unexported fields
}
System used to procedurally execute with engine.
type SystemRoutine ¶
type SystemRoutine interface { InitSystem() Destroy() AddComponent(ComponentRoutine) DeleteEntity(*Entity) AddIntegrant(IntegrantRoutine) ComponentTypes() []ComponentRoutine SetActive(bool) // contains filtered or unexported methods }
SystemRoutine plugs into engine to procedurally alter components.
type Updater ¶
type Updater interface { SystemRoutine Update() }
Updater interface used on components that update every game loop.
Notes ¶
Bugs ¶
Game loop currently performing very badly on windows
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package animation adds the Animation updater system with the clip and keyframe components
|
Package animation adds the Animation updater system with the clip and keyframe components |
Package audio adds the Audio listener integrant with the clip, sound, source, and listener components.
|
Package audio adds the Audio listener integrant with the clip, sound, source, and listener components. |
Package collision adds the Collision updater system with the collider component as well as helpers for collision detection
|
Package collision adds the Collision updater system with the collider component as well as helpers for collision detection |
Package cursor adds the Cursor updater system.
|
Package cursor adds the Cursor updater system. |
Package glfw adds the GLFW integrant.
|
Package glfw adds the GLFW integrant. |
Package keyboard adds a empty Keyboard listener integrant to be overwriten by the platform specific integrant.
|
Package keyboard adds a empty Keyboard listener integrant to be overwriten by the platform specific integrant. |
Package openal adds the OpenAL listener integrant.
|
Package openal adds the OpenAL listener integrant. |
Package opengl adds the OpenGL drawer system.
|
Package opengl adds the OpenGL drawer system. |
Package physics adds the Physics updater system with the rigidbody component.
|
Package physics adds the Physics updater system with the rigidbody component. |
platforms
|
|
linux
Package linux adds linux support to engine.
|
Package linux adds linux support to engine. |
web
Package web adds web/javascript support to engine.
|
Package web adds web/javascript support to engine. |
windows
Package windows adds windows support to engine.
|
Package windows adds windows support to engine. |
Package render adds an empty Render system to be overwritten by platform specific drawer with material, mesh, camera, and texture components.
|
Package render adds an empty Render system to be overwritten by platform specific drawer with material, mesh, camera, and texture components. |
Package scripting adds the Scripting updater system.
|
Package scripting adds the Scripting updater system. |
Package std add circle, rect, mesh, transform, vector, and color components
|
Package std add circle, rect, mesh, transform, vector, and color components |
Package webgl adds the WebGL drawer system.
|
Package webgl adds the WebGL drawer system. |