VideoModeParams has a bunch of settings. It's confusing to

pass the whole thing around, since it's not clear what data
is actually used.  For simple functions, just pass the needed
data.
This commit is contained in:
Glenn Maynard
2006-01-14 23:44:31 +00:00
parent 3b45f4347d
commit a1592e71e7
@@ -181,6 +181,8 @@ void GraphicsWindow::SetVideoModeParams( const VideoModeParams &p )
g_CurrentParams = p; g_CurrentParams = p;
} }
/* Set the display mode to the given size, bit depth and refresh. The refresh
* setting may be ignored. */
CString GraphicsWindow::SetScreenMode( const VideoModeParams &p ) CString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
{ {
if( p.windowed ) if( p.windowed )
@@ -222,9 +224,9 @@ CString GraphicsWindow::SetScreenMode( const VideoModeParams &p )
return CString(); return CString();
} }
static int GetWindowStyle( const VideoModeParams &p ) static int GetWindowStyle( bool bWindowed )
{ {
if( p.windowed ) if( bWindowed )
return WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; return WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
else else
return WS_POPUP; return WS_POPUP;
@@ -234,7 +236,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p )
{ {
ASSERT( g_hWndMain == NULL ); ASSERT( g_hWndMain == NULL );
int iWindowStyle = GetWindowStyle(p); int iWindowStyle = GetWindowStyle( p.windowed );
AppInstance inst; AppInstance inst;
g_hWndMain = CreateWindow( g_sClassName, "app", iWindowStyle, g_hWndMain = CreateWindow( g_sClassName, "app", iWindowStyle,
@@ -252,7 +254,7 @@ void GraphicsWindow::RecreateGraphicsWindow( const VideoModeParams &p )
{ {
ASSERT( g_hWndMain != NULL ); ASSERT( g_hWndMain != NULL );
int iWindowStyle = GetWindowStyle(p); int iWindowStyle = GetWindowStyle( p.windowed );
AppInstance inst; AppInstance inst;
HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle, HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle,
@@ -303,7 +305,7 @@ void GraphicsWindow::ConfigureGraphicsWindow( const VideoModeParams &p )
/* The window style may change as a result of switching to or from fullscreen; /* The window style may change as a result of switching to or from fullscreen;
* apply it. Don't change the WS_VISIBLE bit. */ * apply it. Don't change the WS_VISIBLE bit. */
int iWindowStyle = GetWindowStyle(p); int iWindowStyle = GetWindowStyle( p.windowed );
if( GetWindowLong( g_hWndMain, GWL_STYLE ) & WS_VISIBLE ) if( GetWindowLong( g_hWndMain, GWL_STYLE ) & WS_VISIBLE )
iWindowStyle |= WS_VISIBLE; iWindowStyle |= WS_VISIBLE;
SetWindowLong( g_hWndMain, GWL_STYLE, iWindowStyle ); SetWindowLong( g_hWndMain, GWL_STYLE, iWindowStyle );