add GetMonitorAspectRatio
This commit is contained in:
@@ -21,6 +21,8 @@ public:
|
||||
void *GetProcAddress( RString s );
|
||||
RString TryVideoMode( const VideoModeParams& p, bool& newDeviceOut );
|
||||
void GetDisplayResolutions( DisplayResolutions &dr ) const;
|
||||
float GetMonitorAspectRatio() const;
|
||||
|
||||
void SwapBuffers();
|
||||
void Update();
|
||||
|
||||
|
||||
@@ -411,6 +411,11 @@ void LowLevelWindow_Cocoa::GetDisplayResolutions( DisplayResolutions &dr ) const
|
||||
// Do not release modes! We don't own it here.
|
||||
}
|
||||
|
||||
float LowLevelWindow_Cocoa::GetMonitorAspectRatio() const
|
||||
{
|
||||
return 4/3.f;
|
||||
}
|
||||
|
||||
void LowLevelWindow_Cocoa::SwapBuffers()
|
||||
{
|
||||
CGLFlushDrawable( CGLGetCurrentContext() );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <windows.h>
|
||||
class VideoModeParams;
|
||||
class DisplayResolutions;
|
||||
class DisplayResolution;
|
||||
|
||||
namespace GraphicsWindow
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace GraphicsWindow
|
||||
void DestroyGraphicsWindow();
|
||||
|
||||
void GetDisplayResolutions( DisplayResolutions &out );
|
||||
float GetMonitorAspectRatio();
|
||||
|
||||
const VideoModeParams &GetParams();
|
||||
HDC GetHDC();
|
||||
|
||||
Reference in New Issue
Block a user