4#include "../../Bridge/BridgeApi.h"
6#include "Rendering/IGraphicsDevice.h"
7#include "Rendering/VertexFormat.h"
9#include "Foundation/StringView.h"
10#include "Foundation/Platform/Timer.h"
14#include <unordered_map>
26 GUI_MODE_TEX_OFFSET_MASK = 255,
28 GUI_MODE_TEX_TYPE_2D = (0u) << 26,
29 GUI_MODE_TEX_TYPE_ARRAY = (1u) << 26,
30 GUI_MODE_TEX_TYPE_CUBE = (2u) << 26,
31 GUI_MODE_TEX_TYPE_2DMS = (3u) << 26,
32 GUI_MODE_TEX_TYPE_MASK = (3u) << 26,
34 GUI_MODE_TEX_CHANNELS_RGB = (0u) << 28,
35 GUI_MODE_TEX_CHANNELS_ALPHA = (1u) << 28,
36 GUI_MODE_TEX_CHANNELS_RED = (2u) << 28,
37 GUI_MODE_TEX_CHANNELS_111R = (3u) << 28,
38 GUI_MODE_TEX_CHANNELS_111INVR = (4u) << 28,
39 GUI_MODE_TEX_CHANNELS_MASK = (7u) << 28,
41 GUI_MODE_MASK = GUI_MODE_TEX_TYPE_MASK | GUI_MODE_TEX_CHANNELS_MASK
45 COGSCORE_DLL_API
extern ImDrawCallback
setGuiMode;
49 static constexpr int cNoOfFontSizes = 4;
51 ImFontAtlas fontAtlas;
52 ImFont* font[cNoOfFontSizes] = {};
53 float initialSize = 0.0f;
56 COGSCORE_DLL_API
void load(
const Context* context,
const std::string& name,
float size,
const ImWchar* glyphRanges);
57 COGSCORE_DLL_API
void reloadWithNewGlyphs(
const Context* context,
const ImWchar* glyphRanges);
58 COGSCORE_DLL_API ImFont* find(
float size,
float& scale)
const;
63 std::unordered_map<size_t, GuiFont> fonts;
70 bool initialize(
Context* context);
73 ImGuiContext* createGuiContext();
74 void deleteGuiContext(ImGuiContext* guiContext);
80 static bool isUsingMouse();
86 static bool isUsingKeyboard();
88 static void setClipboardCallbacks(GetClipboardTextFn getter, SetClipboardTextFn setter);
90 void frame(ImGuiContext* guiContext,
ViewContext& view,
bool updateio =
true);
95 void addTextToGlyphBuilder(
const char* text);
96 void addRangeToGlyphBuilder(
const ImWchar* ranges);
97 ImVector<ImWchar> getLoadedRanges() {
return loadedRanges; }
102 bool createResources();
103 void createSampler();
104 void updateConstantBuffer(
IContext* deviceContext, uint32_t mode);
106 static GetClipboardTextFn getClipboardTextFn;
107 static SetClipboardTextFn setClipboardTextFn;
135 ImGuiContext* imguiContext =
nullptr;
137 ImFontGlyphRangesBuilder fontGlyphBuilder;
138 ImVector<ImWchar> loadedRanges;
139 bool updateLoadedRanges =
false;
141 uint32_t mode = GUI_MODE_DEFAULT;
143 int vertexBufferSize = 5000;
144 int indexBufferSize = 10000;
147 bool touchPointerHeld =
false;
149 glm::vec2 touchPointerPosition = { 0.0f, 0.0f };
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Represents a graphics device used to manage graphics resources and issue drawing commands.
COGSCORE_DLL_API ImDrawCallback setGuiMode
Callback for Render updates - not really called.
Contains all Cogs related functionality.
static const Handle_t NoHandle
Represents a handle to nothing.
Represents a graphics device context which can receive rendering commands.