core

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAssets = NewAssetManager("assets")

DefaultAssets points at the conventional project assets directory.

Functions

func BindDefault3DControls added in v0.1.7

func BindDefault3DControls()

BindDefault3DControls registers the standard movement controls used by 3D sample scenes.

func ConnectEntitySignal

func ConnectEntitySignal(entityID uint64, name string, cb func(...any)) uint64

ConnectEntitySignal connects to an entity-scoped signal.

func ConnectEntitySignal1

func ConnectEntitySignal1[A any](entityID uint64, name string, cb func(A)) uint64

ConnectEntitySignal1 connects a typed callback for one-argument entity signals.

func ConnectEntitySignal2

func ConnectEntitySignal2[A, B any](entityID uint64, name string, cb func(A, B)) uint64

ConnectEntitySignal2 connects a typed callback for two-argument entity signals.

func ConnectGlobalSignal

func ConnectGlobalSignal(name string, cb func(...any)) uint64

ConnectGlobalSignal connects to a global signal.

func ConnectGlobalSignal1

func ConnectGlobalSignal1[A any](name string, cb func(A)) uint64

ConnectGlobalSignal1 connects a typed callback for one-argument global signals.

func ConnectGlobalSignal2

func ConnectGlobalSignal2[A, B any](name string, cb func(A, B)) uint64

ConnectGlobalSignal2 connects a typed callback for two-argument global signals.

func ConnectScopedSignal

func ConnectScopedSignal(scope SignalScope, owner, name string, cb func(...any)) uint64

ConnectScopedSignal registers (if needed) and connects a callback.

func ConnectSystemSignal

func ConnectSystemSignal(system, name string, cb func(...any)) uint64

ConnectSystemSignal is a convenience to register and connect in one call.

func ConnectSystemSignal0

func ConnectSystemSignal0(system, name string, cb func()) uint64

ConnectSystemSignal0 connects a typed callback with no arguments.

func ConnectSystemSignal1

func ConnectSystemSignal1[A any](system, name string, cb func(A)) uint64

ConnectSystemSignal1 connects a typed callback for one argument system signals.

func ConnectSystemSignal2

func ConnectSystemSignal2[A, B any](system, name string, cb func(A, B)) uint64

ConnectSystemSignal2 connects a typed callback for two argument system signals.

func ConnectSystemSignal3

func ConnectSystemSignal3[A, B, C any](system, name string, cb func(A, B, C)) uint64

ConnectSystemSignal3 connects a typed callback for three argument system signals.

func DisconnectEntitySignal

func DisconnectEntitySignal(entityID uint64, name string, id uint64)

DisconnectEntitySignal disconnects from an entity-scoped signal by id.

func DisconnectGlobalSignal

func DisconnectGlobalSignal(name string, id uint64)

DisconnectGlobalSignal disconnects from a global signal by id.

func DisconnectScopedSignal

func DisconnectScopedSignal(scope SignalScope, owner, name string, id uint64)

DisconnectScopedSignal disconnects a listener from scope/owner/name by id.

func DisconnectSystemSignal

func DisconnectSystemSignal(system, name string, id uint64)

DisconnectSystemSignal removes a listener by id from a system signal.

func EmitEntitySignal

func EmitEntitySignal(entityID uint64, name string, args ...any)

EmitEntitySignal emits to an entity-scoped signal synchronously.

func EmitEntitySignalDeferred

func EmitEntitySignalDeferred(entityID uint64, name string, args ...any)

EmitEntitySignalDeferred queues an entity signal for emission at frame end.

func EmitGlobalSignal

func EmitGlobalSignal(name string, args ...any)

EmitGlobalSignal emits a global signal synchronously.

func EmitGlobalSignalDeferred

func EmitGlobalSignalDeferred(name string, args ...any)

EmitGlobalSignalDeferred queues a global signal for frame-end emission.

func EmitScopedSignal

func EmitScopedSignal(scope SignalScope, owner, name string, args ...any)

EmitScopedSignal emits to all listeners under scope/owner/name synchronously.

func EmitScopedSignalDeferred

func EmitScopedSignalDeferred(scope SignalScope, owner, name string, args ...any)

EmitScopedSignalDeferred queues a signal emission to execute at frame end via FlushDeferredSignals. This mirrors Godot's emit_deferred() and allows safer tree modifications.

func EmitSystemSignal

func EmitSystemSignal(system, name string, args ...any)

EmitSystemSignal emits a system signal synchronously.

