Documentation ¶
Overview ¶
Package engine provides functionality for the app engine.
Index ¶
- Constants
- func BindEventHandler(eventCode int, handler EventHandler)
- func CloseScene(closeCallback func())
- func ComponentNameMatches(componentName, namePattern string) bool
- func ExecuteOnFrontendThread(action func())
- func ForceAllViewsRedraw()
- func GetCurrentApp() *frontend.App
- func GetFrontendContext() frontend.Context
- func GetNewLineString() string
- func GetResourceManager() frontend.ResourceManager
- func GetScreenSize() a.IntVector2
- func GetScreenSize3() a.IntVector3
- func GetSpecialValueFromString(i interface{}) interface{}
- func IsForcedToRedraw() bool
- func IsInDebugMode() bool
- func IsSpecialTransformValue(x float32) bool
- func IsSpecialTransformVector3(pos a.Vector3) bool
- func IsSpecialValueString(i interface{}) bool
- func IsStatefulComponent(component Component) bool
- func LoadScene(sceneId a.ResId, show bool)
- func LogDebug(msg string, values ...interface{})
- func LogError(msg string, values ...interface{})
- func LogInfo(msg string, values ...interface{})
- func LogWarning(msg string, values ...interface{})
- func NameOfComponent(component interface{}) string
- func Navigate(path string, args a.SiMap) (err error)
- func RaiseEvent(event AmphionEvent)
- func RequestRendering()
- func RequestUpdate()
- func RunTask(task *Task)
- func SetWindowTitle(title string)
- func ShowScene(scene *SceneObject) error
- func SwapScenes()
- func UnbindEventHandler(eventCode int, handler EventHandler)
- type AmphionEngine
- func (engine *AmphionEngine) BindEventHandler(code int, handler EventHandler)
- func (engine *AmphionEngine) CloseScene(callback func())
- func (engine *AmphionEngine) ExecuteOnFrontendThread(action func())
- func (engine *AmphionEngine) ForceAllViewsRedraw()
- func (engine *AmphionEngine) GetAppContext() *AppContext
- func (engine *AmphionEngine) GetComponentsManager() *ComponentsManager
- func (engine *AmphionEngine) GetCurrentApp() *frontend.App
- func (engine *AmphionEngine) GetCurrentScene() *SceneObject
- func (engine *AmphionEngine) GetFeaturesManager() *FeaturesManager
- func (engine *AmphionEngine) GetFrontend() frontend.Frontend
- func (engine *AmphionEngine) GetGlobalContext() frontend.Context
- func (engine *AmphionEngine) GetInputManager() *InputManager
- func (engine *AmphionEngine) GetLogger() *Logger
- func (engine *AmphionEngine) GetMessageDispatcher() *MessageDispatcher
- func (engine *AmphionEngine) GetName() string
- func (engine *AmphionEngine) GetRenderer() *rendering.ARenderer
- func (engine *AmphionEngine) GetResourceManager() frontend.ResourceManager
- func (engine *AmphionEngine) GetSceneContext() *SceneContext
- func (engine *AmphionEngine) GetState() byte
- func (engine *AmphionEngine) GetStateString() string
- func (engine *AmphionEngine) GetTasksRoutine() *TasksRoutine
- func (engine *AmphionEngine) IsForcedToRedraw() bool
- func (engine *AmphionEngine) IsRenderingRequested() bool
- func (engine *AmphionEngine) IsUpdateRequested() bool
- func (engine *AmphionEngine) LoadApp(delegate ...AppDelegate)
- func (engine *AmphionEngine) LoadPrefab(resId a.ResId) (*SceneObject, error)
- func (engine *AmphionEngine) LoadScene(scene a.ResId, show bool)
- func (engine *AmphionEngine) OnMessage(_ Message) bool
- func (engine *AmphionEngine) RaiseEvent(event AmphionEvent)
- func (engine *AmphionEngine) RequestRendering()
- func (engine *AmphionEngine) RequestUpdate()
- func (engine *AmphionEngine) RunTask(task *Task)
- func (engine *AmphionEngine) SetWindowTitle(title string)
- func (engine *AmphionEngine) ShowScene(scene *SceneObject) error
- func (engine *AmphionEngine) Start()
- func (engine *AmphionEngine) Stop()
- func (engine *AmphionEngine) SwapScenes()
- func (engine *AmphionEngine) UnbindEventHandler(code int, handler EventHandler)
- func (engine *AmphionEngine) WaitForStop()
- type AmphionEvent
- type AppContext
- type AppDelegate
- type AppDelegateImpl
- type BoundaryComponent
- type ClipboardData
- type Component
- type ComponentContainer
- type ComponentImpl
- type ComponentsManager
- func (m *ComponentsManager) GetComponentState(component Component) a.SiMap
- func (m *ComponentsManager) GetEventHandler(name string) EventHandler
- func (m *ComponentsManager) GetName() string
- func (m *ComponentsManager) MakeComponent(name string) Component
- func (m *ComponentsManager) NameOfComponent(component interface{}) string
- func (m *ComponentsManager) RegisterComponentType(component Component)
- func (m *ComponentsManager) RegisterEventHandler(handler EventHandler)
- func (m *ComponentsManager) SetComponentState(component Component, state a.SiMap)
- type ConsoleLogger
- type DrawingContext
- type EventBinder
- type EventHandler
- type FeatureCode
- type FeaturesManager
- type ILogger
- type InitContext
- type InputFileData
- type InputManager
- type KeyEventData
- type KeyName
- type Layout
- type LogLevel
- type Logger
- type Message
- type MessageDispatcher
- func (d *MessageDispatcher) AddListener(listener MessageListener, parent MessageListener)
- func (d *MessageDispatcher) Dispatch(message Message, maxDepth int)
- func (d *MessageDispatcher) DispatchDirectly(listener MessageListener, message Message)
- func (d *MessageDispatcher) DispatchDown(from MessageListener, message Message, maxDepth int)
- func (d *MessageDispatcher) DispatchUp(from MessageListener, message Message)
- func (d *MessageDispatcher) RemoveListener(listener MessageListener)
- type MessageListener
- type MessageListenerComponent
- type MouseButton
- type MouseEventData
- type SceneContext
- type SceneObject
- func (o *SceneObject) AddChild(object *SceneObject)
- func (o *SceneObject) AddComponent(component Component) Component
- func (o *SceneObject) AddNewChild(name string) *SceneObject
- func (o *SceneObject) Copy(copyName string) *SceneObject
- func (o *SceneObject) DebugString() string
- func (o *SceneObject) DecodeFromYaml(data []byte) error
- func (o *SceneObject) DumpToJson() ([]byte, error)
- func (o *SceneObject) DumpToMap() a.SiMap
- func (o *SceneObject) EncodeToJson() ([]byte, error)
- func (o *SceneObject) EncodeToYaml() ([]byte, error)
- func (o *SceneObject) FindComponentByName(name string, includeDirty ...bool) Component
- func (o *SceneObject) FindObjectByName(name string, includeDirty ...bool) *SceneObject
- func (o *SceneObject) ForEachChild(action func(object *SceneObject), includeDirty ...bool)
- func (o *SceneObject) ForEachComponent(action func(component Component))
- func (o *SceneObject) ForEachObject(action func(object *SceneObject), includeDirty ...bool)
- func (o *SceneObject) FromMap(siMap a.SiMap)
- func (o *SceneObject) GetChildAt(index int) *SceneObject
- func (o *SceneObject) GetChildByName(name string) *SceneObject
- func (o *SceneObject) GetChildren() []*SceneObject
- func (o *SceneObject) GetChildrenCount() int
- func (o *SceneObject) GetComponentByName(n string, includeDirty ...bool) Component
- func (o *SceneObject) GetComponentContainers() []*ComponentContainer
- func (o *SceneObject) GetComponents(includeDirty ...bool) []Component
- func (o *SceneObject) GetComponentsByName(n string, includeDirty ...bool) []Component
- func (o *SceneObject) GetId() int
- func (o *SceneObject) GetName() string
- func (o *SceneObject) GetParent() *SceneObject
- func (o *SceneObject) GetRenderingNode() *rendering.Node
- func (o *SceneObject) HasBoundary() bool
- func (o *SceneObject) HasViews() bool
- func (o *SceneObject) IsDirty() bool
- func (o *SceneObject) IsEnabled() bool
- func (o *SceneObject) IsFocused() bool
- func (o *SceneObject) IsHovered() bool
- func (o *SceneObject) IsPointInsideBoundaries(point a.Vector3) bool
- func (o *SceneObject) IsPointInsideBoundaries2D(point a.Vector3) bool
- func (o *SceneObject) IsVisibleInScene() bool
- func (o *SceneObject) OnMessage(message Message) bool
- func (o *SceneObject) Redraw()
- func (o *SceneObject) RemoveAllChildren()
- func (o *SceneObject) RemoveAllComponents()
- func (o *SceneObject) RemoveChild(object *SceneObject)
- func (o *SceneObject) RemoveComponent(comp Component)
- func (o *SceneObject) RemoveComponentByName(name string)
- func (o *SceneObject) RemoveFromScene()
- func (o *SceneObject) RenderTraverse(action func(node *rendering.Node), ...)
- func (o *SceneObject) SetEnabled(enabled bool)
- func (o *SceneObject) SetParent(newParent *SceneObject)
- func (o *SceneObject) SetPosition(v a.Vector3)
- func (o *SceneObject) SetPositionXy(x, y float32)
- func (o *SceneObject) SetPositionXyz(x, y, z float32)
- func (o *SceneObject) SetSize(v a.Vector3)
- func (o *SceneObject) SetSizeXy(x, y float32)
- func (o *SceneObject) SetSizeXyz(x, y, z float32)
- func (o *SceneObject) ToMap() a.SiMap
- func (o *SceneObject) ToString() string
- func (o *SceneObject) Traverse(action func(object *SceneObject) bool, includeDirty ...bool)
- type ScreenOrientation
- type StatefulComponent
- type Task
- type TaskBuilder
- type TaskCallback
- type TaskErrorCallback
- type TaskRunner
- type TasksRoutine
- type Transform
- func (t Transform) Equals(other Transform) bool
- func (t *Transform) FromMap(siMap a.SiMap)
- func (t Transform) GetGlobalPosition() a.Vector3
- func (t Transform) GetGlobalRect() *common.RectBoundary
- func (t Transform) GetGlobalTopLeftPosition() a.Vector3
- func (t Transform) GetLocalPosition() a.Vector3
- func (t Transform) GetParent() *Transform
- func (t Transform) GetRect() *common.RectBoundary
- func (t Transform) GetSize() a.Vector3
- func (t Transform) GetTopLeftPosition() a.Vector3
- func (t Transform) ToMap() a.SiMap
- func (t *Transform) ToRenderingTransform() rendering.Transform
- type UpdateContext
- type UpdatingComponent
- type ViewComponent
- type ViewImpl
Constants ¶
const ( StateStopped = 0 StateStarted = 1 StateUpdating = 2 StateRendering = 3 )
const ( //Deprecated EventUpdate = -1 //Deprecated EventRender = -2 //Deprecated EventCloseScene = -3 EventMouseDown = -4 EventDoubleClick = -5 EventStop = -7 EventKeyDown = -8 EventMouseUp = -9 EventAppHide = -10 EventAppShow = -11 EventPaste = -12 EventCopy = -13 EventMouseIn = -14 EventMouseOut = -15 EventDropFile = -16 EventMouseMove = -17 EventAppLoaded = -18 EventFocusGain = -19 EventFocusLoose = -20 EventMouseScroll = -21 EventTouchDown = -22 EventTouchUp = -23 EventTouchMove = -24 EventKeyUp = -25 EventTextInput = -26 EventOrientationChange = -27 )
const ( MessageRedraw = iota MessageBuiltinEvent MessageUpdate MessageUpdateStop )
const (
FeatureSetWindowTitle = iota
)
const MessageMaxDepth = -1
const (
TargetFrameTime = 16
)
const Version = "0.2.0"
Variables ¶
This section is empty.
Functions ¶
func BindEventHandler ¶ added in v0.1.5
func BindEventHandler(eventCode int, handler EventHandler)
BindEventHandler - shortcut for (engine *AmphionEngine) BindEventHandler(code int, handler EventHandler). Binds an event handler for the specified event code. The handler will be invoked in the event Loop goroutine, when the event with the specified code is raised.
func CloseScene ¶ added in v0.2.3
func CloseScene(closeCallback func())
CloseScene closes the currently showing scene asynchronously. It will call the provided callback function as soon as the scene was closed. If no scene is showing calls the callback function immediately.
func ComponentNameMatches ¶ added in v0.2.1
ComponentNameMatches checks if namePattern matches the given componentName.
func ExecuteOnFrontendThread ¶ added in v0.1.7
func ExecuteOnFrontendThread(action func())
ExecuteOnFrontendThread - shortcut for (engine *AmphionEngine) ExecuteOnFrontendThread(action func()). Executes the specified action on frontend thread.
func ForceAllViewsRedraw ¶ added in v0.2.1
func ForceAllViewsRedraw()
ForceAllViewsRedraw will request all view in the scene to redraw on the next rendering cycle. It will not request rendering, you will need to call RequestRendering after that.
func GetCurrentApp ¶ added in v0.2.0
GetCurrentApp returns the current loaded app or nil if no app is loaded.
func GetFrontendContext ¶ added in v0.2.0
GetFrontendContext returns the global application context. See frontend.Context.
func GetNewLineString ¶ added in v0.2.1
func GetNewLineString() string
GetNewLineString returns the correct new line sequence for the current platform.
func GetResourceManager ¶ added in v0.2.0
func GetResourceManager() frontend.ResourceManager
GetResourceManager returns the current resource manager.
func GetScreenSize ¶ added in v0.2.0
func GetScreenSize() a.IntVector2
GetScreenSize returns the screen size as a.IntVector2. X and Y are the width and height of the screen.
func GetScreenSize3 ¶ added in v0.2.0
func GetScreenSize3() a.IntVector3
GetScreenSize3 returns the screen size as a.IntVector3. X and Y are the width and height of the screen. Z = 1.
func GetSpecialValueFromString ¶ added in v0.2.0
func GetSpecialValueFromString(i interface{}) interface{}
GetSpecialValueFromString returns the value corresponding to the given special string.
func IsForcedToRedraw ¶ added in v0.2.1
func IsForcedToRedraw() bool
IsForcedToRedraw checks if all views redraw was requested in the next rendering cycle by calling ForceAllViewsRedraw.
func IsInDebugMode ¶ added in v0.2.1
func IsInDebugMode() bool
IsInDebugMode checks if engine is currently in debug mode.
func IsSpecialTransformValue ¶ added in v0.2.0
IsSpecialTransformValue checks if the given float32 value is special(MatchParent, WrapContent or CenterInParent).
func IsSpecialTransformVector3 ¶ added in v0.2.0
IsSpecialTransformVector3 checks if the given vector contains special transform values.
func IsSpecialValueString ¶ added in v0.2.0
func IsSpecialValueString(i interface{}) bool
IsSpecialValueString checks if the provided values is a string and it is a special values string, e.g. "$MatchParent".
func IsStatefulComponent ¶
IsStatefulComponent checks if the given component has state. A component becomes stateful if is implements StatefulComponent interface or contains fields with state tag.
func LoadScene ¶ added in v0.2.3
LoadScene loads scene from a resource file asynchronously. If show is true, after loading also shows this scene.
func LogDebug ¶ added in v0.1.1
func LogDebug(msg string, values ...interface{})
LogDebug is same as LogInfo, but prints only if app is in debug mode.
func LogError ¶ added in v0.1.1
func LogError(msg string, values ...interface{})
LogError prints an error to the log from the current component, formatting the msg using fmt.Sprintf.
func LogInfo ¶ added in v0.1.1
func LogInfo(msg string, values ...interface{})
LogInfo prints a message to the log from the current component, formatting the msg using fmt.Sprintf.
func LogWarning ¶ added in v0.1.1
func LogWarning(msg string, values ...interface{})
LogWarning prints a warning to the log from the current component, formatting the msg using fmt.Sprintf.
func NameOfComponent ¶
func NameOfComponent(component interface{}) string
NameOfComponent return the name of the given component suitable for serialization.
func Navigate ¶ added in v0.1.7
Opens the scene corresponding to the specified path. Path "/" corresponds to the app's main scene. Other paths correspond to the scene path in the scene folder. For example "res/scenes/test.scene" corresponds to "/test", "res/scenes/hello/test.scene" to "/hello/test". Args can be passed, that can be later read from the scene.
func RaiseEvent ¶ added in v0.2.0
func RaiseEvent(event AmphionEvent)
RaiseEvent raises a new event to be processed in the event goroutine.
func RequestRendering ¶ added in v0.1.1
func RequestRendering()
RequestRendering - shortcut for (engine *AmphionEngine) RequestRendering().
func RequestUpdate ¶ added in v0.1.1
func RequestUpdate()
RequestUpdate - shortcut for (engine *AmphionEngine) RequestUpdate().
func RunTask ¶ added in v0.1.1
func RunTask(task *Task)
RunTask - shortcut for (engine *AmphionEngine) RunTask(task Task).
func SetWindowTitle ¶ added in v0.2.0
func SetWindowTitle(title string)
SetWindowTitle updates app's window title. On web sets the tab's title.
func ShowScene ¶ added in v0.2.3
func ShowScene(scene *SceneObject) error
ShowScene shows the specified scene object. Returns an error, if the engine is not yet ready or if another scene is already showing.
func SwapScenes ¶ added in v0.2.3
func SwapScenes()
SwapScenes hides the current showing scene and shows the currently loaded scene (using LoadScene). The previously showing scene will be properly stopped and the deleted. So, calling SwapScenes again will not swap the two scenes back. If no scene is loaded, will not do anything.
func UnbindEventHandler ¶ added in v0.1.5
func UnbindEventHandler(eventCode int, handler EventHandler)
UnbindEventHandler - shortcut for (engine *AmphionEngine) UnbindEventHandler(code int, handler EventHandler). Unbinds the event handler for the specified event code. The handler will no longer be invoked, when the event with the specified code is raised.
Types ¶
type AmphionEngine ¶
type AmphionEngine struct { *FeaturesManager // contains filtered or unexported fields }
func GetInstance ¶
func GetInstance() *AmphionEngine
GetInstance returns pointer to the engine instance.
func Initialize ¶
func Initialize(front frontend.Frontend) *AmphionEngine
Initialize initializes a new instance of Amphion Engine and configures it to run with the specified frontend. Returns pointer to the created engine instance. The engine is a singleton, so calling Initialize more than once will have no effect.
func (*AmphionEngine) BindEventHandler ¶
func (engine *AmphionEngine) BindEventHandler(code int, handler EventHandler)
BindEventHandler binds an event handler for the specified event code. The handler will be invoked in the event Loop goroutine, when the event with the specified code is raised.
func (*AmphionEngine) CloseScene ¶
func (engine *AmphionEngine) CloseScene(callback func())
CloseScene closes the currently showing scene asynchronously. It will call the provided callback function as soon as the scene was closed. If no scene is showing calls the callback function immediately.
func (*AmphionEngine) ExecuteOnFrontendThread ¶ added in v0.1.7
func (engine *AmphionEngine) ExecuteOnFrontendThread(action func())
ExecuteOnFrontendThread executes the specified action on frontend thread. Can be used to execute UI related functions from another goroutine.
func (*AmphionEngine) ForceAllViewsRedraw ¶ added in v0.2.0
func (engine *AmphionEngine) ForceAllViewsRedraw()
ForceAllViewsRedraw will request all view in the scene to redraw on the next rendering cycle. It will not request rendering, you will need to call RequestRendering after that.
func (*AmphionEngine) GetAppContext ¶ added in v0.1.7
func (engine *AmphionEngine) GetAppContext() *AppContext
GetAppContext returns the current app's context.
func (*AmphionEngine) GetComponentsManager ¶
func (engine *AmphionEngine) GetComponentsManager() *ComponentsManager
GetComponentsManager returns the current ComponentsManager.
func (*AmphionEngine) GetCurrentApp ¶
func (engine *AmphionEngine) GetCurrentApp() *frontend.App
GetCurrentApp returns the current loaded app or nil if no app is loaded.
func (*AmphionEngine) GetCurrentScene ¶
func (engine *AmphionEngine) GetCurrentScene() *SceneObject
GetCurrentScene returns the currently displaying scene object.
func (*AmphionEngine) GetFeaturesManager ¶ added in v0.2.0
func (engine *AmphionEngine) GetFeaturesManager() *FeaturesManager
GetFeaturesManager returns the current FeaturesManager.
func (*AmphionEngine) GetFrontend ¶
func (engine *AmphionEngine) GetFrontend() frontend.Frontend
GetFrontend returns the current frontend.
func (*AmphionEngine) GetGlobalContext ¶
func (engine *AmphionEngine) GetGlobalContext() frontend.Context
GetGlobalContext returns the global application context. See frontend.Context.
func (*AmphionEngine) GetInputManager ¶
func (engine *AmphionEngine) GetInputManager() *InputManager
GetInputManager returns the current input manager.
func (*AmphionEngine) GetLogger ¶
func (engine *AmphionEngine) GetLogger() *Logger
GetLogger returns the logger.
func (*AmphionEngine) GetMessageDispatcher ¶
func (engine *AmphionEngine) GetMessageDispatcher() *MessageDispatcher
func (*AmphionEngine) GetName ¶
func (engine *AmphionEngine) GetName() string
func (*AmphionEngine) GetRenderer ¶
func (engine *AmphionEngine) GetRenderer() *rendering.ARenderer
GetRenderer returns the renderer.
func (*AmphionEngine) GetResourceManager ¶
func (engine *AmphionEngine) GetResourceManager() frontend.ResourceManager
GetResourceManager returns the current resource manager.
func (*AmphionEngine) GetSceneContext ¶ added in v0.1.7
func (engine *AmphionEngine) GetSceneContext() *SceneContext
GetSceneContext returns the current scene's context.
func (*AmphionEngine) GetState ¶
func (engine *AmphionEngine) GetState() byte
GetState returns the current engine state.
func (*AmphionEngine) GetStateString ¶
func (engine *AmphionEngine) GetStateString() string
GetStateString returns the current engine state as string.
func (*AmphionEngine) GetTasksRoutine ¶
func (engine *AmphionEngine) GetTasksRoutine() *TasksRoutine
func (*AmphionEngine) IsForcedToRedraw ¶
func (engine *AmphionEngine) IsForcedToRedraw() bool
IsForcedToRedraw checks if all views redraw was requested in the next rendering cycle by calling ForceAllViewsRedraw.
func (*AmphionEngine) IsRenderingRequested ¶
func (engine *AmphionEngine) IsRenderingRequested() bool
IsRenderingRequested returns whether rendering is requested for the next update cycle.
func (*AmphionEngine) IsUpdateRequested ¶
func (engine *AmphionEngine) IsUpdateRequested() bool
IsUpdateRequested returns whether an update is requested for the next frame.
func (*AmphionEngine) LoadApp ¶
func (engine *AmphionEngine) LoadApp(delegate ...AppDelegate)
LoadApp loads app data from well-known source and shows the main scene.
func (*AmphionEngine) LoadPrefab ¶ added in v0.1.1
func (engine *AmphionEngine) LoadPrefab(resId a.ResId) (*SceneObject, error)
LoadPrefab synchronously loads prefab from file.
func (*AmphionEngine) LoadScene ¶
func (engine *AmphionEngine) LoadScene(scene a.ResId, show bool)
LoadScene loads scene from a resource file asynchronously. If show is true, after loading also shows this scene.
func (*AmphionEngine) OnMessage ¶
func (engine *AmphionEngine) OnMessage(_ Message) bool
func (*AmphionEngine) RaiseEvent ¶ added in v0.1.7
func (engine *AmphionEngine) RaiseEvent(event AmphionEvent)
RaiseEvent raises a new event.
func (*AmphionEngine) RequestRendering ¶
func (engine *AmphionEngine) RequestRendering()
RequestRendering tells the engine to schedule rendering in the next update cycle. It will also request an update, if it was not requested already.
func (*AmphionEngine) RequestUpdate ¶
func (engine *AmphionEngine) RequestUpdate()
RequestUpdate tells the engine to schedule an update as soon as possible.
func (*AmphionEngine) RunTask ¶
func (engine *AmphionEngine) RunTask(task *Task)
RunTask runs the given task in the background goroutine.
func (*AmphionEngine) SetWindowTitle ¶ added in v0.1.7
func (engine *AmphionEngine) SetWindowTitle(title string)
SetWindowTitle updates app's window title. On web sets the tab's title.
func (*AmphionEngine) ShowScene ¶
func (engine *AmphionEngine) ShowScene(scene *SceneObject) error
ShowScene shows the specified scene object. Returns an error, if the engine is not yet ready or if another scene is already showing.
func (*AmphionEngine) Start ¶
func (engine *AmphionEngine) Start()
Start starts the engine. Must be called, before any interaction with the engine.
func (*AmphionEngine) Stop ¶
func (engine *AmphionEngine) Stop()
Stop closes the current scene if any, and stops the engine.
func (*AmphionEngine) SwapScenes ¶
func (engine *AmphionEngine) SwapScenes()
SwapScenes hides the current showing scene and shows the currently loaded scene (using LoadScene). The previously showing scene will be properly stopped and the deleted. So, calling SwapScenes again will not swap the two scenes back. If no scene is loaded, will not do anything.
func (*AmphionEngine) UnbindEventHandler ¶
func (engine *AmphionEngine) UnbindEventHandler(code int, handler EventHandler)
UnbindEventHandler unbinds the event handler for the specified event code. The handler will no longer be invoked, when the event with the specified code is raised.
func (*AmphionEngine) WaitForStop ¶
func (engine *AmphionEngine) WaitForStop()
WaitForStop blocks the calling goroutine until the engine is stopped.
type AmphionEvent ¶
type AmphionEvent struct { Sender interface{} Code int Data interface{} }
func NewAmphionEvent ¶
func NewAmphionEvent(from interface{}, code int, data interface{}) AmphionEvent
func (AmphionEvent) MouseEventData ¶ added in v0.2.5
func (e AmphionEvent) MouseEventData() MouseEventData
func (AmphionEvent) StringData ¶ added in v0.2.5
func (e AmphionEvent) StringData() string
type AppContext ¶ added in v0.1.7
type AppContext struct {
// contains filtered or unexported fields
}
AppContext holds app specific data.
func GetAppContext ¶ added in v0.2.0
func GetAppContext() *AppContext
GetAppContext returns the current app's context.
func (*AppContext) Orientation ¶ added in v0.3.4
func (c *AppContext) Orientation() ScreenOrientation
type AppDelegate ¶ added in v0.3.4
type AppDelegate interface { OnAppLoaded() OnAppStopping() }
type AppDelegateImpl ¶ added in v0.3.4
type AppDelegateImpl struct { }
func (*AppDelegateImpl) OnAppLoaded ¶ added in v0.3.4
func (d *AppDelegateImpl) OnAppLoaded()
func (*AppDelegateImpl) OnAppStopping ¶ added in v0.3.4
func (d *AppDelegateImpl) OnAppStopping()
type BoundaryComponent ¶
BoundaryComponent is a component, that determines the bounding box of an object in the scene. Used for mouse interactions.
type ClipboardData ¶ added in v0.1.1
type ClipboardData struct {
// contains filtered or unexported fields
}
Experimental Holds an entry of clipboard
func NewClipboardData ¶ added in v0.1.1
func NewClipboardData(kind, mime string, str string, bytes []byte) *ClipboardData
func (*ClipboardData) GetData ¶ added in v0.1.1
func (c *ClipboardData) GetData() []byte
func (*ClipboardData) GetKind ¶ added in v0.1.1
func (c *ClipboardData) GetKind() string
func (*ClipboardData) GetMime ¶ added in v0.1.1
func (c *ClipboardData) GetMime() string
func (*ClipboardData) GetString ¶ added in v0.1.1
func (c *ClipboardData) GetString() string
type Component ¶
type Component interface { // OnInit is called only once when the component is first created. OnInit(ctx InitContext) // OnStart is called every time the component is being enabled. // If the scene object is enabled on component attachment this method will also be called. OnStart() // OnStop is called when the component is being disabled. OnStop() }
Component is a basic component interface. A component is a piece of functionality, that can be attached to scene objects.
func FindComponentByName ¶ added in v0.2.0
FindComponentByName searches for a component with the specified name through all the current scene object tree. See SceneObject.FindComponentByName.
type ComponentContainer ¶
type ComponentContainer struct {
// contains filtered or unexported fields
}
Wrap around container interface, that can be enabled or disabled
func NewComponentContainer ¶
func NewComponentContainer(sceneObject *SceneObject, component Component) *ComponentContainer
func (*ComponentContainer) GetComponent ¶
func (c *ComponentContainer) GetComponent() Component
func (*ComponentContainer) IsDirty ¶ added in v0.2.0
func (c *ComponentContainer) IsDirty() bool
func (*ComponentContainer) IsEnabled ¶
func (c *ComponentContainer) IsEnabled() bool
func (*ComponentContainer) SetEnabled ¶
func (c *ComponentContainer) SetEnabled(enabled bool)
type ComponentImpl ¶
type ComponentImpl struct { Engine *AmphionEngine SceneObject *SceneObject Logger *Logger }
ComponentImpl is a default component interface implementation
func (*ComponentImpl) OnInit ¶
func (c *ComponentImpl) OnInit(ctx InitContext)
func (*ComponentImpl) OnStart ¶
func (c *ComponentImpl) OnStart()
func (*ComponentImpl) OnStop ¶
func (c *ComponentImpl) OnStop()
type ComponentsManager ¶
type ComponentsManager struct {
// contains filtered or unexported fields
}
ComponentsManager keeps track of types of components and event handlers. that are present in the application. It also allows getting and setting the state of a component.
func GetComponentsManager ¶ added in v0.3.4
func GetComponentsManager() *ComponentsManager
GetComponentsManager returns the current ComponentsManager.
func (*ComponentsManager) GetComponentState ¶
func (m *ComponentsManager) GetComponentState(component Component) a.SiMap
GetComponentState retrieves component's state and returns it as string-interface map.
func (*ComponentsManager) GetEventHandler ¶
func (m *ComponentsManager) GetEventHandler(name string) EventHandler
GetEventHandler retrieves the previously registered event handler by it's name.
func (*ComponentsManager) GetName ¶
func (m *ComponentsManager) GetName() string
func (*ComponentsManager) MakeComponent ¶
func (m *ComponentsManager) MakeComponent(name string) Component
MakeComponent creates an instance of a component with the specified name. Returns the new instance of component or nil if component with that name was not registered.
func (*ComponentsManager) NameOfComponent ¶ added in v0.3.4
func (m *ComponentsManager) NameOfComponent(component interface{}) string
NameOfComponent return the unique name of the given component suitable for serialization.
func (*ComponentsManager) RegisterComponentType ¶
func (m *ComponentsManager) RegisterComponentType(component Component)
RegisterComponentType registers component, so an instance of it can be later created using MakeComponent.
func (*ComponentsManager) RegisterEventHandler ¶
func (m *ComponentsManager) RegisterEventHandler(handler EventHandler)
RegisterEventHandler registers an event handler, so that it can be serialized and deserialized as a part of component's state.
func (*ComponentsManager) SetComponentState ¶
func (m *ComponentsManager) SetComponentState(component Component, state a.SiMap)
SetComponentState sets the component's state from the given state map.
type ConsoleLogger ¶
type ConsoleLogger struct{}
type DrawingContext ¶
type DrawingContext struct {
// contains filtered or unexported fields
}
func (DrawingContext) GetRenderer ¶
func (c DrawingContext) GetRenderer() *rendering.ARenderer
func (DrawingContext) GetRenderingNode ¶ added in v0.2.4
func (c DrawingContext) GetRenderingNode() *rendering.Node
type EventBinder ¶
type EventBinder struct {
// contains filtered or unexported fields
}
func (*EventBinder) Bind ¶
func (b *EventBinder) Bind(code int, handler EventHandler)
func (*EventBinder) GetHandlers ¶
func (b *EventBinder) GetHandlers(code int) []EventHandler
func (*EventBinder) InvokeHandlers ¶
func (b *EventBinder) InvokeHandlers(event AmphionEvent)
func (*EventBinder) Unbind ¶
func (b *EventBinder) Unbind(code int, handler EventHandler)
type EventHandler ¶
type EventHandler func(event AmphionEvent) bool
EventHandler handles event. Returns whether to continue event propagation or not.
type FeatureCode ¶ added in v0.2.0
type FeatureCode int
type FeaturesManager ¶ added in v0.2.0
type FeaturesManager struct {
// contains filtered or unexported fields
}
FeaturesManager is responsible for keeping track of what frontend features are available and invoking them. Frontend should register all features that it provides. Then those features become available and can be invoked.
func GetFeaturesManager ¶ added in v0.2.0
func GetFeaturesManager() *FeaturesManager
GetFeaturesManager returns the current FeaturesManager.
func (*FeaturesManager) InvokeFeature ¶ added in v0.2.0
func (f *FeaturesManager) InvokeFeature(code FeatureCode, data interface{}) interface{}
InvokeFeature invokes the feature with the specified FeatureCode if is available. Passes the specified data to the feature delegate and returns the result.
func (*FeaturesManager) IsFeatureAvailable ¶ added in v0.2.0
func (f *FeaturesManager) IsFeatureAvailable(code FeatureCode) bool
IsFeatureAvailable checks if feature with the specified FeatureCode is available (provided by the frontend).
func (*FeaturesManager) RegisterFeatureDelegate ¶ added in v0.2.0
func (f *FeaturesManager) RegisterFeatureDelegate(code FeatureCode, delegate frontend.FeatureDelegate)
RegisterFeatureDelegate should be called by the frontend.
type InitContext ¶
type InitContext struct {
// contains filtered or unexported fields
}
InitContext contains necessary objects for component initialization.
func (InitContext) GetEngine ¶
func (c InitContext) GetEngine() *AmphionEngine
func (InitContext) GetLogger ¶
func (c InitContext) GetLogger() *Logger
func (InitContext) GetRenderer ¶
func (c InitContext) GetRenderer() *rendering.ARenderer
func (InitContext) GetRenderingNode ¶ added in v0.2.4
func (c InitContext) GetRenderingNode() *rendering.Node
func (InitContext) GetSceneObject ¶
func (c InitContext) GetSceneObject() *SceneObject
type InputFileData ¶ added in v0.1.1
Represents file data returned as a result of the user selecting file or dragging it.
type InputManager ¶ added in v0.2.0
type InputManager struct {
// contains filtered or unexported fields
}
func GetInputManager ¶ added in v0.2.0
func GetInputManager() *InputManager
GetInputManager returns the current input manager.
func (*InputManager) GetCursorPosition ¶ added in v0.2.0
func (m *InputManager) GetCursorPosition() a.IntVector2
func (*InputManager) IsKeyPressed ¶ added in v0.2.5
func (m *InputManager) IsKeyPressed(name KeyName) bool
type KeyName ¶ added in v0.2.5
type KeyName string
const ( KeyUnknown KeyName = "Unknown" KeyLeftShift KeyName = "LeftShift" KeyRightShift KeyName = "RightShift" KeyLeftAlt KeyName = "LeftAlt" KeyRightAlt KeyName = "RightAlt" KeyLeftSuper KeyName = "LeftSuper" KeyRightSuper KeyName = "RightSuper" KeyLeftControl KeyName = "LeftControl" KeyRightControl KeyName = "RightControl" KeySpace KeyName = "Space" KeyEnter KeyName = "Enter" KeyNumEnter KeyName = "NumEnter" KeyBackspace KeyName = "Backspace" KeyLeftArrow KeyName = "LeftArrow" KeyRightArrow KeyName = "RightArrow" KeyUpArrow KeyName = "UpArrow" KeyDownArrow KeyName = "DownArrow" KeyInsert KeyName = "Insert" KeyDelete KeyName = "Delete" KeyHome KeyName = "Home" KeyEnd KeyName = "End" KeyPageUp KeyName = "PageUp" KeyPageDown KeyName = "PageDown" KeyCapsLock KeyName = "CapsLock" KeyTab KeyName = "Tab" KeyEscape KeyName = "Escape" KeyFn KeyName = "Fn" )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func GetLoggerForPlatform ¶
type Message ¶
type Message struct { Sender interface{} Code byte Data interface{} }
func NewMessage ¶
type MessageDispatcher ¶
type MessageDispatcher struct {
// contains filtered or unexported fields
}
func NewMessageDispatcher ¶
func NewMessageDispatcher(root MessageListener) *MessageDispatcher
func (*MessageDispatcher) AddListener ¶
func (d *MessageDispatcher) AddListener(listener MessageListener, parent MessageListener)
Adds listener into the message tree
func (*MessageDispatcher) Dispatch ¶
func (d *MessageDispatcher) Dispatch(message Message, maxDepth int)
Sends message from the root down in the message tree
func (*MessageDispatcher) DispatchDirectly ¶
func (d *MessageDispatcher) DispatchDirectly(listener MessageListener, message Message)
func (*MessageDispatcher) DispatchDown ¶
func (d *MessageDispatcher) DispatchDown(from MessageListener, message Message, maxDepth int)
Sends this message up in the message tree
func (*MessageDispatcher) DispatchUp ¶
func (d *MessageDispatcher) DispatchUp(from MessageListener, message Message)
Sends specified message down in the message tree.
func (*MessageDispatcher) RemoveListener ¶
func (d *MessageDispatcher) RemoveListener(listener MessageListener)
Removes listener from message tree. You cannot remove the root element.
type MessageListener ¶
type MessageListener interface { // Receives a message and returns whether to continue message propagation or not OnMessage(message Message) bool }
Interface for receiving messages from dispatcher
type MessageListenerComponent ¶
type MessageListenerComponent interface { Component MessageListener }
type MouseButton ¶ added in v0.2.5
type MouseButton byte
const ( MouseUnknown MouseButton = iota MouseLeft MouseRight MouseMiddle MouseBack MouseForward )
type MouseEventData ¶ added in v0.1.5
type MouseEventData struct { SceneObject *SceneObject MousePosition a.IntVector2 MouseButton MouseButton }
MouseEventData represents the data of mouse related event. Contains mouse coordinates, SceneObject, that was clicked and the mouse button.
type SceneContext ¶ added in v0.1.7
This struct holds data related to a scene.
func GetSceneContext ¶ added in v0.2.0
func GetSceneContext() *SceneContext
GetSceneContext returns the current scene's context.
type SceneObject ¶
type SceneObject struct { Transform Transform // contains filtered or unexported fields }
SceneObject is an object in the scene. The scene itself is also a SceneObject.
func FindObjectByName ¶ added in v0.2.0
func FindObjectByName(name string, includeDirty ...bool) *SceneObject
FindObjectByName searches for an object with the specified name through all the current scene object tree. See SceneObject.FindObjectByName.
func GetCurrentScene ¶ added in v0.2.0
func GetCurrentScene() *SceneObject
GetCurrentScene returns the currently displaying scene object.
func LoadPrefab ¶ added in v0.1.1
func LoadPrefab(resId a.ResId) (*SceneObject, error)
LoadPrefab - shortcut for (engine *AmphionEngine) LoadPrefab(resId int) (*SceneObject, error).
func NewSceneObject ¶
func NewSceneObject(name string) *SceneObject
NewSceneObject creates a new instance of scene object. Can be used only with engine running.
func NewSceneObjectForTesting ¶ added in v0.2.0
func NewSceneObjectForTesting(name string, components ...Component) *SceneObject
NewSceneObjectForTesting creates a new instance of scene object without engine running. Can be used for testing purposes. Do not use in actual Amphion apps!
func (*SceneObject) AddChild ¶
func (o *SceneObject) AddChild(object *SceneObject)
AddChild adds a child object to this scene object.
func (*SceneObject) AddComponent ¶
func (o *SceneObject) AddComponent(component Component) Component
AddComponent adds a component to this scene object. Returns the given component.
func (*SceneObject) AddNewChild ¶ added in v0.2.7
func (o *SceneObject) AddNewChild(name string) *SceneObject
AddNewChild creates a new scene object with the given name and adds it as a child to the current object.
func (*SceneObject) Copy ¶ added in v0.2.1
func (o *SceneObject) Copy(copyName string) *SceneObject
Copy creates a new scene object with all components and children of the receiver. The new object is dirty. It is enabled if the receiver is enabled.
func (*SceneObject) DebugString ¶ added in v0.1.12
func (o *SceneObject) DebugString() string
DebugString return string for debugging.
func (*SceneObject) DecodeFromYaml ¶
func (o *SceneObject) DecodeFromYaml(data []byte) error
func (*SceneObject) DumpToJson ¶ added in v0.2.0
func (o *SceneObject) DumpToJson() ([]byte, error)
func (*SceneObject) DumpToMap ¶ added in v0.2.0
func (o *SceneObject) DumpToMap() a.SiMap
func (*SceneObject) EncodeToJson ¶ added in v0.2.0
func (o *SceneObject) EncodeToJson() ([]byte, error)
func (*SceneObject) EncodeToYaml ¶
func (o *SceneObject) EncodeToYaml() ([]byte, error)
func (*SceneObject) FindComponentByName ¶ added in v0.2.0
func (o *SceneObject) FindComponentByName(name string, includeDirty ...bool) Component
FindComponentByName searches for a component with the specified name through all the scene object tree. Returns the first suitable component. Returns nil if no component with the name was found. By default the search does not include dirty components. To also include dirty components pass true as the second argument.
func (*SceneObject) FindObjectByName ¶ added in v0.2.0
func (o *SceneObject) FindObjectByName(name string, includeDirty ...bool) *SceneObject
FindObjectByName searches for an object with the specified name through all the scene object tree. Returns the first suitable object. Returns nil if no object with the name was found. By default the search does not include dirty objects. To also include dirty objects pass true as the second argument.
func (*SceneObject) ForEachChild ¶ added in v0.2.0
func (o *SceneObject) ForEachChild(action func(object *SceneObject), includeDirty ...bool)
ForEachChild cycles through all direct children of the scene object, calling the specified action for each of them. The method skips dirty objects.
func (*SceneObject) ForEachComponent ¶
func (o *SceneObject) ForEachComponent(action func(component Component))
ForEachComponent iterates over each component attached to the object, calling the action function for each of them. The method skips dirty components.
func (*SceneObject) ForEachObject ¶
func (o *SceneObject) ForEachObject(action func(object *SceneObject), includeDirty ...bool)
ForEachObject traverses the scene object tree, calling the action function for each of the objects. The action is also called for the object on which the method was called. The method skips dirty objects.
func (*SceneObject) FromMap ¶
func (o *SceneObject) FromMap(siMap a.SiMap)
func (*SceneObject) GetChildAt ¶ added in v0.2.7
func (o *SceneObject) GetChildAt(index int) *SceneObject
GetChildAt returns the child scene object at the given index. If there is no child with that index returns nil.
func (*SceneObject) GetChildByName ¶
func (o *SceneObject) GetChildByName(name string) *SceneObject
GetChildByName finds scene object in the list of children of the current object. Returns nil if no object with the specified name was not found.
func (*SceneObject) GetChildren ¶
func (o *SceneObject) GetChildren() []*SceneObject
GetChildren returns the list of children of this scene object. Modifying the returned list wont modify the actual list of children of this scene object.
func (*SceneObject) GetChildrenCount ¶ added in v0.2.1
func (o *SceneObject) GetChildrenCount() int
GetChildrenCount returns the number of children of this object.
func (*SceneObject) GetComponentByName ¶
func (o *SceneObject) GetComponentByName(n string, includeDirty ...bool) Component
GetComponentByName searches for component with the specified name throughout the components attached to this object. The parameter n can be on of the following:
- full component name, e.g. github.com/cadmean-ru/amphion/engine/builtin.TextView,
- short component name, e.g. TextView,
- regex string.
If there are multiple components with the same name returns the first. Returns nil if no component with the name n was found or it has not been initialized or is disabled.
func (*SceneObject) GetComponentContainers ¶ added in v0.2.0
func (o *SceneObject) GetComponentContainers() []*ComponentContainer
GetComponentContainers returns the list of containers, that makes possible to enable/disable specific components.
func (*SceneObject) GetComponents ¶
func (o *SceneObject) GetComponents(includeDirty ...bool) []Component
GetComponents returns a slice of all components attached to the object. Modifying the returned list will not change the actual list of components of this scene object.
func (*SceneObject) GetComponentsByName ¶
func (o *SceneObject) GetComponentsByName(n string, includeDirty ...bool) []Component
GetComponentsByName searches for all components with the specified name throughout the components attached to this object. The parameter n can be on of the following:
- full component name, e.g. github.com/cadmean-ru/amphion/engine/builtin.TextView,
- short component name, e.g. TextView,
- regex string.
Returns empty slice if no components with the name n was found. Components that have not been initialized or are disabled will not be included.
func (*SceneObject) GetId ¶
func (o *SceneObject) GetId() int
GetId returns the id of the object in the scene. The id is not guaranteed to remain the same over time and serves for internal engine purposes. For identification use object's name.
func (*SceneObject) GetName ¶
func (o *SceneObject) GetName() string
GetName returns the name of the scene object.
func (*SceneObject) GetParent ¶
func (o *SceneObject) GetParent() *SceneObject
GetParent returns the parent object of this scene object. Returns nil if no parent object.
func (*SceneObject) GetRenderingNode ¶ added in v0.3.4
func (o *SceneObject) GetRenderingNode() *rendering.Node
func (*SceneObject) HasBoundary ¶
func (o *SceneObject) HasBoundary() bool
HasBoundary checks if the scene object has any boundary components.
func (*SceneObject) HasViews ¶ added in v0.2.4
func (o *SceneObject) HasViews() bool
HasViews checks if the scene object has any view components.
func (*SceneObject) IsDirty ¶ added in v0.2.0
func (o *SceneObject) IsDirty() bool
IsDirty checks if the scene object is dirty. An object is considered dirty if it has not been initialized or if it is disabled or it will be deleted in the next update. It is not safe to work with a dirty object.
func (*SceneObject) IsEnabled ¶
func (o *SceneObject) IsEnabled() bool
IsEnabled returns if this object is currently enabled or not.
func (*SceneObject) IsFocused ¶
func (o *SceneObject) IsFocused() bool
IsFocused checks if the scene object is currently focused.
func (*SceneObject) IsHovered ¶ added in v0.1.7
func (o *SceneObject) IsHovered() bool
IsHovered checks if the cursor is over the scene object.
func (*SceneObject) IsPointInsideBoundaries ¶
func (o *SceneObject) IsPointInsideBoundaries(point a.Vector3) bool
func (*SceneObject) IsPointInsideBoundaries2D ¶
func (o *SceneObject) IsPointInsideBoundaries2D(point a.Vector3) bool
func (*SceneObject) IsVisibleInScene ¶ added in v0.1.7
func (o *SceneObject) IsVisibleInScene() bool
func (*SceneObject) OnMessage ¶
func (o *SceneObject) OnMessage(message Message) bool
func (*SceneObject) Redraw ¶ added in v0.1.3
func (o *SceneObject) Redraw()
Redraw forces all views of this object to redraw and requests rendering.
func (*SceneObject) RemoveAllChildren ¶ added in v0.2.1
func (o *SceneObject) RemoveAllChildren()
RemoveAllChildren removes all children from the receiver scene object.
func (*SceneObject) RemoveAllComponents ¶ added in v0.2.1
func (o *SceneObject) RemoveAllComponents()
RemoveAllComponents removes all components of the scene object.
func (*SceneObject) RemoveChild ¶
func (o *SceneObject) RemoveChild(object *SceneObject)
RemoveChild removes the specified child from this scene object.
func (*SceneObject) RemoveComponent ¶ added in v0.2.1
func (o *SceneObject) RemoveComponent(comp Component)
RemoveComponent removes the given component from the scene object.
func (*SceneObject) RemoveComponentByName ¶ added in v0.2.1
func (o *SceneObject) RemoveComponentByName(name string)
RemoveComponentByName removes a component with the given name from the scene object& If there are more than one component with the same name only the first encountered component will be removed.
func (*SceneObject) RemoveFromScene ¶ added in v0.2.1
func (o *SceneObject) RemoveFromScene()
RemoveFromScene removes the scene object from the current scene. After that the object is considered dirty.
func (*SceneObject) RenderTraverse ¶ added in v0.2.4
func (o *SceneObject) RenderTraverse(action func(node *rendering.Node), afterChildrenAction func(node *rendering.Node))
func (*SceneObject) SetEnabled ¶
func (o *SceneObject) SetEnabled(enabled bool)
SetEnabled sets the enabled state of this object as specified.
func (*SceneObject) SetParent ¶ added in v0.2.1
func (o *SceneObject) SetParent(newParent *SceneObject)
SetParent changes the parent of the scene object to the specified object. Can be used to move a child from one object to another.
func (*SceneObject) SetPosition ¶ added in v0.1.1
func (o *SceneObject) SetPosition(v a.Vector3)
SetPosition sets the position of this object equal to the specified vector, requesting rendering.
func (*SceneObject) SetPositionXy ¶ added in v0.1.3
func (o *SceneObject) SetPositionXy(x, y float32)
SetPositionXy sets the position of this object equal to a new vector with specified coordinates, requesting rendering.
func (*SceneObject) SetPositionXyz ¶ added in v0.1.1
func (o *SceneObject) SetPositionXyz(x, y, z float32)
SetPositionXyz sets the position of this object equal to a new vector with specified coordinates, requesting rendering.
func (*SceneObject) SetSize ¶ added in v0.1.1
func (o *SceneObject) SetSize(v a.Vector3)
SetSize Set the size of this object equal to the specified vector, requesting rendering.
func (*SceneObject) SetSizeXy ¶ added in v0.1.7
func (o *SceneObject) SetSizeXy(x, y float32)
SetSizeXy Set the size of this object equal to a new vector with specified coordinates, requesting rendering.
func (*SceneObject) SetSizeXyz ¶ added in v0.1.1
func (o *SceneObject) SetSizeXyz(x, y, z float32)
SetSizeXyz Set the size of this object equal to a new vector with specified coordinates, requesting rendering.
func (*SceneObject) ToMap ¶
func (o *SceneObject) ToMap() a.SiMap
func (*SceneObject) ToString ¶
func (o *SceneObject) ToString() string
ToString returns the string representation of the scene object.
func (*SceneObject) Traverse ¶ added in v0.2.0
func (o *SceneObject) Traverse(action func(object *SceneObject) bool, includeDirty ...bool)
Traverse traverses the scene object tree (pre-order), calling the action function for each of the objects. If action returns false interrupts the process. By default the method skips dirty objects. To also include dirty objects pass true as the second argument.
type ScreenOrientation ¶ added in v0.3.4
type ScreenOrientation int
const ( OrientationUnknown ScreenOrientation = iota OrientationStraight OrientationReverse OrientationLeft OrientationRight )
type StatefulComponent ¶
StatefulComponent is an interface for components, that can persist state.
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
func NewTask ¶
func NewTask(runner TaskRunner, callback TaskCallback, errorCallback TaskErrorCallback) *Task
type TaskBuilder ¶
type TaskBuilder struct {
// contains filtered or unexported fields
}
func NewTaskBuilder ¶
func NewTaskBuilder() *TaskBuilder
func (*TaskBuilder) Build ¶
func (b *TaskBuilder) Build() *Task
func (*TaskBuilder) Err ¶
func (b *TaskBuilder) Err(callback TaskErrorCallback) *TaskBuilder
func (*TaskBuilder) Run ¶
func (b *TaskBuilder) Run(runner TaskRunner) *TaskBuilder
func (*TaskBuilder) Then ¶ added in v0.1.1
func (b *TaskBuilder) Then(callback TaskCallback) *TaskBuilder
type TaskCallback ¶
type TaskCallback func(res interface{})
type TaskErrorCallback ¶
type TaskErrorCallback func(err error)
type TaskRunner ¶
type TaskRunner func() (interface{}, error)
type TasksRoutine ¶
type TasksRoutine struct {
// contains filtered or unexported fields
}
func (*TasksRoutine) RunTask ¶
func (r *TasksRoutine) RunTask(task *Task)
type Transform ¶
type Transform struct { Position a.Vector3 Pivot a.Vector3 Rotation a.Vector3 Size a.Vector3 SceneObject *SceneObject // contains filtered or unexported fields }
Transform describes how a scene object is positioned on the screen.
func NewTransform2D ¶ added in v0.2.0
func NewTransform2D(object *SceneObject) Transform
NewTransform2D creates a new transform with default values.
func NewTransformFromMap ¶
func (Transform) GetGlobalPosition ¶
GetGlobalPosition calculates the actual global position in the scene.
func (Transform) GetGlobalRect ¶
func (t Transform) GetGlobalRect() *common.RectBoundary
GetGlobalRect calculates global rect of this transform.
func (Transform) GetGlobalTopLeftPosition ¶
GetGlobalTopLeftPosition calculates global position of the top left point of the bounding box.
func (Transform) GetLocalPosition ¶
GetLocalPosition calculates the actual local position related to this transform's parent.
func (Transform) GetRect ¶
func (t Transform) GetRect() *common.RectBoundary
GetRect calculates local rect of this transform.
func (Transform) GetSize ¶ added in v0.1.1
GetSize calculates the actual size of the Transform replacing the special values.
func (Transform) GetTopLeftPosition ¶
GetTopLeftPosition calculates local position of the top left point of the bounding box.
func (*Transform) ToRenderingTransform ¶ added in v0.1.1
ToRenderingTransform calculates a transform that is ready to be rendered on screen with all absolute values in pixels calculated.
type UpdateContext ¶
type UpdateContext struct {
DeltaTime float32
}
UpdateContext contains info about current update cycle
type UpdatingComponent ¶
type UpdatingComponent interface { Component OnUpdate(ctx UpdateContext) }
UpdatingComponent is an interface for components that can receive updates.
type ViewComponent ¶
type ViewComponent interface { Component OnDraw(ctx DrawingContext) ShouldDraw() bool Redraw() }
ViewComponent is an interface for views.
type ViewImpl ¶ added in v0.1.1
type ViewImpl struct { ShouldRedraw bool Context InitContext PrimitiveId int Engine *AmphionEngine SceneObject *SceneObject }
ViewImpl is a basic view component implementation.
func (*ViewImpl) OnDraw ¶ added in v0.1.1
func (v *ViewImpl) OnDraw(_ DrawingContext)
func (*ViewImpl) OnInit ¶ added in v0.1.1
func (v *ViewImpl) OnInit(ctx InitContext)
func (*ViewImpl) ShouldDraw ¶ added in v0.2.4
Source Files ¶
- appContext.go
- appDelegate.go
- callbacks.go
- click.go
- clipboard.go
- component.go
- componentContainer.go
- componentImpl.go
- componentManager.go
- engine.go
- event.go
- features.go
- featuresManager.go
- inputManager.go
- keys.go
- layout.go
- logger.go
- message.go
- navigation.go
- newLine.go
- scene.go
- sceneContext.go
- specialValues.go
- static.go
- task.go
- transform.go
- updateRoutine.go
- version.go
- viewImpl.go
Directories ¶
Path | Synopsis |
---|---|
Package builtin provides a set of basic components.
|
Package builtin provides a set of basic components. |
This package is a wrapper around github.com/cadmean-ru/goRPCKit library adapted for Amphion tasks system.
|
This package is a wrapper around github.com/cadmean-ru/goRPCKit library adapted for Amphion tasks system. |