Skip to content

LibGui's datatypes

TechnologicalTurtle edited this page Jul 25, 2026 · 8 revisions

LibGui's Datatypes

This file contains documentation for structs and classes deemed too small (or irrelevant) for their own pages :(

Vec2

Is simple struct holding two floats x and y. It contains overloads for basic mathematical operators (+-*/).

Vec2i

Is simple struct holding two integer values x and y. It contains overloads for basic mathematical operators (+-*/).

Color

Is struct holding four float values red (r), green (g), blue (b), alpha (a). It contains overloads for basic mathematical operators (+-*/), it also has some preset values such as black, white, gray, Red, green and blue.

Color::FromHEX(...)

Decodes hex color value string into Color struct, supports RGB and RGBA hex codes. Supported formats are:

  • normal rgb #00FF00
  • normal rgba #00FF0090
  • weird rgb $00FF00
  • weird rgba $00FF0090

The weird ones (especially weird rgba) are essential for DynamicText formatting.

Color::ColorPicker(...)

Wrapper for tinyfiledialogs library function tinyfd_colorChooser(...); opens OS native color picker window.
Image of linux mint color picker

Note

This function waits untill the user picks color, so you can't render (and do anything) while whis is called. And don't be afraid, LibGui keeps your program's windows updated so they won't freeze.

TextFile

Wrapper for std::fstream. Contains function Write (for writing into a file) and Get (for getting contents of an file).

Vertex

Vertex is single point used for making shapes with LibGui::Object class.
It has three properties:
Vec2 pos which remembers point's position,
Vec2 texCoord (abbreviation for texture coordinate) which, if there's a texture linked to parent object, determines where is the point on the texture; and
Color color which just describes color of this point. To learn more about texture coordinates(or understand it 'coz my explanation sucks) look at first part of this article.

Pixel

Pixel is basically a char based variant of Color, made for LibGui::Image class.
It also contains methods for translation into Color struct.

Mouse button

Represents single mouse button and can be found in LibGui::MouseCursor as left_button, middle_button or right_button.
It has three bool values:

  • clicked -> is true on first frame user started holding given button
  • pressed -> is true when given button is pressed
  • released -> is true on frame right after user stopped holding given button

It also has an method Update(...), which you are NOT supposed to call manually, becouse it's called automatically on LibGui::MouseCursor::Update(...) which is called on LibGui::Window::Draw().

Key status

Similar to the Mouse button it has three bool values

  • clicked -> is true on first frame user started holding given key
  • pressed -> is true when given key is pressed
  • released -> is true on frame right after user stopped holding given key

It's used in LibGui::KeyTracker class.

Rectangle input

Is internal class that derives input function to majority of object-like classes. It is NOT meant to be used externally.

Clone this wiki locally