func EmitSystemSignalDeferred

func EmitSystemSignalDeferred(system, name string, args ...any)

EmitSystemSignalDeferred queues a system signal for emission at frame end.

func FlushDeferredSignals

func FlushDeferredSignals()

FlushDeferredSignals executes all queued deferred emissions. Call this at the end of each frame, typically in the game loop after all updates.

func ListEntitySignals

func ListEntitySignals(entityID uint64) []string

ListEntitySignals returns all signal names for an entity.

func ListGlobalSignals

func ListGlobalSignals() []string

ListGlobalSignals returns all global signal names.

func ListSignals

func ListSignals(scope SignalScope, owner string) []string

ListSignals returns all signal names for a given scope/owner. Useful for introspection and discovering what signals a system emits.

func ListSystemSignals

func ListSystemSignals(system string) []string

ListSystemSignals returns all signal names emitted by a system.

func RemoveEntitySignals

func RemoveEntitySignals(entityID uint64)

RemoveEntitySignals cleans up all signals for a given entity (called on entity destruction). This prevents memory leaks and mimics Godot's automatic cleanup.

Types

type AssetManager added in v0.1.7

type AssetManager struct {
	// contains filtered or unexported fields
}

AssetManager resolves and caches project assets. It is intentionally file-oriented so it can support textures, audio, JSON, or any other asset type.

func NewAssetManager added in v0.1.7

func NewAssetManager(root string) *AssetManager

NewAssetManager creates a manager rooted at the given directory. If root is empty, it defaults to "assets".

func (*AssetManager) ClearCache added in v0.1.7

func (a *AssetManager) ClearCache()

ClearCache removes cached asset bytes.

func (*AssetManager) Exists added in v0.1.7

func (a *AssetManager) Exists(name string) bool

Exists reports whether the resolved asset path exists on disk.

func (*AssetManager) MustResolve added in v0.1.7

func (a *AssetManager) MustResolve(name string) string

MustResolve returns the resolved asset path or panics if the asset cannot be resolved.

func (*AssetManager) Open added in v0.1.7

func (a *AssetManager) Open(name string) (*os.File, error)

Open opens an asset for streaming access.

func (*AssetManager) ReadBytes added in v0.1.7

func (a *AssetManager) ReadBytes(name string) ([]byte, error)

ReadBytes loads an asset into memory and caches the contents by resolved path.

func (*AssetManager) ReadString added in v0.1.7

func (a *AssetManager) ReadString(name string) (string, error)

ReadString loads an asset as UTF-8 text.

func (*AssetManager) Register added in v0.1.7

func (a *AssetManager) Register(name, path string) error

Register associates a logical name with a relative or absolute path.

func (*AssetManager) Resolve added in v0.1.7

func (a *AssetManager) Resolve(name string) (string, error)

Resolve returns the absolute or project-relative path for a logical asset name. Registered aliases take precedence; otherwise the input is treated as a path under the asset root.

func (*AssetManager) Root added in v0.1.7

func (a *AssetManager) Root() string

Root returns the current asset root directory.

type DeferredEmission

type DeferredEmission struct {
	// contains filtered or unexported fields
}

DeferredEmission represents a signal emission queued for frame-end execution. This mirrors Godot's emit_deferred() pattern.

type InputManager

type InputManager struct {
	// contains filtered or unexported fields
}

func NewInputManager

func NewInputManager() *InputManager

func (*InputManager) BeginFrame

func (i *InputManager) BeginFrame()

BeginFrame clears edge-triggered state for the new frame.

func (*InputManager) BindAction

func (i *InputManager) BindAction(action string, keys ...sdl.Scancode)

func (*InputManager) BufferAction

func (i *InputManager) BufferAction(action string)

BufferAction adds an action to the input buffer (called when action is pressed).

func (*InputManager) EnqueueEvent

func (i *InputManager) EnqueueEvent(event sdl.Event)

EnqueueEvent is non-blocking and safe to call from the main loop. If the queue is full, it processes the event inline instead of stalling.

func (*InputManager) HasBufferedAction

func (i *InputManager) HasBufferedAction(action string) bool

HasBufferedAction checks if an action has a buffered input (consumes it).

func (*InputManager) IsActionJustPressed

func (i *InputManager) IsActionJustPressed(action string) bool

func (*InputManager) IsActionJustReleased

func (i *InputManager) IsActionJustReleased(action string) bool

func (*InputManager) IsActionPressed

func (i *InputManager) IsActionPressed(action string) bool

