Documentation
¶
Overview ¶
Package module runs independent minimum systems composed by project scene plans.
Index ¶
- Constants
- Variables
- func OnSlotsChange(c *Context, names []string, handler func(*Context) error) error
- type AnimationsContent
- type Collision2D
- type Collision3D
- type Content
- func (c *Content) BindControl[T any](id string, v T) error
- func (c *Content) ControlTextTabWidth(e ecs.Entity, text *scene.Text2D) (float32, bool)
- func (c *Content) Define[P, S any](template html.Template, css string, b ContentBehavior[P, S]) (*html.Definition[P, S], error)
- func (c *Content) Despawn(e ecs.Entity) bool
- func (c *Content) Element(id string) (ecs.Entity, error)
- func (c *Content) FindPart[P, T any](e ecs.Entity) (ecs.Entity, bool)
- func (c *Content) Focus(e ecs.Entity) bool
- func (c *Content) FocusedControl() ecs.Entity
- func (c *Content) Font(name string) (*text.Font, error)
- func (c *Content) Get[T any](e ecs.Entity) (T, bool)
- func (c *Content) HTMLControl(e ecs.Entity, id string) (ecs.Entity, bool)
- func (c *Content) HTMLNode(e ecs.Entity, id string) (html.Node, bool)
- func (c *Content) HTMLRoot(e ecs.Entity) (html.Node, error)
- func (c *Content) HTMLScrollStyle(e ecs.Entity, id string) (html.ScrollStyle, bool)
- func (c *Content) HTMLSet(e ecs.Entity, source string)
- func (c *Content) HTMLSetCSS(e ecs.Entity, cssText string) bool
- func (c *Content) HTMLSetOffset(e ecs.Entity, id string, x, y float32) bool
- func (c *Content) HTMLSetScroll(e ecs.Entity, id string, area ecs.Entity, x, y float32) bool
- func (c *Content) Has[T any](e ecs.Entity) bool
- func (c *Content) Insert[T any](e ecs.Entity, value T) error
- func (c *Content) IsAlive(e ecs.Entity) bool
- func (c *Content) ModelRig(name string) (*project.ModelRig, error)
- func (c *Content) Mount[P, S any](e ecs.Entity, d *html.Definition[P, S], p P, s S, key uint64) (ecs.Entity, error)
- func (c *Content) MustElement(id string) ecs.Entity
- func (c *Content) MustMut[T any](e ecs.Entity) *T
- func (c *Content) Mut[T any](e ecs.Entity) *T
- func (c *Content) Query[T any]() iter.Seq2[ecs.Entity, ecs.ComponentAccess[T]]
- func (c *Content) Query2[A, B any]() iter.Seq2[ecs.Entity, ecs.Components2[A, B]]
- func (c *Content) ReadFile(name string) ([]byte, error)
- func (c *Content) Ref[T any](e ecs.Entity) *T
- func (c *Content) RefreshTransforms() error
- func (c *Content) ReleaseHTML(e ecs.Entity)
- func (c *Content) RemoveResource[T any]() (T, bool)
- func (c *Content) Resource[T any]() (T, bool)
- func (c *Content) ResourceMut[T any]() (*T, bool)
- func (c *Content) Root() ecs.Entity
- func (c *Content) ScrollOffset(e ecs.Entity) (mgl32.Vec2, bool)
- func (c *Content) SetControlValue(e ecs.Entity, v string) bool
- func (c *Content) SetDisabled(e ecs.Entity, v bool)
- func (c *Content) SetIfChanged[T comparable](e ecs.Entity, v T) bool
- func (c *Content) SetScrollOffset(e ecs.Entity, v mgl32.Vec2) bool
- func (c *Content) SetSelected(e ecs.Entity, v bool)
- func (c *Content) Spawn(bundle ecs.Bundle) ecs.Entity
- func (c *Content) SpawnNode[T any](o ui.NodeOptions, v T) ecs.Entity
- func (c *Content) SpawnNode2[A, B any](o ui.NodeOptions, a A, b B) ecs.Entity
- func (c *Content) SpawnScrollArea(o ui.ScrollAreaOptions) ecs.Entity
- func (c *Content) Store[T any](value T)
- func (c *Content) SurfaceFonts(e ecs.Entity, font, bold *text.Font)
- func (c *Content) SyncHTML() error
- func (c *Content) SyncUI() error
- func (c *Content) Unmount(e ecs.Entity) bool
- func (c *Content) UpdateState[P, S any](e ecs.Entity, update func(*S)) bool
- type ContentBehavior
- type ContentComponentContext
- type ContentEventContext
- type ContentFeature
- type ContentMessages
- type ContentProfile
- type ContentRenderContext
- type ContentSystemContext
- type Context
- func (c *Context) Active() bool
- func (c *Context) Alive() bool
- func (c *Context) BindEmitter[T any](topic string) (Emitter[T], error)
- func (c *Context) BindRequester[Q, R any](topic string) (Requester[Q, R], error)
- func (c *Context) Content() *Content
- func (c *Context) Despawn(e Entity) error
- func (c *Context) Disown[T ownedResource](resource T)
- func (c *Context) Dispose() error
- func (c *Context) Each[T any](visit func(Entity, T) bool) (err error)
- func (c *Context) Element(name string) (Entity, error)
- func (c *Context) Forward(target string, m Message) error
- func (c *Context) ForwardAs(target, topic string, m Message) error
- func (c *Context) Generation() uint64
- func (c *Context) Get[T any](e Entity) (T, bool)
- func (c *Context) Host() *Host
- func (c *Context) InstallMaterial3D[T graphics.Material3D](entity Entity, material *T) error
- func (c *Context) Name() string
- func (c *Context) OpenFile(name string) (fs.File, error)
- func (c *Context) OpenResource(name string) (fs.File, error)
- func (c *Context) Own[T ownedResource](resource T) error
- func (c *Context) Remove[T any](e Entity) error
- func (c *Context) Reparent(child, parent Entity) error
- func (c *Context) Resource[T any](kind, name string) (T, error)
- func (c *Context) Root() Entity
- func (c *Context) Send[T any](target, topic string, value T) error
- func (c *Context) Set[T any](e Entity, value T) error
- func (c *Context) Slot(name string) (Slot, error)
- func (c *Context) Spawn(parent Entity) (Entity, error)
- func (c *Context) Switch(request SceneSwitchRequest) error
- type Emitter
- type Entity
- type FontService
- type FullContent
- type HTMLContent
- type HTMLNode
- func (n HTMLNode) Append(child HTMLNode) bool
- func (n HTMLNode) Bounds() (Rect, bool)
- func (n HTMLNode) Clear() bool
- func (n HTMLNode) Clone() HTMLNode
- func (n HTMLNode) FindByID(id string) (HTMLNode, bool)
- func (n HTMLNode) Remove() bool
- func (n HTMLNode) RemoveAttribute(name string) bool
- func (n HTMLNode) SetAttribute(name, value string) bool
- func (n HTMLNode) SetHidden(hidden bool) bool
- func (n HTMLNode) SetSelectedIndex(selected int) bool
- func (n HTMLNode) SetText(value string) bool
- type Host
- type Input
- type LayoutContent
- type Lifecycle
- type ManagedResource
- type Message
- type Options
- type ParticlesContent
- type Physics2DContent
- type Rect
- type Registry
- func (r *Registry) RegisterMod[T any](id project.ModID, create func() T, hooks Lifecycle[T]) error
- func (r *Registry) RegisterScene[T any](id project.SceneID, create func() T, hooks Lifecycle[T]) error
- func (r *Registry) RegisterValue[T any](name project.ValueType, decode func(project.SlotValue) (T, error)) error
- type Render2D
- type RenderOutputHandle
- type Request
- type RequestID
- type RequestOptions
- type Requester
- type Result
- type Runtime
- func (r *Runtime) Cancel(id RequestID) error
- func (r *Runtime) Close() error
- func (r *Runtime) Dispatch() error
- func (r *Runtime) HandleHTMLEvent(event htmlui.Event) error
- func (r *Runtime) HandleInput(event scene.InputEvent) error
- func (r *Runtime) Manager() *SceneManager
- func (r *Runtime) Mount(id project.SceneID) (*Scene, error)
- func (r *Runtime) MountEntry() (*Scene, error)
- func (r *Runtime) NeedsTick() bool
- func (r *Runtime) Pending() int
- func (r *Runtime) PublishCollisions() error
- func (r *Runtime) Queued() int
- func (r *Runtime) RenderScope() *ecs.QueryScope
- func (r *Runtime) SyncScopes()
- func (r *Runtime) Update(delta float32) error
- func (r *Runtime) UpdateFrame(delta float32) error
- type Scene
- func (s *Scene) AdvanceGPUFor(device *render.Device, budget graphics.UploadBudget) (bool, error)
- func (s *Scene) Alive() bool
- func (s *Scene) Dispose() error
- func (s *Scene) Emitter[T any](name string) (Emitter[T], error)
- func (s *Scene) GPUReadyFor(device *render.Device) bool
- func (s *Scene) Generation() uint64
- func (s *Scene) ID() project.SceneID
- func (s *Scene) SlotWriter(instance, name string) (SlotWriter, error)
- func (s *Scene) State() SceneState
- type SceneActivationOptions
- type SceneManager
- func (m *SceneManager) Activate(target *Scene, options SceneActivationOptions) error
- func (m *SceneManager) Active() *Scene
- func (m *SceneManager) BeginPreload(request ScenePreloadRequest) (*ScenePreloader, error)
- func (m *SceneManager) Preload(request ScenePreloadRequest) (*Scene, error)
- func (m *SceneManager) StartEntry() (*Scene, error)
- func (m *SceneManager) Switch(request SceneSwitchRequest) error
- type ScenePreloadRequest
- type ScenePreloader
- func (p *ScenePreloader) Advance(budget time.Duration) (bool, error)
- func (p *ScenePreloader) AdvanceFor(device *render.Device, budget graphics.UploadBudget) (ready bool, err error)
- func (p *ScenePreloader) CPUReady() bool
- func (p *ScenePreloader) Discard()
- func (p *ScenePreloader) GPUReadyFor(device *render.Device) bool
- func (p *ScenePreloader) Ready() bool
- func (p *ScenePreloader) ReadyFor(device *render.Device) bool
- func (p *ScenePreloader) Scene() *Scene
- type SceneStartup
- type SceneState
- type SceneSwitchRequest
- type SceneSwitchResult
- type Signal
- type Slot
- func (s Slot) Read[T any]() (T, error)
- func (s Slot) Revision() SlotRevision
- func (s Slot) Root() Entity
- func (s Slot) Set(value project.SlotValue) error
- func (s Slot) SetVisual(handle RenderOutputHandle) error
- func (s Slot) Value() (project.SlotValue, bool)
- func (s Slot) Visual() (RenderOutputHandle, bool)
- type SlotRevision
- type SlotWriter
- type SpatialContent
- type SpineContent
- type TextRenderRequest
- type TextRenderResult
- type Tick
- type TilemapsContent
- type TrailsContent
- type WithContent
Constants ¶
const InputTopic = "input"
const SceneTarget = ""
SceneTarget addresses the sender's scene. All other targets are instance IDs in that scene. Receivers need no declaration or subscription.
Variables ¶
var ( ErrInvalid = errors.New("module: invalid argument") ErrDisposed = errors.New("module: instance disposed") ErrBusy = errors.New("module: structural operation requires a tick boundary") ErrQueueFull = errors.New("module: event queue capacity reached") ErrPendingFull = errors.New("module: pending request capacity reached") ErrCommandFull = errors.New("module: structural command capacity reached") ErrType = errors.New("module: protocol type mismatch") ErrOwnership = errors.New("module: entity belongs to another instance") ErrReadOnly = errors.New("module: slot does not allow external writes") ErrTimeout = errors.New("module: request timed out") ErrCanceled = errors.New("module: request canceled") ErrAlreadyReplied = errors.New("module: request already replied") ErrStaleRevision = errors.New("module: request slot revision changed") )
var ErrStartupLimit = errors.New("module: scene startup did not settle within its batch/event budget")
Functions ¶
Types ¶
type AnimationsContent ¶
type AnimationsContent struct{}
type Collision2D ¶
type Collision2D struct {
Element string
Phase physics.CollisionPhase
Type, OtherType uint32
Normal, Point [2]float32
Penetration float32
}
Geometry uses solver world coordinates. Element is the sender's private name; OtherType is the collider's authored category, never an external entity handle.
type Collision3D ¶
type Content ¶
type Content struct {
// contains filtered or unexported fields
}
Content confines procedural UI and model operations to one module. ECS IDs returned by UI libraries are checked against ownership at every access.
func (*Content) ControlTextTabWidth ¶
func (*Content) Define ¶
func (c *Content) Define[P, S any](template html.Template, css string, b ContentBehavior[P, S]) (*html.Definition[P, S], error)
func (*Content) FocusedControl ¶
FocusedControl returns this module's keyboard focus, or zero if focus is outside.
func (*Content) HTMLControl ¶
func (*Content) HTMLScrollStyle ¶
func (*Content) HTMLSetOffset ¶
func (*Content) HTMLSetScroll ¶
func (*Content) RefreshTransforms ¶
func (*Content) ReleaseHTML ¶
func (*Content) RemoveResource ¶
func (*Content) ResourceMut ¶
func (*Content) SetIfChanged ¶
func (c *Content) SetIfChanged[T comparable](e ecs.Entity, v T) bool
func (*Content) SetScrollOffset ¶
func (*Content) SpawnNode2 ¶
func (*Content) SpawnScrollArea ¶
func (c *Content) SpawnScrollArea(o ui.ScrollAreaOptions) ecs.Entity
func (*Content) SurfaceFonts ¶
ImageProvider and fonts are installed on owned surfaces rather than globally.
type ContentBehavior ¶
type ContentBehavior[P, S any] struct { Render func(ContentRenderContext[P, S], *html.View) Unmount func(*ContentComponentContext[P, S]) HandleEvent func(*ContentEventContext[P, S]) }
type ContentComponentContext ¶
type ContentComponentContext[P, S any] = ContentRenderContext[P, S]
type ContentEventContext ¶
type ContentEventContext[P, S any] struct { World *Content Pointer *html.PointerEvent Props *P State *S Ref string Event html.Event Component ecs.Entity // contains filtered or unexported fields }
func (*ContentEventContext[P, S]) PreventDefault ¶
func (c *ContentEventContext[P, S]) PreventDefault()
func (*ContentEventContext[P, S]) StopPropagation ¶
func (c *ContentEventContext[P, S]) StopPropagation()
func (*ContentEventContext[P, S]) UpdateState ¶
func (c *ContentEventContext[P, S]) UpdateState(update func(*S)) bool
type ContentFeature ¶
type ContentFeature interface {
// contains filtered or unexported methods
}
type ContentMessages ¶
type ContentMessages[T any] struct { // contains filtered or unexported fields }
ContentMessages filters engine control messages to their owning module.
type ContentProfile ¶
type ContentProfile interface {
// contains filtered or unexported methods
}
ContentProfile selects component construction and its entire lifecycle at compile time. It must cover both authored content and content created by code.
type ContentRenderContext ¶
type ContentRenderContext[P, S any] struct { World *Content Props *P State *S Component ecs.Entity }
ContentRenderContext is passed by value; Props and State refer to the component.
type ContentSystemContext ¶
type ContentSystemContext struct{ World *Content }
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context deliberately exposes neither the global World nor foreign entities. One stable context is allocated at mount and reused for every callback.
func (*Context) BindEmitter ¶
func (*Context) BindRequester ¶
func (*Context) Disown ¶
func (c *Context) Disown[T ownedResource](resource T)
Disown removes an explicitly closed resource from lifecycle bookkeeping.
func (*Context) Each ¶
Each visits this module's private entity list only. Values are read copies; returning false stops iteration. Entities spawned during traversal wait until the boundary before becoming visible to queries.
func (*Context) Forward ¶
Forward preserves the sender and payload. Scenes relay to modules within the current delivery; module relays enter the next batch. Sends always enqueue. Requests have one destination per delivery.
func (*Context) Generation ¶
func (*Context) InstallMaterial3D ¶
func (c *Context) InstallMaterial3D[T graphics.Material3D](entity Entity, material *T) error
InstallMaterial3D replaces the built-in material during this instance's installation and registers its concrete renderer without exposing the World.
func (*Context) OpenFile ¶
OpenFile serves inline component paths and other module-private files. Resolution uses the same ownership boundary as the project compiler.
func (*Context) OpenResource ¶
OpenResource accepts a declared private resource name, not an arbitrary path. The module chooses its file layout; no resources/ directory is imposed.
func (*Context) Resource ¶
Resource returns a typed, privately declared resource installed by a feature.
func (*Context) Send ¶
Send is convenient for occasional messages. BindEmitter avoids even the type lookup on frequently used send paths.
func (*Context) Set ¶
Set replaces existing components immediately; archetype changes are commands applied after the batch/update traversal. Transform writes affect local content.
func (*Context) Switch ¶
func (c *Context) Switch(request SceneSwitchRequest) error
type Emitter ¶
type Emitter[T any] struct { // contains filtered or unexported fields }
BindEmitter reserves typed buffers during Install. Emit sends to the scene; EmitTo addresses any scene module without a declared receive port.
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
Entity is an ownership-bound handle; it cannot be converted into an ECS ID.
type FontService ¶
type FontService struct {
// contains filtered or unexported fields
}
FontService reads only its module's declared resource. Identical font bytes share layout/output caches within the Runtime; provider state stays private.
func (*FontService) Destroy ¶
func (f *FontService) Destroy() error
func (*FontService) Render ¶
func (f *FontService) Render(c *Context, request Request[TextRenderRequest, TextRenderResult]) error
type FullContent ¶
type FullContent struct{}
FullContent supports every authored component, including HTML and 3D.
type HTMLContent ¶
type HTMLContent struct{}
type HTMLNode ¶
type HTMLNode struct {
// contains filtered or unexported fields
}
HTMLNode permits document edits inside an owned surface without exposing a World, ECS identity or callbacks with access to foreign input targets.
func (HTMLNode) Bounds ¶
Bounds returns the node's last synchronized layout border box in the HTML surface's coordinates. Hidden or detached nodes have no box; runtime scroll and animation offsets are not included.
func (HTMLNode) RemoveAttribute ¶
func (HTMLNode) SetAttribute ¶
func (HTMLNode) SetSelectedIndex ¶
type Host ¶
type Host struct {
Context *window.Context
RequestRender func()
WakeAt func(time.Time)
RequestClose func()
Minimize func()
ToggleMaximize func()
ToggleFullscreen func()
SetWindowTitle func(string)
SetViewport func(int, int)
GetViewport func() (int, int)
SetWindowDragRegion func(func(float64, float64) bool)
SetWindowInputRegion func([]window.InputRegionRect)
OnCloseRequested func(func() bool)
OpenFolder func(window.FileDialogOptions) (string, error)
OpenFile func(window.FileDialogOptions) (string, error)
OpenFiles func(window.FileDialogOptions) ([]string, error)
SetClipboardText func(string) bool
SetMouseCaptured func(bool) bool
MouseCaptured func() bool
TakeMouseDelta func() (float64, float64)
}
Host provides platform capabilities without exposing the application world.
type Input ¶
type Input struct {
Target Entity
Element string
HTMLID string
HTMLKind htmlui.EventKind
Value string
Event scene.InputEvent
}
Input removes raw cross-module ECS identities from the engine input event.
type LayoutContent ¶
type LayoutContent struct{}
type Lifecycle ¶
type Lifecycle[T any] struct { Install func(*Context, *T) error Enter func(*Context, *T, SceneStartup) error Exit func(*Context, *T) error Suspend func(*Context, *T) error Resume func(*Context, *T, SceneStartup) error Update func(*Context, *T, Tick) error // FrameUpdate runs once per awake frame before UI synchronization. Unlike // fixed Update, it does not keep an on-demand application awake. FrameUpdate func(*Context, *T, Tick) error OnMessage func(*Context, *T, Message) error Destroy func(*Context, *T) error }
Lifecycle creates private state for every instance. Install and scene.startup run once during loading. Enter/Resume prepare activation before its commit; errors preserve the current foreground. Exit/Suspend leave the foreground, and Destroy releases the instance. Nil hooks have no schedule cost.
type ManagedResource ¶
ManagedResource belongs to one module and changes activity only at committed scene transitions. Heavy platform backends live in opt-in adapter packages.
type Message ¶
type Message struct {
Err error
Topic string
From string
ID RequestID
// contains filtered or unexported fields
}
Message is borrowed for the duration of OnMessage. Payloads remain typed in preallocated buffers. Use Value, RequestValue or ResultValue to inspect them.
type Options ¶
type Options struct {
Source fs.FS
Resources project.ResourceFeature
Host *Host
Wake func()
CommandCapacity int
OutputCapacity int
TextCacheCapacity int
StartupBatches int
StartupEvents int
TimeoutTicks uint64
EventCapacity int
RequestCapacity int
// PayloadCapacity is the initial capacity per payload type and bank.
// Zero selects min(8, EventCapacity); storage grows on demand while
// EventCapacity continues to bound the total event queue.
PayloadCapacity int
}
type ParticlesContent ¶
type ParticlesContent struct{}
type Physics2DContent ¶
type Physics2DContent struct{}
type Rect ¶
type Rect struct{ X, Y, Width, Height float32 }
Rect is an element's border box in its HTML surface's coordinates.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry contains cold registration only. A Runtime snapshots it at creation.
func (*Registry) RegisterMod ¶
func (*Registry) RegisterScene ¶
func (*Registry) RegisterValue ¶
func (r *Registry) RegisterValue[T any](name project.ValueType, decode func(project.SlotValue) (T, error)) error
RegisterValue connects a JSON protocol name to a concrete Go type. Decode is used only for slot reads, never to encode message payloads. Slice/pointer fields in event values are immutable until delivery completes.
type Render2D ¶
type Render2D struct{}
Render2D supports sprites, text, cameras, materials and pointer input.
type RenderOutputHandle ¶
type RenderOutputHandle = scene.RenderOutputHandle
type Request ¶
Request carries an opaque reply address, never the requester's Context/entity. Retaining it for deferred work is safe; Reply validates its identity again.
type RequestOptions ¶
type RequestOptions struct {
Revision SlotRevision
// Zero selects the Runtime default; timeouts count fixed logic ticks.
TimeoutTicks uint64
}
type Requester ¶
type Requester[Q, R any] struct { // contains filtered or unexported fields }
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is single-threaded. Plans and registration are immutable for its life.
func New ¶
func New[P ContentProfile](world *ecs.World, plan *project.ProjectPlan, registry Registry, options Options) (*Runtime, error)
New creates a runtime with statically selected content capabilities.
func (*Runtime) Dispatch ¶
Dispatch freezes exactly one batch per logic tick. Replies/actions emitted by callbacks are in the other buffer and cannot recurse into this batch.
func (*Runtime) HandleHTMLEvent ¶
HandleHTMLEvent gives semantic form/control input to the owning scene. Surface and generated target identities never enter the behavior callback.
func (*Runtime) HandleInput ¶
func (r *Runtime) HandleInput(event scene.InputEvent) error
func (*Runtime) Manager ¶
func (r *Runtime) Manager() *SceneManager
func (*Runtime) Mount ¶
Mount is a loading operation; event callbacks enqueue disposal, never mount new scenes while a frozen batch is being traversed.
func (*Runtime) MountEntry ¶
func (*Runtime) PublishCollisions ¶
PublishCollisions runs after physics. It queues the next module batch, so a collision callback cannot mutate the solver or recurse into this simulation.
func (*Runtime) RenderScope ¶
func (r *Runtime) RenderScope() *ecs.QueryScope
RenderScope contains visible scenes, including retained overlay backgrounds.
func (*Runtime) SyncScopes ¶
func (r *Runtime) SyncScopes()
SyncScopes rebuilds cached execution lists only after scene transitions, hierarchy edits, ownership changes or entity lifetimes. Unowned engine entities are shared; unrelated component migrations preserve scope versions.
func (*Runtime) UpdateFrame ¶
UpdateFrame runs UI/application hooks once per awake frame, independently of fixed-tick accumulation. Callers must dispatch pending events first.
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
func (*Scene) AdvanceGPUFor ¶
func (*Scene) Emitter ¶
Emitter sends messages to a scene from the application orchestrator. A module never receives this Scene object through Context.
func (*Scene) Generation ¶
func (*Scene) SlotWriter ¶
func (s *Scene) SlotWriter(instance, name string) (SlotWriter, error)
func (*Scene) State ¶
func (s *Scene) State() SceneState
type SceneActivationOptions ¶
type SceneManager ¶
type SceneManager struct {
// contains filtered or unexported fields
}
func (*SceneManager) Activate ¶
func (m *SceneManager) Activate(target *Scene, options SceneActivationOptions) error
Activate queues the exact prepared instance. Disposal before the commit produces a failed switch instead of silently loading another instance.
func (*SceneManager) Active ¶
func (m *SceneManager) Active() *Scene
func (*SceneManager) BeginPreload ¶
func (m *SceneManager) BeginPreload(request ScenePreloadRequest) (*ScenePreloader, error)
func (*SceneManager) Preload ¶
func (m *SceneManager) Preload(request ScenePreloadRequest) (*Scene, error)
Preload is the synchronous convenience form of BeginPreload and Advance. Interactive loaders use BeginPreload to budget main-thread work per frame.
func (*SceneManager) StartEntry ¶
func (m *SceneManager) StartEntry() (*Scene, error)
func (*SceneManager) Switch ¶
func (m *SceneManager) Switch(request SceneSwitchRequest) error
Switch commits at the next event/update structural boundary. A ready target activates without repeating installation or startup resource loading.
type ScenePreloadRequest ¶
type ScenePreloader ¶
type ScenePreloader struct {
// contains filtered or unexported fields
}
ScenePreloader prepares CPU content on a worker, then commits startup and budgets GPU uploads on the owning render thread. Lifecycle callbacks always run on the caller's thread and remain indivisible work units.
func (*ScenePreloader) Advance ¶
func (p *ScenePreloader) Advance(budget time.Duration) (bool, error)
func (*ScenePreloader) AdvanceFor ¶
func (p *ScenePreloader) AdvanceFor(device *render.Device, budget graphics.UploadBudget) (ready bool, err error)
func (*ScenePreloader) CPUReady ¶
func (p *ScenePreloader) CPUReady() bool
func (*ScenePreloader) Discard ¶
func (p *ScenePreloader) Discard()
func (*ScenePreloader) GPUReadyFor ¶
func (p *ScenePreloader) GPUReadyFor(device *render.Device) bool
func (*ScenePreloader) Ready ¶
func (p *ScenePreloader) Ready() bool
func (*ScenePreloader) Scene ¶
func (p *ScenePreloader) Scene() *Scene
type SceneState ¶
type SceneState uint8
const ( SceneLoading SceneState = iota SceneReady SceneActive SceneSuspended SceneDisposed )
type SceneSwitchRequest ¶
type SceneSwitchRequest struct {
Scene project.SceneID
Startup project.SlotValue
// Retain applies when the departing scene has no explicit ExitPolicy.
Retain bool
// Overlay keeps retained scenes visible beneath the new foreground scene.
// The background scenes are paused and cannot receive input.
Overlay bool
}
type SceneSwitchResult ¶
type Slot ¶
type Slot struct {
// contains filtered or unexported fields
}
func (Slot) Revision ¶
func (s Slot) Revision() SlotRevision
func (Slot) SetVisual ¶
func (s Slot) SetVisual(handle RenderOutputHandle) error
SetVisual borrows a handle and retains a separate lease for this slot. A reply value is borrowed only until its callback returns. Empty clears it.
func (Slot) Value ¶
Value is a borrowed read-only view until the next write. Fields storage belongs to the instance; use Read[T] for a concrete scalar/contract value.
func (Slot) Visual ¶
func (s Slot) Visual() (RenderOutputHandle, bool)
Visual is a borrowed view of the slot's lease, not ownership of that lease.
type SlotRevision ¶
type SlotRevision struct {
// contains filtered or unexported fields
}
func (SlotRevision) With ¶
func (v SlotRevision) With(other SlotRevision) SlotRevision
With guards a request against changes to up to four slots of its source.
type SlotWriter ¶
type SlotWriter struct {
// contains filtered or unexported fields
}
SlotWriter is resolved by the application/scene orchestrator. Modules obtain no other instance handles; their external slot changes use messages.
type SpatialContent ¶
type SpatialContent struct{}
type SpineContent ¶
type SpineContent struct{}
type TextRenderRequest ¶
type TextRenderRequest struct {
Text string
Size float64
Color [4]float32
Width, Height float32
Alignment scene.TextAlignment
}
Engine protocols contain data only; consumers need no provider imports.
type TextRenderResult ¶
type TextRenderResult struct {
Output RenderOutputHandle
Width, Height float32
}
type TilemapsContent ¶
type TilemapsContent struct{}
type TrailsContent ¶
type TrailsContent struct{}
type WithContent ¶
type WithContent[P ContentProfile, F ContentFeature] struct{}
WithContent adds one statically selected capability. The runtime and node traversal remain shared; writers append into the same destination bundle.