[657] | 1 | /*
|
---|
| 2 | -----------------------------------------------------------------------------
|
---|
| 3 | This source file is part of OGRE
|
---|
| 4 | (Object-oriented Graphics Rendering Engine)
|
---|
| 5 | For the latest info, see http://www.ogre3d.org/
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
| 23 | -----------------------------------------------------------------------------
|
---|
| 24 | */
|
---|
| 25 | #include "OgreStableHeaders.h"
|
---|
| 26 | #include "OgrePlatformManager.h"
|
---|
| 27 |
|
---|
| 28 | #include "OgreDynLibManager.h"
|
---|
| 29 | #include "OgreDynLib.h"
|
---|
| 30 |
|
---|
| 31 | #include "OgreConfigDialog.h"
|
---|
| 32 | #include "OgreErrorDialog.h"
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | namespace Ogre {
|
---|
| 36 |
|
---|
| 37 | //-----------------------------------------------------------------------
|
---|
| 38 | template<> PlatformManager* Singleton<PlatformManager>::ms_Singleton = 0;
|
---|
| 39 | PlatformManager* PlatformManager::getSingletonPtr(void)
|
---|
| 40 | {
|
---|
| 41 | return ms_Singleton;
|
---|
| 42 | }
|
---|
| 43 | PlatformManager& PlatformManager::getSingleton(void)
|
---|
| 44 | {
|
---|
| 45 | assert( ms_Singleton ); return ( *ms_Singleton );
|
---|
| 46 | }
|
---|
| 47 | //-----------------------------------------------------------------------
|
---|
| 48 | PlatformManager::PlatformManager()
|
---|
| 49 | {
|
---|
| 50 | // Load library
|
---|
| 51 |
|
---|
| 52 | DynLib* lib = DynLibManager::getSingleton().load(OGRE_PLATFORM_LIB);
|
---|
| 53 |
|
---|
| 54 | mpfCreateConfigDialog = (DLL_CREATECONFIGDIALOG)lib->getSymbol("createPlatformConfigDialog");
|
---|
| 55 | mpfCreateErrorDialog = (DLL_CREATEERRORDIALOG)lib->getSymbol("createPlatformErrorDialog");
|
---|
| 56 | mpfCreateInputReader = (DLL_CREATEINPUTREADER)lib->getSymbol("createPlatformInputReader");
|
---|
| 57 | mpfCreateTimer = (DLL_CREATETIMER)lib->getSymbol("createTimer");
|
---|
| 58 |
|
---|
| 59 | mpfDestroyConfigDialog = (DLL_DESTROYCONFIGDIALOG)lib->getSymbol("destroyPlatformConfigDialog");
|
---|
| 60 | mpfDestroyErrorDialog = (DLL_DESTROYERRORDIALOG)lib->getSymbol("destroyPlatformErrorDialog");
|
---|
| 61 | mpfDestroyInputReader = (DLL_DESTROYINPUTREADER)lib->getSymbol("destroyPlatformInputReader");
|
---|
| 62 | mpfDestroyTimer = (DLL_DESTROYTIMER)lib->getSymbol("destroyTimer");
|
---|
| 63 |
|
---|
| 64 | }
|
---|
| 65 | //-----------------------------------------------------------------------
|
---|
| 66 | ConfigDialog* PlatformManager::createConfigDialog()
|
---|
| 67 | {
|
---|
| 68 | // Delegate
|
---|
| 69 | ConfigDialog* pdlg;
|
---|
| 70 | mpfCreateConfigDialog(&pdlg);
|
---|
| 71 | return pdlg;
|
---|
| 72 | }
|
---|
| 73 | //-----------------------------------------------------------------------
|
---|
| 74 | ErrorDialog* PlatformManager::createErrorDialog()
|
---|
| 75 | {
|
---|
| 76 | // Delegate
|
---|
| 77 | ErrorDialog* pdlg;
|
---|
| 78 | mpfCreateErrorDialog(&pdlg);
|
---|
| 79 | return pdlg;
|
---|
| 80 | }
|
---|
| 81 | //-----------------------------------------------------------------------
|
---|
| 82 | InputReader* PlatformManager::createInputReader()
|
---|
| 83 | {
|
---|
| 84 | // Delegate
|
---|
| 85 | InputReader* pinput;
|
---|
| 86 | mpfCreateInputReader(&pinput);
|
---|
| 87 | return pinput;
|
---|
| 88 | }
|
---|
| 89 | //-----------------------------------------------------------------------
|
---|
| 90 | void PlatformManager::destroyConfigDialog(ConfigDialog* dlg)
|
---|
| 91 | {
|
---|
| 92 | // Delegate
|
---|
| 93 | mpfDestroyConfigDialog(dlg);
|
---|
| 94 | }
|
---|
| 95 | //-----------------------------------------------------------------------
|
---|
| 96 | void PlatformManager::destroyErrorDialog(ErrorDialog* dlg)
|
---|
| 97 | {
|
---|
| 98 | // Delegate
|
---|
| 99 | mpfDestroyErrorDialog(dlg);
|
---|
| 100 | }
|
---|
| 101 | //-----------------------------------------------------------------------
|
---|
| 102 | void PlatformManager::destroyInputReader(InputReader* reader)
|
---|
| 103 | {
|
---|
| 104 | // Delegate
|
---|
| 105 | mpfDestroyInputReader(reader);
|
---|
| 106 | }
|
---|
| 107 | //-----------------------------------------------------------------------
|
---|
| 108 | Timer* PlatformManager::createTimer()
|
---|
| 109 | {
|
---|
| 110 | // Delegate
|
---|
| 111 | Timer* pTimer;
|
---|
| 112 | mpfCreateTimer(&pTimer);
|
---|
| 113 | return pTimer;
|
---|
| 114 | }
|
---|
| 115 | //-----------------------------------------------------------------------
|
---|
| 116 | void PlatformManager::destroyTimer(Timer* timer)
|
---|
| 117 | {
|
---|
| 118 | mpfDestroyTimer(timer);
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | //-----------------------------------------------------------------------
|
---|
| 122 | ConfigDialog::~ConfigDialog() {
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | //-----------------------------------------------------------------------
|
---|
| 126 | ErrorDialog::~ErrorDialog() {
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | }
|
---|