blob: 2fb97acbc635050105b4282936325c2925754f6f (
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
|
#pragma once
#include "interfaces/input.hpp"
#include "interfaces/subscriber.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;
void clear_currently_pressed() noexcept override;
private:
Key _currently_pressed;
std::mutex _currently_pressed_mutex;
};
|