Changeset d8cf709 in opengl-game for game-gui.hpp
- Timestamp:
- Feb 13, 2021, 11:41:39 PM (4 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- c6f0793
- Parents:
- 8b823e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
game-gui.hpp
r8b823e7 rd8cf709 8 8 #include <vulkan/vulkan.h> 9 9 #endif 10 11 // These are included here so I can implement the RawEvent union, which requires knowledge 12 // of the ui event types of all ui libraries I might use for any of the GameGui clases 13 // GLFW does not have its own event type though, so SDL is currently the only library this is done for 14 #include <SDL2/SDL.h> 10 15 11 16 using namespace std; … … 25 30 }; 26 31 27 struct WindowEvent {28 EventType type;32 union RawEvent { 33 SDL_Event sdl; 29 34 }; 30 35 … … 45 50 }; 46 51 52 struct WindowEvent { 53 EventType type; 54 }; 55 47 56 struct WindowResizeEvent { 48 57 EventType type; … … 53 62 struct UnknownEvent { 54 63 EventType type; 55 unsigned int eventType;56 64 }; 57 65 58 66 // TODO: Switch from union to std::variant 59 67 60 union UIEvent {68 union GameEvent { 61 69 EventType type; 62 70 WindowEvent window; … … 65 73 WindowResizeEvent windowResize; 66 74 UnknownEvent unknown; 75 }; 76 77 struct UIEvent { 78 RawEvent rawEvent; 79 GameEvent event; 67 80 }; 68 81 … … 80 93 81 94 virtual void processEvents() = 0; 82 virtual int pollEvent(UIEvent* event) = 0;95 virtual int pollEvent(UIEvent* uiEvent) = 0; 83 96 virtual bool keyPressed(unsigned int key) = 0; 84 97
Note:
See TracChangeset
for help on using the changeset viewer.