func (*InputManager) IsKeyJustPressed

func (i *InputManager) IsKeyJustPressed(key sdl.Scancode) bool

func (*InputManager) IsKeyJustReleased

func (i *InputManager) IsKeyJustReleased(key sdl.Scancode) bool

func (*InputManager) IsKeyPressed

func (i *InputManager) IsKeyPressed(key sdl.Scancode) bool

func (*InputManager) OnEvent

func (i *InputManager) OnEvent(cb func(sdl.Event)) func()

OnEvent registers a callback that receives every SDL event seen by the input worker. It returns a function that unregisters the callback.

func (*InputManager) ProcessEvent

func (i *InputManager) ProcessEvent(event sdl.Event)

func (*InputManager) Start

func (i *InputManager) Start()

Start launches the background event worker. It is safe to call multiple times.

func (*InputManager) Stop

func (i *InputManager) Stop()

Stop terminates the background event worker.

func (*InputManager) UnbindAction

func (i *InputManager) UnbindAction(action string)

func (*InputManager) UpdateBuffers

func (i *InputManager) UpdateBuffers(dt float32)

UpdateBuffers decays input buffer timers each frame (call from OnProcess, once per render frame).

type Node3D added in v0.1.7

type Node3D struct {
	// contains filtered or unexported fields
}

Node3D is a fluent entity builder for reusable 3D setup.

func (*Node3D) At added in v0.1.7

func (n *Node3D) At(x, y, z float32) *Node3D

At sets the local position of the node.

func (*Node3D) Build added in v0.1.7

func (n *Node3D) Build() ecs.Entity

Build commits the node data into the ECS world and returns its entity id.

func (*Node3D) Sized added in v0.1.7

func (n *Node3D) Sized(x, y, z float32) *Node3D

Sized sets the local scale of the node.

func (*Node3D) WithCamera added in v0.1.7

func (n *Node3D) WithCamera(camera components.Camera3D) *Node3D

WithCamera attaches a camera component to the node.

func (*Node3D) WithCharacterBody added in v0.1.7

func (n *Node3D) WithCharacterBody(body components.CharacterBody3D) *Node3D

WithCharacterBody attaches a 3D character body to the node.

func (*Node3D) WithMaterial added in v0.1.7

func (n *Node3D) WithMaterial(material components.Material3D) *Node3D

WithMaterial attaches a material to the node.

func (*Node3D) WithMesh added in v0.1.7

func (n *Node3D) WithMesh(mesh components.Mesh3D) *Node3D

WithMesh attaches a mesh to the node.

func (*Node3D) WithRigidBody added in v0.1.7

func (n *Node3D) WithRigidBody(body components.RigidBody3D) *Node3D

WithRigidBody attaches a 3D rigid body to the node.

func (*Node3D) WithStaticBody added in v0.1.7

func (n *Node3D) WithStaticBody() *Node3D

WithStaticBody attaches a 3D static body marker to the node.

type Scene

type Scene struct {
	// contains filtered or unexported fields
}

Scene is a simple wrapper around the ECS world. It provides convenience methods for entity management.

func NewScene

func NewScene() *Scene

NewScene creates a new scene with an ECS world. If a default Window has previously been created via core.New(...), the scene will automatically start processing (input, registered systems, and entity callbacks) without the developer having to call StartProcessing manually.

func (*Scene) AddCharacterBody3D added in v0.1.7

func (s *Scene) AddCharacterBody3D(entity ecs.Entity, body components.CharacterBody3D)

AddCharacterBody3D attaches a CharacterBody3D to an entity.

func (*Scene) AddEntityCallbacks added in v0.1.7

func (s *Scene) AddEntityCallbacks(entity ecs.Entity, start func(*ecs.World, ecs.Entity), process func(*ecs.World, ecs.Entity, float32), physics func(*ecs.World, ecs.Entity, float32))

AddEntityCallbacks registers per-entity lifecycle callbacks. Any of the callback parameters may be nil if not needed.

func (*Scene) AddMaterial3D added in v0.1.7

func (s *Scene) AddMaterial3D(entity ecs.Entity, material components.Material3D)

AddMaterial3D sets or replaces the Material3D component on an entity.

func (*Scene) AddMesh3D added in v0.1.7

func (s *Scene) AddMesh3D(entity ecs.Entity, mesh components.Mesh3D)

AddMesh3D sets a Mesh3D component on an existing entity.

func (*Scene) AddPhysicsCallback added in v0.1.7

