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.
33 lines
620 B
Go
33 lines
620 B
Go
//go:build !aego_nonative
|
|
|
|
package engine
|
|
|
|
import (
|
|
"aego/core/errs"
|
|
"aego/core/log"
|
|
"aego/gpu"
|
|
"aego/gpu/gl33"
|
|
"aego/platform"
|
|
"aego/platform/sdl"
|
|
)
|
|
|
|
func newNativePlatform() (platform.Platform, error) {
|
|
p, err := sdl.New()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return p, nil
|
|
}
|
|
|
|
func newNativeDevice(win platform.Window, cfg Config, l *log.Logger) (gpu.Device, error) {
|
|
gw, ok := win.(glWindow)
|
|
if !ok {
|
|
return nil, errs.New(errs.GPUInit, "window has no OpenGL context")
|
|
}
|
|
d, err := gl33.New(gw.GLProcAddress, gl33.Options{Debug: cfg.Debug, Log: l})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return d, nil
|
|
}
|