add GetMonitorAspectRatio

This commit is contained in:
Chris Danford
2006-02-07 04:39:48 +00:00
parent b46e53e27b
commit ddbe74e1e2
4 changed files with 21 additions and 0 deletions
@@ -516,6 +516,18 @@ void GraphicsWindow::GetDisplayResolutions( DisplayResolutions &out )
}
}
float GraphicsWindow::GetMonitorAspectRatio()
{
// There's no way to query the monitor for this, so assume that the
// normal desktop resolution is using square pixels.
DEVMODE dm;
ZERO( dm );
dm.dmSize = sizeof(dm);
BOOL bResult = EnumDisplaySettings( NULL, ENUM_REGISTRY_SETTINGS, &dm );
ASSERT( bResult );
return dm.dmPelsWidth / (float)dm.dmPelsHeight;
}
/*
* (c) 2004 Glenn Maynard