summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-24 14:04:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-24 14:04:51 +0200
commitbb17be56d2cd22949bf485c518d543a7e79a6b7d (patch)
tree2076f82df9a2e9a612dc4678bbdda1adf0d1064e /editor
parenta4c24b236e7438adb34798fcd20178e3b69b5215 (diff)
a
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp10
-rw-r--r--editor/editor.hpp8
2 files changed, 9 insertions, 9 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index b353aa4d..bea41116 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -15,7 +15,7 @@ namespace floormat {
static const std::filesystem::path image_path{IMAGE_PATH, std::filesystem::path::generic_format};
-tile_editor::tile_editor(editor_mode mode, Containers::StringView name) : _name{ name}, _mode{ mode}
+tile_editor::tile_editor(editor_mode mode, StringView name) : _name{ name}, _mode{ mode}
{
load_atlases();
}
@@ -25,7 +25,7 @@ void tile_editor::load_atlases()
using atlas_array = std::vector<std::shared_ptr<tile_atlas>>;
for (auto& atlas : json_helper::from_json<atlas_array>(image_path/(_name + ".json")))
{
- Containers::StringView name = atlas->name();
+ StringView name = atlas->name();
if (auto x = name.findLast('.'); x)
name = name.prefix(x.data());
auto& [_, vec] = _permutation;
@@ -34,11 +34,11 @@ void tile_editor::load_atlases()
}
}
-std::shared_ptr<tile_atlas> tile_editor::maybe_atlas(Containers::StringView str)
+std::shared_ptr<tile_atlas> tile_editor::maybe_atlas(StringView str)
{
auto it = std::find_if(_atlases.begin(), _atlases.end(), [&](const auto& tuple) -> bool {
const auto& [x, _] = tuple;
- return Containers::StringView{x} == str;
+ return StringView{x} == str;
});
if (it == _atlases.end())
return nullptr;
@@ -46,7 +46,7 @@ std::shared_ptr<tile_atlas> tile_editor::maybe_atlas(Containers::StringView str)
return it->second;
}
-std::shared_ptr<tile_atlas> tile_editor::atlas(Containers::StringView str)
+std::shared_ptr<tile_atlas> tile_editor::atlas(StringView str)
{
if (auto ptr = maybe_atlas(str); ptr)
return ptr;
diff --git a/editor/editor.hpp b/editor/editor.hpp
index d952b9ba..e7f81305 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -22,14 +22,14 @@ struct world;
struct tile_editor final
{
- tile_editor(editor_mode mode, Containers::StringView name);
- std::shared_ptr<tile_atlas> maybe_atlas(Containers::StringView str);
- std::shared_ptr<tile_atlas> atlas(Containers::StringView str);
+ tile_editor(editor_mode mode, StringView name);
+ std::shared_ptr<tile_atlas> maybe_atlas(StringView str);
+ std::shared_ptr<tile_atlas> atlas(StringView str);
auto cbegin() const { return _atlases.cbegin(); }
auto cend() const { return _atlases.cend(); }
auto begin() const { return _atlases.cbegin(); }
auto end() const { return _atlases.cend(); }
- Containers::StringView name() const { return _name; }
+ StringView name() const { return _name; }
editor_mode mode() const { return _mode; }
void clear_selection();