source: OGRE/trunk/ogrenew/OgreMain/include/OgrePlatformManager.h @ 657

Revision 657, 6.3 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
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#ifndef __PlatformManager_H__
26#define __PlatformManager_H__
27
28#include "OgrePrerequisites.h"
29
30#include "OgreSingleton.h"
31
32namespace Ogre {
33    typedef void (*DLL_CREATECONFIGDIALOG)(ConfigDialog** ppDlg);
34    typedef void (*DLL_CREATEERRORDIALOG)(ErrorDialog** ppDlg);
35    typedef void (*DLL_CREATEINPUTREADER)(InputReader** ppReader);
36        typedef void (*DLL_CREATETIMER)(Timer** ppTimer);
37
38    typedef void (*DLL_DESTROYCONFIGDIALOG)(ConfigDialog* ppDlg);
39    typedef void (*DLL_DESTROYERRORDIALOG)(ErrorDialog* ppDlg);
40    typedef void (*DLL_DESTROYINPUTREADER)(InputReader* ppReader);
41    typedef void (*DLL_DESTROYTIMER)(Timer* ppTimer);
42
43    /** Class which manages the platform settings Ogre runs on.
44        @remarks
45            Because Ogre is designed to be platform-independent, it
46            dynamically loads a library containing all the platform-specific
47            elements like dialogs etc.
48        @par
49            This class manages that load and provides a simple interface to
50            the platform.
51    */
52    class _OgreExport PlatformManager : public Singleton<PlatformManager>
53    {
54    protected:
55        DLL_CREATECONFIGDIALOG mpfCreateConfigDialog;
56        DLL_CREATEERRORDIALOG mpfCreateErrorDialog;
57        DLL_CREATEINPUTREADER mpfCreateInputReader;
58                DLL_CREATETIMER mpfCreateTimer;
59
60        DLL_DESTROYCONFIGDIALOG mpfDestroyConfigDialog;
61        DLL_DESTROYERRORDIALOG mpfDestroyErrorDialog;
62        DLL_DESTROYINPUTREADER mpfDestroyInputReader;
63        DLL_DESTROYTIMER mpfDestroyTimer;
64               
65    public:
66        /** Default constructor.
67        */
68        PlatformManager();
69
70        /** Gets a new instance of a platform-specific config dialog.
71            @remarks
72                The instance returned from this method will be a
73                platform-specific subclass of ConfigDialog, and must be
74                destroyed by the caller when required.
75        */
76        ConfigDialog* createConfigDialog();
77
78        /** Destroys an instance of a platform-specific config dialog.
79            @remarks
80                Required since deletion of objects must be performed on the
81                correct heap.
82        */
83        void destroyConfigDialog(ConfigDialog* dlg);
84
85        /** Gets a new instance of a platform-specific config dialog.
86            @remarks
87                The instance returned from this method will be a
88                platform-specific subclass of ErrorDialog, and must be
89                destroyed by the caller when required.
90        */
91        ErrorDialog* createErrorDialog();
92
93        /** Destroys an instance of a platform-specific error dialog.
94            @remarks
95                Required since deletion of objects must be performed on the
96                correct heap.
97        */
98        void destroyErrorDialog(ErrorDialog* dlg);
99
100        /** Gets a new instance of a platform-specific input reader.
101            @remarks
102                The instance returned from this method will be a
103                platform-specific subclass of InputReader, and must be
104                destroyed by the caller when required.
105        */
106        InputReader* createInputReader();
107
108        /** Destroys an instance of a platform-specific input reader.
109            @remarks
110                Required since deletion of objects must be performed on the
111                correct heap.
112        */
113        void destroyInputReader(InputReader* reader);
114               
115                /** Creates a new Timer instance
116                */
117                Timer* createTimer();
118
119        /** Destroys an instance of a timer. */
120        void destroyTimer(Timer* timer);
121        /** Override standard Singleton retrieval.
122        @remarks
123        Why do we do this? Well, it's because the Singleton
124        implementation is in a .h file, which means it gets compiled
125        into anybody who includes it. This is needed for the
126        Singleton template to work, but we actually only want it
127        compiled into the implementation of the class based on the
128        Singleton, not all of them. If we don't change this, we get
129        link errors when trying to use the Singleton-based class from
130        an outside dll.
131        @par
132        This method just delegates to the template version anyway,
133        but the implementation stays in this single compilation unit,
134        preventing link errors.
135        */
136        static PlatformManager& getSingleton(void);
137        /** Override standard Singleton retrieval.
138        @remarks
139        Why do we do this? Well, it's because the Singleton
140        implementation is in a .h file, which means it gets compiled
141        into anybody who includes it. This is needed for the
142        Singleton template to work, but we actually only want it
143        compiled into the implementation of the class based on the
144        Singleton, not all of them. If we don't change this, we get
145        link errors when trying to use the Singleton-based class from
146        an outside dll.
147        @par
148        This method just delegates to the template version anyway,
149        but the implementation stays in this single compilation unit,
150        preventing link errors.
151        */
152        static PlatformManager* getSingletonPtr(void);
153
154
155    };
156
157
158}
159
160#endif
Note: See TracBrowser for help on using the repository browser.