more code cleanup
This commit is contained in:
35
env.go
35
env.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user