Lysa  0.0
Lysa 3D Engine
Window Class Reference

Detailed Description

Operating system window that serve as rendering surface.

  • Create and own the OS window/surface and its swap chain.
  • Drive the per‑frame loop (compute, pre‑render, render, present).
  • Host one or more Viewports that render Scenes into the swap chain.
  • Route input events to the UI system and active scene tree.
  • Provide convenience for mouse modes/cursor, post‑processing, and UI.

Notes:

  • A Window is typically created by Application from a WindowConfiguration.
  • Thread‑safety: unless stated otherwise, public methods should be called from the main/render thread. UI helpers are not thread‑safe.

Public Member Functions

 Window (WindowConfiguration &config, const std::shared_ptr< Node > &rootNode=nullptr)
 
virtual void onReady ()
 
virtual void onClose ()
 
virtual void onResize ()
 
std::shared_ptr< ViewportaddViewport (const std::shared_ptr< Viewport > &viewport)
 
auto getAspectRatio () const
 
const auto & getExtent () const
 
const auto & getFramesInFlight () const
 
auto & getViewports () const
 
auto & getRenderer () const
 
auto & getUIRenderer ()
 
void waitIdle () const
 
void addPostprocessing (const std::string &fragShaderName, vireo::ImageFormat outputFormat, void *data=nullptr, uint32 dataSize=0) const
 
void removePostprocessing (const std::string &fragShaderName) const
 
void show () const
 
void close ()
 
void setMouseMode (MouseMode mode) const
 
void setMouseCursor (MouseCursor cursor) const
 
void resetMousePosition () const
 
float2 getMousePosition () const
 
void setMousePosition (const float2 &position) const
 
std::shared_ptr< ui::Windowadd (const std::shared_ptr< ui::Window > &window)
 
void remove (const std::shared_ptr< ui::Window > &window)
 
auto & getFont () const
 
auto getFontScale () const
 
const auto & getConfiguration () const
 
void updatePipelines (const std::unordered_map< pipeline_id, std::vector< std::shared_ptr< Material >>> &pipelineIds) const
 
virtual ~Window ()
 
 Window (Window &) = delete
 
Window & operator= (Window &) = delete
 

Constructor & Destructor Documentation

Window ( WindowConfiguration config,
const std::shared_ptr< Node > &  rootNode = nullptr 
)

Constructs a Window and initializes the OS surface, swap chain, renderer and optional root node.

Parameters
configWindow configuration (extent, title, rendering config, etc.).
rootNodeOptional scene root attached to the first viewport.
virtual ~Window ( )
virtual

Destroys the window and releases owned resources.

Window ( Window &  )
delete

Member Function Documentation

std::shared_ptr<ui::Window> add ( const std::shared_ptr< ui::Window > &  window)

Adds a GUI Window to the Window manager for display

Parameters
windowThe window to display must not be yet added to the window manager
void addPostprocessing ( const std::string &  fragShaderName,
vireo::ImageFormat  outputFormat,
void *  data = nullptr,
uint32  dataSize = 0 
) const

Adds a full‑screen post‑processing pass.

Parameters
fragShaderNameFragment shader identifier/name.
outputFormatOutput image format.
dataOptional extra parameters blob.
dataSizeSize in bytes of the extra parameters.
std::shared_ptr<Viewport> addViewport ( const std::shared_ptr< Viewport > &  viewport)

Attaches a viewport to this window and wires it to the renderer.

Parameters
viewportViewport to attach (must not be attached elsewhere).
Returns
The same viewport shared_ptr for chaining/convenience.
void close ( )

Requests the window to close and releases resources.

auto getAspectRatio ( ) const
inline

Returns the opaque, os-specific, window handle

Returns the current aspect ratio (width/height) of the window.

const auto& getConfiguration ( ) const
inline

Returns the immutable window configuration used to create this window.

const auto& getExtent ( ) const
inline

Returns the current swap chain extent (width/height in pixels).

auto& getFont ( ) const
inline

Returns the default font loaded at startup

auto getFontScale ( ) const
inline

Returns the scaling factor used for the default font.

const auto& getFramesInFlight ( ) const
inline

Returns the number of frames processed in flight.

float2 getMousePosition ( ) const

Returns the mouse position

Returns
Mouse coordinates in pixels relative to the client area.
auto& getRenderer ( ) const
inline

Returns the main scene renderer associated with this window.

auto& getUIRenderer ( )
inline

Returns the UI renderer (Dear ImGui or equivalent wrapper).

auto& getViewports ( ) const
inline

Returns the list of viewports attached to this window.

virtual void onClose ( )
inlinevirtual

Called when the window is about to close (release resources here).

virtual void onReady ( )
inlinevirtual

Called once the window is fully created and ready to display.

virtual void onResize ( )
inlinevirtual

Called after the window/swap chain has been resized.

Window& operator= ( Window &  )
delete
void remove ( const std::shared_ptr< ui::Window > &  window)

Removes the Window from the Window manager

Parameters
windowThe window to remove must be added to the window manager before
void removePostprocessing ( const std::string &  fragShaderName) const

Removes a previously added post‑processing pass by fragment name.

void resetMousePosition ( ) const

Sets the mouse position to the center of the window

void setMouseCursor ( MouseCursor  cursor) const

Sets the mouse cursor

Parameters
cursorMouseCursor enum selecting the cursor shape.
void setMouseMode ( MouseMode  mode) const

Sets the mouse visibility and capture mode

Parameters
modeMouseMode (visible, hidden, captured, etc.).
void setMousePosition ( const float2 &  position) const

Returns the mouse position

Parameters
positionCoordinates in pixels relative to the client area.
void show ( ) const

Makes the OS window visible.

void updatePipelines ( const std::unordered_map< pipeline_id, std::vector< std::shared_ptr< Material >>> &  pipelineIds) const

Updates graphics pipelines following a materials/pipelines mapping. Typically called when Resources/Scene report material changes.

Parameters
pipelineIdsMap of pipeline family id to materials.
void waitIdle ( ) const

Blocks until the device/queues are idle for this window.

Friends And Related Function Documentation

friend class Application
friend
friend class Input
friend