Loading...
Searching...
No Matches
Engine/Window

Window ownership and access helpers. More...

Collaboration diagram for Engine/Window:

Functions

sf::RenderWindowml::WindowManager::getWindow ()
 Return the framework's shared sf::RenderWindow.

Detailed Description

Window ownership and access helpers.

Function Documentation

◆ getWindow()

sf::RenderWindow & ml::WindowManager::getWindow ( )
inline

Return the framework's shared sf::RenderWindow.

WindowManager provides a single, lazily-created sf::RenderWindow that is shared across the entire Malena framework. Because the window is stored in a function-local static, it is created on the first call and lives for the duration of the program — no explicit construction or passing of a window pointer is needed.

AppManager, DrawableWrapper, and any other framework class that needs the window reference call this function rather than holding their own pointer, ensuring there is always exactly one window in a Malena application.

Usage

// Retrieve the shared window for drawing
window.draw(myShape);
// Pass it explicitly where an sf::RenderWindow& is required
ml::Application app(videoMode, "My App", controller,
Primary entry point for Malena applications without a manifest.
void draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)
sf::RenderWindow & getWindow()
Return the framework's shared sf::RenderWindow.
Note
The window is heap-allocated via new and the pointer is stored in a local static. Do not call delete on the returned reference.
Returns
Reference to the single shared sf::RenderWindow.

Definition at line 45 of file WindowManager.h.