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

OgrePlatformManager.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 "OgreStableHeaders.h"
00026 #include "OgrePlatformManager.h"
00027 
00028 #include "OgreDynLibManager.h"
00029 #include "OgreDynLib.h"
00030 
00031 namespace Ogre {
00032 
00033     //-----------------------------------------------------------------------
00034     template<> PlatformManager* Singleton<PlatformManager>::ms_Singleton = 0;
00035     PlatformManager* PlatformManager::getSingletonPtr(void)
00036     {
00037         return ms_Singleton;
00038     }
00039     PlatformManager& PlatformManager::getSingleton(void)
00040     {  
00041         assert( ms_Singleton );  return ( *ms_Singleton );  
00042     }
00043     //-----------------------------------------------------------------------
00044     PlatformManager::PlatformManager()
00045     {
00046         // Load library
00047         String libraryName = "OgrePlatform.";
00048         #if OGRE_PLATFORM == PLATFORM_WIN32
00049             libraryName += "dll";
00050         #elif OGRE_PLATFORM == PLATFORM_APPLE
00051             libraryName += "bundle";
00052         #else
00053             //PLATFORM_LINUX
00054             libraryName = "lib" + libraryName + "so";
00055         #endif
00056 
00057         DynLib* lib = DynLibManager::getSingleton().load(libraryName);
00058 
00059         mpfCreateConfigDialog = (DLL_CREATECONFIGDIALOG)lib->getSymbol("createPlatformConfigDialog");
00060         mpfCreateErrorDialog = (DLL_CREATEERRORDIALOG)lib->getSymbol("createPlatformErrorDialog");
00061         mpfCreateInputReader = (DLL_CREATEINPUTREADER)lib->getSymbol("createPlatformInputReader");
00062         mpfCreateTimer = (DLL_CREATETIMER)lib->getSymbol("createTimer");
00063 
00064         mpfDestroyConfigDialog = (DLL_DESTROYCONFIGDIALOG)lib->getSymbol("destroyPlatformConfigDialog");
00065         mpfDestroyErrorDialog = (DLL_DESTROYERRORDIALOG)lib->getSymbol("destroyPlatformErrorDialog");
00066         mpfDestroyInputReader = (DLL_DESTROYINPUTREADER)lib->getSymbol("destroyPlatformInputReader");
00067         mpfDestroyTimer = (DLL_DESTROYTIMER)lib->getSymbol("destroyTimer");
00068 
00069     }
00070     //-----------------------------------------------------------------------
00071     ConfigDialog* PlatformManager::createConfigDialog()
00072     {
00073         // Delegate
00074         ConfigDialog* pdlg;
00075         mpfCreateConfigDialog(&pdlg);
00076         return pdlg;
00077     }
00078     //-----------------------------------------------------------------------
00079     ErrorDialog* PlatformManager::createErrorDialog()
00080     {
00081         // Delegate
00082         ErrorDialog* pdlg;
00083         mpfCreateErrorDialog(&pdlg);
00084         return pdlg;
00085     }
00086     //-----------------------------------------------------------------------
00087     InputReader* PlatformManager::createInputReader()
00088     {
00089         // Delegate
00090         InputReader* pinput;
00091         mpfCreateInputReader(&pinput);
00092         return pinput;
00093     }
00094     //-----------------------------------------------------------------------
00095     void PlatformManager::destroyConfigDialog(ConfigDialog*  dlg)
00096     {
00097         // Delegate
00098         mpfDestroyConfigDialog(dlg);
00099     }
00100     //-----------------------------------------------------------------------
00101     void PlatformManager::destroyErrorDialog(ErrorDialog* dlg)
00102     {
00103         // Delegate
00104         mpfDestroyErrorDialog(dlg);
00105     }
00106     //-----------------------------------------------------------------------
00107     void PlatformManager::destroyInputReader(InputReader* reader)
00108     {
00109         // Delegate
00110         mpfDestroyInputReader(reader);
00111     }
00112     //-----------------------------------------------------------------------
00113     Timer* PlatformManager::createTimer()
00114     {
00115         // Delegate
00116         Timer* pTimer;
00117         mpfCreateTimer(&pTimer);
00118         return pTimer;
00119     }
00120     //-----------------------------------------------------------------------
00121     void PlatformManager::destroyTimer(Timer* timer)
00122     {
00123         mpfDestroyTimer(timer);
00124     }
00125 
00126 
00127 
00128 }

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:33 2004