From 958e97de0c0df71966aa52079dd9289bbadfd934 Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Thu, 21 Aug 2025 18:26:29 +0200 Subject: [PATCH] Configure steps per simulation update function call via SimStepsPerUpdate --- main.go | 2 +- simulation/simulation.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 96a2bf1..3dda15c 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,7 @@ func main() { ebiten.MaximizeWindow() ebiten.SetTPS(MaxTps) app := &Application{ - simulation: *simulation.NewSimulation(CanvasWidth, CanvasHeight), + simulation: *simulation.NewSimulation(CanvasWidth, CanvasHeight, SimStepsPerUpdate), } InitGrid(app.simulation.Grid) err := ebiten.RunGame(app) diff --git a/simulation/simulation.go b/simulation/simulation.go index 51630c0..6136d25 100644 --- a/simulation/simulation.go +++ b/simulation/simulation.go @@ -5,11 +5,12 @@ import ( ) type Simulation struct { + StepsPerUpdate int Grid *XelGrid } func (sim *Simulation) Update() { - for range 10 { + for range sim.StepsPerUpdate { // get all available xels with energy != 0 available_positions := []Vector2{} for i, xel := range sim.Grid.Xels { @@ -25,8 +26,9 @@ func (sim *Simulation) Update() { } } -func NewSimulation(width int, height int) *Simulation { +func NewSimulation(width int, height int, stepsPerUpdate int) *Simulation { return &Simulation{ Grid: NewXelGrid(width, height), + StepsPerUpdate: stepsPerUpdate, } }