Open Source Tomb Raider Engine
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

UI.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. * \file include/UI.h
  3. * \brief Abstract UI interface
  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/vec2.hpp>
  14. #include <glm/gtc/type_precision.hpp>
  15. #include "system/Shader.h"
  16. class ImDrawList;
  17. class UI {
  18. public:
  19. static int initialize();
  20. static void eventsFinished();
  21. static void display();
  22. static void shutdown();
  23. static void setSize(glm::i32vec2 s);
  24. static void setVisible(bool v);
  25. static bool isVisible();
  26. static void handleKeyboard(KeyboardButton key, bool pressed);
  27. static void handleText(char* text, bool notFinished);
  28. static void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  29. static void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
  30. static void handleMouseScroll(int xrel, int yrel);
  31. static void handleControllerAxis(float value, KeyboardButton axis);
  32. static void handleControllerButton(KeyboardButton button, bool released);
  33. static void renderImGui(ImDrawList** const draw_lists, int count);
  34. private:
  35. static bool visible;
  36. static unsigned int fontTex;
  37. static std::string iniFilename;
  38. static std::string logFilename;
  39. static bool metaKeyIsActive;
  40. static std::list<std::tuple<KeyboardButton, bool>> keyboardEvents;
  41. static std::list<std::tuple<unsigned int, unsigned int, KeyboardButton, bool>> clickEvents;
  42. static std::list<std::tuple<int, int, int, int>> motionEvents;
  43. static std::list<std::tuple<int, int>> scrollEvents;
  44. static Shader imguiShader;
  45. static const char* imguiShaderVertex;
  46. static const char* imguiShaderFragment;
  47. };
  48. #endif