From e041b2a3ea3835a6b3a59dfbd1f24a86fd104396 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sat, 17 May 2025 18:03:44 -0700 Subject: Dirty rect & UI features - dirty rectangle (and the math library thereof) - drawing it - no more std::vector in Sandbox - single step - cycle counter display --- src/sandbox.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/sandbox.hpp') diff --git a/src/sandbox.hpp b/src/sandbox.hpp index bc6f928..03a6a85 100644 --- a/src/sandbox.hpp +++ b/src/sandbox.hpp @@ -1,9 +1,9 @@ #pragma once +#include "common.hpp" #include "rand.hpp" #include -#include const int MBIT_DISPLACABLE = 1; @@ -28,15 +28,21 @@ struct Tile { }; struct Sandbox { - std::vector _bitmap; - std::vector _a; + uint32_t* bitmap; + Tile* tiles; + /// Dirty rects used by the current simulation step. Only used during it. + // TODO use multiple dirty rects? + Rect dirty_curr; + /// Dirty rects to be used, when the next simulation step happens. May write to this during simulation, or outside of simulation. + Rect dirty_writeto; RandomState _rand; Tile _wall_tile; int width, height; int _x, _y; int ncycle = 0; - Sandbox(int w, int h); + Sandbox(int w, int h, RandomState rand = {}); + ~Sandbox(); void simulate_step(); -- cgit v1.2.3-70-g09d2