R-Type 0.1
Loading...
Searching...
No Matches
RtkWindowAdapter Class Reference

Adapts the window of the graphical library to the IsRenderWindow concept. More...

#include <rtkWindowAdapter.hpp>

Public Member Functions

 RtkWindowAdapter (rtk::RenderWindow &window)
 Wraps a window.
 
bool pollEvents (rtk::ecs::concepts::Event &engineEvent)
 Polls window events and points the engine Event at them.
 
bool beginFrame (rtk::ecs::concepts::ColorRGBA8 color)
 Starts a frame cleared with a color.
 
void draw (std::span< const rtk::ecs::concepts::SpriteData > sprites)
 Draws a batch of sprites.
 
void endFrame ()
 Presents the frame.
 

Detailed Description

Adapts the window of the graphical library to the IsRenderWindow concept.

Constructor & Destructor Documentation

◆ RtkWindowAdapter()

RtkWindowAdapter::RtkWindowAdapter ( rtk::RenderWindow & window)
inline

Wraps a window.

Parameters
windowWindow to adapt, which must outlive the adapter.

Member Function Documentation

◆ pollEvents()

bool RtkWindowAdapter::pollEvents ( rtk::ecs::concepts::Event & engineEvent)
inline

Polls window events and points the engine Event at them.

Parameters
engineEventEvent filled with the backend queries.
Returns
False once the window is closed.

◆ beginFrame()

bool RtkWindowAdapter::beginFrame ( rtk::ecs::concepts::ColorRGBA8 color)
inline

Starts a frame cleared with a color.

Parameters
colorClear color, alpha is ignored.
Returns
False if the frame cannot be drawn.

◆ draw()

void RtkWindowAdapter::draw ( std::span< const rtk::ecs::concepts::SpriteData > sprites)
inline

Draws a batch of sprites.

Parameters
spritesSprites to draw.