diff options
-rw-r--r-- | docs/class-diag.puml | 96 | ||||
-rw-r--r-- | readme.md | 15 |
2 files changed, 74 insertions, 37 deletions
diff --git a/docs/class-diag.puml b/docs/class-diag.puml index f695ed3..30e4a71 100644 --- a/docs/class-diag.puml +++ b/docs/class-diag.puml @@ -210,6 +210,7 @@ rectangle Group_Pathfinding as "Pathfinding" <<group>> { PathfindingContext -> Pathfinder } rectangle Group_Model as "Model" <<group>> { + together { class Museum { + people : People + canvas : Canvas @@ -218,16 +219,31 @@ rectangle Group_Model as "Model" <<group>> { -- + paused : bool + update() + - tick_interval = 15ms <<constexpr>> + -- + skip_forward() + skip_backward() + - jump : int -- - - jump : unsigned long + - snapshot_ticks = 50 <<constexpr>> + - history : stack<vec<Memento>> + - save_snapshot() : vec<Memento> + - restore_snapshot(const vec<Memento> &) -- - working : bool - worker : thread * - work() } + interface Memento { + } + } together { + class CanvasDataMemento { + - data : CanvasData + } + class TileDataMemento { + - data : TileData + } class Canvas { + Canvas(Museum &) -- @@ -240,6 +256,9 @@ rectangle Group_Model as "Model" <<group>> { -- + tile_color : TileColorFactory + tile_behavior : TileBehaviorFactory + -- + + save() : vec<Memento> + + restore(const vec<Memento> &) -- - tiles : vector<Tile *> - museum : Museum & @@ -248,6 +267,11 @@ rectangle Group_Model as "Model" <<group>> { + rows : unsigned int + columns : unsigned int } + } + together { + class ArtistDataMemento { + - data : ArtistData + } class People { + People(Museum &) + update(tick : bool) @@ -255,14 +279,29 @@ rectangle Group_Model as "Model" <<group>> { + add_artist(ArtistData) + remove_artist(Artist &) + get_artists() : forward_list<Artist *> + -- + + save() : vec<Memento> + + restore(const vec<Memento> &) -- - artists : forward_list<Artist *> - artist_count : size_t - museum : Museum & } - interface Memento { + class Artist { + + update(tick : bool) + + step : bool + + color : Color + + data : ArtistData + -- + - data : ArtistData + - museum : Museum & + } + struct ArtistData { + + x : float + + y : float + + vx : float + + vy : float } - People -r[hidden] Canvas } together { class Tile { @@ -281,40 +320,25 @@ rectangle Group_Model as "Model" <<group>> { + y : unsigned int + type : string } - class Artist { - + update(tick : bool) - + step : bool - + color : Color - + data : ArtistData - -- - - data : ArtistData - - museum : Museum & - } - struct ArtistData { - + x : float - + y : float - + vx : float - + vy : float } + together { class TileColorFactory <<factory>> { + get_color(string) : Color <<static>> + register_color(string, Color) <<static>> } - class TileBehaviorFactory <<factory>> { - + TileBehaviorFactory(Museum &) - + create(string) : uniq<TileBehavior> - -- - - museum : Museum & - } - } - struct Color { red : unsigned int green : unsigned int blue : unsigned int } - + } together { + class TileBehaviorFactory <<factory>> { + + TileBehaviorFactory(Museum &) + + create(string) : uniq<TileBehavior> + -- + - museum : Museum & + } interface TileBehavior { + step(Artist *) + update(Tile &) @@ -329,19 +353,19 @@ rectangle Group_Model as "Model" <<group>> { - type = "" <<constexpr>> } class StepTileBehavior { - - type = "G" : <<constexpr>> + - type = "G" <<constexpr>> } class DeleteArtistTileBehavior { - - type = "R" : <<constexpr>> + - type = "R" <<constexpr>> } class SetNeighborTileBehavior { - - type = "B" : <<constexpr>> + - type = "B" <<constexpr>> -- - dx : int - dy : int } class CreateArtistTileBehavior { - - type = "Y" : <<constexpr>> + - type = "Y" <<constexpr>> -- - last_interactions : unsigned int } @@ -362,7 +386,7 @@ rectangle Group_Model as "Model" <<group>> { Canvas --> TileBehaviorFactory People --> Artist - Tile -> TileData + Tile --> TileData Artist -l> ArtistData Canvas -> CanvasData @@ -386,9 +410,13 @@ rectangle Group_Model as "Model" <<group>> { Tile --> "state" TileBehavior Tile .[norank].> TileBehaviorFactory - Memento <|.[norank]. TileData - Memento <|.[norank]. ArtistData - Memento <|.[norank]. CanvasData + Memento <|.. TileDataMemento + Memento <|.. ArtistDataMemento + Memento <|.. CanvasDataMemento + Museum -[norank]-> Memento + People -[norank]-> ArtistDataMemento + Canvas -[norank]-> CanvasDataMemento + Canvas -[norank]-> TileDataMemento ' LAYOUT Artist -r[hidden] Tile @@ -1,5 +1,14 @@ -# TODO +This is a standard CMake project. To build (using Ninja), run: -- update class diagram -- triple check class diagram +``` +$ cmake -B build -G Ninja +$ ninja -C build +``` + +This project uses the following third-party dependencies, which must be +installed globally before building this project: + +- [SDL3](https://github.com/libsdl-org/SDL) 3.1.3 +- [cpr](https://github.com/libcpr/cpr) 1.11.0 +- [pugixml](https://github.com/zeux/pugixml) 1.14 |