summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-02 05:31:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-02 05:31:06 +0200
commitab16b95656fbcf719604072263f8375cd80213c2 (patch)
tree41b52d7a95126e85c8f44adc6d7138a319746cb8 /editor
parent93880a5b068239768ba8b6e562a21e3d9103c124 (diff)
a
Diffstat (limited to 'editor')
-rw-r--r--editor/imgui.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp
index 9a83d780..73095134 100644
--- a/editor/imgui.cpp
+++ b/editor/imgui.cpp
@@ -3,6 +3,7 @@
#include "compat/format.hpp"
#include "src/world.hpp"
#include "src/anim-atlas.hpp"
+#include "shaders/tile.hpp"
#include "main/clickable.hpp"
#include "imgui-raii.hpp"
@@ -113,13 +114,25 @@ void app::draw_clickables()
{
ImDrawList& draw = *ImGui::GetForegroundDrawList();
const auto color = ImGui::ColorConvertFloat4ToU32({0, .8f, .8f, .95f});
+ constexpr float thickness = 2.5f;
+ const auto& shader = M->shader();
+ const auto win_size = M->window_size();
for (const auto& x : M->clickable_scenery())
{
auto dest = Math::Range2D<float>(x.dest);
auto min = dest.min(), max = dest.max();
draw.AddRect({ min.x(), min.y() }, { max.x(), max.y() },
- color, 0, ImDrawFlags_None, 2.5f);
+ color, 0, ImDrawFlags_None, thickness);
+ if (x.slope != 0.f)
+ {
+ const auto& e = *x.e;
+ const auto bb_min_ = -tile_shader::project(Vector3(Vector2(e.bbox_size/2), 0));
+ const auto bb_max_ = bb_min_ + tile_shader::project(Vector3(Vector2(e.bbox_size), 0));
+ const auto bb_min = min + tile_shader::project(Vector3(bb_min_, 0));
+ const auto bb_max = min + tile_shader::project(Vector3(bb_max_, 0));
+ draw.AddLine({ bb_min[0], bb_min[1] }, { bb_max[0], bb_max[1] }, color, thickness);
+ }
}
}