FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
librocketinputprocessor.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_GUI_LIBROCKETINPUTPROCESSOR_H
23 #define FIFE_GUI_LIBROCKETINPUTPROCESSOR_H
24 
25 // Standard C++ library includes
26 #include <map>
27 
28 // 3rd party library includes
29 #include <Rocket/Core/Input.h>
30 #include <Rocket/Core/Types.h>
31 #include <SDL_events.h>
32 
33 // FIFE includes
34 // These includes are split up in two parts, separated by one empty line
35 // First block: files included from the FIFE root src directory
36 // Second block: files included from the same folder
37 #include "util/base/fife_stdint.h"
38 
39 namespace Rocket {
40  namespace Core {
41  class Context;
42  }
43 }
44 
45 namespace FIFE {
46 
48  public:
49 
52  LibRocketInputProcessor(Rocket::Core::Context* context);
53 
57 
68  bool onSdlEvent(SDL_Event &evt);
69 
73  void turn();
74 
75  private:
76 
79  void updateKeyModState();
80 
83  bool processMouseMotion(SDL_Event& event);
84 
87  bool processMouseInput(SDL_Event& event);
88 
91  bool processMouseWheelMotion(SDL_Event& event);
92 
95  bool processKeyInput(SDL_Event& event);
96 
99  bool processTextInput(SDL_Event& event);
100 
103  void populateKeyMap();
104 
107  Rocket::Core::Context* m_context;
108 
112 
117  int32_t m_wheelCounter;
118 
121  std::map<SDL_Keycode, Rocket::Core::Input::KeyIdentifier> m_keyMap;
122  };
123 
124 };
125 
126 #endif //FIFE_GUI_LIBROCKETINPUTPROCESSOR_H
std::map< SDL_Keycode, Rocket::Core::Input::KeyIdentifier > m_keyMap
Keymap to convert SDL key to Librocket key.
uint32_t m_keyModState
Bitmask that stores key modifiers.
int32_t m_wheelCounter
Counts how many times the wheel has been moved.
Rocket::Core::Context * m_context
Reference to librocket&#39;s context.
unsigned int uint32_t
Definition: core.h:40