Open Source Tomb Raider Engine
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

UI.h 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*!
  2. * \file include/UI.h
  3. * \brief UI/Event Manager
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _UI_H_
  8. #define _UI_H_
  9. #include <functional>
  10. #include <list>
  11. #include <memory>
  12. #include <tuple>
  13. #include <glm/gtc/type_precision.hpp>
  14. #include "system/Shader.h"
  15. struct ImDrawData;
  16. class UI {
  17. public:
  18. static int initialize();
  19. static void eventsFinished();
  20. static void display();
  21. static void shutdown();
  22. static void setSize(glm::i32vec2 s);
  23. static void setVisible(bool v) { visible = v; }
  24. static bool isVisible() { return visible; }
  25. static void handleKeyboard(KeyboardButton key, bool pressed);
  26. static void handleText(char* text, bool notFinished);
  27. static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  28. static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
  29. static void handleMouseScroll(int xrel, int yrel);
  30. static void handleControllerAxis(float value, KeyboardButton axis);
  31. static void handleControllerButton(KeyboardButton button, bool released);
  32. static void renderImGui(ImDrawData* draw_data);
  33. private:
  34. static bool visible;
  35. static unsigned int fontTex;
  36. static std::string iniFilename;
  37. static std::string logFilename;
  38. static bool metaKeyIsActive;
  39. static std::list<std::tuple<KeyboardButton, bool>> keyboardEvents;
  40. static std::list<std::tuple<unsigned int, unsigned int, KeyboardButton, bool>> clickEvents;
  41. static std::list<std::tuple<int, int, int, int>> motionEvents;
  42. static std::list<std::tuple<int, int>> scrollEvents;
  43. static Shader imguiShader;
  44. static const char* imguiShaderVertex;
  45. static const char* imguiShaderFragment;
  46. static unsigned int vboHandle, elementHandle;
  47. };
  48. #endif