func (s *Scene) AddPhysicsCallback(entity ecs.Entity, cb func(*ecs.World, ecs.Entity, float32))

AddPhysicsCallback registers a physics callback for the given entity.

func (*Scene) AddProcessCallback added in v0.1.7

func (s *Scene) AddProcessCallback(entity ecs.Entity, cb func(*ecs.World, ecs.Entity, float32))

AddProcessCallback registers a per-frame process callback for the given entity.

func (*Scene) AddRigidBody3D added in v0.1.7

func (s *Scene) AddRigidBody3D(entity ecs.Entity, body components.RigidBody3D)

AddRigidBody3D attaches a RigidBody3D to an entity.

func (*Scene) AddStartCallback added in v0.1.7

func (s *Scene) AddStartCallback(entity ecs.Entity, cb func(*ecs.World, ecs.Entity))

AddStartCallback registers a start callback for the given entity.

func (*Scene) AddStaticBody3D added in v0.1.7

func (s *Scene) AddStaticBody3D(entity ecs.Entity)

AddStaticBody3D marks an entity with StaticBody3D.

func (*Scene) AddTransform3D added in v0.1.7

func (s *Scene) AddTransform3D(entity ecs.Entity, t components.Transform3D)

AddTransform3D sets the Transform3D component on an existing entity.

func (*Scene) CreateBox3D added in v0.1.7

func (s *Scene) CreateBox3D(width, height, depth float32, material components.Material3D) ecs.Entity

CreateBox3D creates a rectangular box entity with a mesh and optional material.

func (*Scene) CreateCamera3D added in v0.1.7

func (s *Scene) CreateCamera3D(camera components.Camera3D) ecs.Entity

CreateCamera3D creates a camera entity in the scene and marks it as the active camera. The provided camera value will be stored as the Camera3D component; pass components.NewCamera3D() or a modified copy to configure.

func (*Scene) CreateCube3D added in v0.1.7

func (s *Scene) CreateCube3D(size float32, material components.Material3D) ecs.Entity

CreateCube3D creates a cube entity with a mesh and optional material.

func (*Scene) CreateEntity

func (s *Scene) CreateEntity() ecs.Entity

CreateEntity creates a new entity in the scene.

func (*Scene) CreateEntity3D added in v0.1.7

func (s *Scene) CreateEntity3D() ecs.Entity

CreateEntity3D creates and tags a new entity as part of the 3D world.

func (*Scene) CreatePlane3D added in v0.1.7

func (s *Scene) CreatePlane3D(width, depth float32, material components.Material3D) ecs.Entity

CreatePlane3D creates a plane entity with a mesh and optional material. If material is the zero value, DefaultMaterial3D will be used.

func (*Scene) DestroyEntity

func (s *Scene) DestroyEntity(entity ecs.Entity)

DestroyEntity removes an entity from the scene.

func (*Scene) GetCamera

func (s *Scene) GetCamera() ecs.Entity

GetCamera returns the camera entity.

func (*Scene) RegisterPhysicsSystem added in v0.1.7

func (s *Scene) RegisterPhysicsSystem(sys interface{ Update(*ecs.World, float32) })

RegisterPhysicsSystem registers a fixed-step physics system that will be called during the window physics step when StartProcessing is invoked.

func (*Scene) RegisterProcessSystem added in v0.1.7

func (s *Scene) RegisterProcessSystem(sys interface{ Update(*ecs.World, float32) })

RegisterProcessSystem registers a per-frame system that will be called during the window process step when StartProcessing is invoked.

func (*Scene) SetCamera

func (s *Scene) SetCamera(entity ecs.Entity)

SetCamera sets the camera entity.

func (*Scene) SetDefaultCamera

func (s *Scene) SetDefaultCamera() ecs.Entity

SetDefaultCamera creates a default camera entity and returns it.

func (*Scene) StartProcessing added in v0.1.7

func (s *Scene) StartProcessing(win *Window)

StartProcessing wires the registered systems into the provided window's process and physics callbacks so the engine updates systems automatically.

func (*Scene) World

func (s *Scene) World() *ecs.World

World returns the underlying ECS world for entity and component operations.

type Scene3D added in v0.1.7

type Scene3D struct {
	// contains filtered or unexported fields
}

Scene3D owns reusable 3D scene-building helpers on top of the ECS world.

func NewScene3D added in v0.1.7

func NewScene3D(scene *Scene) *Scene3D

NewScene3D creates a reusable 3D scene controller.

