Added aspect ratio in resolution list ()

master
krzys-h 2015-07-11 23:53:25 +02:00
parent e8582d214c
commit 03717e11d4
1 changed files with 11 additions and 1 deletions

View File

@ -4545,6 +4545,15 @@ void CMainDialog::UpdateSceneResume(int rank)
// Updates the list of modes.
int GCD(int a, int b) {
return (b == 0) ? a : GCD(b, a%b);
}
Math::IntPoint AspectRatio(Math::IntPoint resolution)
{
int gcd = GCD(resolution.x, resolution.y);
return Math::IntPoint(static_cast<float>(resolution.x) / gcd, static_cast<float>(resolution.y) / gcd);
}
void CMainDialog::UpdateDisplayMode()
{
CWindow* pw;
@ -4563,7 +4572,8 @@ void CMainDialog::UpdateDisplayMode()
for (Math::IntPoint mode : modes)
{
mode_text.str("");
mode_text << mode.x << "x" << mode.y;
Math::IntPoint aspect = AspectRatio(mode);
mode_text << mode.x << "x" << mode.y << " [" << aspect.x << ":" << aspect.y << "]";
pl->SetItemName(i++, mode_text.str().c_str());
}