Game of Ur
0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Toggle main menu visibility
Loading...
Searching...
No Matches
ur_records.hpp
Go to the documentation of this file.
1
11
12
#ifndef ZOAPPRECORDS_H
13
#define ZOAPPRECORDS_H
14
15
#include <toymaker/engine/sim_system.hpp>
16
17
#include "
game_of_ur_data/model.hpp
"
18
#include "
game_of_ur_data/serialize.hpp
"
19
20
26
struct
GameRecord
{
27
GameScoreData
mSummary;
28
PlayerData
mPlayerA;
29
PlayerData
mPlayerB;
30
};
31
37
class
UrRecords:
public
ToyMaker::SimObjectAspect<UrRecords> {
38
public
:
39
UrRecords(): SimObjectAspect<UrRecords>{0} {}
40
inline
static
std::string getSimObjectAspectTypeName() {
return
"UrRecords"
; }
41
static
std::shared_ptr<BaseSimObjectAspect> create(
const
nlohmann::json& jsonAspectProperties);
42
std::shared_ptr<BaseSimObjectAspect> clone()
const override
;
43
44
void
submitRecord(
const
GameRecord
& gameRecord);
45
46
inline
GameRecord
getLatestRecord()
const
{
return
mLoadedRecords.back(); }
47
inline
std::vector<GameRecord> getAllRecords()
const
{
return
mLoadedRecords; }
48
49
private
:
50
static
void
ApplyInvariants(
const
GameRecord
& gameRecord);
51
void
onActivated()
override
;
52
void
onDeactivated()
override
;
53
54
std::vector<GameRecord> mLoadedRecords {};
55
std::string mRecordsPath {};
56
};
57
58
void
from_json(
const
nlohmann::json& json,
GameRecord
& gameRecord);
59
void
to_json(nlohmann::json& json,
const
GameRecord
& gameRecord);
60
61
#endif
model.hpp
The class containing the interface to the data model for the whole game (Game of Ur).
serialize.hpp
Contains methods to convert data from its-in game representation to its JSON representation,...
GameRecord
The details of a single completed game.
Definition
ur_records.hpp:26
GameScoreData
Data returned by GameOfUrModel when queried for scores.
Definition
model.hpp:151
PlayerData
Data returned by GameOfUrModel when queried about a player.
Definition
model.hpp:229
src
app
ur_records.hpp
Generated on
for Game of Ur by
1.17.0