blob: 29534e87910395e53cbcdb86bbaa28e550629a87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#pragma once
#include "interfaces/input.hpp"
#include <yacppdic/auto_wirable.hpp>
#include <memory>
#include <mutex>
class UserInputObserver
: public IUserInputObserver,
public yacppdic::AutoWirable<IUserInputObserver, UserInputObserver>
{
public:
UserInputObserver() noexcept = default;
void listen() noexcept override;
bool is_key_pressed(Key key) noexcept override;
Key get_currently_pressed_key() const noexcept override;
void clear_currently_pressed() noexcept override;
private:
Key _currently_pressed;
std::mutex _currently_pressed_mutex;
};
|