more code cleanup

This commit is contained in:
2026-01-09 23:05:05 -06:00
parent cf036a0bdb
commit 90e36425ff
6 changed files with 243 additions and 197 deletions

35
env.go
View File

@@ -2,14 +2,28 @@ package main
import (
sg "github.com/d2fn/sumi/internal/graphics"
"time"
)
/** Env **/
type Env struct {
Layout Layout
Time float64
Ports map[string]float64
Graphics sg.Graphics
Time time.Time
Frame uint
Ports map[string]float64
Layout Layout
Viewport *sg.Graphics
Window *sg.Graphics
Controls *sg.Graphics
Offscreen *sg.Graphics
Storage *Storage
}
func NewEnv() *Env {
return &Env{
Time: time.Now(),
Frame: 0,
Ports: make(map[string]float64),
}
}
type Layout struct {
@@ -22,16 +36,5 @@ type Layout struct {
// bounds of the region of the app window reserved for rendering the graphics buffer
Viewport sg.Rect
// bounds of the off screen graphics buffer where rendering happens
Graphics sg.Rect
Offscreen sg.Rect
}
func (ctx *Env) GetGraphicsWidth() float32 {
return ctx.Graphics.Bounds.Width
}
func (ctx *Env) GetGraphicsHeight() float32 {
return ctx.Graphics.Bounds.Height
}