-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemainwindow.h
executable file
·110 lines (83 loc) · 3.01 KB
/
emainwindow.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
#ifndef EMAINWINDOW_H
#define EMAINWINDOW_H
#include "widgets/ewidget.h"
#include "widgets/eresolution.h"
#include "textures/eterraintextures.h"
#include "textures/egodtextures.h"
#include "textures/ebuildingtextures.h"
#include "textures/echaractertextures.h"
#include "widgets/esettingsmenu.h"
using eSlot = std::function<void()>;
class eGameBoard;
class eGameWidget;
class eWorldWidget;
class eCampaign;
struct eGameWidgetSettings;
class eMainWindow {
public:
eMainWindow();
~eMainWindow();
bool initialize(const eSettings& settings);
public:
void setWidget(eWidget* const w);
eWidget* takeWidget();
int exec();
void addSlot(const eSlot& slot);
int width() const { return resolution().width(); }
int height() const { return resolution().height(); }
const eResolution& resolution() const { return mSettings.fRes; }
SDL_Renderer* renderer() const { return mSdlRenderer; }
void setResolution(const eResolution& res);
void setFullscreen(const bool f);
void startGameAction(eGameBoard* const board,
const eGameWidgetSettings& settings);
void startGameAction(const stdsptr<eCampaign>& c,
const eGameWidgetSettings& settings);
void startGameAction(const eAction& a);
void episodeFinished();
void adventureComplete();
void episodeLost();
bool saveGame(const std::string& path);
bool loadGame(const std::string& path);
void closeGame();
void showRosterOfLeaders();
void showMenuLoading();
void showMainMenu();
void showSettingsMenu();
void showChooseGameMenu();
void showChooseGameEditMenu();
void showGame(const stdsptr<eCampaign>& c,
const eGameWidgetSettings& settings);
void showGame(eGameBoard* b,
const eGameWidgetSettings& settings);
void showWorld();
eWidget* currentWidget() const { return mWidget; }
eWorldWidget* worldWidget() const { return mWW; }
const eSettings& settings() const { return mSettings; }
void execDialog(eWidget* const d,
const bool closable = true,
const eAction& closeFunc = nullptr,
eWidget* const parent = nullptr);
void showEpisodeIntroduction(const stdsptr<eCampaign>& c = nullptr);
const stdsptr<eCampaign>& campaign() const { return mCampaign; }
const std::string& leader() const { return mLeader; }
void setLeader(const std::string& leader) { mLeader = leader; }
std::string leaderSaveDir() const;
private:
void clearWidgets();
eSettings mSettings;
std::string mLeader;
bool mQuit = false;
bool mFirstFullscrenSetting = true;
bool mFirstResolutionSetting = true;
std::vector<eSlot> mSlots;
int mShiftPressed = 0;
stdsptr<eCampaign> mCampaign;
eGameBoard* mBoard = nullptr;
eGameWidget* mGW = nullptr;
eWorldWidget* mWW = nullptr;
eWidget* mWidget = nullptr;
SDL_Window* mSdlWindow = nullptr;
SDL_Renderer* mSdlRenderer = nullptr;
};
#endif // EMAINWINDOW_H