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
* cInitInfo = nullptr;
UImGui_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
- Textures
- Logging
- Unicode support
- Additional features
- Client-side bar
- Custom type definitions
- Memory management
- C API development
- Config files and Folders
- Interfaces
- Internal Event safety
- Customising the build system
- Modules system
- Collaborating with others
- Advanced content
- Developer and contributor resources
- Misc