/
GameModel.h
201 lines (175 loc) · 5.01 KB
/
GameModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#ifndef GAMEMODEL_H
#define GAMEMODEL_H
#include <vector>
#include <deque>
#include "client/SaveInfo.h"
#include "simulation/Simulation.h"
#include "gui/interface/Colour.h"
#include "graphics/Renderer.h"
#include "GameView.h"
#include "GameController.h"
#include "Brush.h"
#include "client/User.h"
#include "Notification.h"
#include "QuickOption.h"
#include "Tool.h"
#include "Menu.h"
using namespace std;
class GameView;
class GameController;
class Simulation;
class Renderer;
class ToolSelection
{
public:
enum
{
ToolPrimary, ToolSecondary, ToolTertiary
};
};
class GameModel
{
private:
vector<Notification*> notifications;
//int clipboardSize;
//unsigned char * clipboardData;
GameSave * clipboard;
GameSave * placeSave;
deque<string> consoleLog;
vector<GameView*> observers;
vector<Tool*> toolList;
//All tools that are associated with elements
vector<Tool*> elementTools;
//Tools that are present in elementTools, but don't have an associated menu and need to be freed manually
vector<Tool*> extraElementTools;
Simulation * sim;
Renderer * ren;
vector<Menu*> menuList;
vector<QuickOption*> quickOptions;
int activeMenu;
int currentBrush;
vector<Brush *> brushList;
SaveInfo * currentSave;
SaveFile * currentFile;
Tool * lastTool;
Tool ** activeTools;
Tool * decoToolset[4];
Tool * regularToolset[4];
User currentUser;
float toolStrength;
std::deque<Snapshot*> history;
size_t activeColourPreset;
std::vector<ui::Colour> colourPresets;
bool colourSelector;
ui::Colour colour;
int edgeMode;
std::string infoTip;
std::string toolTip;
//bool zoomEnabled;
void notifyRendererChanged();
void notifySimulationChanged();
void notifyPausedChanged();
void notifyDecorationChanged();
void notifySaveChanged();
void notifyBrushChanged();
void notifyMenuListChanged();
void notifyToolListChanged();
void notifyActiveToolsChanged();
void notifyUserChanged();
void notifyZoomChanged();
void notifyClipboardChanged();
void notifyPlaceSaveChanged();
void notifyColourSelectorColourChanged();
void notifyColourSelectorVisibilityChanged();
void notifyColourPresetsChanged();
void notifyColourActivePresetChanged();
void notifyNotificationsChanged();
void notifyLogChanged(string entry);
void notifyInfoTipChanged();
void notifyToolTipChanged();
void notifyQuickOptionsChanged();
void notifyLastToolChanged();
public:
GameModel();
~GameModel();
void SetEdgeMode(int edgeMode);
int GetEdgeMode();
void SetActiveColourPreset(size_t preset);
size_t GetActiveColourPreset();
void SetPresetColour(ui::Colour colour);
std::vector<ui::Colour> GetColourPresets();
void SetColourSelectorVisibility(bool visibility);
bool GetColourSelectorVisibility();
void SetColourSelectorColour(ui::Colour colour);
ui::Colour GetColourSelectorColour();
void SetToolTip(std::string text);
void SetInfoTip(std::string text);
std::string GetToolTip();
std::string GetInfoTip();
void BuildMenus();
void BuildFavoritesMenu();
void BuildQuickOptionMenu(GameController * controller);
std::deque<Snapshot*> GetHistory();
void SetHistory(std::deque<Snapshot*> newHistory);
void UpdateQuickOptions();
Tool * GetActiveTool(int selection);
void SetActiveTool(int selection, Tool * tool);
void SetToolStrength(float value);
float GetToolStrength();
Tool * GetLastTool();
void SetLastTool(Tool * newTool);
Tool * GetToolFromIdentifier(std::string identifier);
Tool * GetElementTool(int elementID);
vector<Tool*> GetToolList();
vector<Tool*> GetUnlistedTools();
Brush * GetBrush();
vector<Brush*> GetBrushList();
int GetBrushID();
void SetBrushID(int i);
void SetVote(int direction);
SaveInfo * GetSave();
SaveFile * GetSaveFile();
void SetSave(SaveInfo * newSave);
void SetSaveFile(SaveFile * newSave);
void AddObserver(GameView * observer);
bool GetPaused();
void SetPaused(bool pauseState);
bool GetDecoration();
void SetDecoration(bool decorationState);
bool GetAHeatEnable();
void SetAHeatEnable(bool aHeat);
bool GetGravityGrid();
void ShowGravityGrid(bool showGrid);
void ClearSimulation();
vector<Menu*> GetMenuList();
vector<QuickOption*> GetQuickOptions();
void SetActiveMenu(int menuID);
int GetActiveMenu();
void FrameStep(int frames);
User GetUser();
void SetUser(User user);
Simulation * GetSimulation();
Renderer * GetRenderer();
void SetZoomEnabled(bool enabled);
bool GetZoomEnabled();
void SetZoomSize(int size);
int GetZoomSize();
void SetZoomFactor(int factor);
int GetZoomFactor();
void SetZoomPosition(ui::Point position);
ui::Point GetZoomPosition();
bool MouseInZoom(ui::Point position);
ui::Point AdjustZoomCoords(ui::Point position);
void SetZoomWindowPosition(ui::Point position);
ui::Point GetZoomWindowPosition();
void SetClipboard(GameSave * save);
void SetPlaceSave(GameSave * save);
void Log(string message, bool printToFile);
deque<string> GetLog();
GameSave * GetClipboard();
GameSave * GetPlaceSave();
std::vector<Notification*> GetNotifications();
void AddNotification(Notification * notification);
void RemoveNotification(Notification * notification);
};
#endif // GAMEMODEL_H