dynamic window sizing
This commit is contained in:
73
main.go
73
main.go
@@ -17,32 +17,61 @@ import (
|
||||
//"github.com/ojrac/opensimplex-go"
|
||||
)
|
||||
|
||||
var snapshotsPath string
|
||||
var (
|
||||
snapshotsPath string
|
||||
storage *Storage
|
||||
sourceWidth, sourceHeight int
|
||||
targetWidth, targetHeight int
|
||||
)
|
||||
|
||||
func bootstrap() {
|
||||
|
||||
rl.InitWindow(800, 600, "bootstrap")
|
||||
|
||||
monitor := rl.GetCurrentMonitor()
|
||||
fmt.Printf("Using monitor %d\n", monitor)
|
||||
|
||||
monitorWidth := rl.GetMonitorWidth(monitor)
|
||||
monitorHeight := rl.GetMonitorHeight(monitor)
|
||||
|
||||
defaultTargetWidth := int(float32(monitorWidth) * 0.95)
|
||||
defaultTargetHeight := int(float32(monitorHeight) * 0.9)
|
||||
defaultSourceWidth := 5*defaultTargetWidth
|
||||
defaultSourceHeight := 5*defaultTargetHeight
|
||||
|
||||
fmt.Printf("monitor : %d x %d / window : %d x %d / buffer : %d x %d",
|
||||
monitorWidth, monitorHeight,
|
||||
defaultTargetWidth, defaultTargetHeight,
|
||||
defaultSourceWidth, defaultSourceHeight)
|
||||
|
||||
flag.StringVar(&snapshotsPath, "path", "snapshots", "Path to snapshots and db")
|
||||
flag.IntVar(&sourceWidth, "bw", defaultSourceWidth, "Width of the internal graphics source")
|
||||
flag.IntVar(&sourceHeight, "bh", defaultSourceHeight, "Height of the internal graphics source")
|
||||
flag.IntVar(&targetWidth, "w", defaultTargetWidth, "Width of the display window")
|
||||
flag.IntVar(&targetHeight, "h", defaultTargetHeight, "Height of the display window")
|
||||
flag.Parse()
|
||||
|
||||
rl.CloseWindow()
|
||||
|
||||
log.Printf("Storing snapshots at '%s'\n", snapshotsPath)
|
||||
|
||||
os.MkdirAll(snapshotsPath, 0755)
|
||||
var err error
|
||||
storage, err = NewStorage(snapshotsPath)
|
||||
if err != nil {
|
||||
log.Printf("Error loading storage: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
log := log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
|
||||
|
||||
flag.StringVar(&snapshotsPath, "path", "snapshots", "Path to snapshots and db")
|
||||
flag.Parse()
|
||||
|
||||
var sourceWidth int32 = 8000
|
||||
var sourceHeight int32 = 6400
|
||||
|
||||
var targetWidth int32 = int32(1600)
|
||||
var targetHeight int32 = int32(1000)
|
||||
|
||||
log.Printf("Storing snapshots at '%s'\n", snapshotsPath)
|
||||
|
||||
os.MkdirAll(snapshotsPath, 0755)
|
||||
storage, err := NewStorage(snapshotsPath)
|
||||
if err != nil {
|
||||
log.Printf("Error loading storage: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
bootstrap()
|
||||
|
||||
//rl.SetConfigFlags(rl.FlagMsaa4xHint)
|
||||
rl.InitWindow(targetWidth, targetHeight, "sumi sierpinski arrow")
|
||||
rl.InitWindow(int32(targetWidth), int32(targetHeight), "sumi sierpinski arrow")
|
||||
|
||||
// layout_name: controls initialization
|
||||
var ControlScrollPaneScrollView rl.Rectangle
|
||||
@@ -72,8 +101,8 @@ func main() {
|
||||
scale: 100.0,
|
||||
field: &AdderField {
|
||||
fields: []Field {
|
||||
&ScaleField { scale: 10,field: noiseField },
|
||||
sinXYField,
|
||||
noiseField,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -81,7 +110,7 @@ func main() {
|
||||
|
||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||
|
||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
||||
sketch := NewSketch(int32(sourceWidth), int32(sourceHeight))
|
||||
|
||||
fieldColor := colorCycle.Next()
|
||||
fmt.Printf("field color = %v\n", fieldColor)
|
||||
@@ -102,7 +131,7 @@ func main() {
|
||||
//NewColor(11, 35, 176, 50),
|
||||
|
||||
//r
|
||||
contourLayer := NewContourLayer(&sketch, rng, field, actorColor, -10*math.Pi, 10*math.Pi)
|
||||
contourLayer := NewContourLayer(&sketch, rng, field, actorColor, -25*math.Pi, 25*math.Pi)
|
||||
sketch.AddLayer("contours", contourLayer)
|
||||
sketch.AddLayer("sierpinski-arrowhead", sierpinskiLayer)
|
||||
// aurora := NewImageLayer("/home/d/Dropbox/photos/Events/2025/Aurora/Photo Nov 11 2025, 9 52 03 PM.jpg")
|
||||
|
||||
Reference in New Issue
Block a user