summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--editor/app.hpp2
-rw-r--r--editor/editor.cpp6
-rw-r--r--editor/editor.hpp7
-rw-r--r--editor/scenery-editor.cpp2
-rw-r--r--editor/scenery-editor.hpp5
-rw-r--r--editor/tile-editor.cpp2
-rw-r--r--editor/tile-editor.hpp12
-rw-r--r--editor/wall-editor.cpp1
-rw-r--r--editor/wall-editor.hpp25
-rw-r--r--test/app.hpp1
-rw-r--r--test/main.cpp1
-rw-r--r--test/wall-atlas2.cpp7
12 files changed, 51 insertions, 20 deletions
diff --git a/editor/app.hpp b/editor/app.hpp
index 04857771..e40f5f2d 100644
--- a/editor/app.hpp
+++ b/editor/app.hpp
@@ -22,7 +22,7 @@ namespace floormat {
struct chunk;
struct floormat_main;
class tile_atlas;
-struct tile_editor;
+class tile_editor;
struct fm_settings;
class anim_atlas;
struct critter;
diff --git a/editor/editor.cpp b/editor/editor.cpp
index fd1921e5..816f73e3 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -171,7 +171,7 @@ void editor::set_mode(editor_mode mode)
on_release();
}
-const tile_editor* editor::current_tile_editor() const noexcept
+const tile_editor* editor::current_ground_editor() const noexcept
{
switch (_mode)
{
@@ -200,9 +200,9 @@ const vobj_editor* editor::current_vobj_editor() const noexcept
return nullptr;
}
-tile_editor* editor::current_tile_editor() noexcept
+tile_editor* editor::current_ground_editor() noexcept
{
- return const_cast<tile_editor*>(static_cast<const editor&>(*this).current_tile_editor());
+ return const_cast<tile_editor*>(static_cast<const editor&>(*this).current_ground_editor());
}
scenery_editor* editor::current_scenery_editor() noexcept
diff --git a/editor/editor.hpp b/editor/editor.hpp
index 4a7292ea..e84e022f 100644
--- a/editor/editor.hpp
+++ b/editor/editor.hpp
@@ -5,6 +5,7 @@
#include "src/scenery.hpp"
#include "editor-enums.hpp"
#include "tile-editor.hpp"
+#include "wall-editor.hpp"
#include "scenery-editor.hpp"
#include "vobj-editor.hpp"
@@ -25,8 +26,8 @@ struct editor final
[[nodiscard]] editor_mode mode() const noexcept { return _mode; }
void set_mode(editor_mode mode);
- tile_editor* current_tile_editor() noexcept;
- const tile_editor* current_tile_editor() const noexcept;
+ tile_editor* current_ground_editor() noexcept;
+ const tile_editor* current_ground_editor() const noexcept;
scenery_editor* current_scenery_editor() noexcept;
const scenery_editor* current_scenery_editor() const noexcept;
vobj_editor* current_vobj_editor() noexcept;
@@ -57,7 +58,7 @@ private:
app* _app;
tile_editor _floor{ editor_mode::floor, "floor"_s };
- tile_editor _wall { editor_mode::walls, "wall"_s };
+ wall_editor _wall;
scenery_editor _scenery;
vobj_editor _vobj;
diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp
index d338cdcb..b1871221 100644
--- a/editor/scenery-editor.cpp
+++ b/editor/scenery-editor.cpp
@@ -31,10 +31,12 @@ void scenery_editor::set_rotation(enum rotation r)
s.r = r;
}
+#if 0
enum rotation scenery_editor::rotation() const
{
return _selected.proto.r;
}
+#endif
void scenery_editor::next_rotation()
{
diff --git a/editor/scenery-editor.hpp b/editor/scenery-editor.hpp
index cf2a1681..8a48373f 100644
--- a/editor/scenery-editor.hpp
+++ b/editor/scenery-editor.hpp
@@ -11,8 +11,9 @@ struct global_coords;
struct world;
struct app;
-struct scenery_editor final
+class scenery_editor final
{
+public:
struct scenery_ final {
String name, descr;
scenery_proto proto;
@@ -22,7 +23,7 @@ struct scenery_editor final
scenery_editor() noexcept;
void set_rotation(enum rotation r);
- enum rotation rotation() const;
+ //enum rotation rotation() const;
void next_rotation();
void prev_rotation();
diff --git a/editor/tile-editor.cpp b/editor/tile-editor.cpp
index 940e3c1c..e8e4eb7a 100644
--- a/editor/tile-editor.cpp
+++ b/editor/tile-editor.cpp
@@ -10,7 +10,7 @@
namespace floormat {
-tile_editor::tile_editor(editor_mode mode, StringView name) : _name{name}, _mode{ mode}
+tile_editor::tile_editor(StringView name) : _name{name}
{
load_atlases();
}
diff --git a/editor/tile-editor.hpp b/editor/tile-editor.hpp
index 82f020df..c0ff27f0 100644
--- a/editor/tile-editor.hpp
+++ b/editor/tile-editor.hpp
@@ -12,9 +12,8 @@ namespace floormat {
struct world;
-struct tile_editor final
+class tile_editor final
{
-private:
enum selection_mode : unsigned char {
sel_none, sel_tile, sel_perm,
};
@@ -29,14 +28,12 @@ private:
tile_image_proto _selected_tile;
tuple _permutation;
selection_mode _selection_mode = sel_none;
- editor_mode _mode;
- editor_wall_rotation _rotation = editor_wall_rotation::N;
void load_atlases();
tile_image_proto get_selected_perm();
public:
- tile_editor(editor_mode mode, StringView name);
+ tile_editor(StringView name);
std::shared_ptr<tile_atlas> maybe_atlas(StringView str);
std::shared_ptr<tile_atlas> atlas(StringView str);
auto cbegin() const noexcept { return _atlases.cbegin(); }
@@ -44,8 +41,6 @@ public:
auto begin() const noexcept { return _atlases.cbegin(); }
auto end() const noexcept { return _atlases.cend(); }
StringView name() const noexcept;
- editor_mode mode() const noexcept { return _mode; }
- editor_wall_rotation rotation() const noexcept { return _rotation; }
void clear_selection();
void select_tile(const std::shared_ptr<tile_atlas>& atlas, size_t variant);
@@ -56,10 +51,7 @@ public:
bool is_anything_selected() const;
tile_image_proto get_selected();
void place_tile(world& world, global_coords pos, const tile_image_proto& img);
- void toggle_rotation();
- void set_rotation(editor_wall_rotation r);
editor_snap_mode check_snap(int mods) const;
- bool can_rotate() const;
};
} // namespace floormat
diff --git a/editor/wall-editor.cpp b/editor/wall-editor.cpp
new file mode 100644
index 00000000..e6463d78
--- /dev/null
+++ b/editor/wall-editor.cpp
@@ -0,0 +1 @@
+#include "wall-editor.hpp"
diff --git a/editor/wall-editor.hpp b/editor/wall-editor.hpp
new file mode 100644
index 00000000..87cfa8f7
--- /dev/null
+++ b/editor/wall-editor.hpp
@@ -0,0 +1,25 @@
+#pragma once
+#include "src/rotation.hpp"
+#include <memory>
+#include <map>
+
+namespace floormat {
+
+class wall_atlas;
+
+class wall_editor
+{
+ std::map<StringView, std::shared_ptr<wall_atlas>> _atlases;
+ std::shared_ptr<wall_atlas> _selected_atlas;
+ rotation _r = rotation::N;
+
+public:
+
+ wall_editor();
+
+ enum rotation rotation() const { return _r; }
+ void set_rotation(enum rotation r);
+ void toggle_rotation();
+};
+
+} // namespace floormat
diff --git a/test/app.hpp b/test/app.hpp
index b0b7f30f..3fb88666 100644
--- a/test/app.hpp
+++ b/test/app.hpp
@@ -37,6 +37,7 @@ struct test_app final : private FM_APPLICATION
static void test_scenery();
static void test_path_search_node_pool();
static void test_wall_atlas();
+ static void test_wall_atlas2();
static void zzz_test_misc();
};
} // namespace floormat
diff --git a/test/main.cpp b/test/main.cpp
index 2bd038ce..a5a96c54 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -33,6 +33,7 @@ int test_app::exec()
test_math();
test_hash();
test_wall_atlas();
+ test_wall_atlas2();
test_scenery();
test_path_search_node_pool();
diff --git a/test/wall-atlas2.cpp b/test/wall-atlas2.cpp
new file mode 100644
index 00000000..778b5b0b
--- /dev/null
+++ b/test/wall-atlas2.cpp
@@ -0,0 +1,7 @@
+#include "app.hpp"
+
+namespace floormat {
+
+//void test_app::test_wall_atlas2() {}
+
+} // namespace floormat