OpenRaider  0.1.4-dev
Open Source Tomb Raider Game Engine implementation
UI.h
Go to the documentation of this file.
1 
8 #ifndef _UI_H_
9 #define _UI_H_
10 
11 #include <functional>
12 #include <list>
13 #include <memory>
14 #include <tuple>
15 
16 #include <glm/gtc/type_precision.hpp>
17 
18 #include "system/Shader.h"
19 
20 struct ImDrawList;
21 
22 class UI {
23  public:
24  static int initialize();
25  static void eventsFinished();
26  static void display();
27  static void shutdown();
28  static void setSize(glm::i32vec2 s);
29 
30  static void setVisible(bool v) { visible = v; }
31  static bool isVisible() { return visible; }
32 
33  static void handleKeyboard(KeyboardButton key, bool pressed);
34  static void handleText(char* text, bool notFinished);
35  static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
36  static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
37  static void handleMouseScroll(int xrel, int yrel);
38  static void handleControllerAxis(float value, KeyboardButton axis);
39  static void handleControllerButton(KeyboardButton button, bool released);
40 
41  static void renderImGui(ImDrawList** const draw_lists, int count);
42 
43  private:
44  static bool visible;
45  static unsigned int fontTex;
46  static std::string iniFilename;
47  static std::string logFilename;
48  static bool metaKeyIsActive;
49 
50  static std::list<std::tuple<KeyboardButton, bool>> keyboardEvents;
51  static std::list<std::tuple<unsigned int, unsigned int, KeyboardButton, bool>> clickEvents;
52  static std::list<std::tuple<int, int, int, int>> motionEvents;
53  static std::list<std::tuple<int, int>> scrollEvents;
54 
56  static const char* imguiShaderVertex;
57  static const char* imguiShaderFragment;
58 };
59 
60 #endif
61 
static void setVisible(bool v)
Definition: UI.h:30
static std::string logFilename
Definition: UI.h:47
static void handleMouseScroll(int xrel, int yrel)
Definition: UI.cpp:403
static int initialize()
Definition: UI.cpp:44
static const char * imguiShaderFragment
Definition: UI.h:57
static std::list< std::tuple< int, int > > scrollEvents
Definition: UI.h:53
OpenGL Shader Implementation.
static void handleControllerAxis(float value, KeyboardButton axis)
Definition: UI.cpp:410
static void handleControllerButton(KeyboardButton button, bool released)
Definition: UI.cpp:414
static bool isVisible()
Definition: UI.h:31
static std::list< std::tuple< KeyboardButton, bool > > keyboardEvents
Definition: UI.h:50
KeyboardButton
Definition: global.h:34
static Shader imguiShader
Definition: UI.h:55
Definition: UI.h:22
static const char * imguiShaderVertex
Definition: UI.h:56
static unsigned int fontTex
Definition: UI.h:45
static bool visible
Definition: UI.h:44
static void display()
Definition: UI.cpp:220
static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs)
Definition: UI.cpp:396
static std::string iniFilename
Definition: UI.h:46
static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released)
Definition: UI.cpp:378
static std::list< std::tuple< int, int, int, int > > motionEvents
Definition: UI.h:52
Definition: Shader.h:54
static void handleKeyboard(KeyboardButton key, bool pressed)
Definition: UI.cpp:355
static void renderImGui(ImDrawList **const draw_lists, int count)
Definition: UI.cpp:459
static void shutdown()
Definition: UI.cpp:351
static bool metaKeyIsActive
Definition: UI.h:48
static std::list< std::tuple< unsigned int, unsigned int, KeyboardButton, bool > > clickEvents
Definition: UI.h:51
static void eventsFinished()
Definition: UI.cpp:147
static void handleText(char *text, bool notFinished)
Definition: UI.cpp:367
static void setSize(glm::i32vec2 s)
Definition: UI.cpp:39