1#ifndef VULKAN_KEYBOARDLISTENER
2#define VULKAN_KEYBOARDLISTENER
24 reactToKeyPress(keyPressed);
28 std::function<void(
int)> reactToKeyPress;
34 template<std::derived_from<KeyboardObserver>... Listeners>
36 (this->listeners.push_back(&listeners), ...);
41 for (
int key = 32; key <= 96; ++key) {
42 if (glfwGetKey(+window, key)) {
46 for (
int key = 256; key <= 348; ++key) {
47 if (glfwGetKey(+window, key)) {
56 void notifyKeyPress(
int keyPressed) {
57 for (
auto& listener : listeners) {
58 listener->onKeyPress(keyPressed);
63 std::vector<KeyboardObserver*> listeners;
Definition: KeyboardListener.h:19
ConcreteKeyboardObserver(std::function< void(int)> action)
Definition: KeyboardListener.h:21
void onKeyPress(int keyPressed) override
Definition: KeyboardListener.h:23
Definition: KeyboardListener.h:32
void checkKeyPressed()
Definition: KeyboardListener.h:40
KeyboardListener(const Window &window, Listeners &... listeners)
Definition: KeyboardListener.h:35
Definition: KeyboardListener.h:13
virtual void onKeyPress(int keyPressed)=0
Manages the creation and lifetime of an OS window.
Definition: Window.h:15
Definition: KeyboardListener.h:11