aboutsummaryrefslogtreecommitdiff
path: root/src/engine/user/input.hpp
blob: 3cec1b85404e64fa237774887c6412731783f6c2 (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
#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;

	void clear_currently_pressed() noexcept override;

private:
	Key _currently_pressed;
	std::mutex _currently_pressed_mutex;
};