diff options
author | rtk0c <[email protected]> | 2025-05-17 18:03:44 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2025-05-17 18:03:44 -0700 |
commit | e041b2a3ea3835a6b3a59dfbd1f24a86fd104396 (patch) | |
tree | 876f22bcc7710864d32ea0d61150bfc6c3a8ad17 /src/sandbox.hpp | |
parent | 152580faf7e7665a04be69b4a0e0538cf39c975c (diff) |
Dirty rect & UI features
- dirty rectangle (and the math library thereof)
- drawing it
- no more std::vector in Sandbox
- single step
- cycle counter display
Diffstat (limited to 'src/sandbox.hpp')
-rw-r--r-- | src/sandbox.hpp | 14 |
1 files changed, 10 insertions, 4 deletions
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 <cstdint> -#include <vector> const int MBIT_DISPLACABLE = 1; @@ -28,15 +28,21 @@ struct Tile { }; struct Sandbox { - std::vector<uint32_t> _bitmap; - std::vector<Tile> _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(); |