Velvet 0.1a
A beginner-friendly C++ GUI framework built on SFML.
Loading...
Searching...
No Matches
Window Class Reference

Application window and main event/render loop. More...

#include <Window.hpp>

Public Member Functions

 Window (int width, int height, const std::string &title)
 Create a window.
 
void setBackgroundColor (unsigned int hexCode)
 Set window background color from RGBA hex integer.
 
void add (Widget *widget)
 Add a widget by pointer.
 
template<typename... Ts>
void add (Ts &&... widgets_list)
 Add one or more widgets (pointer or reference forms).
 
bool isOpen ()
 Check if the native window is open.
 
void run ()
 Start event + render loop.
 
void close ()
 Close the window.
 

Detailed Description

Application window and main event/render loop.

Window owns the SFML RenderWindow, forwards events to added widgets, and renders widgets each frame.

Typical usage:

Window window(800, 600, "My App");
window.add(rootWidget);
window.run();
Application window and main event/render loop.
Definition Window.hpp:19

Constructor & Destructor Documentation

◆ Window()

Window::Window ( int  width,
int  height,
const std::string &  title 
)
inline

Create a window.

Member Function Documentation

◆ add() [1/2]

template<typename... Ts>
void Window::add ( Ts &&...  widgets_list)
inline

Add one or more widgets (pointer or reference forms).

◆ add() [2/2]

void Window::add ( Widget widget)
inline

Add a widget by pointer.

The widget must remain alive while the window is running.

◆ close()

void Window::close ( )
inline

Close the window.

◆ isOpen()

bool Window::isOpen ( )
inline

Check if the native window is open.

◆ run()

void Window::run ( )
inline

Start event + render loop.

Handles close/resize events, propagates all events to widgets, clears background, renders widgets, and presents the frame.

◆ setBackgroundColor()

void Window::setBackgroundColor ( unsigned int  hexCode)
inline

Set window background color from RGBA hex integer.

Example: 0xE6E6E6FFu


The documentation for this class was generated from the following file: