move display-related init into a function

This commit is contained in:
Glenn Maynard
2005-03-22 21:34:23 +00:00
parent 0515e7949a
commit 0948c50ce4
+36 -25
View File
@@ -28,6 +28,7 @@
#endif #endif
#include "Screen.h" #include "Screen.h"
#include "ScreenDimensions.h"
#include "CodeDetector.h" #include "CodeDetector.h"
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include "Game.h" #include "Game.h"
@@ -129,6 +130,40 @@ static void StoreActualGraphicOptions( bool initial )
Dialog::SetWindowed( DISPLAY->GetVideoModeParams().windowed ); Dialog::SetWindowed( DISPLAY->GetVideoModeParams().windowed );
} }
RageDisplay *CreateDisplay();
static void StartDisplay()
{
if( DISPLAY != NULL )
return; // already started
DISPLAY = CreateDisplay();
DISPLAY->ChangeCentering(
PREFSMAN->m_iCenterImageTranslateX,
PREFSMAN->m_iCenterImageTranslateY,
PREFSMAN->m_fCenterImageAddWidth,
PREFSMAN->m_fCenterImageAddHeight );
TEXTUREMAN = new RageTextureManager();
TEXTUREMAN->SetPrefs(
RageTextureManagerPrefs(
PREFSMAN->m_iTextureColorDepth,
PREFSMAN->m_iMovieColorDepth,
PREFSMAN->m_bDelayedTextureDelete,
PREFSMAN->m_iMaxTextureResolution,
PREFSMAN->m_bForceMipMaps
)
);
MODELMAN = new ModelManager;
MODELMAN->SetPrefs(
ModelManagerPrefs(
PREFSMAN->m_bDelayedModelDelete
)
);
}
void ApplyGraphicOptions() void ApplyGraphicOptions()
{ {
bool bNeedReload = false; bool bNeedReload = false;
@@ -1095,31 +1130,7 @@ int main(int argc, char* argv[])
SAFE_DELETE( loading_window ); // destroy this before init'ing Display SAFE_DELETE( loading_window ); // destroy this before init'ing Display
DISPLAY = CreateDisplay(); StartDisplay();
DISPLAY->ChangeCentering(
PREFSMAN->m_iCenterImageTranslateX,
PREFSMAN->m_iCenterImageTranslateY,
PREFSMAN->m_fCenterImageAddWidth,
PREFSMAN->m_fCenterImageAddHeight );
TEXTUREMAN = new RageTextureManager();
TEXTUREMAN->SetPrefs(
RageTextureManagerPrefs(
PREFSMAN->m_iTextureColorDepth,
PREFSMAN->m_iMovieColorDepth,
PREFSMAN->m_bDelayedTextureDelete,
PREFSMAN->m_iMaxTextureResolution,
PREFSMAN->m_bForceMipMaps
)
);
MODELMAN = new ModelManager;
MODELMAN->SetPrefs(
ModelManagerPrefs(
PREFSMAN->m_bDelayedModelDelete
)
);
StoreActualGraphicOptions( true ); StoreActualGraphicOptions( true );