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

Classes

class  SdlMusic
 Un flux long, decode au fil de la lecture. More...
class  SdlSound
 Une lecture d'un tampon, sur son propre canal. More...
class  SdlSoundBuffer
 Un echantillon decode en memoire, partageable par plusieurs sons. More...
class  SdlGamepad
 La manette numero _index, ouverte a la construction. More...
class  SdlKeyboard
 Le clavier d'UNE fenetre. More...
class  SdlMouse
class  SdlFont
 Une police ouverte a une taille donnee. More...
class  SdlPolygon
 Un contour quelconque, decoupe en triangles une fois pour toutes. More...
class  SdlSprite
 Une vue sur une texture : decoupe, position, taille, rotation. More...
class  SdlText
 Une chaine rendue en texture, refaite quand elle change. More...
class  SdlTexture
 Une image en memoire vive, televersee a la demande. More...
class  SdlAudioModule
 SDL_mixer derriere IAudioModule. More...
class  SdlGraphicModule
 SDL2 ne remplit que IGraphic2Module. More...
class  SdlWindow
 Une fenetre SDL et son renderer, implemente IWindow2. More...

Macros

#define SDL2_CPP_

Functions

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

Detailed Description

sdl2_impl

version: 0.2.0

Docs

SDL2 (API 2.32, via sdl2-compat sur cette machine) behind igraphic and iaudio.

Exports getGraphic2Module() and getAudioModule(). No getGraphic3Module — SDL renders no 3D scene graph, so the symbol is absent rather than returning something broken. Get<IGraphic3Module>("sdl2_impl") is nullptr.

Two ways to take it

target artefact use
sdl2_impl sdl2_impl.dylib the plugin, what ModuleManager::Load() opens
sdl2_impl_static libsdl2_impl.a linked in, brings its include dirs

Windows are real, and there can be several

Unlike raylib, createWindow() opens a new window every call, so a hosted game gets its own. SDL's event queue is process-wide, not per window, so SdlWindow keeps a registry of live windows and spreads each event to the one it names — events without a window (SDL_QUIT, device hotplug) reach everyone.

Resources outlive the renderer

createTexture(path) and createText(text, font) receive no window, but SDL needs a SDL_Renderer to build a texture. Both keep the renderer-independent data and upload lazily at draw time, so an object survives a window change.

Macro Definition Documentation

◆ SDL2_CPP_

#define SDL2_CPP_

Function Documentation

◆ drawPoly()

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

draw a polygon

Parameters
polygon

Implements graphic::IWindow2.

◆ drawSprite()

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

draw a sprite

Parameters
sprite

Implements graphic::IWindow2.

◆ drawText()

void SdlWindow::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.

◆ GetMouseWheelMove()

float SdlMouse::GetMouseWheelMove ( ) const
overridevirtual

get the mouse wheel move

Returns
float

Implements graphic::IMouse.

◆ getPosition()

Vector2f SdlMouse::getPosition ( ) const
overridevirtual

get the position of the mouse

Returns
Vector2f

Implements graphic::IMouse.

◆ isButtonDown()

bool SdlMouse::isButtonDown ( Buttons key) const
overridevirtual

notice if a button is down

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonPressed() [1/2]

bool SdlGamepad::isButtonPressed ( Button button) const
overridevirtual

notice if the button is pressed

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonPressed() [2/2]

bool SdlMouse::isButtonPressed ( Buttons key) const
overridevirtual

notice if a button is pressed

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonReleased() [1/2]

bool SdlGamepad::isButtonReleased ( Button button) const
overridevirtual

notice if the button is released

Parameters
button
Returns
bool

Implements graphic::IGamepad.

◆ isButtonReleased() [2/2]

bool SdlMouse::isButtonReleased ( Buttons key) const
overridevirtual

notice if a button is released

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isButtonUp()

bool SdlMouse::isButtonUp ( Buttons key) const
overridevirtual

notice if a button is up

Parameters
key
Returns
true
false

Implements graphic::IMouse.

◆ isKeyDown()

bool SdlKeyboard::isKeyDown ( Keys key) const
overridevirtual

Check if the key is down.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyPressed()

bool SdlKeyboard::isKeyPressed ( Keys key) const
overridevirtual

Check if the key is pressed.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyReleased()

bool SdlKeyboard::isKeyReleased ( Keys key) const
overridevirtual

Check if the key is released.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ isKeyUp()

bool SdlKeyboard::isKeyUp ( Keys key) const
overridevirtual

Check if the key is up.

Parameters
key
Returns
bool

Implements graphic::IKeyboard.

◆ setPosition()

void SdlMouse::setPosition ( Vector2f position)
overridevirtual

set the position of the mouse

Parameters
position

Implements graphic::IMouse.

◆ whichKeyDown()

std::vector< graphic::IKeyboard::Keys > SdlKeyboard::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.