Function - Horizon-NTH/HorizonGUI GitHub Wiki
void hgui::init();
Initializes the HorizonGUI library. This function initializes all dependencies needed and must be called at the beginning of your code.
void hgui::end();
Terminates application, destroys all windows, releases all acquired resources and exits rendering loop.
bool hgui::kernel::init_glfw();
Initializes GLFW. This function is automatically called when hgui::init()
is invoked.
It ensures GLFW is initialized only once. You must not use this function yourself.
void hgui::kernel::init_glad();
Initializes GLAD (OpenGL loader). This function loads OpenGL function pointers using GLAD. This function will be automatically called after the creation of the first window, so you must not use this function yourself.
void hgui::kernel::init_resources();
Only available when the API is in STATIC mod, and will be automatically called to create various default shader, cursors, ... You must not use* this function yourself.
void hgui::kernel::resources_cleaner();
Cleans up resources used by the library, and is automatically called after all windows destruction or the call of the end, so you must not call this function yourself.
void hgui::kernel::debug(GLenum source, GLenum type, unsigned int id, GLenum severity, GLsizei length, const char* message, const void* userParam);
A debug callback function used for OpenGL debugging. It prints debug messages about shaders to the console.
void hgui::after(const std::chrono::milliseconds& delay, const std::function<void()>& function);
Schedules a function to be executed after a specified delay.
Parameters:
-
delay
: Time delay before executing the function. -
function
: Function to be executed.
Note: This function is just an equivalent to the
program
function of the TagManager. It's a reference to the function of Tkinter.
std::shared_ptr<hgui::kernel::Image> hgui::image_loader(const std::string& imagePath);
Loads an image from the specified file path and returns a shared pointer to the loaded image.
Parameters:
-
imagePath
: Path to the image file.
Returns: A shared pointer to the loaded image.
std::shared_ptr<hgui::kernel::GIF> hgui::gif_loader(const std::string& gifPath);
Loads an animated gif from the specified path and returns a shared pointer to the loaded gif.
Parameters:
-
gifPath
: Path to the gif file.
Returns: A shared pointer to the loaded gif.
std::shared_ptr<hgui::kernel::Audio> hgui::audio_loader(const std::string& audioPath);
Loads an audio from the specified path and returns a shared pointer to the loaded audio.
Parameters:
-
audioPath
: Path to the audio file.
Returns: A shared pointer to the loaded audio.
std::string hgui::file_reader(const std::string& filePath);
Reads the contents of a file and returns them as a string.
Parameters:
-
filePath
: Path to the file.
Returns: Content of the file as a string.
bool hgui::random(double chances);
Generates a random boolean value based on the given probability (chances
).
Returns true
with the given probability, and false
otherwise.
Parameters:
-
chances
: Probability of returningtrue
(value between 0 and 1).
Returns:
true
with the specified probability, and false
otherwise.
std::string hgui::get_unique_id();
Generates a unique identifier string. Each call to this function produces a new unique ID.
Returns: A unique identifier string.
double hgui::get_delta_time();
Retrieve the delta time of the application.
Returns:
delta time as a double