Nebula
Loading...
Searching...
No Matches
imguicontext.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
11//------------------------------------------------------------------------------
13#include "coregraphics/buffer.h"
15#include "input/inputevent.h"
19#include "imguiinputhandler.h"
21#include "frame/framecode.h"
22
23#define IMGUI_DEFINE_MATH_OPERATORS
24#include "imgui.h"
25
26struct ImDrawData;
27struct ImFont;
28struct ImVec2;
29namespace Dynui
30{
31
32extern ImGuiKey NebulaToImguiKeyCodes[];
34extern const char* EditorUIPath;
35
37{
39 uint layer : 8 = 0;
40 uint mip : 4 = 0;
41 uint useAlpha : 1 = 1;
42 uint useRange : 1 = 0;
44 uint red : 1 = 1;
45 uint green : 1 = 1;
46 uint blue : 1 = 1;
47 uint alpha : 1 = 1;
48 uint splat : 1 = 0;
49};
50
52
59
60
61extern ImFont* ImguiFont;
62extern ImFont* ImguiBoldFont;
63extern ImFont* ImguiItFont;
64extern ImFont* ImguiIconFont;
65
67{
69public:
73 virtual ~ImguiContext();
74
76 static void Create();
78 static void Discard();
79
81 static void SetRectSize(SizeT width, SizeT height);
82
84 static bool HandleInput(const Input::InputEvent& event);
85
87 static void OnViewportResized(const uint framescriptHash, SizeT width, SizeT height);
89 static void NewFrame(const Graphics::FrameContext& ctx);
90
92 static void EndFrame(const Graphics::FrameContext& ctx);
93
94private:
95 static void RecoverImGuiContextErrors();
96};
97
99void ImGuiCloseButton(bool& toggle, int id);
101bool ImGuiToggleButton(const char* label, bool toggle);
102
103} // namespace Dynui
static void EndFrame(const Graphics::FrameContext &ctx)
called after frame
Definition imguicontext.cc:1261
static void Create()
Create context.
Definition imguicontext.cc:596
virtual ~ImguiContext()
destructor
Definition imguicontext.cc:574
static void OnViewportResized(const uint framescriptHash, SizeT width, SizeT height)
called if the window size has changed
Definition imguicontext.cc:1215
static void SetRectSize(SizeT width, SizeT height)
set the screen dimensions to use when rendering the UI (all vertices will be mapped to these values)
ImguiContext()
constructor
Definition imguicontext.cc:566
static bool HandleInput(const Input::InputEvent &event)
handle event
Definition imguicontext.cc:1165
static void Discard()
Discard context.
Definition imguicontext.cc:1120
static void RecoverImGuiContextErrors()
Definition imguicontext.cc:490
Definition graphicscontext.h:175
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
The input events of the Input subsystems.
Definition inputevent.h:24
Nebula's dynamic array class.
Definition array.h:61
void NewFrame()
Progress to next frame.
Definition vkgraphicsdevice.cc:2455
Imgui Profiler UI.
Definition imguiconsole.cc:195
ImGuiKey NebulaToImguiKeyCodes[]
Definition imguicontext.cc:37
ImFont * ImguiIconFont
Definition imguicontext.cc:227
ImFont * ImguiItFont
Definition imguicontext.cc:226
void SetImguiTextureIdData(Ids::Id32 id, const ImguiTextureId &data)
Set imgui texture data.
Definition imguicontext.cc:1282
void ImGuiCloseButton(bool &toggle, int id)
Helper function to recreate the ImGUI close button used for windows and tabs.
Definition imguicontext.cc:1300
Ids::IdAllocator< ImguiTextureId > ImguiTextureIdAllocator(0xFFF)
Definition imguicontext.h:51
ImFont * ImguiFont
Definition imguicontext.cc:224
void DeallocateImguiTextureId(Ids::Id32 id)
Deallocate imgui texture.
Definition imguicontext.cc:1291
bool ImGuiToggleButton(const char *label, bool toggle)
Helper function for toggle buttons.
Definition imguicontext.cc:1338
Ids::Id32 AllocateImguiTextureId(const ImguiTextureId &data)
Allocate imgui texture.
Definition imguicontext.cc:1271
Util::Array< Util::String > ImguiDragAndDropFiles
Definition imguicontext.cc:35
const char * EditorUIPath
Definition imguicontext.cc:36
ImFont * ImguiBoldFont
Definition imguicontext.cc:225
uint32_t Id32
Definition id.h:138
A resource table declares a list of resources (ResourceTable in DX12, DescriptorSet in Vulkan).
texture type
Definition texture.h:25
Definition imguicontext.h:37
CoreGraphics::TextureId nebulaHandle
Definition imguicontext.h:38
uint useRange
Definition imguicontext.h:42
uint green
Definition imguicontext.h:45
uint mip
Definition imguicontext.h:40
uint alpha
Definition imguicontext.h:47
float rangeMin
Definition imguicontext.h:43
uint blue
Definition imguicontext.h:46
uint useAlpha
Definition imguicontext.h:41
uint layer
Definition imguicontext.h:39
uint splat
Definition imguicontext.h:48
float rangeMax
Definition imguicontext.h:43
uint red
Definition imguicontext.h:44
Definition graphicsserver.h:31
int SizeT
Definition types.h:42
unsigned int uint
Definition types.h:33