func (*Scene3D) CameraEntity added in v0.1.7

func (s *Scene3D) CameraEntity() ecs.Entity

CameraEntity returns the ECS entity used as the active camera.

func (*Scene3D) SetCamera added in v0.1.7

func (s *Scene3D) SetCamera(entity ecs.Entity)

SetCamera selects the active camera entity for the scene.

func (*Scene3D) Spawn added in v0.1.7

func (s *Scene3D) Spawn() *Node3D

Spawn returns a fluent builder for a new 3D entity.

func (*Scene3D) SpawnBox added in v0.1.7

func (s *Scene3D) SpawnBox(width, height, depth float32) *Node3D

SpawnBox returns a node preconfigured with a box mesh.

func (*Scene3D) SpawnCamera added in v0.1.7

func (s *Scene3D) SpawnCamera() *Node3D

SpawnCamera returns a node preconfigured with a Camera3D component.

func (*Scene3D) SpawnCube added in v0.1.7

func (s *Scene3D) SpawnCube(size float32) *Node3D

SpawnCube returns a node preconfigured with a cube mesh.

func (*Scene3D) SpawnPlane added in v0.1.7

func (s *Scene3D) SpawnPlane(width, depth float32) *Node3D

SpawnPlane returns a node preconfigured with a plane mesh.

func (*Scene3D) World added in v0.1.7

func (s *Scene3D) World() *ecs.World

World returns the underlying ECS world.

type ScreenType added in v0.1.7

type ScreenType string

ScreenType controls how the game view responds to window size changes.

const (
	// ScreenTypeSame keeps a fixed logical game resolution with letterboxing.
	ScreenTypeSame ScreenType = "same"
	// ScreenTypeExpand keeps a fixed logical game resolution and fills the output without distortion.
	ScreenTypeExpand ScreenType = "expand"
)

type Signal

type Signal struct {
	// contains filtered or unexported fields
}

Signal is a thread-safe event broadcaster inspired by Godot 4 signals. It implements the observer pattern with minimal overhead and optimized lookup. Listeners are functions with a variadic `...any` argument list.

func GetEntitySignal

func GetEntitySignal(entityID uint64, name string) *Signal

GetEntitySignal returns an entity-scoped signal.

func GetGlobalSignal

func GetGlobalSignal(name string) *Signal

GetGlobalSignal returns a global signal by name.

func GetScopedSignal

func GetScopedSignal(scope SignalScope, owner, name string) *Signal

GetScopedSignal returns an existing signal for the given scope/owner/name, or nil.

func GetSystemSignal

func GetSystemSignal(system, name string) *Signal

GetSystemSignal returns a previously registered signal, or nil if none.

func NewSignal

func NewSignal() *Signal

NewSignal creates a new Signal with optional metadata name.

func RegisterEntitySignal

func RegisterEntitySignal(entityID uint64, name string) *Signal

RegisterEntitySignal ensures an entity-scoped signal exists.

func RegisterEntitySignalDef

func RegisterEntitySignalDef(entityID uint64, def *SignalDef) *Signal

RegisterEntitySignalDef registers an entity signal with metadata.

func RegisterGlobalSignal

func RegisterGlobalSignal(name string) *Signal

RegisterGlobalSignal ensures a global signal exists.

func RegisterGlobalSignalDef

func RegisterGlobalSignalDef(def *SignalDef) *Signal

RegisterGlobalSignalDef registers a global signal with metadata.

func RegisterScopedSignal

func RegisterScopedSignal(scope SignalScope, owner, name string) *Signal

RegisterScopedSignal ensures a signal exists for the given scope/owner/name. Returns the Signal for optional further configuration or manual connection.

func RegisterScopedSignalDef

func RegisterScopedSignalDef(scope SignalScope, owner string, def *SignalDef) *Signal

RegisterScopedSignalDef registers both a signal and its metadata definition. This enables introspection: developers can query what signals a system emits.

func RegisterSystemSignal

func RegisterSystemSignal(system, name string) *Signal

RegisterSystemSignal ensures a signal exists for the given system and name and returns it.

func RegisterSystemSignalDef

func RegisterSystemSignalDef(system string, def *SignalDef) *Signal

RegisterSystemSignalDef registers a signal with metadata documentation. Example: RegisterSystemSignalDef("TimerSystem", &SignalDef{Name: "timeout", Description: "Emitted when timer expires", ArgTypes: []string{"Entity", "uint64"}})

func (*Signal) Connect

