Foundation for the aego engine. core/ errs, log, handle arena, mathx, clock, stats platform SDL3 backend plus a headless one, input state, events gpu device abstraction with gl33 and null backends vfs scheme-based virtual filesystem with overlay mounts engine builder, module registry, phase-ordered system loop, jobs demos basic, resize, input, headless; sandbox driver OpenGL bindings are generated into gpu/gl33/gl by tools/gen-gl.sh, so the module has no external dependencies.
46 lines
673 B
Go
46 lines
673 B
Go
package engine
|
|
|
|
import "aego/platform"
|
|
|
|
const (
|
|
SystemAppFixed = "app.fixed"
|
|
SystemAppUpdate = "app.update"
|
|
SystemAppRender = "app.render"
|
|
)
|
|
|
|
type App interface {
|
|
Init(*Engine) error
|
|
Event(platform.Event)
|
|
FixedUpdate(dt float64)
|
|
Update(dt float64)
|
|
Render(alpha float64)
|
|
Shutdown()
|
|
}
|
|
|
|
type appSystemKind uint8
|
|
|
|
const (
|
|
appFixed appSystemKind = iota
|
|
appUpdate
|
|
appRender
|
|
)
|
|
|
|
type appSystem struct {
|
|
e *Engine
|
|
kind appSystemKind
|
|
}
|
|
|
|
func (s *appSystem) Run(ctx *Context) {
|
|
if s.e.app == nil {
|
|
return
|
|
}
|
|
switch s.kind {
|
|
case appFixed:
|
|
s.e.app.FixedUpdate(ctx.Dt)
|
|
case appUpdate:
|
|
s.e.app.Update(ctx.Dt)
|
|
case appRender:
|
|
s.e.app.Render(ctx.Alpha)
|
|
}
|
|
}
|