source: OGRE/trunk/ogrenew/OgreMain/src/OgrePlatformManager.cpp @ 692

Revision 692, 5.1 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://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
35namespace 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                mpfMessagePump = (DLL_MESSAGEPUMP)lib->getSymbol("messagePump");
65
66    }
67    //-----------------------------------------------------------------------
68    ConfigDialog* PlatformManager::createConfigDialog()
69    {
70        // Delegate
71        ConfigDialog* pdlg;
72        mpfCreateConfigDialog(&pdlg);
73        return pdlg;
74    }
75    //-----------------------------------------------------------------------
76    ErrorDialog* PlatformManager::createErrorDialog()
77    {
78        // Delegate
79        ErrorDialog* pdlg;
80        mpfCreateErrorDialog(&pdlg);
81        return pdlg;
82    }
83    //-----------------------------------------------------------------------
84    InputReader* PlatformManager::createInputReader()
85    {
86        // Delegate
87        InputReader* pinput;
88        mpfCreateInputReader(&pinput);
89        return pinput;
90    }
91    //-----------------------------------------------------------------------
92    void PlatformManager::destroyConfigDialog(ConfigDialog*  dlg)
93    {
94        // Delegate
95        mpfDestroyConfigDialog(dlg);
96    }
97    //-----------------------------------------------------------------------
98    void PlatformManager::destroyErrorDialog(ErrorDialog* dlg)
99    {
100        // Delegate
101        mpfDestroyErrorDialog(dlg);
102    }
103    //-----------------------------------------------------------------------
104    void PlatformManager::destroyInputReader(InputReader* reader)
105    {
106        // Delegate
107        mpfDestroyInputReader(reader);
108    }
109    //-----------------------------------------------------------------------
110    Timer* PlatformManager::createTimer()
111    {
112        // Delegate
113        Timer* pTimer;
114        mpfCreateTimer(&pTimer);
115        return pTimer;
116    }
117    //-----------------------------------------------------------------------
118    void PlatformManager::destroyTimer(Timer* timer)
119    {
120        mpfDestroyTimer(timer);
121    }
122    //-----------------------------------------------------------------------
123    void PlatformManager::messagePump( RenderWindow* rw )
124    {
125        //Delegate -- If the platform does not export this function, then just return
126        if( rw && mpfMessagePump )
127            mpfMessagePump(rw);
128    }
129    //-----------------------------------------------------------------------
130    ConfigDialog::~ConfigDialog() {
131    }
132
133    //-----------------------------------------------------------------------
134    ErrorDialog::~ErrorDialog() {
135    }
136
137
138}
Note: See TracBrowser for help on using the repository browser.