diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp index 82520b2..b85af1d 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.cpp @@ -19,15 +19,15 @@ namespace jasper::world { namespace ig = studio::ig; -constexpr auto btnSize = ImVec2(22, ig::BtnSz.y); +constexpr auto btnSize = ImVec2{22, ig::BtnSz.y}; WorldObjectSetEditorImGui::WorldObjectSetEditorImGui( studio::StudioContext &ctx, - ox::StringView path): - Editor(path), + ox::StringParam path): + Editor(std::move(path)), m_sctx(ctx), - m_itemPath(path), - m_doc(*readObj(keelCtx(m_sctx), path).unwrapThrow()), + m_itemPath(itemPath()), + m_doc(*readObj(keelCtx(m_sctx), itemPath()).unwrapThrow()), m_tileSheet(readObj(keelCtx(m_sctx), m_doc.tilesheet).unwrapThrow()) { auto const&tilesheetList = m_sctx.project->fileList(ncore::FileExt_ng); auto &kctx = keelCtx(m_sctx); @@ -43,13 +43,13 @@ WorldObjectSetEditorImGui::WorldObjectSetEditorImGui( void WorldObjectSetEditorImGui::draw(studio::StudioContext&) noexcept { const auto paneSize = ImGui::GetContentRegionAvail(); constexpr auto resourcesWidth = 300.f; - ImGui::BeginChild("ObjEditor", ImVec2(paneSize.x - resourcesWidth, 0)); + ImGui::BeginChild("ObjEditor", {paneSize.x - resourcesWidth, 0}); if (m_selectedObj < m_doc.objects.size()) { drawObjEditor(); } ImGui::EndChild(); ImGui::SameLine(); - ImGui::BeginChild("Resources", ImVec2(0, 0)); + ImGui::BeginChild("Resources", {0, 0}); { { ig::IDStackItem const idStackItem("TileSheetSelector"); @@ -184,7 +184,7 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept { } ImGui::Separator(); ImGui::Text("Subsheet:"); - ImGui::BeginChild("SubsheetSelector", ImVec2{300, 300}); + ImGui::BeginChild("SubsheetSelector", {300, 300}); { ImGui::SetNextItemOpen(true); if (m_tileSheet) { @@ -206,16 +206,16 @@ void WorldObjectSetEditorImGui::drawObjEditor() noexcept { auto const height = static_cast(m_subsheet->rows * ncore::TileHeight); auto const horzPct = width / 240.f; auto const vertPct = height / 160.f; - auto const imageSz = ImVec2(width * scale, height * scale); + auto const imageSz = ImVec2{width * scale, height * scale}; auto const imagePos = ImGui::GetCursorScreenPos(); ImGui::Image( std::bit_cast(buffId), imageSz, - ImVec2(0, 1.0), - ImVec2(horzPct, 1 - vertPct)); + {0, 1.0}, + {horzPct, 1 - vertPct}); auto const&io = ImGui::GetIO(); if (ImGui::IsItemClicked()) { - auto const mousePos = clickPos(imageSz, imagePos, ox::Vec2(io.MousePos)); + auto const mousePos = clickPos(imageSz, imagePos, ox::Vec2{io.MousePos}); auto &obj = activeObj(); auto intermediate = obj.collisionMap; if (m_colView.click(mousePos, intermediate)) { diff --git a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp index 4bd74c1..79e7066 100644 --- a/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp +++ b/src/jasper/modules/world/src/studio/worldobjectseteditor/worldobjectseteditor-imgui.hpp @@ -37,7 +37,7 @@ class WorldObjectSetEditorImGui: public studio::Editor { } m_objEditor; public: - WorldObjectSetEditorImGui(studio::StudioContext &ctx, ox::StringView path); + WorldObjectSetEditorImGui(studio::StudioContext &ctx, ox::StringParam path); void draw(studio::StudioContext&) noexcept final;