source: opengl-game/gui/screen.hpp@ 670c09a

feature/imgui-sdl
Last change on this file since 670c09a 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: 1001 bytes
Line 
1#ifndef _SCREEN_H
2#define _SCREEN_H
3
4#include <vector>
5
6#include <vulkan/vulkan.h>
7
8#include <SDL2/SDL.h>
9
10#include "../consts.hpp"
11//#include "../game-gui.hpp"
12
13#include "ui-element.hpp"
14
15using namespace std;
16
17class VulkanGame;
18
19template<class Type>
20struct ValueReference {
21
22};
23
24// TODO: Add a function to create an SDL_Color from a uint32_t
25
26// TODO: Maybe make this a subclass of UIElement
27class Screen {
28public:
29 Screen(SDL_Renderer& renderer, VulkanGame& gameInfo);
30 virtual ~Screen();
31
32 virtual void createRenderCommands(VkCommandBuffer& commandBuffer, uint32_t currentImage) = 0;
33 virtual void init();
34
35 virtual void renderUI();
36 virtual void handleEvent(UIEvent& e);
37 void addUIElement(UIElement* element);
38
39protected:
40 SDL_Renderer& renderer;
41 VulkanGame& gameInfo;
42
43private:
44 vector<UIElement*> uiElements;
45};
46
47// TODO: Maybe move these somewhere else
48void button_onMouseEnter(UIElement& element);
49void button_onMouseLeave(UIElement& element);
50
51#endif // _SCREEN_H
Note: See TracBrowser for help on using the repository browser.