Function - Horizon-NTH/HorizonGUI GitHub Wiki

Table of Contents

Initialization

init

void hgui::init();

Initializes the HorizonGUI library. This function initializes all dependencies needed and must be called at the beginning of your code.

end

void hgui::end();

Terminates application, destroys all windows, releases all acquired resources and exits rendering loop.

init_glfw

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.

init_glad

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.

init_resources

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.

Resource Management

Function: resources_cleaner

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.

Developing utilities

debug

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.


after

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.

image_loader

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.

gif_loader

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.

audio_loader

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.

file_reader

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.

random

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 returning true (value between 0 and 1).

Returns: true with the specified probability, and false otherwise.

get_unique_id

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.

get_delta_time

double hgui::get_delta_time();

Retrieve the delta time of the application.

Returns: delta time as a double

⚠️ **GitHub.com Fallback** ⚠️