-wide-bg option to stretch the background tile layer when wide-screen mode is enabled - Daro Land

This commit is contained in:
Ian Curtis 2020-12-20 18:17:34 +00:00
parent 7d2b21a6dc
commit 72c0c60c98
2 changed files with 55 additions and 46 deletions

View file

@ -540,13 +540,17 @@ void CRender2D::Setup2D(bool isBottom)
{ {
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
glViewport(0, 0, m_totalXPixels, m_totalYPixels); glViewport(0, 0, m_totalXPixels, m_totalYPixels);
glDisable(GL_SCISSOR_TEST); // scissor is enabled to fix the 2d/3d miss match problem glDisable(GL_SCISSOR_TEST); // scissor is enabled to fix the 2d/3d miss match problem
glClear(GL_COLOR_BUFFER_BIT); // we want to clear outside the scissored areas so must disable it glClear(GL_COLOR_BUFFER_BIT); // we want to clear outside the scissored areas so must disable it
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
} }
// Set up the viewport and orthogonal projection // Set up the viewport and orthogonal projection
glViewport(m_xOffset - m_correction, m_yOffset + m_correction, m_xPixels, m_yPixels); bool stretchBottom = m_config["WideBackground"].ValueAs<bool>() && isBottom;
if (!stretchBottom)
{
glViewport(m_xOffset - m_correction, m_yOffset + m_correction, m_xPixels, m_yPixels); //Preserve aspect ratio of tile layer by constraining and centering viewport
}
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
glOrtho(0.0, 1.0, 1.0, 0.0, 1.0, -1.0); glOrtho(0.0, 1.0, 1.0, 0.0, 1.0, -1.0);

View file

@ -1398,6 +1398,7 @@ static Util::Config::Node DefaultConfig()
config.Set("FullScreen", false); config.Set("FullScreen", false);
config.Set("WideScreen", false); config.Set("WideScreen", false);
config.Set("Stretch", false); config.Set("Stretch", false);
config.Set("WideBackground", false);
config.Set("VSync", true); config.Set("VSync", true);
config.Set("Throttle", true); config.Set("Throttle", true);
config.Set("ShowFrameRate", false); config.Set("ShowFrameRate", false);
@ -1468,6 +1469,8 @@ static void Help(void)
puts(" -window Windowed mode [Default]"); puts(" -window Windowed mode [Default]");
puts(" -fullscreen Full screen mode"); puts(" -fullscreen Full screen mode");
puts(" -wide-screen Expand 3D field of view to screen width"); puts(" -wide-screen Expand 3D field of view to screen width");
puts(" -wide-bg When wide-screen mode is enabled, also expand the 2D");
puts(" background layer to screen width");
puts(" -stretch Fit viewport to resolution, ignoring aspect ratio"); puts(" -stretch Fit viewport to resolution, ignoring aspect ratio");
puts(" -no-throttle Disable 60 Hz frame rate lock"); puts(" -no-throttle Disable 60 Hz frame rate lock");
puts(" -vsync Lock to vertical refresh rate [Default]"); puts(" -vsync Lock to vertical refresh rate [Default]");
@ -1582,6 +1585,8 @@ static ParsedCommandLine ParseCommandLine(int argc, char **argv)
{ "-wide-screen", { "WideScreen", true } }, { "-wide-screen", { "WideScreen", true } },
{ "-stretch", { "Stretch", true } }, { "-stretch", { "Stretch", true } },
{ "-no-stretch", { "Stretch", false } }, { "-no-stretch", { "Stretch", false } },
{ "-wide-bg", { "WideBackground", true } },
{ "-no-wide-bg", { "WideBackground", false } },
{ "-no-multi-texture", { "MultiTexture", false } }, { "-no-multi-texture", { "MultiTexture", false } },
{ "-multi-texture", { "MultiTexture", true } }, { "-multi-texture", { "MultiTexture", true } },
{ "-throttle", { "Throttle", true } }, { "-throttle", { "Throttle", true } },