func (s *Signal) Connect(cb func(...any)) uint64

Connect registers a callback and returns an identifier you can use to disconnect.

func (*Signal) Disconnect

func (s *Signal) Disconnect(id uint64)

Disconnect removes a previously registered listener by id.

func (*Signal) Emit

func (s *Signal) Emit(args ...any)

Emit calls all listeners with the provided arguments (synchronous, immediate).

func (*Signal) ListenerCount

func (s *Signal) ListenerCount() int

ListenerCount returns how many listeners are connected to this signal. Useful for deciding whether to emit before building the args.

func (*Signal) Name

func (s *Signal) Name() string

Name returns the signal's name if set, or empty string.

func (*Signal) SetName

func (s *Signal) SetName(name string) *Signal

SetName sets the signal name for introspection and debugging.

type SignalDef

type SignalDef struct {
	Name        string   // e.g., "timeout", "body_entered"
	Description string   // Human description of when this signal fires
	ArgTypes    []string // Type names of arguments, e.g., []string{"Entity", "uint64"}
}

SignalDef describes a signal's metadata: name, arg types, and description. This enables compile-time documentation of what signals a system emits.

func GetEntitySignalDef

func GetEntitySignalDef(entityID uint64, name string) *SignalDef

GetEntitySignalDef returns metadata for an entity signal.

func GetGlobalSignalDef

func GetGlobalSignalDef(name string) *SignalDef

GetGlobalSignalDef returns metadata for a global signal.

func GetScopedSignalDef

func GetScopedSignalDef(scope SignalScope, owner, name string) *SignalDef

GetScopedSignalDef returns the metadata for a signal if it was registered via RegisterScopedSignalDef.

func GetSystemSignalDef

func GetSystemSignalDef(system, name string) *SignalDef

GetSystemSignalDef returns metadata for a system signal if registered.

type SignalScope

type SignalScope string
const (
	SignalScopeGlobal SignalScope = "global"
	SignalScopeSystem SignalScope = "system"
	SignalScopeEntity SignalScope = "entity"
)

type Window

type Window struct {
	Title  string
	Width  int32
	Height int32
	Flags  []sdl.WindowFlags

	PhysicsStep float32 // seconds per physics tick (default 1/60)
	// contains filtered or unexported fields
}

func DefaultWindow added in v0.1.7

func DefaultWindow() *Window

DefaultWindow returns the window created by the last call to New(), if any.

func New

func New(title string, w int32, h int32, flags ...sdl.WindowFlags) (*Window, error)

func (*Window) Destroy

func (w *Window) Destroy()

func (*Window) OnPhysicsProcess

func (w *Window) OnPhysicsProcess(cb func(dt float32))

OnPhysicsProcess registers a fixed-step physics callback receiving fixed dt.

func (*Window) OnProcess

func (w *Window) OnProcess(cb func(dt float32))

OnProcess registers a per-frame callback receiving `dt` in seconds.

func (*Window) OnReady

func (w *Window) OnReady(cb func())

OnReady registers a callback to run once before the main loop starts.

func (*Window) Renderer

func (w *Window) Renderer() *sdl.Renderer

Renderer exposes the SDL renderer for low-level drawing systems.

func (*Window) Run

func (w *Window) Run()

func (*Window) RunWithUpdate

func (w *Window) RunWithUpdate(update func())

func (*Window) ScreenType added in v0.1.7

func (w *Window) ScreenType() ScreenType

ScreenType returns the currently configured screen type.

func (*Window) SetClearColor

func (w *Window) SetClearColor(r, g, b, a uint8)

SetClearColor sets the clear color used at the start of each rendered frame.

func (*Window) SetClearColorHex

func (w *Window) SetClearColorHex(hex string) error

SetClearColorHex sets clear color from hex: #RGB, #RGBA, #RRGGBB, #RRGGBBAA. The leading # is optional.

func (*Window) SetPhysicsStep

func (w *Window) SetPhysicsStep(step float32)

SetPhysicsStep sets the fixed-step physics delta in seconds.

func (*Window) SetScreenType added in v0.1.7

func (w *Window) SetScreenType(screenType ScreenType, logicalW, logicalH int32) error

SetScreenType configures how rendering adapts to window size changes. For ScreenTypeSame, logicalW/logicalH must be > 0 and are used as the fixed game resolution.

func (*Window) ViewportSize added in v0.1.7

func (w *Window) ViewportSize() (int32, int32)

ViewportSize returns the active gameplay viewport dimensions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL