-
-
Notifications
You must be signed in to change notification settings - Fork 7
Utility interface
Stanislav Vasilev edited this page Sep 30, 2025
·
8 revisions
The Utility interface provides utility functions. It looks like this:
class UIMGUI_PUBLIC_API Utility
{
public:
static void sanitiseFilepath(FString& str) noexcept;
static void keyToText(FString& text, CKeys key, bool bLong) noexcept;
static FString keyToText(const CKeys key, bool bLong) noexcept;
static void keyToText(FString& text, const InputAction& action, bool bLong) noexcept;
static FString keyToText(const InputAction& action, bool bLong) noexcept;
// DO NOT USE THIS, THIS IS ONLY HERE FOR INTERNAL REASONS!!! REALLY KNOW WHAT YOU'RE DOING WHEN USING THIS
static Global& getGlobal() noexcept;
static void removeConsole() noexcept;
static FString toLower(String str) noexcept;
static void toLower(FString& str) noexcept;
static FString toUpper(String str) noexcept;
static void toUpper(FString& str) noexcept;
static TVector<FString> splitString(const FString& str, String token) noexcept;
static void sleep(uint64_t milliseconds) noexcept;
static KeyStringsArrType& getKeyStrings() noexcept;
};Reference for the functions:
-
toUpper- Converts a string to all uppercase characters -
toLower- Converts a string to all lowercase characters -
splitString- Splits a string -
removeConsole- Removes the console window on Windows -
getGlobal- Returns a reference to the internal global class, DO NOT TOUCH!!! -
keyToText- Converts a key code to text in short or long form for usage in UI -
sanitizeFilepath- Sanitizes file paths, such as replacing\with/on Windows -
sleep- Puts the current thread to sleep for X milliseconds -
getKeyStrings- Returns the internal string table for each keyboard key. Don't use manually, instead use one of thekeyToTextfunctions
The whole interface is flagged as event safe at Any time.
The C API is severely downsized, by removing most string operation functions. It uses the standard C API development rules as defined here. It looks like this:
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_sanitiseFilepath(UImGui_String str);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_keyToText(uint16_t key, bool bLong);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_keyToTextInputAction(UImGui_CInputAction* action, bool bLong);
// Event Safety - Any time
UIMGUI_PUBLIC_API void UImGui_Utility_removeConsole();
// Event Safety - Any time
// Sleep for X milliseconds
UIMGUI_PUBLIC_API void UImGui_Utility_sleep(uint64_t milliseconds);
UIMGUI_PUBLIC_API void UImGui_Utility_loadContext(void* context);
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_toLower(char* str);
UIMGUI_PUBLIC_API UImGui_String UImGui_Utility_toUpper(char* str);
// Event Safety - Any time
UIMGUI_PUBLIC_API UImGui_CGlobal* UImGui_Global_get(UImGui_CGlobal* parent);Most functions in the C API are available, except for some that are considered internal and are not needed.
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