Skip to content

Commit

Permalink
More updates to scaling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
user-grinch committed Jun 27, 2024
1 parent a8248f4 commit 7b24470
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions src/opcodemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,13 @@ static RTN_TYPE RUNTIME_API ImGuiSetColumnWidth(RUNTIME_CONTEXT ctx) {
float width = wGetFloatParam(ctx);
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
ImGui::SetColumnWidth(idx, width);
ImGui::SetColumnWidth(idx, width * data->imgui.m_vecScaling.x);

if (data->imgui.m_bNeedToUpdateScaling) {
data->imgui.m_bWasScalingUpdatedThisFrame = true;
}
};

return RTN_CONTINUE;
}

Expand Down Expand Up @@ -485,7 +490,11 @@ static RTN_TYPE RUNTIME_API ImGuiSetCursorVisible(RUNTIME_CONTEXT ctx) {
static RTN_TYPE RUNTIME_API ImGuiGetFrameHeight(RUNTIME_CONTEXT ctx) {
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
data->SetData("__frameHeight__", 0, ImGui::GetFrameHeight());
data->SetData("__frameHeight__", 0, ImGui::GetFrameHeight() / data->imgui.m_vecScaling.y);

if (data->imgui.m_bNeedToUpdateScaling) {
data->imgui.m_bWasScalingUpdatedThisFrame = true;
}
};
wSetFloatParam(ctx, data->GetData("__frameHeight__", 0, 0.0f));
return RTN_CONTINUE;
Expand Down Expand Up @@ -559,7 +568,11 @@ static RTN_TYPE RUNTIME_API ImGuiGetWindowContentRegionWidth(RUNTIME_CONTEXT ctx
ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
float width = ImGui::GetWindowContentRegionWidth();
data->SetData(buf, 0, width);
data->SetData(buf, 0, width / data->imgui.m_vecScaling.x);

if (data->imgui.m_bNeedToUpdateScaling) {
data->imgui.m_bWasScalingUpdatedThisFrame = true;
}
};

wSetFloatParam(ctx, data->GetData(buf, 0, 0.0f));
Expand Down Expand Up @@ -666,7 +679,10 @@ static RTN_TYPE RUNTIME_API ImGuiPushItemWidth(RUNTIME_CONTEXT ctx) {

ScriptExData* data = ScriptExData::Get();
data->imgui += [=]() {
ImGui::PushItemWidth(width);
ImGui::PushItemWidth(width * data->imgui.m_vecScaling.x);
if (data->imgui.m_bNeedToUpdateScaling) {
data->imgui.m_bWasScalingUpdatedThisFrame = true;
}
};

return RTN_CONTINUE;
Expand Down Expand Up @@ -1081,8 +1097,12 @@ static RTN_TYPE RUNTIME_API ImGuiGetScalingSize(RUNTIME_CONTEXT ctx) {

y = ImGui::GetFrameHeight() * 1.3f;

data->SetData(buf, 0, x);
data->SetData(buf, 1, y);
data->SetData(buf, 0, x / data->imgui.m_vecScaling.x);
data->SetData(buf, 1, y / data->imgui.m_vecScaling.y);

if (data->imgui.m_bNeedToUpdateScaling) {
data->imgui.m_bWasScalingUpdatedThisFrame = true;
}
};

wSetFloatParam(ctx, data->GetData(buf, 0, 10.0f));
Expand Down

0 comments on commit 7b24470

Please sign in to comment.