diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/data/vector2.cpp | 7 | ||||
-rw-r--r-- | src/engine/data/vector2.hpp | 2 | ||||
-rw-r--r-- | src/engine/graphics/scene.cpp | 2 | ||||
-rw-r--r-- | src/engine/user/input.hpp | 6 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/engine/data/vector2.cpp b/src/engine/data/vector2.cpp index 0f203d0..cb81947 100644 --- a/src/engine/data/vector2.cpp +++ b/src/engine/data/vector2.cpp @@ -2,6 +2,8 @@ #include "util/hash.hpp" +#include <tuple> + auto Vector2::get_x() const noexcept -> Vector2::Value { return _x; @@ -79,6 +81,11 @@ auto Vector2::operator==(const Vector2 &rhs) const noexcept -> bool return _x == rhs._x && _y == rhs._y; } +auto Vector2::operator<(const Vector2 &rhs) const noexcept -> bool +{ + return std::tie(_x, _y) < std::tie(rhs._x, rhs._y); +} + auto Vector2Hasher::operator()(const Vector2 &vector2) const noexcept -> std::size_t { std::size_t result_hash = 0; diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index 620b41c..96ebf87 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -43,6 +43,8 @@ public: auto operator==(const Vector2 &rhs) const noexcept -> bool; + auto operator<(const Vector2 &rhs) const noexcept -> bool; + /** * Returns Vector2({.x = 0, .y = 1}) */ diff --git a/src/engine/graphics/scene.cpp b/src/engine/graphics/scene.cpp index 7a0e960..9f561f0 100644 --- a/src/engine/graphics/scene.cpp +++ b/src/engine/graphics/scene.cpp @@ -13,7 +13,7 @@ Scene::Scene( IMatrixFactory<MatrixElement> matrix_factory, std::shared_ptr<ICursorController> cursor_controller) noexcept - : _matrix(matrix_factory(size() - Bounds({.width = 0U, .height = 1U}))), + : _matrix(matrix_factory(size())), _cursor_controller(std::move(cursor_controller)), _is_shown(false) { diff --git a/src/engine/user/input.hpp b/src/engine/user/input.hpp index 29534e8..9f565c1 100644 --- a/src/engine/user/input.hpp +++ b/src/engine/user/input.hpp @@ -16,13 +16,13 @@ public: void listen() noexcept override; - bool is_key_pressed(Key key) noexcept override; + auto is_key_pressed(Key key) noexcept -> bool override; - Key get_currently_pressed_key() const noexcept override; + [[nodiscard]] auto get_currently_pressed_key() const noexcept -> Key override; void clear_currently_pressed() noexcept override; private: - Key _currently_pressed; + Key _currently_pressed{}; std::mutex _currently_pressed_mutex; }; |