Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# OgreWin32PlatformDll.cpp

Go to the documentation of this file.

    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 #ifdef DX7INPUTONLY
    00028 #include "OgreWin32Input.h"
    00029 #else
    00030 #include "OgreWin32Input8.h"
    00031 #endif
    00032 #include "OgreWin32Timer.h"
    00033 #include "OgreRoot.h"
    00034 #include "OgreLogManager.h"
    00035 #include "OgreRenderWindow.h"
    00036
    00037 namespace Ogre {
    00038
    00039 #ifdef DEBUG
    00040     int g_iCreatedConfigDiag = 0;
    00041     int g_iCreatedErrorDiag = 0;
    00042     int g_iCreatedRenderWindow = 0;
    00043     int g_iCreatedInputReader = 0;
    00044 #endif
    00045
    00047     extern "C" void createPlatformConfigDialog(ConfigDialog** ppDlg)
    00048     {
    00049         // Must get HINSTANCE
    00050         HINSTANCE hInst = GetModuleHandle("OgrePlatform.dll");
    00051         *ppDlg = new Win32ConfigDialog(hInst);
    00052
    00053 #ifdef DEBUG
    00054         g_iCreatedConfigDiag++;
    00055 #endif
    00056     }
    00057
    00059     extern "C" void createPlatformErrorDialog(ErrorDialog** ppDlg)
    00060     {
    00061         HINSTANCE hInst = GetModuleHandle("OgrePlatform.dll");
    00062         *ppDlg = new Win32ErrorDialog(hInst);
    00063
    00064 #ifdef DEBUG
    00065         g_iCreatedErrorDiag++;
    00066 #endif
    00067     }
    00068
    00070     extern "C" void createTimer(Timer** ppTimer)
    00071     {
    00072         *ppTimer = new Win32Timer();
    00073         (*ppTimer)->reset();
    00074     }
    00075
    00076     extern "C" void destroyTimer(Timer* ppTimer)
    00077     {
    00078         delete ppTimer;
    00079     }
    00081     extern "C" void createPlatformInputReader(InputReader** ppReader)
    00082     {
    00083 #ifdef DX7INPUTONLY
    00084         *ppReader = new Win32Input();
    00085 #else
    00086         *ppReader = new Win32Input8();
    00087 #endif
    00088
    00089 #ifdef DEBUG
    00090         g_iCreatedInputReader++;
    00091 #endif
    00092     }
    00093
    00095     extern "C" void destroyPlatformConfigDialog(ConfigDialog* dlg)
    00096     {
    00097         delete dlg;
    00098
    00099 #ifdef DEBUG
    00100         g_iCreatedConfigDiag--;
    00101 #endif
    00102     }
    00104     extern "C" void destroyPlatformErrorDialog(ErrorDialog* dlg)
    00105     {
    00106         delete dlg;
    00107
    00108 #ifdef DEBUG
    00109         g_iCreatedErrorDiag--;
    00110 #endif
    00111     }
    00113     extern "C" void destroyPlatformRenderWindow(RenderWindow* wnd)
    00114     {
    00115         delete wnd;
    00116
    00117 #ifdef DEBUG
    00118         g_iCreatedRenderWindow--;
    00119 #endif
    00120     }
    00122     extern "C" void destroyPlatformInputReader(InputReader* reader)
    00123     {
    00124         delete reader;
    00125
    00126 #ifdef DEBUG
    00127         g_iCreatedInputReader--;
    00128 #endif
    00129     }
    00130
    00131 #ifdef DEBUG
    00132     BOOL WINAPI DllMain( HINSTANCE hinstDLL,  // handle to DLL module
    00133                          DWORD fdwReason,     // reason for calling function
    00134                          LPVOID lpvReserved   // reserved
    00135                        )
    00136     {
    00137         if( fdwReason == DLL_THREAD_DETACH ) {
    00138             if( g_iCreatedConfigDiag )
    00139                 LogManager::logMessage( "Memory Leak: Not all platform configuration dialogs were destroyed!!!", LML_CRITICAL );
    00140             if( g_iCreatedConfigDiag )
    00141                 LogManager::logMessage( "Memory Leak: Not all platform error dialogs were destroyed!!!", LML_CRITICAL );
    00142             if( g_iCreatedConfigDiag )
    00143                 LogManager::logMessage( "Memory Leak: Not all platform render windows were destroyed!!!", LML_CRITICAL );
    00144             if( g_iCreatedConfigDiag )
    00145                 LogManager::logMessage( "Memory Leak: Not all platform input readers were destroyed!!!", LML_CRITICAL );
    00146         }
    00147     }
    00148 #endif
    00149 }

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:51 2004