summaryrefslogtreecommitdiffhomepage
path: root/editor/tests
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-28 03:44:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-28 04:05:05 +0200
commit37215facfcecb3a4133a740d7fda57c0ef564395 (patch)
tree22e4da3a44314c75977438e9b65eeb9b6e452ded /editor/tests
parentb8a295f01dbb82e19dce92fd3a2048d98554eb75 (diff)
w
Diffstat (limited to 'editor/tests')
-rw-r--r--editor/tests/hole-test.cpp98
1 files changed, 98 insertions, 0 deletions
diff --git a/editor/tests/hole-test.cpp b/editor/tests/hole-test.cpp
new file mode 100644
index 00000000..6cb60449
--- /dev/null
+++ b/editor/tests/hole-test.cpp
@@ -0,0 +1,98 @@
+#include "../tests-private.hpp"
+#include "compat/shared-ptr-wrapper.hpp"
+#include "src/tile-constants.hpp"
+#include "src/chunk-region.hpp"
+#include "src/object.hpp"
+#include "src/world.hpp"
+#include "../app.hpp"
+#include "../imgui-raii.hpp"
+#include "floormat/main.hpp"
+#include "src/critter.hpp"
+
+namespace floormat::tests {
+namespace {
+
+using namespace floormat::imgui;
+
+struct hole_test final : base_test
+{
+ ~hole_test() noexcept override = default;
+
+ bool handle_key(app& a, const key_event& e, bool is_down) override;
+ bool handle_mouse_click(app& a, const mouse_button_event& e, bool is_down) override;
+ bool handle_mouse_move(app& a, const mouse_move_event& e) override;
+ void draw_overlay(app& a) override;
+ void draw_ui(app& a, float menu_bar_height) override;
+ void update_pre(app& a, const Ns& dt) override;
+ void update_post(app&, const Ns&) override {}
+};
+
+bool hole_test::handle_key(app& a, const key_event& e, bool is_down)
+{
+ return false;
+}
+
+bool hole_test::handle_mouse_click(app& a, const mouse_button_event& e, bool is_down)
+{
+ return false;
+}
+
+bool hole_test::handle_mouse_move(app& a, const mouse_move_event& e)
+{
+ return false;
+}
+
+void hole_test::draw_overlay(app& a)
+{
+}
+
+void hole_test::draw_ui(app& a, float menu_bar_height)
+{
+ const auto& m = a.main();
+ const auto size_x = ImGui::GetWindowSize().x;
+ const auto window_size = ImVec2{size_x, size_x};
+ //const auto dpi = m.dpi_scale();
+ constexpr auto igcf = ImGuiChildFlags_None;
+ constexpr auto igwf = ImGuiWindowFlags_NoDecoration;
+
+ ImGui::NewLine();
+
+ char buf[32];
+
+ ImGui::LabelText("##test-area", "Test area");
+
+ ImGui::NewLine();
+ if (auto b1 = imgui::begin_child("Test area"_s, window_size, igcf, igwf))
+ {
+ const auto& win = *ImGui::GetCurrentWindow();
+ ImDrawList& draw = *win.DrawList;
+ }
+ ImGui::NewLine();
+
+ const auto label_width = ImGui::CalcTextSize("MMMM").x;
+
+ label_left("width", buf, label_width);
+ ImGui::NewLine();
+
+ label_left("height", buf, label_width);
+ ImGui::NewLine();
+
+ label_left("x", buf, label_width);
+ ImGui::NewLine();
+
+ label_left("y", buf, label_width);
+ ImGui::NewLine();
+
+ label_left("z", buf, label_width);
+ ImGui::NewLine();
+}
+
+void hole_test::update_pre(app& a, const Ns& dt)
+{
+}
+
+} // namespace
+
+Pointer<base_test> tests_data::make_test_hole() { return Pointer<hole_test>{InPlaceInit}; }
+
+} // namespace floormat::tests