Documentation ¶
Index ¶
- Constants
- type Director
- func (d *Director) AddLuaScene(key, path string)
- func (d *Director) AddLuaSystem(path string)
- func (d *Director) AddScene(scene SceneInterface)
- func (d *Director) AddSystem(sys akara.System)
- func (d *Director) ExportToLua(state *lua.LState, table *lua.LTable) *lua.LTable
- func (d *Director) RemoveScene(key string) *Director
- func (d *Director) Run() error
- func (d *Director) Stop()
- func (d *Director) Update(dt time.Duration) (err error)
- type DirectorComponents
- type DirectorSystems
- type LuaScene
- type LuaSystem
- type ObjectFactory
- func (factory *ObjectFactory) Camera(x, y, w, h int) akara.EID
- func (factory *ObjectFactory) Circle(x, y, radius int, fill, stroke color.Color) akara.EID
- func (factory *ObjectFactory) Image(uri string, x, y int) akara.EID
- func (factory *ObjectFactory) Label(str string, x, y, size int, fontName string, c color.Color) akara.EID
- func (factory *ObjectFactory) Layer(x, y int) akara.EID
- func (factory *ObjectFactory) Rectangle(x, y, w, h int, fill, stroke color.Color) akara.EID
- func (factory *ObjectFactory) Sound(filePath string, paused bool, volume float64, muted bool, loop bool, ...) akara.EID
- func (factory *ObjectFactory) Viewport(x, y, w, h int) akara.EID
- type Scene
- type SceneInterface
- type SceneSystem
Constants ¶
const ( FlagNameDebug = "debug" FlagDescDebug = "print debug info" )
const ( FlagNameProfileCPU = "cpuprofile" FlagDescProfileCPU = "write cpu profile to file" )
const ( FlagNameTrace = "trace" FlagDescTrace = "write trace to file" )
const (
DefaultSceneTickRate = 60
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Director ¶
type Director struct { *akara.World Events *eventemitter.EventEmitter Sys DirectorSystems Components DirectorComponents // contains filtered or unexported fields }
Director provides a scene management abstraction, with supporting systems. scenes are basically a superset of the functionality provided by an akara.System, but with a bunch of object creation facilities provided for free.
func (*Director) AddLuaScene ¶
AddLuaScene creates and adds a scene using a lua script
func (*Director) AddLuaSystem ¶
AddLuaSystem creates and adds a scene using a lua script
func (*Director) ExportToLua ¶
func (*Director) RemoveScene ¶
RemoveScene queues a scene for removal
type DirectorComponents ¶
type DirectorComponents struct { Audio *audio.Component Interactive *interactive.Component Viewport *viewport.Component Camera *camera.Camera Color *color.Color Debug *debug.Component FileLoadRequest *fileLoadRequest.Component FileLoadResponse *fileLoadResponse.Component FileType *fileType.Component Fill *fill.Component HasChildren *hasChildren.Component Animation *animation.Component Stroke *stroke.Component Font *font.Component Opacity *opacity.Component Origin *origin.Component RenderTexture *renderTexture.Component RenderOrder *renderOrder.Component Size *size.Component SceneGraphNode *sceneGraphNode.Component Text *text.Component Texture2D *texture2D.Component Transform *transform.Component Uuid *uuid.Component }
DirectorComponents contains all of the primitive components that come with director. These are INTENTIONALLY nil instances, which can be used when creating component filters. See akara's `World.NewComponentFilter` and `World.AddSubscription`
type DirectorSystems ¶
type DirectorSystems struct { Load *file_loader.System Renderer *renderer.System Texture *texture_manager.System Tweens *tween.System Input *input.System Audio *audio.System }
DirectorSystems contains the base systems that are available when a director instance is created
func (DirectorSystems) ExportToLua ¶
type LuaScene ¶
LuaScene is a graphical scene which is created purely from a lua script. The Lua script requires an init and update function be declared.
func NewLuaScene ¶
func (*LuaScene) IsInitialized ¶
type LuaSystem ¶
type LuaSystem struct { SceneSystem LuaScriptPath string // contains filtered or unexported fields }
LuaSystem is a non-graphical system which is created purely from a lua script. The Lua script requires an init and update function be declared.
func NewLuaSystem ¶
func (*LuaSystem) IsInitialized ¶
type ObjectFactory ¶
type ObjectFactory struct { common.SceneComponents // contains filtered or unexported fields }
type Scene ¶
type Scene struct { SceneSystem Graph scenegraph.Node Viewports []akara.EID // contains filtered or unexported fields }
Scene is the basic scene struct, intended to be embedded in an end-user's scenes. This scene "class" has most of the generic scene lifecycle stuff required, so it is recommended that it's always used to create new scenes (for now).
func (*Scene) ExportToLua ¶
func (*Scene) GenericSceneInit ¶
func (*Scene) GenericUpdate ¶
func (s *Scene) GenericUpdate()
func (*Scene) RemoveEntity ¶
type SceneInterface ¶
type SceneInterface interface { akara.System Key() string Render() // contains filtered or unexported methods }
SceneInterface represents what director considers to be a scene
type SceneSystem ¶
type SceneSystem struct { *Director akara.BaseSystem Lua *lua.LState Components common.SceneComponents Add ObjectFactory }
SceneSystem is the generic non-graphical stuff for a scene. This is kept separate so that non-graphical scenes can be created, such as for headless servers. This type of "scene" can still create objects, but is much more like a system in that it just inits and then does an update every tick.
Example 1: You could have many modal ui menus, and a system that manages state for all of these ui's.
Example 2: A scene that spawns objects with velocities, and another system that only uses the velocity to update their position every tick.
func (*SceneSystem) ExportToLua ¶
func (*SceneSystem) InitializeLua ¶
func (s *SceneSystem) InitializeLua()
func (*SceneSystem) IsInitialized ¶
func (s *SceneSystem) IsInitialized() bool
func (*SceneSystem) LuaInitialized ¶
func (s *SceneSystem) LuaInitialized() bool
func (*SceneSystem) UninitializeLua ¶
func (s *SceneSystem) UninitializeLua()
Source Files ¶
- director.go
- director_components.go
- director_lua.go
- director_systems.go
- flags.go
- object_factory_camera.go
- object_factory_generic.go
- object_factory_image.go
- object_factory_label.go
- object_factory_layer.go
- object_factory_shape.go
- object_factory_shape_circle.go
- object_factory_shape_rectangle.go
- object_factory_sound.go
- object_factory_viewport.go
- scene.go
- scene_interface.go
- scene_lua.go
- scene_lua_api_constants_input.go
- scene_lua_api_constants_logging.go
- scene_lua_api_object_factory_circle.go
- scene_lua_api_object_factory_image.go
- scene_lua_api_object_factory_label.go
- scene_lua_api_object_factory_rectangle.go
- scene_lua_api_systems_renderer.go
- scene_lua_scene.go
- scene_lua_system.go
- scene_object_factory.go
- scene_system.go
- scene_system_lua.go
- scene_viewport.go