mirror of https://github.com/AxioDL/metaforce.git
Honor scale factor in input viewer
This commit is contained in:
parent
1559441431
commit
052c1888cb
|
@ -573,34 +573,37 @@ void ImGuiConsole::ShowDebugOverlay() {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
// ImGui::NewLine();
|
||||||
|
|
||||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||||
zeus::CVector2f p = ImGui::GetCursorScreenPos();
|
zeus::CVector2f p = ImGui::GetCursorScreenPos();
|
||||||
|
|
||||||
constexpr float leftStickRadius = 30;
|
float scale = ImGui::GetIO().DisplayFramebufferScale.x;
|
||||||
p = p + zeus::CVector2f{20, 20}; // Pad p so we don't clip outside our rect
|
float leftStickRadius = 30 * scale;
|
||||||
zeus::CVector2f leftStickCenter = p + zeus::CVector2f(30, 45);
|
p = p + zeus::CVector2f{20, 20} * scale; // Pad p so we don't clip outside our rect
|
||||||
constexpr float dpadRadius = 15;
|
zeus::CVector2f leftStickCenter = p + zeus::CVector2f(30, 45) * scale;
|
||||||
constexpr float dpadWidth = 8;
|
float dpadRadius = 15 * scale;
|
||||||
zeus::CVector2f dpadCenter = p + zeus::CVector2f(80, 90);
|
float dpadWidth = 8 * scale;
|
||||||
constexpr float rightStickRadius = 20;
|
zeus::CVector2f dpadCenter = p + zeus::CVector2f(80, 90) * scale;
|
||||||
zeus::CVector2f rightStickCenter = p + zeus::CVector2f(160, 90);
|
float rightStickRadius = 20 * scale;
|
||||||
constexpr float startButtonRadius = 8;
|
zeus::CVector2f rightStickCenter = p + zeus::CVector2f(160, 90) * scale;
|
||||||
zeus::CVector2f startButtonCenter = p + zeus::CVector2f(120, 55);
|
float startButtonRadius = 8 * scale;
|
||||||
constexpr float aButtonRadius = 16;
|
zeus::CVector2f startButtonCenter = p + zeus::CVector2f(120, 55) * scale;
|
||||||
zeus::CVector2f aButtonCenter = p + zeus::CVector2f(210, 48);
|
float aButtonRadius = 16 * scale;
|
||||||
constexpr float bButtonRadius = 8;
|
zeus::CVector2f aButtonCenter = p + zeus::CVector2f(210, 48) * scale;
|
||||||
zeus::CVector2f bButtonCenter = aButtonCenter + zeus::CVector2f(-24, 16);
|
float bButtonRadius = 8 * scale;
|
||||||
constexpr float xButtonRadius = 8;
|
zeus::CVector2f bButtonCenter = aButtonCenter + zeus::CVector2f(-24, 16) * scale;
|
||||||
zeus::CVector2f xButtonCenter = aButtonCenter + zeus::CVector2f(24, -16);
|
float xButtonRadius = 8 * scale;
|
||||||
constexpr float yButtonRadius = 8;
|
zeus::CVector2f xButtonCenter = aButtonCenter + zeus::CVector2f(24, -16) * scale;
|
||||||
zeus::CVector2f yButtonCenter = aButtonCenter + zeus::CVector2f(-12, -24);
|
float yButtonRadius = 8 * scale;
|
||||||
constexpr float triggerWidth = leftStickRadius * 2;
|
zeus::CVector2f yButtonCenter = aButtonCenter + zeus::CVector2f(-12, -24) * scale;
|
||||||
constexpr float triggerHeight = 8;
|
float triggerWidth = leftStickRadius * 2;
|
||||||
zeus::CVector2f lCenter = leftStickCenter + zeus::CVector2f(0, -60);
|
float triggerHeight = 8 * scale;
|
||||||
|
zeus::CVector2f lCenter = leftStickCenter + zeus::CVector2f(0, -60) * scale;
|
||||||
zeus::CVector2f rCenter = zeus::CVector2f(aButtonCenter.x(), lCenter.y());
|
zeus::CVector2f rCenter = zeus::CVector2f(aButtonCenter.x(), lCenter.y());
|
||||||
const auto zButtonCenter = rCenter + zeus::CVector2f{0, 24};
|
const auto zButtonCenter = rCenter + zeus::CVector2f{0, 24 * scale};
|
||||||
const float zButtonHalfWidth = triggerWidth / 2;
|
const float zButtonHalfWidth = triggerWidth / 2;
|
||||||
const float zButtonHalfHeight = 4;
|
const float zButtonHalfHeight = 4 * scale;
|
||||||
|
|
||||||
constexpr ImU32 stickGray = IM_COL32(150, 150, 150, 255);
|
constexpr ImU32 stickGray = IM_COL32(150, 150, 150, 255);
|
||||||
constexpr ImU32 darkGray = IM_COL32(60, 60, 60, 255);
|
constexpr ImU32 darkGray = IM_COL32(60, 60, 60, 255);
|
||||||
|
@ -629,7 +632,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
||||||
|
|
||||||
// dpad
|
// dpad
|
||||||
{
|
{
|
||||||
constexpr float halfWidth = dpadWidth / 2;
|
float halfWidth = dpadWidth / 2;
|
||||||
dl->AddRectFilled(dpadCenter + zeus::CVector2f(-halfWidth, -dpadRadius), dpadCenter + zeus::CVector2f(halfWidth, dpadRadius),
|
dl->AddRectFilled(dpadCenter + zeus::CVector2f(-halfWidth, -dpadRadius), dpadCenter + zeus::CVector2f(halfWidth, dpadRadius),
|
||||||
stickGray);
|
stickGray);
|
||||||
|
|
||||||
|
@ -698,7 +701,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
||||||
dl->AddRectFilled(rStart, rEnd - zeus::CVector2f(rValue, 0), darkGray);
|
dl->AddRectFilled(rStart, rEnd - zeus::CVector2f(rValue, 0), darkGray);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Dummy(ImVec2(270, 130));
|
ImGui::Dummy(zeus::CVector2f(270, 130) * scale);
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue