-
-
Notifications
You must be signed in to change notification settings - Fork 7
Instance
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.
As said before, the Instance is a class. It contains the following member functions and variables:
Instance() noexcept;
// 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;
// Application metadata from uvproj.yaml. Check out this page for more info: https://github.com/MadLadSquad/UntitledImGuiFramework/wiki/Config-files-and-folder-structure#the-uvprojyaml-file
FString applicationName;
FString applicationVersion;
FString engineVersion;
void reloadApplicationMetadata() noexcept;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
GenericRenderer* customRenderer = nullptr;
GenericTexture* customTexture = nullptr;
GenericWindow* customWindow = nullptr
UImGui_CInitInfo* cInitInfo = nullptr;
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_WINDOWThe 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.
The entire module is flagged as event safe at Any time, except for the following members of the Instance:
-
getComponentByIDs()-Post-startup -
onEventConfigureStyle-GUI
Tip
The application metadata strings from uvproj.yaml are listed as post-construct, but can actually become Any time, as long as you call UImGui::Instance::reloadApplicationMetadata after you've set up your directory strings.
This project is supported by all the people who joined our discord server and became beta testers. If you want to join the discord you can click here.
- Home
- Beginner content
- Install guide
- Creating and using the UI components
- The Instance
- The Init Info struct
- Building better titlebar menus
- 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
- Loading dynamic libraries at runtime
- Understanding the library layout
- Compilation mode modifiers
- Supporting plugins
- Production export and deployment
- OS integration tips
- Targeting WASM
- Using a custom rendering engine:
- Using a custom windowing backend:
- Developer and contributor resources
- Misc