candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
GuiSystem.h
Go to the documentation of this file.
1
3#include "Core.h"
4#include <functional>
5#include <entt/entity/fwd.hpp>
6
7struct SDL_Window;
8
9namespace candlewick {
10
11class GuiSystem {
12 Renderer const *m_renderer;
13 bool m_initialized = false;
14
15public:
16 using GuiBehavior = std::function<void(const Renderer &)>;
17
18 GuiSystem(const Renderer &renderer, GuiBehavior behav);
19
20 void addCallback(GuiBehavior cb) { _callbacks.push_back(std::move(cb)); }
21
22 void render(CommandBuffer &cmdBuf);
23
24 void release();
25
26 bool initialized() const { return m_initialized; }
27
28 std::vector<GuiBehavior> _callbacks;
29
30private:
31 bool init(const Renderer &renderer);
32};
33
37void showCandlewickAboutWindow(bool *p_open = NULL, float wrap_width = 400.f);
38
39struct DirectionalLight;
40
43
46void guiAddDisableCheckbox(const char *label, entt::registry &reg,
47 entt::entity id, bool &flag);
48
50
54void guiAddFileDialog(SDL_Window *window, DialogFileType dialog_file_type,
55 std::string &filename);
57
59 const char *prefix = "cdw_screenshot", const char *extension = ".png",
61
62} // namespace candlewick
Definition CommandBuffer.h:17
GuiSystem(const Renderer &renderer, GuiBehavior behav)
std::vector< GuiBehavior > _callbacks
Definition GuiSystem.h:28
bool initialized() const
Definition GuiSystem.h:26
std::function< void(const Renderer &)> GuiBehavior
Definition GuiSystem.h:16
void render(CommandBuffer &cmdBuf)
void addCallback(GuiBehavior cb)
Definition GuiSystem.h:20
void showCandlewickAboutWindow(bool *p_open=NULL, float wrap_width=400.f)
Show an about window providing information about Candlewick.
Definition Camera.h:8
std::string generateMediaFilenameFromTimestamp(const char *prefix="cdw_screenshot", const char *extension=".png", DialogFileType file_type=DialogFileType::IMAGES)
void guiAddFileDialog(SDL_Window *window, DialogFileType dialog_file_type, std::string &filename)
Add a GUI button-text pair to select a file to save something to.
void guiAddDisableCheckbox(const char *label, entt::registry &reg, entt::entity id, bool &flag)
Adds an ImGui::Checkbox which toggles the Disable component on the entity.
DialogFileType
Definition GuiSystem.h:49
@ VIDEOS
Definition GuiSystem.h:49
@ IMAGES
Definition GuiSystem.h:49
void guiAddLightControls(DirectionalLight &light)
Adds a set of ImGui elements to control a DirectionalLight.
Definition LightUniforms.h:7
The Renderer class provides a rendering context for a graphical application.
Definition Renderer.h:20