gui-kit

API Reference

Window

GLFW-based window management with OpenGL rendering support.

The guikit::Window class provides a wrapper around GLFW for creating and managing windows with OpenGL rendering capabilities.

This doc assumes using namespace guikit is set and #include <guikit/window.hpp> is included. Otherwise, use guikit::Window instead of Window.

Constructors

Default constructor

Creates a window with default settings.

Window();

Parametrized constructor

Creates a window with the specified title, width, and height.

Window(std::string title, uint64_t width, uint64_t height);

Example:

// Create a 800x600 window titled "My App"
Window window("My App", 800, 600);

Available methods

setBackground(Color color)

Sets the window background color.

Window& setBackground(Color color);

Example:

Window window("My App", 800, 600);
window.setBackground(Color(255, 0, 0, 255)); // Red background

setTitle(std::string title)

Sets the window title.

Window& setTitle(std::string title);

Example:

Window window("My App", 800, 600);
window.setTitle("New Title");

setWindowSize(uint16_t width, uint16_t height)

Sets the window dimensions.

Window& setWindowSize(uint16_t width, uint16_t height);

Example:

Window window("My App", 800, 600);
window.setWindowSize(1024, 768);

show()

Displays the window and starts the render loop.

Window& show();

Example:

Window window("My App", 800, 600);
window.setBackground(Color(50, 50, 50, 255));
window.show();

Full Example

#include <guikit/window.hpp>
#include <guikit/color.hpp>

using namespace guikit;

int main() {
    Window window("My Application", 1024, 768);
    
    window.setBackground(Color(30, 30, 30, 255))
          .setTitle("Updated Title");
    
    window.show();
    
    return 0;
}

On this page