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

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:22 2004