PlatformHelper.cpp
Go to the documentation of this file.00001 00011 #include "PlatformHelper.h" 00012 00013 00014 //********************** 00015 //*** WINDOWS 32-BIT *** 00016 //********************** 00017 00018 #ifdef WIN32 00019 00020 // Need to have memory-leak checking 00021 #include <crtdbg.h> 00022 00023 //*** DefaultWinMain *** 00024 00025 void DefaultWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 00026 { 00027 // Enable windows memory leak detection (will report leaks in the Output window) 00028 #ifdef _DEBUG 00029 int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag 00030 flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit 00031 _CrtSetDbgFlag(flag); // Set flag to the new value 00032 00033 // _CrtSetBreakAlloc(1624); // Can be manually commented back in to break at a certain allocation 00034 #endif 00035 00036 // Platform abstraction systems - This is where we choose which platform components we want to use 00037 Platform_Win32_OS* os=new Platform_Win32_OS(hInstance,lpCmdLine); 00038 Platform::SetPlatform_OS(os); 00039 Platform::SetPlatform_Time(new Platform_Win32_Time()); 00040 Platform::SetPlatform_Sound(new Platform_Win32_Sound(os)); 00041 Platform::SetPlatform_Input(new Platform_Win32_Input(os)); 00042 Platform::SetPlatform_Screen(new Platform_Win32_Screen(os)); 00043 Platform::SetPlatform_FileSystem(new Platform_Win32_FileSystem()); 00044 Platform::SetPlatform_Network(new Platform_Win32_Network()); 00045 // Platform::SetPlatform_3D(new Platform_Win32_3D(os)); // Don't use both Screen and 3D - only one or the other at a time 00046 00047 } 00048 00049 //*** DefaultWinMain3D *** 00050 00051 void DefaultWinMain3D(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 00052 { 00053 // Enable windows memory leak detection (will report leaks in the Output window) 00054 #ifdef _DEBUG 00055 int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag 00056 flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit 00057 _CrtSetDbgFlag(flag); // Set flag to the new value 00058 00059 // _CrtSetBreakAlloc(1624); // Can be manually commented back in to break at a certain allocation 00060 #endif 00061 00062 // Platform abstraction systems - This is where we choose which platform components we want to use 00063 Platform_Win32_OS* os=new Platform_Win32_OS(hInstance,lpCmdLine); 00064 Platform::SetPlatform_OS(os); 00065 Platform::SetPlatform_Time(new Platform_Win32_Time()); 00066 Platform::SetPlatform_Sound(new Platform_Win32_Sound(os)); 00067 Platform::SetPlatform_Input(new Platform_Win32_Input(os)); 00068 Platform::SetPlatform_3D(new Platform_Win32_3D(os)); 00069 Platform::SetPlatform_FileSystem(new Platform_Win32_FileSystem()); 00070 Platform::SetPlatform_Network(new Platform_Win32_Network()); 00071 // Platform::SetPlatform_Screen(new Platform_Win32_Screen(os)); // Don't use both Screen and 3D - only one or the other at a time 00072 } 00073 00074 #endif /* #ifdef WIN32 */ 00075 00076 //************************** 00077 //*** END WINDOWS 32-BIT *** 00078 //************************** 00079
Reproduction/republishing of any material on this site without permission is strictly prohibited.
