OpenMiner/include/core/Keyboard.hpp
exilief dc8d781393 Switching from SDL to SFML (#14)
* Add SFML support besides SDL. Choose with global macro USE_SDL / USE_SFML.

+ Small fixes to make it compile on MinGW (with Glad instead of GLEW -> option NO_GLEW)

* Add SFML support besides SDL (Part 3). Cleaned up some macros.

* Add SFML support besides SDL (Part 4). Small SFML fixes. Changed Spaces->Tabs

* Add SFML support besides SDL (Part 5). Cleaning up more macros + small fixes.

* Port to SFML. Removed all SDL code.

* Small changes

* Conversion functions to/from SFML types for Vector2/3 and Color.

* Removed unused SDL files

* Changes for SFML port

* Changes for SFML port

* Fixed line endings (probably?)
2018-12-26 18:36:46 +01:00

57 lines
969 B
C++

/*
* =====================================================================================
*
* Filename: Keyboard.hpp
*
* Description:
*
* Created: 20/12/2014 00:52:04
*
* Author: Quentin Bazin, <quent42340@gmail.com>
*
* =====================================================================================
*/
#ifndef KEYBOARD_HPP_
#define KEYBOARD_HPP_
#include <map>
#include <SFML/Window/Keyboard.hpp>
#include "IntTypes.hpp"
class Keyboard {
public:
enum Key {
D,
Q,
S,
W,
X,
Z,
E,
Left,
Right,
Up,
Down,
BackSpace,
LeftShift,
Space,
Return,
RightShift
};
static bool isKeyPressed(Key key);
static bool isKeyPressedOnce(Key key);
static bool isKeyPressedWithDelay(Key key, u16 delay);
private:
static std::map<Key, bool> pressed;
static std::map<Key, u32> lastTimePressed;
static std::map<Key, sf::Keyboard::Key> keysCode;
};
#endif // KEYBOARD_HPP_