[jasper/world/studio] Cleanup
All checks were successful
Build / build (push) Successful in 3m59s

This commit is contained in:
Gary Talent 2024-12-22 01:21:00 -06:00
parent dc96e9de79
commit 1ac3ace95c
2 changed files with 13 additions and 13 deletions

View File

@ -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<WorldObjectSet>(keelCtx(m_sctx), path).unwrapThrow()),
m_itemPath(itemPath()),
m_doc(*readObj<WorldObjectSet>(keelCtx(m_sctx), itemPath()).unwrapThrow()),
m_tileSheet(readObj<ncore::TileSheet>(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<float>(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<void*>(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)) {

View File

@ -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;