From d74228a9f508e96fd93be27cebd20df056e4ef4b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 11 Apr 2024 02:32:46 +0200 Subject: editor: remove StaticArray usage --- editor/app.hpp | 3 +-- editor/ctor.cpp | 3 ++- editor/events.cpp | 6 +++--- editor/update.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/editor/app.hpp b/editor/app.hpp index 5d6723b3..1be252ba 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -8,7 +8,6 @@ #include "src/object-id.hpp" #include "editor-enums.hpp" #include -#include #include #include #include @@ -190,7 +189,7 @@ private: safe_ptr _tests; safe_ptr _editor; safe_ptr keys_; - StaticArray key_modifiers{ValueInit}; + struct key_modifiers_ { int data[key_COUNT]; } key_modifiers; Array inspectors; object_id _character_id = 0; struct cursor_state cursor; diff --git a/editor/ctor.cpp b/editor/ctor.cpp index 6b35b34c..6e7e435f 100644 --- a/editor/ctor.cpp +++ b/editor/ctor.cpp @@ -15,7 +15,8 @@ app::app(fm_settings&& opts) : _wireframe{InPlaceInit}, _tests{tests_data_::make()}, _editor{InPlaceInit, this}, - keys_{InPlaceInit, 0u} + keys_{InPlaceInit, 0u}, + key_modifiers{} { reset_world(); auto& w = M->world(); diff --git a/editor/events.cpp b/editor/events.cpp index 2ba39ff5..a69d0e65 100644 --- a/editor/events.cpp +++ b/editor/events.cpp @@ -42,14 +42,14 @@ void app::clear_keys(key min_inclusive, key max_exclusive) { const auto idx = key(i); keys[idx] = false; - key_modifiers[i] = kmod_none; + key_modifiers.data[i] = kmod_none; } } void app::clear_keys() { keys_->reset(); - key_modifiers = StaticArray{ValueInit}; + key_modifiers = {}; } void app::on_mouse_move(const mouse_move_event& event) noexcept @@ -198,7 +198,7 @@ void app::on_key_up_down(const key_event& event, bool is_down) noexcept else { (*keys_)[x] = is_down; - key_modifiers[size_t(x)] = mods; + key_modifiers.data[size_t(x)] = mods; } } diff --git a/editor/update.cpp b/editor/update.cpp index 823c8c01..2311d478 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -220,7 +220,7 @@ void app::apply_commands(const key_set& keys) using value_type = key_set::value_type; for (value_type i = key_MIN; i < key_NO_REPEAT; i++) if (const auto k = key(i); keys[k]) - do_key(k, key_modifiers[i]); + do_key(k, key_modifiers.data[i]); } void app::update_world(Ns dt) -- cgit v1.2.3