summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-04-11 02:32:46 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-04-11 02:32:46 +0200
commitd74228a9f508e96fd93be27cebd20df056e4ef4b (patch)
tree4e705be14b7f00516ca9ecd4ab2707e89e35b5a2
parente66bf2074088ff58495619e05cb89b143d5dfd92 (diff)
editor: remove StaticArray usage
-rw-r--r--editor/app.hpp3
-rw-r--r--editor/ctor.cpp3
-rw-r--r--editor/events.cpp6
-rw-r--r--editor/update.cpp2
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 <Corrade/Containers/Array.h>
-#include <Corrade/Containers/StaticArray.h>
#include <Corrade/Containers/Pointer.h>
#include <Corrade/Containers/Optional.h>
#include <Magnum/Math/Vector2.h>
@@ -190,7 +189,7 @@ private:
safe_ptr<tests_data_> _tests;
safe_ptr<editor> _editor;
safe_ptr<key_set> keys_;
- StaticArray<key_COUNT, int> key_modifiers{ValueInit};
+ struct key_modifiers_ { int data[key_COUNT]; } key_modifiers;
Array<popup_target> 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<key_COUNT, int>{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)