Documentation
¶
Overview ¶
Package app provides the engine's top-level App, which implements ebiten.Game so games do not have to. An App owns the window, the run loop, frame timing, the debug watchdog, screenshot capture, and exit handling, and embeds a scene.Manager. Games register scenes and, optionally, set OnUpdate for global per-frame logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExit = errors.New("application exit requested")
ErrExit is returned from Run when the application exits normally, either because a game requested exit or the configured run-for duration elapsed.
Functions ¶
Types ¶
type App ¶
type App struct {
// OnUpdate, when set, runs once per frame before scenes update. Games use
// it for global input and logic (menus, pause, hotkeys) without
// implementing ebiten.Game. Returning a non-nil error stops the loop.
OnUpdate func(duration time.Duration) error
// contains filtered or unexported fields
}
App is the engine's top-level game object. It implements ebiten.Game so that games never have to: games register scenes on the Manager and optionally set OnUpdate for global per-frame logic.
func (*App) Manager ¶
Manager returns the App's scene Manager for registering and controlling scenes.
func (*App) RequestExit ¶
func (a *App) RequestExit()
RequestExit asks the app to exit cleanly at the end of the current frame.
type CameraSettings ¶
type CameraSettings struct {
MoveSpeed float64 `toml:"move_speed"`
ZoomSpeed float64 `toml:"zoom_speed"`
}
CameraSettings holds default pan/zoom speeds for the camera controller. The engine does not consume these directly; a game applies them to its CameraController.
type DebugSettings ¶
type DebugSettings struct {
Enabled bool `toml:"enabled"`
HTTPEnabled bool `toml:"http_enabled"`
HTTPPort int `toml:"http_port"`
}
DebugSettings configures debug mode and the debug HTTP server.
type LogSettings ¶
type LogSettings struct {
Level string `toml:"level"`
}
LogSettings configures logging. Consumed by a game at startup.
type RenderSettings ¶
type RenderSettings struct {
UsePlaceholderSpriteImages bool `toml:"use_placeholder_sprite_images"`
}
RenderSettings holds render toggles.
type RunSettings ¶
RunSettings configures run duration. A zero For means run until closed.
type ScreenshotSettings ¶
type ScreenshotSettings struct {
Path string `toml:"path"`
Delay config.Duration `toml:"delay"`
Frequency config.Duration `toml:"frequency"`
}
ScreenshotSettings configures automatic screenshot capture.
type Settings ¶
type Settings struct {
Window WindowSettings `toml:"window"`
Camera CameraSettings `toml:"camera"`
Debug DebugSettings `toml:"debug"`
Screenshot ScreenshotSettings `toml:"screenshot"`
Run RunSettings `toml:"run"`
Log LogSettings `toml:"log"`
Render RenderSettings `toml:"render"`
}
Settings is the engine's configuration, loaded from layered TOML and flags.
func LoadSettings ¶
LoadSettings loads engine settings from the embedded defaults, an optional local TOML file, and section.key=value overrides.
func (*Settings) Apply ¶
func (s *Settings) Apply()
Apply applies the settings that control engine-global toggles.
func (*Settings) RegisterFlags ¶
RegisterFlags binds the engine's command-line flags to the settings, using the current values as defaults. Call this after LoadSettings and before parsing, so an explicitly-set flag overrides the loaded value.