P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
SfmlWindow Class Reference

Sfml Window class - implements IWindow2 only, sfml has no 3D. More...

#include <SfmlWindow.hpp>

Inheritance diagram for SfmlWindow:
Collaboration diagram for SfmlWindow:

Public Member Functions

 SfmlWindow (int32_t screenWidth, int32_t screenHeight, std::string title)
 ~SfmlWindow ()=default
bool isOpen () override
 notice if the window is open
void close () override
 close the window
Vector2f getPosition () override
 Where the window sits on the desktop, in pixels, origin top-left of the primary screen.
void setPosition (Vector2f position) override
 Move the window on the desktop.
Vector2f getSize () override
 The drawable area, in pixels - NOT the desktop size. A hit-test built on IMouse::getPosition() compares against this one.
void setSize (Vector2f size) override
 Resize the drawable area.
void setFrameLimit (int32_t limit) override
 Set the Frame Limit object.
void setMouseVisibility (bool visible) override
 Show or hide the system cursor over THIS window.
int32_t getDelta () override
 Get the Delta object.
bool pollEvent () override
 Drains the whole queue into _events and folds it into state. Called again in the same frame it finds the native queue empty, appends nothing, and answers the same thing.
void eventClose () override
 notice the window that a close was requested
void beginDraw () override
 allowing to draw 2D on the window
void endDraw () override
 end the 2D drawing
void drawPoly (graphic::IPolygon *polygon) override
 draw a polygon
void drawSprite (graphic::ISprite *sprite) override
 draw a sprite
void drawText (graphic::IText *text) override
 draw a text
Public Member Functions inherited from graphic::IWindow2
virtual ~IWindow2 ()=default
Public Member Functions inherited from graphic::IWindow
virtual ~IWindow ()=default
 Destroy the IWindow object.

Friends

class SfmlKeyboard
class SfmlMouse
class SfmlGamepad

Detailed Description

Sfml Window class - implements IWindow2 only, sfml has no 3D.

All input state is rebuilt from the window's own events, never through a global OS query : sf::Keyboard::isKeyPressed() would need the "Input Monitoring" permission on macOS, while events reach the focused window normally.

sfml has a queue and raylib has not, so this is where the two are made to agree : pollEvent() drains the whole queue into _events and folds it into state, endDraw() drops it. Between the two, every read is idempotent - which is what lets an arcade and the game running inside it read the same key in the same frame without either one stealing it.

Constructor & Destructor Documentation

◆ SfmlWindow()

SfmlWindow::SfmlWindow ( int32_t screenWidth,
int32_t screenHeight,
std::string title )
inline

◆ ~SfmlWindow()

SfmlWindow::~SfmlWindow ( )
default

Member Function Documentation

◆ beginDraw()

void SfmlWindow::beginDraw ( )
inlineoverridevirtual

allowing to draw 2D on the window

Implements graphic::IWindow2.

◆ close()

void SfmlWindow::close ( )
inlineoverridevirtual

close the window

Implements graphic::IWindow.

◆ endDraw()

void SfmlWindow::endDraw ( )
inlineoverridevirtual

end the 2D drawing

Implements graphic::IWindow2.

◆ eventClose()

void SfmlWindow::eventClose ( )
inlineoverridevirtual

notice the window that a close was requested

Implements graphic::IWindow.

◆ getDelta()

int32_t SfmlWindow::getDelta ( )
inlineoverridevirtual

Get the Delta object.

Returns
__int32_t

Implements graphic::IWindow.

◆ getPosition()

Vector2f SfmlWindow::getPosition ( )
inlineoverridevirtual

Where the window sits on the desktop, in pixels, origin top-left of the primary screen.

Returns
Vector2f

Implements graphic::IWindow.

◆ getSize()

Vector2f SfmlWindow::getSize ( )
inlineoverridevirtual

The drawable area, in pixels - NOT the desktop size. A hit-test built on IMouse::getPosition() compares against this one.

Returns
Vector2f

Implements graphic::IWindow.

◆ isOpen()

bool SfmlWindow::isOpen ( )
inlineoverridevirtual

notice if the window is open

Returns
bool

Implements graphic::IWindow.

◆ pollEvent()

bool SfmlWindow::pollEvent ( )
inlineoverridevirtual

Drains the whole queue into _events and folds it into state. Called again in the same frame it finds the native queue empty, appends nothing, and answers the same thing.

Implements graphic::IWindow.

◆ setFrameLimit()

void SfmlWindow::setFrameLimit ( int32_t limit)
inlineoverridevirtual

Set the Frame Limit object.

Parameters
limit

Implements graphic::IWindow.

◆ setMouseVisibility()

void SfmlWindow::setMouseVisibility ( bool visible)
inlineoverridevirtual

Show or hide the system cursor over THIS window.

For any game that draws its own pointer - a crosshair, a selection ring - where the native arrow sitting on top of it is just a second, wrong cursor.

Scoped to the window, not to the desktop : leaving it puts the arrow back, and closing the window can never strand the user without a pointer. Vendors whose cursor is process-wide (raylib) restore it on close for the same reason.

Hiding does NOT capture the mouse : IMouse::getPosition() keeps answering, and the pointer still leaves the window normally.

Parameters
visible

Implements graphic::IWindow.

◆ setPosition()

void SfmlWindow::setPosition ( Vector2f position)
inlineoverridevirtual

Move the window on the desktop.

Parameters
position

Implements graphic::IWindow.

◆ setSize()

void SfmlWindow::setSize ( Vector2f size)
inlineoverridevirtual

Resize the drawable area.

Parameters
size

Implements graphic::IWindow.

◆ SfmlGamepad

friend class SfmlGamepad
friend

◆ SfmlKeyboard

friend class SfmlKeyboard
friend

◆ SfmlMouse

friend class SfmlMouse
friend

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