Nymph Game Engine
Chaiscript based Game Engine
|
Class for input system. More...
#include <input_system.h>
Public Member Functions | |
virtual | ~InputSystem ()=default |
InputSystem (GLFWwindow *window, float viewport_width, float viewport_height, glm::mat4 camera_transform_matrix, glm::mat4 projection_matrix) | |
Constructor for input system. More... | |
void | pollForInput () |
Polls glfw for new input. More... | |
virtual void | onNotifyNow (std::shared_ptr< Events::Event > event) override |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes. More... | |
virtual void | handleQueuedEvent (std::shared_ptr< Events::Event > event) override |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received. More... | |
void | dummy () |
Public Member Functions inherited from Events::Subject | |
virtual | ~Subject ()=default |
virtual void | notify (std::shared_ptr< Event > event) |
notify is used to tell observers of an event. More... | |
virtual void | notifyNow (std::shared_ptr< Event > event) |
notifyNow is used to tell observers of an event as an interrupt. More... | |
virtual void | addObserver (std::shared_ptr< Observer > observer) |
Adds an observer. More... | |
virtual void | removeObserver (std::shared_ptr< Observer > observer) |
Removes an observer. More... | |
Public Member Functions inherited from Events::Observer | |
virtual | ~Observer () |
void | onNotify (std::shared_ptr< Event > event) |
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queue that is processed when processEventQueue is called. More... | |
void | processEventQueue () |
This should be called once ever loop for every Observer to properly use queued events. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Events::Observer | |
std::shared_ptr< Event > | getEvent () |
bool | eventsWaiting () const noexcept |
Class for input system.
|
virtualdefault |
Input::InputSystem::InputSystem | ( | GLFWwindow * | window, |
float | viewport_width, | ||
float | viewport_height, | ||
glm::mat4 | camera_transform_matrix, | ||
glm::mat4 | projection_matrix | ||
) |
Constructor for input system.
window | The window | |
[in] | viewport_width | The viewport width |
[in] | viewport_height | The viewport height |
[in] | camera_transform_matrix | The camera transform matrix |
[in] | projection_matrix | The projection matrix |
|
inline |
Referenced by generated::getInputSystemModule().
|
overridevirtual |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received.
[in] | event | The event |
Implements Events::Observer.
References Events::RESUME_KEY_INPUT, and Events::SUSPEND_KEY_INPUT.
Referenced by onNotifyNow().
|
overridevirtual |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes.
[in] | event | The event |
Implements Events::Observer.
References handleQueuedEvent().
void Input::InputSystem::pollForInput | ( | ) |
Polls glfw for new input.
References Input::CursorLeaveEvent::create(), Input::CursorEnterEvent::create(), Input::MouseButtonDownEvent::create(), Input::KeyRepeatEvent::create(), Input::CharacterTypedEvent::create(), Input::KeyDownEvent::create(), Input::MouseCursorEvent::create(), Input::MouseScrollEvent::create(), Input::KeyUpEvent::create(), Input::MouseButtonUpEvent::create(), and Events::Subject::notify().