2021-09-19 15:44:31 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 19.09.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef SHOOTER_KEYBOARD_H
|
|
|
|
#define SHOOTER_KEYBOARD_H
|
|
|
|
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2021-10-12 20:18:56 +03:00
|
|
|
class Keyboard final {
|
2021-09-19 15:44:31 +03:00
|
|
|
private:
|
|
|
|
std::map<sf::Keyboard::Key, double> _tappedKeys;
|
|
|
|
public:
|
|
|
|
Keyboard() = default;
|
|
|
|
|
2021-10-31 11:39:08 +03:00
|
|
|
// returns true if this key is _pressed
|
|
|
|
static bool isKeyPressed(sf::Keyboard::Key key);
|
|
|
|
|
|
|
|
// returns true if this key is tapped and 1/5 sec passed (_button bouncing problem solved)
|
|
|
|
bool isKeyTapped(sf::Keyboard::Key key);
|
2021-09-19 15:44:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //SHOOTER_KEYBOARD_H
|