-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypeStorage.ixx
132 lines (107 loc) · 3.55 KB
/
TypeStorage.ixx
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
module;
export module TypeStorage;
export enum class ScreenType {
NoScreen, Menu, Map, Battle, CharacterCreation
};
// This will be stored in the Map module, with a value held in each
export enum class MapType {
World, Building, Dungeon
};
export enum class MapLevel {
Forest, All
};
export enum class FontContext {
Title, Body, Button, Dialog
};
/* values to flag for resolutions. Mostly for development purposes. Final release should always be fullscreen. */
export enum class WindowResType {
Mobile, Tablet, Desktop, Fullscreen
};
/* width and height data */
export struct Resolution {
int w;
int h;
Resolution(int x, int y) {
w = x;
h = y;
}
};
export enum class ConfirmationButtonType {
YesNo, OkCancel
};
/* Dominance Node is a Limb's node in the Dominance Cycle (think Rock, Paper, Scissors). */
export enum class DominanceNode { Red, Green, Blue };
export int const dominanceCycleAdvantage = 15;
/* to avoid recursive self-referential class design, I'll make a Struct to hold information about parent Screens.
* id refers to the id of the Map or Battle object in the database.
* Screens will have the power to set ScreenStruct in GameState, not relying on main.cpp to make the change.
*/
export struct ScreenStruct {
ScreenType screenType;
int id;
ScreenStruct(ScreenType incomingType = ScreenType::NoScreen, int incomingId = -1) {
screenType = incomingType;
id = incomingId;
}
};
/* If this struct is returned to the main function, the program will shut down. */
export ScreenStruct closingScreenStruct() {
ScreenStruct closingScreenStruct(ScreenType::NoScreen, -1);
return closingScreenStruct;
}
/* PANEL BUTTON ENUMS
* Each panel has a list of buttons.
* Each button must store one of these enums, and will choose text independently of the screen.
* The screen checks which enum was triggered (when button clicked) and chooses function/action independently of the button.
* One big enum class will store all Button options.
*/
export enum class ButtonOption {
NoOption,
Agree, Refuse, /* For confirmation panel (OK/Cancel or YES/NO) */
Back, /* for any submenu */
MainMenu, /* quit back to main menu from any screen */
/* Main Menu panel buttons */
NewGame, LoadGame, Settings, About, Exit,
/* Settings buttons */
Mobile, Tablet, Desktop, Fullscreen,
// TO COME: more options for Map, Battle
MapOptions,
/* CHARACTER CREATION SCREEN BUTTONS */
/* Review Mode panel buttons. */
ShowLimbs, ClearSuit, SaveSuit,
/* Inventory (ChooseLimb mode) Panel Buttons. */
LoadLimb, /* Will be re-used dynamically by ALL limb buttons. */
NextPage, PreviousPage,
/* Loaded Limb (LimbLoaded mode) panel buttons. */
NextCharJoint, NextLimbJoint, RotateClockwise, RotateCounterClockwise, UnloadLimb, Equip
};
/* When a button is clicked it must send back one of these Structs.
Sometimes the type of button clicked is enough.
Other times we need a 2nd piece of information,
such as the ID of the map to load or NPC to battle. */
export struct ButtonClickStruct {
ButtonOption buttonOption;
int itemID;
/* constructors. */
ButtonClickStruct(ButtonOption incomingOption, int incomingID) {
buttonOption = incomingOption;
itemID = incomingID;
}
/* blank. */
ButtonClickStruct() {
buttonOption = ButtonOption::NoOption;
itemID = -1;
}
};
export struct Point {
Point() { x = 0; y = 0; }
Point(int x, int y) : x(x), y(y) {}
int x;
int y;
bool equals(Point point) {
return point.x == x && point.y == y;
}
};
export enum LandmarkType { Entrance, Exit, Building, Shrine };
export bool isValidLandmarkType(int value) {
return value >= Entrance && value <= Shrine; }