00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #include "OgreWin32ConfigDialog.h" 00026 #include "OgreWin32ErrorDialog.h" 00027 #include "OgreWin32Input8.h" 00028 #include "OgreWin32Timer.h" 00029 #include "OgreRoot.h" 00030 #include "OgreLogManager.h" 00031 #include "OgreRenderWindow.h" 00032 00033 namespace Ogre { 00034 00035 #ifdef DEBUG 00036 int g_iCreatedConfigDiag = 0; 00037 int g_iCreatedErrorDiag = 0; 00038 int g_iCreatedRenderWindow = 0; 00039 int g_iCreatedInputReader = 0; 00040 #endif 00041 00043 extern "C" void createPlatformConfigDialog(ConfigDialog** ppDlg) 00044 { 00045 // Must get HISTANCE 00046 HINSTANCE hInst = GetModuleHandle("OgrePlatform.dll"); 00047 *ppDlg = new Win32ConfigDialog(hInst); 00048 00049 #ifdef DEBUG 00050 g_iCreatedConfigDiag++; 00051 #endif 00052 } 00053 00055 extern "C" void createPlatformErrorDialog(ErrorDialog** ppDlg) 00056 { 00057 HINSTANCE hInst = GetModuleHandle("OgrePlatform.dll"); 00058 *ppDlg = new Win32ErrorDialog(hInst); 00059 00060 #ifdef DEBUG 00061 g_iCreatedErrorDiag++; 00062 #endif 00063 } 00064 00066 extern "C" void createTimer(Timer** ppTimer) 00067 { 00068 *ppTimer = new Win32Timer(); 00069 (*ppTimer)->reset(); 00070 } 00071 00072 extern "C" void destroyTimer(Timer* ppTimer) 00073 { 00074 delete ppTimer; 00075 } 00077 extern "C" void createPlatformInputReader(InputReader** ppReader) 00078 { 00079 *ppReader = new Win32Input8(); 00080 00081 #ifdef DEBUG 00082 g_iCreatedInputReader++; 00083 #endif 00084 } 00085 00087 extern "C" void destroyPlatformConfigDialog(ConfigDialog* dlg) 00088 { 00089 delete dlg; 00090 00091 #ifdef DEBUG 00092 g_iCreatedConfigDiag--; 00093 #endif 00094 } 00096 extern "C" void destroyPlatformErrorDialog(ErrorDialog* dlg) 00097 { 00098 delete dlg; 00099 00100 #ifdef DEBUG 00101 g_iCreatedErrorDiag--; 00102 #endif 00103 } 00105 extern "C" void destroyPlatformRenderWindow(RenderWindow* wnd) 00106 { 00107 delete wnd; 00108 00109 #ifdef DEBUG 00110 g_iCreatedRenderWindow--; 00111 #endif 00112 } 00114 extern "C" void destroyPlatformInputReader(InputReader* reader) 00115 { 00116 delete reader; 00117 00118 #ifdef DEBUG 00119 g_iCreatedInputReader--; 00120 #endif 00121 } 00122 00123 #ifdef DEBUG 00124 BOOL WINAPI DllMain( HINSTANCE hinstDLL, // handle to DLL module 00125 DWORD fdwReason, // reason for calling function 00126 LPVOID lpvReserved // reserved 00127 ) 00128 { 00129 if( fdwReason == DLL_THREAD_DETACH ) { 00130 if( g_iCreatedConfigDiag ) 00131 LogManager::logMessage( "Memory Leak: Not all platform configuration dialogs were destroyed!!!", LML_CRITICAL ); 00132 if( g_iCreatedConfigDiag ) 00133 LogManager::logMessage( "Memory Leak: Not all platform error dialogs were destroyed!!!", LML_CRITICAL ); 00134 if( g_iCreatedConfigDiag ) 00135 LogManager::logMessage( "Memory Leak: Not all platform render windows were destroyed!!!", LML_CRITICAL ); 00136 if( g_iCreatedConfigDiag ) 00137 LogManager::logMessage( "Memory Leak: Not all platform input readers were destroyed!!!", LML_CRITICAL ); 00138 } 00139 } 00140 #endif 00141 }
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:32 2004