Creates and manages an SDL3 application window.
More...
#include <kwindow.h>
|
| | kWindow () |
| | Constructs an uninitialised window; call init() to create the SDL window.
|
| virtual | ~kWindow () |
| | Destroys the window, releasing the SDL window and frame timer.
|
| bool | init (int width, int height, kString title, bool maximized=false, kWindowType type=kWindowType::WINDOW_DEFAULT, void *nativeHandle=nullptr) |
| | Creates and shows the SDL window.
|
| void | destroy () |
| | Destroys the SDL window and releases its resources.
|
| void | swap () |
| | Swaps the front and back buffers (presents the rendered frame).
|
| int | getWindowWidth () |
| | Returns the current client-area width in pixels.
|
| int | getWindowHeight () |
| | Returns the current client-area height in pixels.
|
| kString | getWindowTitle () |
| | Returns the window title kString.
|
| void | setWindowTitle (kString newTitle) |
| | Changes the window title bar text.
|
| SDL_Window * | getSdlWindow () |
| | Returns the underlying SDL_Window pointer.
|
| bool | getRunning () |
| | Returns whether the application main loop should keep running.
|
| void | setRunning (bool newRunning) |
| | Controls the running state of the application.
|
| kTimer * | getTimer () |
| | Returns the frame timer associated with this window.
|
Creates and manages an SDL3 application window.
kWindow wraps the SDL_Window lifecycle and provides helpers for querying window dimensions, swapping the back buffer, and accessing the built-in frame timer. Attach a kRenderer to a kWindow before rendering.
◆ kWindow()
| kemena::kWindow::kWindow |
( |
| ) |
|
Constructs an uninitialised window; call init() to create the SDL window.
◆ ~kWindow()
| virtual kemena::kWindow::~kWindow |
( |
| ) |
|
|
virtual |
Destroys the window, releasing the SDL window and frame timer.
◆ destroy()
| void kemena::kWindow::destroy |
( |
| ) |
|
Destroys the SDL window and releases its resources.
◆ getRunning()
| bool kemena::kWindow::getRunning |
( |
| ) |
|
Returns whether the application main loop should keep running.
- Returns
- false after the user closes the window or setRunning(false) is called.
◆ getSdlWindow()
| SDL_Window * kemena::kWindow::getSdlWindow |
( |
| ) |
|
Returns the underlying SDL_Window pointer.
- Returns
- Raw SDL window handle; valid until destroy() is called.
◆ getTimer()
| kTimer * kemena::kWindow::getTimer |
( |
| ) |
|
Returns the frame timer associated with this window.
- Returns
- Pointer to the kTimer; valid for the lifetime of the window.
◆ getWindowHeight()
| int kemena::kWindow::getWindowHeight |
( |
| ) |
|
Returns the current client-area height in pixels.
◆ getWindowTitle()
| kString kemena::kWindow::getWindowTitle |
( |
| ) |
|
◆ getWindowWidth()
| int kemena::kWindow::getWindowWidth |
( |
| ) |
|
Returns the current client-area width in pixels.
◆ init()
Creates and shows the SDL window.
- Parameters
-
| width | Initial client-area width in pixels. |
| height | Initial client-area height in pixels. |
| title | Window title bar text. |
| maximized | If true, the window starts maximised. |
| type | Window mode (windowed, fullscreen, borderless). |
| nativeHandle | Optional platform-specific parent window handle. |
- Returns
- true on success.
◆ setRunning()
| void kemena::kWindow::setRunning |
( |
bool | newRunning | ) |
|
Controls the running state of the application.
- Parameters
-
| newRunning | Set to false to request the main loop to exit. |
◆ setWindowTitle()
| void kemena::kWindow::setWindowTitle |
( |
kString | newTitle | ) |
|
Changes the window title bar text.
- Parameters
-
◆ swap()
| void kemena::kWindow::swap |
( |
| ) |
|
Swaps the front and back buffers (presents the rendered frame).
The documentation for this class was generated from the following file: