SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::core::Input Class Reference

A static class giving access to real-time input. More...

#include <Input.h>

Static Public Member Functions

static bool IsKeyPressed (base::KeyCode key)
 Gets the state of a key.
 
static bool IsMousePressed (base::MouseCode button=base::MouseCodes::Left)
 Gets the state of a mouse button.
 
static math::Vector2< float > MousePosition ()
 Gets the position of the mouse relative to the window.
 

Static Public Attributes

static std::unordered_map< base::KeyCode, patterns::Signal<> > keyPressedEvents = globals::generate_key_map()
 A map of signals that are triggered when a key is pressed.
 
static std::unordered_map< base::KeyCode, patterns::Signal<> > keyReleasedEvents = globals::generate_key_map()
 A map of signals that are triggered when a key is released.
 
static std::unordered_map< base::MouseCode, patterns::Signal<> > mousePressedEvents = globals::generate_mouse_map()
 A map of signals that are triggered when a mouse button is pressed.
 
static std::unordered_map< base::MouseCode, patterns::Signal<> > mouseReleasedEvents = globals::generate_mouse_map()
 A map of signals that are triggered when a mouse button is released.
 
static patterns::Signal mouseMovedEvent
 A signal that is triggered when the mouse is moved.
 

Detailed Description

A static class giving access to real-time input.

Member Function Documentation

◆ IsKeyPressed()

bool spark::core::Input::IsKeyPressed ( base::KeyCode key)
static

Gets the state of a key.

Parameters
keyThe key to check.
Returns
A boolean indicating whether the key is pressed.

◆ IsMousePressed()

bool spark::core::Input::IsMousePressed ( base::MouseCode button = base::MouseCodes::Left)
static

Gets the state of a mouse button.

Parameters
buttonThe button to check, defaults to left mouse button.
Returns
A boolean indicating whether the button is pressed.

◆ MousePosition()

math::Vector2< float > spark::core::Input::MousePosition ( )
static

Gets the position of the mouse relative to the window.

Returns
A vector containing the x and y coordinates of the mouse.