The Instance is the class that handles most of the operation of your application, as it is responsible for setting up core settings and UI events.
The instance persists through the whole runtime of the application and is used to instantiate UI components and global data.
Symbols that belong to the instance
As said before, the Instance
is a class. It contains the following member functions and variables:
noexcept;
Instance()
// Events of the instance
virtual void begin() = 0;
virtual void tick(float deltaTime) = 0;
virtual void end() = 0;
virtual ~Instance() noexcept;
virtual void onEventConfigureStyle(ImGuiStyle& style, ImGuiIO& io) = 0;
// Returns the global from the InitInfo struct
static void* getGlobal() noexcept;
// Returns a component given a type and ID
template<ComponentType cmpType>
static auto* getComponentByIDs(const FString& name, uint64_t id);
// Casts the instance to a type for example from Parent to Child type
template<typename T>
static T* cast();
// The InitInfo struct
InitInfo initInfo;
// Autohandlers for events
void beginAutohandle() noexcept;
void tickAutohandle(float deltaTime) noexcept;
void endAutohandle() noexcept;
// Closes the application
static void shutdown() noexcept;
// CLI arguments
std::vector<FString> arguments;
int argc;
char** argv;
Additionally, the InitInfo
struct looks like this:
std::vector<InlineComponent*> inlineComponents; // list of inline components
std::vector<TitlebarComponent*> titlebarComponents; // list of title bar components
std::vector<WindowComponent*> windowComponents; // list of window components
// Provide a global data struct to be shared with all components
void* globalData = nullptr;
bool bGlobalAllocatedOnHeap = true; // Set this to false if the global is a stack pointer
nullptr;
UImGui_CInitInfo* cInitInfo =
FString frameworkLibraryDir;
FString applicationDir;
FString applicationLibraryDir;
FString configDir;
FString projectDir;
FString contentDir;
FString frameworkIncludeDir; FString applicationIncludeDir;
Finally, the ComponentType
enum looks like this:
UIMGUI_COMPONENT_TYPE_INLINE,
UIMGUI_COMPONENT_TYPE_TITLEBAR, UIMGUI_COMPONENT_TYPE_WINDOW
The InitInfo
struct and ComponentType
enum are closely tied with the Instance
. Comments for all of those classes are provided in the code.
For more information on the InitInfo, go here, for more information on component types, go here.
Event safety
The entire module is flagged as event safe at Any time
, except for the following members of the Instance
:
getComponentByIDs()
-Post-startup
onEventConfigureStyle
-GUI
- Home
- Beginner content
- Install guide
- Creating and using the UI components
- The Instance
- The Init Info struct
- Additional features
- Custom type definitions
- C API development
- Config files and Folders
- Interfaces
- Internal Event safety
- Modules system
- I18N
- Plotting
- Knobs
- Spinners
- Toggles
- Text Utils
- Undo/Redo
- CLI Parser
- Theming
- OS
- Opening URLs and using file pickers
- Exec integration
- Fonts
- Unix
- DBus utilities
- XDG integration
- Collaborating with others
- Advanced content
- Loading dynamic libraries at runtime
- Understanding the library layout
- Compilation mode modifiers
- Adding plugin support to your application
- Production export and deployment
- Developer and contributor resources
- Misc