Robot Devastation
SDLEventFactory.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_SDL_EVENT_FACTORY__
6 #define __RD_SDL_EVENT_FACTORY__
7 
8 #include <map>
9 
10 #include <SDL.h>
11 
12 #include "Key.hpp"
13 #include "WindowEvent.hpp"
14 
15 namespace rd{
16 
24 {
25  public:
27  static Key makeKey(SDL_Keycode keycode);
28 
30  static WindowEvent makeWindowEvent(SDL_WindowEvent windowEvent);
31 
33  static bool initLookupTables();
34  private:
37 
39  static bool initialized;
40 
42  static std::map< SDL_Keycode, char> sdl_printable_map;
43 
45  static std::map< SDL_Keycode, int> sdl_control_map;
46 };
47 
48 }
49 
50 #endif //-- __RD_SDL_EVENT_FACTORY__
rd::SDLEventFactory
Factory class that provides static methods for instantiating SDL event source classes.
Definition: SDLEventFactory.hpp:23
rd::SDLEventFactory::initLookupTables
static bool initLookupTables()
Initialize the lookup tables.
Definition: SDLEventFactory.cpp:43
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::SDLEventFactory::sdl_printable_map
static std::map< SDL_Keycode, char > sdl_printable_map
Map storing the correspondence between SDLKeys and their corresponding char respresentation.
Definition: SDLEventFactory.hpp:42
rd::SDLEventFactory::makeKey
static Key makeKey(SDL_Keycode keycode)
Creates a Key from a SDL keycode.
Definition: SDLEventFactory.cpp:23
rd::SDLEventFactory::sdl_control_map
static std::map< SDL_Keycode, int > sdl_control_map
Map storing the correspondence between SDL_Keys and their corresponding control key value.
Definition: SDLEventFactory.hpp:45
rd::Key
Class that represents a keyboard key.
Definition: Key.hpp:23
rd::WindowEvent
Class that represents a window event.
Definition: WindowEvent.hpp:19
rd::SDLEventFactory::initialized
static bool initialized
Boolean indicating that the lookup tables have been initialized or not.
Definition: SDLEventFactory.hpp:39
rd::SDLEventFactory::makeWindowEvent
static WindowEvent makeWindowEvent(SDL_WindowEvent windowEvent)
Creates a WindowEvent from a SDL window event structure.
Definition: SDLEventFactory.cpp:80