automated snapshot

This commit is contained in:
sumi
2025-12-22 17:50:36 -06:00
parent 96a4a34ae0
commit aea3c71cf9
3 changed files with 53 additions and 23 deletions

26
main.go
View File

@@ -12,16 +12,16 @@ import (
)
const (
targetWidth = 1000
targetHeight = 1000
sourceScale = 2
snapshotsDir = "snapshots"
)
func main() {
sourceWidth := int32(sourceScale * targetWidth)
sourceHeight := int32(sourceScale * targetHeight)
var sourceWidth int32 = 8000
var sourceHeight int32 = 6400
var targetWidth int32 = int32(2000)
var targetHeight int32 = int32(1200)
os.MkdirAll(snapshotsDir, 0755)
log := log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
@@ -47,7 +47,7 @@ func main() {
x: -float32(sourceWidth / 2.0),
y: -float32(sourceHeight / 2.0),
field: &ScaleField{
scale: 1.0,
scale: 4.0,
field: &imageField,
},
}
@@ -74,10 +74,16 @@ func main() {
// begin drawing
t := time.Since(t0).Seconds()
targetBounds := rl.Rectangle {
X: float32(targetWidth) / 4.0,
Y: 0,
Width: float32(targetWidth) * 3.0 / 4.0,
Height: float32(targetHeight),
}
// set up RenderCtx
renderCtx := &RenderCtx{
TargetWidth: int32(targetWidth),
TargetHeight: int32(targetHeight),
TargetBounds: targetBounds,
SourceWidth: int32(sourceWidth),
SourceHeight: int32(sourceHeight),
Time: t,
@@ -91,11 +97,7 @@ func main() {
*/
rl.BeginDrawing()
rl.ClearBackground(rl.Blank)
sketch.Draw(renderCtx)
rl.DrawText("Mouse right button drag to move, mouse wheel to zoom", 10, 10, 20, rl.White)
rl.EndDrawing()
if rl.IsKeyDown(rl.KeySpace) {