Avara3D 0.2.0
C++ API reference
ImguiContext.h
1//
2// ImguiContext.h
3// avara3d
4//
5// Created by Morgan Davis on 8/10/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_RENDER_BACKEND_OPENGL_IMGUICONTEXT_H
10#define AVARA3D_RENDER_BACKEND_OPENGL_IMGUICONTEXT_H
11
12#include <memory>
13#include <vector>
14
15struct ImFont;
16struct ImGuiContext;
17
18namespace a3d {
19
20 class Font;
21 class RenderContext;
22
23 class ImguiContext {
24
25 public:
26 // [Internal Lifecycle Functions]
27
28 ImguiContext();
29
30 ImguiContext(const ImguiContext&) = delete;
31 ImguiContext& operator=(const ImguiContext&) = delete;
32
33 ImguiContext(ImguiContext&&) = delete;
34 ImguiContext& operator=(ImguiContext&&) = delete;
35
36 ~ImguiContext();
37
38 // [Internal Member Functions]
39
40
41 void startup(const RenderContext& context);
42 void shutdown();
43
44 ImFont* addFont(std::unique_ptr<Font> font);
45 ImFont* defaultFont() const;
46
47 void beginFrame(const RenderContext& context);
48 void endFrame();
49
50 bool isStarted() const;
51
52 private:
53 // [Private Member Functions]
54
55 void makeCurrent() const;
56 void updateDisplayMetrics(const RenderContext& context);
57 void rebuildDeviceObjects();
58
59 // [Private Member Variables]
60
61 ImGuiContext* _context;
62 std::vector<std::unique_ptr<Font>> _fontSources;
63 ImFont* _defaultFont;
64 bool _fontAtlasDirty;
65 bool _frameActive;
66 bool _started;
67 };
68
69}
70
71#endif // AVARA3D_RENDER_BACKEND_OPENGL_IMGUICONTEXT_H