moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / felib / whandler.h
blob7d36eded134acffbae4b68777dc955a490f77bd1
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __FELIB_WHANDLER_H__
13 #define __FELIB_WHANDLER_H__
15 #include <vector>
16 #include "SDL.h"
18 #include "felibdef.h"
21 #define GET_KEY globalwindowhandler::GetKey
22 #define READ_KEY globalwindowhandler::ReadKey
23 #define GET_TICK globalwindowhandler::GetTick
24 #define DELAY globalwindowhandler::Delay
27 class globalwindowhandler {
28 public:
29 static void KSDLProcessEvents (truth dodelay=false);
30 static void KSDLWaitEvent ();
31 static int GetKey (truth EmptyBuffer=true);
32 static int ReadKey ();
33 static void InstallControlLoop (truth (*What)());
34 static void DeInstallControlLoop (truth (*What)());
35 static feuLong GetTick () { return Tick; }
36 static truth ControlLoopsInstalled () { return Controls; }
37 static void EnableControlLoops () { ControlLoopsEnabled = true; }
38 static void DisableControlLoops () { ControlLoopsEnabled = false; }
39 static truth ShiftIsDown ();
40 static void Init ();
41 static void SetQuitMessageHandler (truth (*What)()) { QuitMessageHandler = What; }
42 static feuLong UpdateTick () { return Tick = SDL_GetTicks()/40; }
44 static void Delay (int ms);
46 private:
47 static void ProcessMessage (SDL_Event *Event);
49 static std::vector<int> KeyBuffer;
50 static truth (*QuitMessageHandler)();
51 static truth (*ControlLoop[MAX_CONTROLS])();
52 static int Controls;
53 static feuLong Tick;
54 static truth ControlLoopsEnabled;
56 static Uint32 nextGameTick;
60 #endif