P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
sfml_impl
Collaboration diagram for sfml_impl:

Classes

class  SfmlMusic
 sfml music stream. More...
class  SfmlSound
 Sfml Sound class - references a SfmlSoundBuffer, does not own it. Deleting the sound never touches the buffer. More...
class  SfmlSoundBuffer
 Sfml SoundBuffer class - owns the loaded samples. SfmlSound only references it (sf::Sound itself already takes a const sf::SoundBuffer& natively, this contract matches sfml's own model). More...
class  SfmlGamepad
 Unlike raylib's GamepadButton (normalized Xbox-style layout), sf::Joystick exposes raw numbered buttons/axes with no guaranteed meaning across controllers/platforms. This uses the common Xbox- style button ordering (0=A,1=B,2=X,3=Y) most drivers report, but it isn't guaranteed the way raylib's mapping is. More...
class  SfmlKeyboard
 Maps the contract's keys to sfml scancodes, and reads the state the window accumulated while popping its events. More...
class  SfmlMouse
 Maps the contract's buttons to sfml buttons, and reads the state the window accumulated while popping its events. Definitions in SfmlWindow.hpp, once SfmlWindow is complete. More...
class  SfmlFont
 Sfml Font class - owns the loaded font. SfmlText only references it (sf::Text itself already takes a const sf::Font& natively). More...
class  SfmlPolygon
class  SfmlSprite
 Sfml Sprite class - references a SfmlTexture, does not own it. Deleting the sprite never touches the texture. More...
class  SfmlText
 Sfml Text class - references a SfmlFont, does not own it. Deleting the text never touches the font. More...
class  SfmlTexture
 Sfml Texture class - owns the loaded texture. SfmlSprite only references it (sf::Sprite itself already takes a const sf::Texture& natively, this contract matches sfml's own model). More...
class  SfmlAudioModule
 sfml has no explicit audio device init/close step (unlike raylib), nothing to do at construction/destruction here. More...
class  SfmlGraphicModule
 Sfml only implements IGraphic2Module - no IGraphic3Module, sfml has no native 3D. No fake IModel here. More...
class  SfmlWindow
 Sfml Window class - implements IWindow2 only, sfml has no 3D. More...

Macros

#define SFML_CPP_

Functions

IGraphic2Module * getGraphic2Module ()
IAudioModule * getAudioModule ()
IModule ** getModules ()
 Tout ce que cette dll fournit, sans avoir a nommer un contrat.
void SfmlWindow::drawPoly (graphic::IPolygon *polygon) override
 draw a polygon
void SfmlWindow::drawSprite (graphic::ISprite *sprite) override
 draw a sprite
void SfmlWindow::drawText (graphic::IText *text) override
 draw a text
std::vector< Keys > SfmlKeyboard::whichKeyDown () const override
 Every key HELD right now - like isKeyDown, without having to name the key.
bool SfmlKeyboard::isKeyPressed (Keys key) const override
 Check if the key is pressed.
bool SfmlKeyboard::isKeyReleased (Keys key) const override
 Check if the key is released.
bool SfmlKeyboard::isKeyDown (Keys key) const override
 Check if the key is down.
bool SfmlKeyboard::isKeyUp (Keys key) const override
 Check if the key is up.
bool SfmlMouse::isButtonPressed (Buttons key) const override
 notice if a button is pressed
bool SfmlMouse::isButtonReleased (Buttons key) const override
 notice if a button is released
bool SfmlMouse::isButtonDown (Buttons key) const override
 notice if a button is down
bool SfmlMouse::isButtonUp (Buttons key) const override
 notice if a button is up
Vector2f SfmlMouse::getPosition () const override
 get the position of the mouse
void SfmlMouse::setPosition (Vector2f position) override
 set the position of the mouse
float SfmlMouse::GetMouseWheelMove () const override
 get the mouse wheel move
bool SfmlGamepad::isButtonDown (Button button) const override
 notice if the button is down
bool SfmlGamepad::isButtonUp (Button button) const override
 notice if the button is up
bool SfmlGamepad::isButtonPressed (Button button) const override
 notice if the button is pressed
bool SfmlGamepad::isButtonReleased (Button button) const override
 notice if the button is released

Detailed Description

sfml_impl

version: 0.2.0

Docs

SFML 3.0.2 behind igraphic and iaudio.

Exports getGraphic2Module() and getAudioModule(). No getGraphic3Module — sfml has no 3D, so the symbol is absent rather than returning something broken. Get<IGraphic3Module>("sfml_impl") is nullptr.

Two ways to take it

target artefact use
sfml_impl sfml_impl.dylib the plugin, what ModuleManager::Load() opens
sfml_impl_static libsfml_impl.a linked in, brings its include dirs

Neither follows BUILD_SHARED_LIBS : a plugin turned into a .a would fail at runtime with an obscure message. Pick by target name.

Examples

build/sfml_impl_demo_dynamic # dlopen at runtime
build/sfml_impl_demo_static # linked in, no dlopen at all

dynamic takes a dll path in argv[1], so the same binary runs any vendor — including raylib, which it has never seen :

build/sfml_impl_demo_dynamic ../../raylib_impl/build/raylib_impl.dylib ../../raylib_impl/assets

What sfml forced

  • Input comes from events, never sf::Keyboard::isKeyPressed(). That query is global and needs macOS Input Monitoring, without which it silently returns nothing.
  • setKeyRepeatEnabled(false), else a held key re-fires isKeyPressed.
  • FocusLost clears every key, else one stays stuck after cmd+tab.
  • sf::Joystick has raw numbered buttons with no guaranteed meaning across controllers, unlike raylib's mapping. Uses the common Xbox ordering.
  • Volume is 0-100 natively, [0, 1] in the contract.
  • Positional audio is real here (OpenAL). Velocity has no API, so it stays a plain accessor.

Tests

tests/TestSfmlImpl.cpp loads the built dll through ModuleManager like a real game would, checks IGraphic3Module is nullptr, then exercises every 2D and audio contract against real assets.

Macro Definition Documentation

◆ SFML_CPP_

#define SFML_CPP_

Function Documentation

◆ drawPoly()

void SfmlWindow::drawPoly ( graphic::IPolygon * polygon)
overridevirtual

draw a polygon

Parameters
polygon

Implements graphic::IWindow2.

◆ drawSprite()

void SfmlWindow::drawSprite ( graphic::ISprite * sprite)
overridevirtual

draw a sprite

Parameters
sprite

Implements graphic::IWindow2.

◆ drawText()

void SfmlWindow::drawText ( graphic::IText * text)
overridevirtual

draw a text

Implements graphic::IWindow2.

◆ getAudioModule()

IAudioModule * getAudioModule ( )

◆ getGraphic2Module()

IGraphic2Module * getGraphic2Module ( )

◆ getModules()

IModule ** getModules ( )

Tout ce que cette dll fournit, sans avoir a nommer un contrat.

Le point d'entree d'AnonymousModuleManager : un nom unique, le meme pour toutes les dll, donc trouvable sans connaitre les contrats a l'avance. Le chargeur trie ensuite par IModule::type().

IModule ** termine par nullptr, et pas un std::vector : un vecteur ne traverse pas un dlopen sans supposer la meme ABI de bibliotheque standard des deux cotes. La conversion vers IModule * se fait ICI, ou le type complet est connu, donc le decalage eventuel est applique par le compilateur et pas devine par l'appelant.

Le tableau est statique : il appartient a la dll et vit aussi longtemps qu'elle.

◆ GetMouseWheelMove()

float SfmlMouse::GetMouseWheelMove ( ) const
overridevirtual

get the mouse wheel move

Returns
float

Implements graphic::IMouse.

◆ getPosition()

Vector2f SfmlMouse::getPosition ( ) const
overridevirtual

get the position of the mouse

Returns
Vector2f

Implements graphic::IMouse.

◆ isButtonDown() [1/2]

bool SfmlGamepad::isButtonDown ( Button button) const
overridevirtual

notice if the button is down

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonDown() [2/2]

bool SfmlMouse::isButtonDown ( Buttons key) const
overridevirtual

notice if a button is down

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonPressed() [1/2]

bool SfmlGamepad::isButtonPressed ( Button button) const
overridevirtual

notice if the button is pressed

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonPressed() [2/2]

bool SfmlMouse::isButtonPressed ( Buttons key) const
overridevirtual

notice if a button is pressed

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonReleased() [1/2]

bool SfmlGamepad::isButtonReleased ( Button button) const
overridevirtual

notice if the button is released

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonReleased() [2/2]

bool SfmlMouse::isButtonReleased ( Buttons key) const
overridevirtual

notice if a button is released

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonUp() [1/2]

bool SfmlGamepad::isButtonUp ( Button button) const
overridevirtual

notice if the button is up

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonUp() [2/2]

bool SfmlMouse::isButtonUp ( Buttons key) const
overridevirtual

notice if a button is up

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isKeyDown()

bool SfmlKeyboard::isKeyDown ( Keys key) const
overridevirtual

Check if the key is down.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyPressed()

bool SfmlKeyboard::isKeyPressed ( Keys key) const
overridevirtual

Check if the key is pressed.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyReleased()

bool SfmlKeyboard::isKeyReleased ( Keys key) const
overridevirtual

Check if the key is released.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyUp()

bool SfmlKeyboard::isKeyUp ( Keys key) const
overridevirtual

Check if the key is up.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ setPosition()

void SfmlMouse::setPosition ( Vector2f position)
overridevirtual

set the position of the mouse

Parameters
position

Implements graphic::IMouse.

◆ whichKeyDown()

std::vector< graphic::IKeyboard::Keys > SfmlKeyboard::whichKeyDown ( ) const
overridevirtual

Every key HELD right now - like isKeyDown, without having to name the key.

A held key stays in the list every frame. For a debug overlay, a state readout, chord detection.

Walks the whole keyboard : avoid in a hot loop, isKeyDown is a direct lookup.

Returns
std::vector<Keys>

Implements graphic::IKeyboard.