automated snapshot
This commit is contained in:
39
sketch.go
Normal file
39
sketch.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
type Sketch interface {
|
||||
Draw(ctx *RenderCtx)
|
||||
}
|
||||
|
||||
/** Ports **/
|
||||
|
||||
type Ports map[string]Signal
|
||||
|
||||
func MakePorts() Ports {
|
||||
return make(Ports)
|
||||
}
|
||||
|
||||
/**
|
||||
* materialize current value for all ports
|
||||
**/
|
||||
func (p Ports) Eval(t float64) map[string]float64 {
|
||||
out := make(map[string]float64, len(p))
|
||||
for name, sig := range(p) {
|
||||
out[name] = sig.Eval(t)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
/** RenderCtx **/
|
||||
|
||||
type RenderCtx struct {
|
||||
Width int32
|
||||
Height int32
|
||||
Time float64
|
||||
Ports map[string]float64
|
||||
Cam rl.Camera2D
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user