R-Type
Public Member Functions | List of all members
GameEngine::Window Class Reference

Class representing a window wrapper for sf::RenderWindow with additional functionality. More...

#include <SfmlTypes.hpp>

Inheritance diagram for GameEngine::Window:
GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >

Public Member Functions

 Window (int width=1920, int height=1080, const std::string &title="Game window")
 Constructor for Window. More...
 
const sf::RenderWindow & getWindow () const override
 Returns the wrapped sf::RenderWindow. More...
 
sf::RenderWindow & getWindow () override
 Returns the wrapped sf::RenderWindow. More...
 
void draw (const sf::Drawable &drawable) override
 Draws a sf::Drawable object on the window. More...
 
void setView (const IView< sf::View > &view) override
 Sets the view of the window. More...
 
void setFramerateLimit (const float rate) override
 Set the maximum framerate of the window. More...
 
bool isOpen () const override
 Checks if the window is open. More...
 
bool pollEvent (IEvent< sf::Event > &event) override
 Polls and retrieves the next event. More...
 
void close () override
 Closes the window. More...
 
void display () override
 Displays the contents of the window. More...
 
void clear () override
 Clears the contents of the window. More...
 
void create (int width, int height, const std::string &title) override
 Creates a new window with the specified dimensions and title. More...
 
Vector2< float > mapPixelToCoords (const Vector2< int > &pos)
 Maps pixel coordinates to world coordinates. More...
 
- Public Member Functions inherited from GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >
virtual ~IWindow ()=default
 Destructor. More...
 

Detailed Description

Class representing a window wrapper for sf::RenderWindow with additional functionality.

Constructor & Destructor Documentation

◆ Window()

GameEngine::Window::Window ( int  width = 1920,
int  height = 1080,
const std::string &  title = "Game window" 
)
inline

Constructor for Window.

Parameters
widthThe width of the window
heightThe height of the window
titleThe title of the window

Member Function Documentation

◆ clear()

void GameEngine::Window::clear ( )
inlineoverridevirtual

◆ close()

void GameEngine::Window::close ( )
inlineoverridevirtual

◆ create()

void GameEngine::Window::create ( int  width,
int  height,
const std::string &  title 
)
inlineoverridevirtual

Creates a new window with the specified dimensions and title.

Parameters
widthThe width of the new window
heightThe height of the new window
titleThe title of the new window

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ display()

void GameEngine::Window::display ( )
inlineoverridevirtual

Displays the contents of the window.

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ draw()

void GameEngine::Window::draw ( const sf::Drawable &  drawable)
inlineoverridevirtual

Draws a sf::Drawable object on the window.

Parameters
drawableThe object to be drawn

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ getWindow() [1/2]

const sf::RenderWindow& GameEngine::Window::getWindow ( ) const
inlineoverridevirtual

Returns the wrapped sf::RenderWindow.

Returns
Reference to the sf::RenderWindow instance

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ getWindow() [2/2]

sf::RenderWindow& GameEngine::Window::getWindow ( )
inlineoverridevirtual

Returns the wrapped sf::RenderWindow.

Returns
Reference to the sf::RenderWindow instance

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ isOpen()

bool GameEngine::Window::isOpen ( ) const
inlineoverridevirtual

Checks if the window is open.

Returns
True if the window is open, false otherwise

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ mapPixelToCoords()

Vector2<float> GameEngine::Window::mapPixelToCoords ( const Vector2< int > &  pos)
inline

Maps pixel coordinates to world coordinates.

Parameters
posThe pixel coordinates to map
Returns
The corresponding world coordinates

◆ pollEvent()

bool GameEngine::Window::pollEvent ( IEvent< sf::Event > &  event)
inlineoverridevirtual

Polls and retrieves the next event.

Parameters
eventThe event to be filled with the polled event
Returns
True if an event was polled, false otherwise

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ setFramerateLimit()

void GameEngine::Window::setFramerateLimit ( const float  rate)
inlineoverridevirtual

Set the maximum framerate of the window.

Parameters
ratethe maximum framerate

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.

◆ setView()

void GameEngine::Window::setView ( const IView< sf::View > &  view)
inlineoverridevirtual

Sets the view of the window.

Parameters
viewThe view to set

Implements GameEngine::IWindow< sf::RenderWindow, sf::View, sf::Event, sf::Drawable >.


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