feature/imgui-sdl
Last change
on this file since e1f88a9 was e1f88a9, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago |
Create a system to draw and switch between different screens, a Screen class, a MainScreen class that extends it, and some classes for UI elements that can be added to screens.
|
-
Property mode
set to
100644
|
File size:
740 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(UIEvent& 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.