mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fix --screenrotate to work with --screensize and --screenoffset
This commit is contained in:
parent
e2fc3b325c
commit
ec8ebf07f3
|
@ -45,9 +45,21 @@ namespace Renderer {
|
||||||
//glScissor starts at the bottom left of the window
|
//glScissor starts at the bottom left of the window
|
||||||
//so (0, 0, 1, 1) is the bottom left pixel
|
//so (0, 0, 1, 1) is the bottom left pixel
|
||||||
//everything else uses y+ = down, so flip it to be consistent
|
//everything else uses y+ = down, so flip it to be consistent
|
||||||
//also take screen height and offset into account
|
switch(Renderer::getScreenRotate())
|
||||||
box.x = Renderer::getScreenOffsetX() + box.x;
|
{
|
||||||
box.y = Renderer::getWindowHeight() - Renderer::getScreenOffsetY() - box.y - box.h;
|
case 0: { box = ClipRect(box.x, Renderer::getWindowHeight() - (box.y + box.h), box.w, box.h); } break;
|
||||||
|
case 1: { box = ClipRect(Renderer::getScreenHeight() - (box.y + box.h), Renderer::getWindowWidth() - (box.x + box.w), box.h, box.w); } break;
|
||||||
|
case 2: { box = ClipRect(Renderer::getScreenWidth() - (box.x + box.w), Renderer::getWindowHeight() - Renderer::getScreenHeight() + box.y, box.w, box.h); } break;
|
||||||
|
case 3: { box = ClipRect(box.y, Renderer::getWindowWidth() - Renderer::getScreenWidth() + box.x, box.h, box.w); } break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(Renderer::getScreenRotate())
|
||||||
|
{
|
||||||
|
case 0: { box.x += Renderer::getScreenOffsetX(); box.y -= Renderer::getScreenOffsetY(); } break;
|
||||||
|
case 1: { box.x += Renderer::getScreenOffsetY(); box.y -= Renderer::getScreenOffsetX(); } break;
|
||||||
|
case 2: { box.x += Renderer::getScreenOffsetX(); box.y -= Renderer::getScreenOffsetY(); } break;
|
||||||
|
case 3: { box.x += Renderer::getScreenOffsetY(); box.y -= Renderer::getScreenOffsetX(); } break;
|
||||||
|
}
|
||||||
|
|
||||||
//make sure the box fits within clipStack.top(), and clip further accordingly
|
//make sure the box fits within clipStack.top(), and clip further accordingly
|
||||||
if(clipStack.size())
|
if(clipStack.size())
|
||||||
|
@ -69,13 +81,8 @@ namespace Renderer {
|
||||||
box.h = 0;
|
box.h = 0;
|
||||||
|
|
||||||
clipStack.push(box);
|
clipStack.push(box);
|
||||||
switch(Renderer::getScreenRotate())
|
|
||||||
{
|
glScissor(box.x, box.y, box.w, box.h);
|
||||||
case 0: { glScissor(box.x, box.y, box.w, box.h); } break;
|
|
||||||
case 1: { glScissor(box.y, Renderer::getScreenWidth() - box.x - box.w, box.h, box.w); } break;
|
|
||||||
case 2: { glScissor(Renderer::getScreenWidth() - box.x - box.w, Renderer::getScreenHeight() - box.y - box.h, box.w, box.h); } break;
|
|
||||||
case 3: { glScissor(Renderer::getScreenHeight() - box.y - box.h, box.x, box.h, box.w); } break;
|
|
||||||
}
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,13 +100,7 @@ namespace Renderer {
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}else{
|
}else{
|
||||||
const ClipRect& top = clipStack.top();
|
const ClipRect& top = clipStack.top();
|
||||||
switch(Renderer::getScreenRotate())
|
glScissor(top.x, top.y, top.w, top.h);
|
||||||
{
|
|
||||||
case 0: { glScissor(top.x, top.y, top.w, top.h); } break;
|
|
||||||
case 1: { glScissor(top.y, Renderer::getScreenWidth() - top.x - top.w, top.h, top.w); } break;
|
|
||||||
case 2: { glScissor(Renderer::getScreenWidth() - top.x - top.w, Renderer::getScreenHeight() - top.y - top.h, top.w, top.h); } break;
|
|
||||||
case 3: { glScissor(Renderer::getScreenHeight() - top.y - top.h, top.x, top.h, top.w); } break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ std::vector<const char*> settings_dont_save {
|
||||||
{ "ScreenWidth" },
|
{ "ScreenWidth" },
|
||||||
{ "ScreenHeight" },
|
{ "ScreenHeight" },
|
||||||
{ "ScreenOffsetX" },
|
{ "ScreenOffsetX" },
|
||||||
{ "ScreenOffsetY" }
|
{ "ScreenOffsetY" },
|
||||||
|
{ "ScreenRotate" }
|
||||||
};
|
};
|
||||||
|
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
|
@ -140,6 +141,7 @@ void Settings::setDefaults()
|
||||||
mIntMap["ScreenHeight"] = 0;
|
mIntMap["ScreenHeight"] = 0;
|
||||||
mIntMap["ScreenOffsetX"] = 0;
|
mIntMap["ScreenOffsetX"] = 0;
|
||||||
mIntMap["ScreenOffsetY"] = 0;
|
mIntMap["ScreenOffsetY"] = 0;
|
||||||
|
mIntMap["ScreenRotate"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
|
|
Loading…
Reference in a new issue