Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b338043aa |
@@ -155,19 +155,20 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto const scale = turbine::scale(m_tctx);
|
||||||
auto const paneSize = ImGui::GetContentRegionAvail();
|
auto const paneSize = ImGui::GetContentRegionAvail();
|
||||||
auto const tileSheetParentSize = ImVec2{paneSize.x - s_palViewWidth, paneSize.y};
|
auto const tileSheetParentSize = ImVec2{paneSize.x - s_palViewWidth * scale, paneSize.y};
|
||||||
auto const fbSize = ox::Vec2{tileSheetParentSize.x - 16, tileSheetParentSize.y - 16};
|
auto const fbSize = ox::Vec2{tileSheetParentSize.x - 16 * scale, tileSheetParentSize.y - 16 * scale};
|
||||||
ImGui::BeginChild("TileSheetView", tileSheetParentSize, true);
|
ImGui::BeginChild("TileSheetView", tileSheetParentSize, true);
|
||||||
{
|
{
|
||||||
drawTileSheet(fbSize);
|
drawTileSheet(fbSize);
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::BeginChild("Controls", {s_palViewWidth - 8, paneSize.y}, true);
|
ImGui::BeginChild("Controls", {(s_palViewWidth - 8) * scale, paneSize.y}, true);
|
||||||
{
|
{
|
||||||
auto const controlsSize = ImGui::GetContentRegionAvail();
|
auto const controlsSize = ImGui::GetContentRegionAvail();
|
||||||
ImGui::BeginChild("ToolBox", {0, 32}, true);
|
ImGui::BeginChild("ToolBox", {0, 32 * scale}, true);
|
||||||
{
|
{
|
||||||
auto const btnSz = ImVec2{45, 14};
|
auto const btnSz = ImVec2{45, 14};
|
||||||
if (ImGui::Selectable("Select", m_tool == TileSheetTool::Select, 0, btnSz)) {
|
if (ImGui::Selectable("Select", m_tool == TileSheetTool::Select, 0, btnSz)) {
|
||||||
@@ -193,7 +194,7 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept {
|
|||||||
//ig::ComboBox("##Operations", ox::Array<ox::CStringView, 1>{"Operations"}, i);
|
//ig::ComboBox("##Operations", ox::Array<ox::CStringView, 1>{"Operations"}, i);
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::BeginChild("OperationsBox", {0, 35}, ImGuiWindowFlags_NoTitleBar);
|
ImGui::BeginChild("OperationsBox", {0, 35 * scale}, ImGuiWindowFlags_NoTitleBar);
|
||||||
{
|
{
|
||||||
if (ImGui::BeginCombo("##Operations", "Operations", 0)) {
|
if (ImGui::BeginCombo("##Operations", "Operations", 0)) {
|
||||||
if (ImGui::Selectable("Flip X", false)) {
|
if (ImGui::Selectable("Flip X", false)) {
|
||||||
@@ -216,12 +217,12 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
auto const ySize = controlsSize.y - (38 + ig::BtnSz.y + 21);
|
auto const ySize = controlsSize.y - (38 + ig::BtnSz.y + 21);
|
||||||
// draw palette/color picker
|
// draw palette/color picker
|
||||||
ImGui::BeginChild("Palette", {s_palViewWidth - 24, ySize / 2.f}, true);
|
ImGui::BeginChild("Palette", {(s_palViewWidth - 24) * scale, ySize / 2.f}, true);
|
||||||
{
|
{
|
||||||
drawPaletteMenu();
|
drawPaletteMenu();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::BeginChild("SubSheets", {s_palViewWidth - 24, ySize / 2.f}, true);
|
ImGui::BeginChild("SubSheets", {(s_palViewWidth - 24) * scale, ySize / 2.f}, true);
|
||||||
{
|
{
|
||||||
static constexpr auto btnHeight = ig::BtnSz.y;
|
static constexpr auto btnHeight = ig::BtnSz.y;
|
||||||
auto constexpr btnSize = ImVec2{btnHeight, btnHeight};
|
auto constexpr btnSize = ImVec2{btnHeight, btnHeight};
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "subcommands/change-format/change-format.hpp"
|
#include "subcommands/change-format/change-format.hpp"
|
||||||
|
|
||||||
#include "configfile.hpp"
|
#include "configfile.hpp"
|
||||||
|
#include "font.hpp"
|
||||||
#include "studioui.hpp"
|
#include "studioui.hpp"
|
||||||
|
|
||||||
namespace studio {
|
namespace studio {
|
||||||
@@ -129,7 +130,7 @@ static ox::Error run(
|
|||||||
if (m->id() == moduleId) {
|
if (m->id() == moduleId) {
|
||||||
for (auto const &c : m->commands()) {
|
for (auto const &c : m->commands()) {
|
||||||
if (c.name == subCmd) {
|
if (c.name == subCmd) {
|
||||||
auto kctx = keel::init(
|
auto const kctx = keel::init(
|
||||||
ox::make_unique<ox::PassThroughFS>(projectDir),
|
ox::make_unique<ox::PassThroughFS>(projectDir),
|
||||||
c.name);
|
c.name);
|
||||||
if (kctx.error) {
|
if (kctx.error) {
|
||||||
|
|||||||
@@ -132,7 +132,11 @@ StudioUI::StudioUI(turbine::Context &tctx, ox::StringParam projectDataDir) noexc
|
|||||||
// that it will still be treated as const.
|
// that it will still be treated as const.
|
||||||
// ImGui documentation recognizes that this is a bad design,
|
// ImGui documentation recognizes that this is a bad design,
|
||||||
// and hopefully it will change at some point.
|
// and hopefully it will change at some point.
|
||||||
io.Fonts->AddFontFromMemoryTTF(const_cast<uint8_t*>(font.data()), static_cast<int>(font.size()), 13, &fontCfg);
|
io.Fonts->AddFontFromMemoryTTF(
|
||||||
|
const_cast<uint8_t*>(font.data()),
|
||||||
|
static_cast<int>(font.size()),
|
||||||
|
13 * turbine::scale(m_tctx),
|
||||||
|
&fontCfg);
|
||||||
}
|
}
|
||||||
auto &kctx = keelCtx(m_tctx);
|
auto &kctx = keelCtx(m_tctx);
|
||||||
kctx.converters.emplace_back(keel::Converter::make<convertStudioConfigV1ToStudioConfigV2>());
|
kctx.converters.emplace_back(keel::Converter::make<convertStudioConfigV1ToStudioConfigV2>());
|
||||||
@@ -215,7 +219,7 @@ void StudioUI::draw() noexcept {
|
|||||||
ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy);
|
ImGuiFocusedFlags_RootAndChildWindows | ImGuiFocusedFlags_NoPopupHierarchy);
|
||||||
if (m_showProjectExplorer) {
|
if (m_showProjectExplorer) {
|
||||||
auto const v = ImGui::GetContentRegionAvail();
|
auto const v = ImGui::GetContentRegionAvail();
|
||||||
m_projectExplorer.draw(m_sctx, {300, v.y});
|
m_projectExplorer.draw(m_sctx, {300 * turbine::scale(m_tctx), v.y});
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
drawTabBar();
|
drawTabBar();
|
||||||
|
|||||||
@@ -112,4 +112,7 @@ void setShutdownHandler(Context &ctx, ShutdownHandler handler) noexcept;
|
|||||||
// sleep time is a minimum of ~16 milliseconds.
|
// sleep time is a minimum of ~16 milliseconds.
|
||||||
void setUpdateHandler(Context &ctx, UpdateHandler) noexcept;
|
void setUpdateHandler(Context &ctx, UpdateHandler) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
float scale(Context const &ctx) noexcept;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Context {
|
|||||||
uint64_t draws = 0;
|
uint64_t draws = 0;
|
||||||
bool running{};
|
bool running{};
|
||||||
ShutdownHandler shutdownHandler{};
|
ShutdownHandler shutdownHandler{};
|
||||||
|
float scale{};
|
||||||
|
|
||||||
Context() noexcept = default;
|
Context() noexcept = default;
|
||||||
|
|
||||||
|
|||||||
@@ -339,6 +339,7 @@ ox::Result<ox::UPtr<Context>> init(
|
|||||||
setMandatoryRefreshPeriod(*ctx, ticksMs(*ctx) + config::MandatoryRefreshPeriod);
|
setMandatoryRefreshPeriod(*ctx, ticksMs(*ctx) + config::MandatoryRefreshPeriod);
|
||||||
// init GLFW context
|
// init GLFW context
|
||||||
glfwInit();
|
glfwInit();
|
||||||
|
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||||
glfwSetErrorCallback(handleGlfwError);
|
glfwSetErrorCallback(handleGlfwError);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
@@ -372,7 +373,13 @@ ox::Result<ox::UPtr<Context>> init(
|
|||||||
ImGui_ImplGlfw_InitForOpenGL(ctx->window, true);
|
ImGui_ImplGlfw_InitForOpenGL(ctx->window, true);
|
||||||
ImGui_ImplOpenGL3_Init();
|
ImGui_ImplOpenGL3_Init();
|
||||||
io.IniFilename = nullptr;
|
io.IniFilename = nullptr;
|
||||||
|
float xscale{}, yscale{};
|
||||||
|
glfwGetWindowContentScale(ctx->window, &xscale, &yscale);
|
||||||
|
ctx->scale = ox::max(xscale, yscale);
|
||||||
|
io.DisplayFramebufferScale = ImVec2(ctx->scale, ctx->scale);
|
||||||
themeImgui();
|
themeImgui();
|
||||||
|
auto &style = ImGui::GetStyle();
|
||||||
|
style.ScaleAllSizes(ctx->scale);
|
||||||
#endif
|
#endif
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
@@ -471,4 +478,8 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept {
|
|||||||
return ctx.keyEventHandler;
|
return ctx.keyEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float scale(Context const &ctx) noexcept {
|
||||||
|
return ctx.scale;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user