CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
InputState.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Input.hpp"
11
14
15#include <array>
16#include <ostream>
17
18namespace CeresEngine {
19
21 private:
24
27
30
31 public: // Button accessors
37
44
48 [[nodiscard]] bool operator&(Button button) const noexcept;
49
53 [[nodiscard]] bool operator&(const ButtonSet& buttons) const noexcept;
54
58 [[nodiscard]] bool operator&(ModifierButton modifiers) const noexcept;
59
60 public: // Axis accessors
64 [[nodiscard]] double operator[](Axis axis) const noexcept;
65
66 public: // Button mutators
70
74
75 public: // Axis mutators
80 };
81
82} // namespace CeresEngine
Definition InputState.hpp:20
bool operator()(Button button, ModifierButton modifiers=ModifierButton::None) const noexcept
Checks if a button is pressed.
ModifierButton modifiers
A list of all modifiers buttons that were pressed.
Definition InputState.hpp:26
bool operator&(Button button) const noexcept
Checks if a button is pressed.
bool operator()(const ButtonSet &buttons, ModifierButton modifiers=ModifierButton::None) const noexcept
Checks if a set of buttons are pressed.
bool operator&(ModifierButton modifiers) const noexcept
Checks if a set of modifiers are pressed.
InputState & operator+=(Button button)
Updates the input state by pressing a button.
double operator[](Axis axis) const noexcept
Gets the value for a axis
InputState & operator-=(Button button)
Updates the input state by releasing a button.
ButtonSet buttons
A vector containing all buttons that were pressed.
Definition InputState.hpp:23
double & operator[](Axis axis)
Gets a mutable value for a axis
Array< double, 256 > axes
A array that contains axis normalized data.
Definition InputState.hpp:29
bool operator&(const ButtonSet &buttons) const noexcept
Checks if a set of buttons are pressed.
Definition Application.hpp:19
ModifierButton
A enumeration of possible modifier buttons.
Definition Input.hpp:298
@ None
A special modifier button constant that only returns true if no modifier key is pressed.
Button
A enumeration of known buttons.
Definition Input.hpp:25
Axis
A enumeration of known axes.
Definition Input.hpp:400
Vector< Button > ButtonSet
A type that represents a set of buttons.
Definition Input.hpp:176
Axis axis(const StringView &str) noexcept
Returns the Axis constant that is represented by str.
Button button(const StringView &str) noexcept
Returns the Button constant that is represented by str.
std::array< T, N > Array
Array is a container that encapsulates fixed size arrays.
Definition Array.hpp:17
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25