sfml_impl 0.1.0
Vendor SFML 3.0.2 : IGraphic2Module / IAudioModule
Loading...
Searching...
No Matches
SfmlKeyboard Class Reference

Maps the contract's keys to sfml scancodes, and reads the state the window accumulated while popping its events. More...

#include <SfmlKeyboard.hpp>

Inheritance diagram for SfmlKeyboard:
Collaboration diagram for SfmlKeyboard:

Public Member Functions

 SfmlKeyboard (const SfmlWindow &window)
 
 ~SfmlKeyboard () override=default
 
std::vector< Keys > whichKeyDown () const override
 
bool isKeyPressed (Keys key) const override
 
bool isKeyReleased (Keys key) const override
 
bool isKeyDown (Keys key) const override
 
bool isKeyUp (Keys key) const override
 

Detailed Description

Maps the contract's keys to sfml scancodes, and reads the state the window accumulated while popping its events.

The window is handed over at construction (the module passes it), so the link can never be missing. The methods are defined in SfmlWindow.hpp, once SfmlWindow is complete.

The reference is CONST : querying the keyboard cannot consume anything, and the compiler guarantees it. Only pollEvent() and endDraw() mutate, on the window side. That is what lets an arcade and the game running inside it read the same key in the same frame.

Modifiers are keys like any other : Shift+E is isKeyDown(KEY_LEFT_SHIFT) and isKeyPressed(KEY_E), composed by the caller.

Constructor & Destructor Documentation

◆ SfmlKeyboard()

SfmlKeyboard::SfmlKeyboard ( const SfmlWindow window)
inline

◆ ~SfmlKeyboard()

SfmlKeyboard::~SfmlKeyboard ( )
overridedefault

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