#pragma once #include "pcg.hpp" #include #include const int MBIT_DISPLACABLE = 1; struct Tile { enum Material : unsigned char { AIR = 0, SOLID, SAND, WATER, }; Material mat; uint8_t pressure = 0; bool updated = false; uint32_t get_color() const; }; struct Sandbox { std::vector _bitmap; std::vector _a; Pcg32 _pcg; Tile _solid_tile; int width, height; int ncycle = 0; Sandbox(int w, int h); void simulate_step(); Tile& gs(int x, int y); void set_sand(int x, int y, Tile sand); void shift_sand(int x, int y); // std::vector to_bitmap() const; };