feature/imgui-sdl
|
Last change
on this file since 914bb99 was d8cf709, checked in by Dmitry Portnoy <dportnoy@…>, 5 years ago |
|
Change UIEvent to also include the original event from the UI library the game gui is currently using, such as SDL or GLFW.
|
-
Property mode
set to
100644
|
|
File size:
742 bytes
|
| Line | |
|---|
| 1 | #ifndef _UI_ELEMENT_HPP
|
|---|
| 2 | #define _UI_ELEMENT_HPP
|
|---|
| 3 |
|
|---|
| 4 | #include <SDL2/SDL.h>
|
|---|
| 5 |
|
|---|
| 6 | #include "../game-gui.hpp"
|
|---|
| 7 |
|
|---|
| 8 | class VulkanGame;
|
|---|
| 9 |
|
|---|
| 10 | class UIElement {
|
|---|
| 11 | public:
|
|---|
| 12 | UIElement(int x, int y, int width, int height, SDL_Renderer& renderer,
|
|---|
| 13 | void (*onMouseClick)(VulkanGame& gameInfo),
|
|---|
| 14 | void (*onMouseEnter)(UIElement& element),
|
|---|
| 15 | void (*onMouseLeave)(UIElement& element));
|
|---|
| 16 | virtual ~UIElement();
|
|---|
| 17 |
|
|---|
| 18 | virtual void init();
|
|---|
| 19 | virtual void render(int x, int y) = 0;
|
|---|
| 20 | virtual void handleEvent(GameEvent& e);
|
|---|
| 21 |
|
|---|
| 22 | protected:
|
|---|
| 23 | int x, y;
|
|---|
| 24 | int width, height;
|
|---|
| 25 | SDL_Renderer& renderer;
|
|---|
| 26 | void (*onMouseClick)(VulkanGame& gameInfo);
|
|---|
| 27 | void (*onMouseEnter)(UIElement& element);
|
|---|
| 28 | void (*onMouseLeave)(UIElement& element);
|
|---|
| 29 | };
|
|---|
| 30 |
|
|---|
| 31 | #endif // _UI_ELEMENT_HPP
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.