Compare commits
No commits in common. "c2e34b64568172a12d25ca4b54796d2d4a56a652" and "5848bc8eb7917de8a4a504426404e2f9f5e08aa9" have entirely different histories.
c2e34b6456
...
5848bc8eb7
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <studio/imguiutil.hpp>
|
#include <studio/imguiuitl.hpp>
|
||||||
#include "aboutpopup.hpp"
|
#include "aboutpopup.hpp"
|
||||||
|
|
||||||
namespace olympic {
|
namespace olympic {
|
||||||
|
@ -48,7 +48,7 @@ static ox::Error runApp(
|
|||||||
turbine::setUpdateHandler(*ctx, updateHandler);
|
turbine::setUpdateHandler(*ctx, updateHandler);
|
||||||
turbine::setKeyEventHandler(*ctx, keyEventHandler);
|
turbine::setKeyEventHandler(*ctx, keyEventHandler);
|
||||||
turbine::setConstantRefresh(*ctx, false);
|
turbine::setConstantRefresh(*ctx, false);
|
||||||
studio::StudioContext studioCtx(*ctx);
|
studio::StudioContext studioCtx;
|
||||||
turbine::setApplicationData(*ctx, &studioCtx);
|
turbine::setApplicationData(*ctx, &studioCtx);
|
||||||
StudioUI ui(*ctx, projectDataDir);
|
StudioUI ui(*ctx, projectDataDir);
|
||||||
studioCtx.ui = &ui;
|
studioCtx.ui = &ui;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <studio/imguiutil.hpp>
|
#include <studio/imguiuitl.hpp>
|
||||||
|
|
||||||
#include "newmenu.hpp"
|
#include "newmenu.hpp"
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <studio/imguiutil.hpp>
|
#include <studio/imguiuitl.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "filedialogmanager.hpp"
|
#include "filedialogmanager.hpp"
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <ox/event/signal.hpp>
|
#include <ox/event/signal.hpp>
|
||||||
|
|
||||||
#include <turbine/context.hpp>
|
|
||||||
|
|
||||||
#include "project.hpp"
|
#include "project.hpp"
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
@ -15,8 +13,6 @@ namespace studio {
|
|||||||
struct StudioContext {
|
struct StudioContext {
|
||||||
class StudioUI *ui = nullptr;
|
class StudioUI *ui = nullptr;
|
||||||
Project *project = nullptr;
|
Project *project = nullptr;
|
||||||
turbine::Context &tctx;
|
|
||||||
inline explicit StudioContext(turbine::Context &pTctx) noexcept: tctx(pTctx) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
13
src/olympic/studio/modlib/include/studio/imguiuitl.hpp
Normal file
13
src/olympic/studio/modlib/include/studio/imguiuitl.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
|
#include <turbine/context.hpp>
|
||||||
|
|
||||||
|
namespace studio::ig {
|
||||||
|
|
||||||
|
void centerNextWindow(turbine::Context &ctx) noexcept;
|
||||||
|
|
||||||
|
}
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <imgui.h>
|
|
||||||
|
|
||||||
#include <turbine/context.hpp>
|
|
||||||
|
|
||||||
namespace studio::ig {
|
|
||||||
|
|
||||||
inline constexpr auto BtnSz = ImVec2{50, 22};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
class IDStackItem {
|
|
||||||
private:
|
|
||||||
T m_id;
|
|
||||||
public:
|
|
||||||
explicit IDStackItem(T id) noexcept: m_id(id) {
|
|
||||||
ImGui::PushID(m_id);
|
|
||||||
}
|
|
||||||
~IDStackItem() noexcept {
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void centerNextWindow(turbine::Context &ctx) noexcept;
|
|
||||||
|
|
||||||
bool PushButton(ox::CStringView lbl, ImVec2 const&btnSz = BtnSz) noexcept;
|
|
||||||
|
|
||||||
void PopupBtns(float popupWidth, bool &popupOpen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param lbl
|
|
||||||
* @param list
|
|
||||||
* @param selectedIdx
|
|
||||||
* @return true if new value selected, false otherwise
|
|
||||||
*/
|
|
||||||
bool ComboBox(ox::CStringView lbl, ox::SpanView<ox::String> list, size_t &selectedIdx) noexcept;
|
|
||||||
|
|
||||||
}
|
|
@ -7,7 +7,7 @@
|
|||||||
#include <studio/context.hpp>
|
#include <studio/context.hpp>
|
||||||
#include <studio/editor.hpp>
|
#include <studio/editor.hpp>
|
||||||
#include <studio/filedialog.hpp>
|
#include <studio/filedialog.hpp>
|
||||||
#include <studio/imguiutil.hpp>
|
#include <studio/imguiuitl.hpp>
|
||||||
#include <studio/module.hpp>
|
#include <studio/module.hpp>
|
||||||
#include <studio/itemmaker.hpp>
|
#include <studio/itemmaker.hpp>
|
||||||
#include <studio/popup.hpp>
|
#include <studio/popup.hpp>
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <turbine/gfx.hpp>
|
#include <turbine/gfx.hpp>
|
||||||
|
|
||||||
#include <studio/imguiutil.hpp>
|
|
||||||
|
|
||||||
namespace studio::ig {
|
namespace studio::ig {
|
||||||
|
|
||||||
void centerNextWindow(turbine::Context &ctx) noexcept {
|
void centerNextWindow(turbine::Context &ctx) noexcept {
|
||||||
@ -18,43 +16,4 @@ void centerNextWindow(turbine::Context &ctx) noexcept {
|
|||||||
ImGui::SetNextWindowPos(ImVec2(screenW / mod, screenH / mod), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
ImGui::SetNextWindowPos(ImVec2(screenW / mod, screenH / mod), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PushButton(ox::CStringView lbl, ImVec2 const&btnSz) noexcept {
|
|
||||||
return ImGui::Button(lbl.c_str(), btnSz);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopupBtns(float popupWidth, bool &popupOpen) {
|
|
||||||
constexpr auto btnSz = ImVec2{50, BtnSz.y};
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::SetCursorPosX(popupWidth - 118);
|
|
||||||
if (ImGui::Button("OK", btnSz)) {
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
popupOpen = false;
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button("Cancel", btnSz)) {
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
popupOpen = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ComboBox(
|
|
||||||
ox::CStringView lbl,
|
|
||||||
ox::SpanView<ox::String> list,
|
|
||||||
size_t &selectedIdx) noexcept {
|
|
||||||
bool out{};
|
|
||||||
auto const first = selectedIdx < list.size() ? list[selectedIdx].c_str() : "";
|
|
||||||
if (ImGui::BeginCombo(lbl.c_str(), first, 0)) {
|
|
||||||
for (auto i = 0u; i < list.size(); ++i) {
|
|
||||||
const auto selected = (selectedIdx == i);
|
|
||||||
if (ImGui::Selectable(list[i].c_str(), selected) && selectedIdx != i) {
|
|
||||||
selectedIdx = i;
|
|
||||||
//oxLogError(m_model.setPalette(list[n]));
|
|
||||||
out = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <studio/imguiutil.hpp>
|
#include <studio/imguiuitl.hpp>
|
||||||
#include <studio/popup.hpp>
|
#include <studio/popup.hpp>
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user