Documentation
¶
Index ¶
- Variables
- type Engine
- func (engine *Engine) AddLibrary(libraries ...*tetra3d.Library)
- func (engine *Engine) AddStage(name string) *Stage
- func (engine *Engine) FindStageByName(stageName string) *Stage
- func (engine *Engine) FindStageByScene(scene *tetra3d.Scene) *Stage
- func (engine *Engine) Quit()
- func (engine *Engine) RemoveStage(sceneName string)
- func (engine *Engine) SendMessage(msg messages.IMessage)
- func (engine *Engine) SendMessageToTargets(msg messages.IMessage, targets ...tetra3d.INode)
- func (engine *Engine) Time() float64
- func (engine *Engine) Update() error
- type IReceiver
- type ReceiverRegistryFunction
- type Stage
- func (stage *Stage) CurrentScene() *tetra3d.Scene
- func (stage *Stage) End()
- func (stage *Stage) Pause()
- func (stage *Stage) Paused() bool
- func (stage *Stage) Remove()
- func (stage *Stage) Restart()
- func (stage *Stage) SetScene(scene *tetra3d.Scene) error
- func (stage *Stage) SetSceneByName(sceneName string) error
- func (stage *Stage) TimerSystem() *ebitick.TimerSystem
- func (stage *Stage) Unpause()
- func (stage *Stage) Update()
Constants ¶
This section is empty.
Variables ¶
var EngineQuit = errors.New("quit")
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
Stages []*Stage
// contains filtered or unexported fields
}
Engine represents an engine for a Tetra3D scene.
func NewEngine ¶
func NewEngine(library *tetra3d.Library, registryFunction ReceiverRegistryFunction) *Engine
NewEngine creates a new Engine. library is the source library to be used for instantiating scenes from. ReceiverRegistryFunction is a function to return an IGameObject (something that can receive messages) for relevant INodes.
func (*Engine) AddLibrary ¶
AddLibrary adds libraries to use for scene creation to the Engine.
func (*Engine) AddStage ¶
AddStage creates a new Stage with the specified name. The Stage would then need to be set with a Scene to create. After that, it will be instantiated and begin updating on the next Engine.Update() call.
func (*Engine) FindStageByName ¶
FindStageByName searches for a Stage by the name of the scene that should be running in it. If the scene isn't found, the function returns nil.
func (*Engine) FindStageByScene ¶
FindStageByScene searches for a Stage by the scene that should be running in it. If the scene isn't found, the function returns nil.
func (*Engine) RemoveStage ¶
RemoveStage queues a Stage for removal, and is done at the end of the Engine's update cycle.
func (*Engine) SendMessage ¶
SendMessage sends the specified message to all Stages in the Engine.
func (*Engine) SendMessageToTargets ¶
SendMessageToTargets sends the specified message to all of the target Nodes, assuming they have IReceivers implemented in their Data() slots.
type ReceiverRegistryFunction ¶
ReceiverRegistryFunction is a function to return something that implements IOnUpdate or IOnRemove (i.e. something game object-like or component-like) for relevant nodes.
type Stage ¶
type Stage struct {
Name string
Active bool
Speed float64 // Speed represents the speed of the engine's playback (for animations, delta time values, and timers).
DebugUpdateTime time.Duration
// contains filtered or unexported fields
}
Stage represents a layer or box in which Scenes are created, updated, replaced, and ended. The scene might change, but the stage generally always exists (i.e. there's one for GUI elements, one for the game world, and one for background skyboxes).
func (*Stage) CurrentScene ¶
CurrentScene returns the currently running Scene within the Stage. If the Stage is inactive or the scene is ended (or the Stage has not instantiated a scene yet), this function will return nil.
func (*Stage) Remove ¶
func (stage *Stage) Remove()
Remove queues the Stage for removal from its owning Engine instance.
func (*Stage) Restart ¶
func (stage *Stage) Restart()
Restart restarts the Stage on the next Update() frame, effectively re-instantiating the Scene in the Stage. This calls End on the Stage before doing so.
func (*Stage) SetScene ¶
SetScene sets the source scene to be run If the Stage is running, this will reset the currently running scene. If no scene of the specified name is found, this function will return an error.
func (*Stage) SetSceneByName ¶
SetSceneByName sets the scene to be run by name, searching through the libraries associated with the Engine. If the Stage is running, this will reset the currently running scene. If no scene of the specified name is found, this function will return an error.
func (*Stage) TimerSystem ¶
func (stage *Stage) TimerSystem() *ebitick.TimerSystem
TimerSystem returns the Stage's built-in TimerSystem for timing events.