]> git.mxchange.org Git - quix0rs-blobwars.git/blob - src/CEngine.h
Fix mouse scaling in fullscreen mode.
[quix0rs-blobwars.git] / src / CEngine.h
1 /*
2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20 */
21
22 class Engine {
23
24         private:
25
26                 SDL_Event event;
27                 signed char frameLoop;
28                 int mouseX, mouseY;
29
30                 // Time Difference
31                 unsigned int time1;
32                 unsigned int time2;
33                 float timeDifference;
34                 
35                 // used for cheating!
36                 char lastKeyPressed[25];
37                 char lastKeyEvents[25];
38                 
39                 // Joystick config stuff
40                 int lastButtonPressed;
41                 
42                 Pak pak;
43
44         public:
45                 
46                 int extremeAvailable;
47
48                 char keyState[SDL_NUM_SCANCODES];
49                 char mouseLeft, mouseRight;
50                 
51                 int joyX, joyY;
52                 int joystickState[32]; // hopefully no one has a joystick with this many buttons(!)
53                 bool waitForButton;
54                 bool waitForKey;
55                 bool allowJoypad;
56
57                 bool paused;
58                 bool saveConfig;
59                 bool allowQuit;
60
61                 char userHomeDirectory[PATH_MAX];
62
63                 int useAudio;
64                 int fullScreen;
65                 int skill;
66                 bool practice;
67
68                 // Development stuff
69                 bool devNoMonsters;
70
71                 SDL_RWops *sdlrw;
72
73                 unsigned char *binaryBuffer; // used for unzipping
74                 unsigned char *dataBuffer; // used for unzipping
75
76                 int messageTime;
77                 int messagePriority;
78                 int messageType;
79                 char message[100];
80
81                 char saveSlot[10][80];
82                 int continueSaveSlot;
83
84                 int playerPosX, playerPosY;
85
86                 List widgetList;
87
88                 Widget *highlightedWidget;
89
90                 Entity world;
91
92                 List defineList;
93
94                 bool cheats;
95                 int cheatHealth, cheatExtras, cheatFuel, cheatLevels, cheatBlood, cheatInvulnerable;
96                 int cheatReload, cheatSpeed, cheatSkipLevel;
97
98         Engine();
99         void destroy();
100         void getInput();
101         int getMouseX() const;
102         int getMouseY() const;
103
104         void setMouse(int x, int y);
105         bool userAccepts();
106         
107         void clearCheatVars();
108         bool compareLastKeyInputs();
109         void addKeyEvent();
110         void flushInput();
111         void clearInput();
112         void setUserHome(const char *path);
113         Pak *getPak();
114         bool unpack(const char *filename, int fileType);
115         bool loadData(const char *filename);
116         void reportFontFailure();
117         void setPlayerPosition(int x, int y, int limitLeft, int limitRight, int limitUp, int limitDown);
118         int getFrameLoop() const;
119         void doFrameLoop();
120         void doTimeDifference();
121         float getTimeDifference() const;
122         void resetTimeDifference();
123         void setInfoMessage(const char *message, int priority, int type);
124         void deleteWidgets();
125         void addWidget(Widget *widget);
126         bool loadWidgets(const char *filename);
127         Widget *getWidgetByName(const char *name);
128         void showWidgetGroup(const char *groupName, bool show);
129         void enableWidgetGroup(const char *groupName, bool show);
130         void showWidget(const char *name, bool show);
131         void enableWidget(const char *name, bool enable);
132         void setWidgetVariable(const char *name, int *variable);
133         bool widgetChanged(const char *name);
134         void highlightWidget(int dir);
135         void highlightWidget(const char *name);
136         int processWidgets();
137         bool loadDefines();
138         int getValueOfDefine(const char *word);
139         char *getDefineOfValue(const char *prefix, int value);
140         int getValueOfFlagTokens(const char *line);
141         void delay(unsigned int frameLimit);
142 };