summaryrefslogtreecommitdiffhomepage
path: root/editor/draw.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-05-19 05:50:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-05-19 05:50:06 +0200
commita4870b515381b222f5dcb9d4d3cfe34102967ce4 (patch)
tree26c21db43a47635ca28594153bd5640f95ebcf62 /editor/draw.cpp
parentf5a7dc9d264c4231d9f688704ceef6971bddf272 (diff)
add selecting and placing vobj's
TODO: - saving to disk - inspect dialog - actual lightmap shader
Diffstat (limited to 'editor/draw.cpp')
-rw-r--r--editor/draw.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp
index b6edf215..9060f865 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -59,13 +59,13 @@ void app::draw_cursor()
anim_mesh.draw(shader, *sel.atlas, sel.r, sel.frame, Vector3(pos), 1);
}
}
- else if (const auto* ed = _editor.current_vobj_editor())
+ else if (const auto* vo = _editor.current_vobj_editor())
{
- if (!ed->is_anything_selected())
+ if (!vo->is_anything_selected())
shader.set_tint(inactive_color);
- if (ed->is_anything_selected())
+ if (vo->is_anything_selected())
{
- const auto& atlas = ed->get_selected()->factory->atlas();
+ const auto& atlas = vo->get_selected()->factory->atlas();
draw(_wireframe_quad, TILE_SIZE2);
shader.set_tint({1, 1, 1, 0.75f});
auto [_f, _w, anim_mesh] = M->meshes();
@@ -182,7 +182,7 @@ void app::draw()
draw_collision_boxes();
if (_editor.current_tile_editor() ||
_editor.current_scenery_editor() && _editor.current_scenery_editor()->is_anything_selected() ||
- _editor.current_vobj_editor())
+ _editor.current_vobj_editor() && _editor.current_vobj_editor()->is_anything_selected())
draw_cursor();
draw_ui();
render_menu();
@@ -204,7 +204,7 @@ clickable* app::find_clickable_scenery(const Optional<Vector2i>& pixel)
const auto pos_ = *pixel - c.dest.min() + Vector2i(c.src.min());
const auto pos = !c.mirrored ? pos_ : Vector2i(int(c.src.sizeX()) - 1 - pos_[0], pos_[1]);
size_t idx = unsigned(pos.y()) * c.stride + unsigned(pos.x());
- fm_assert(idx < c.bitmask.size());
+ fm_assert(c.bitmask.isEmpty() || idx < c.bitmask.size());
if (c.bitmask.isEmpty() || c.bitmask[idx])
{
depth = c.depth;