]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CIrrDeviceStub.h
5b7d92ff589b234f43391a1831cabebd8b824fc6
[irrlicht.git] / source / Irrlicht / CIrrDeviceStub.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__\r
6 #define __C_IRR_DEVICE_STUB_H_INCLUDED__\r
7 \r
8 #include "IrrlichtDevice.h"\r
9 #include "SIrrCreationParameters.h"\r
10 #include "IContextManager.h"\r
11 \r
12 namespace irr\r
13 {\r
14         // lots of prototypes:\r
15         class ILogger;\r
16         class CLogger;\r
17 \r
18         namespace gui\r
19         {\r
20                 class IGUIEnvironment;\r
21                 IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,\r
22                         video::IVideoDriver* Driver, IOSOperator* op);\r
23         }\r
24 \r
25         namespace scene\r
26         {\r
27                 ISceneManager* createSceneManager(video::IVideoDriver* driver,\r
28                         io::IFileSystem* fs, gui::ICursorControl* cc, gui::IGUIEnvironment *gui);\r
29         }\r
30 \r
31         namespace io\r
32         {\r
33                 IFileSystem* createFileSystem();\r
34         }\r
35 \r
36         namespace video\r
37         {\r
38                 IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);\r
39         }\r
40 \r
41 \r
42 \r
43         //! Stub for an Irrlicht Device implementation\r
44         class CIrrDeviceStub : public IrrlichtDevice\r
45         {\r
46         public:\r
47 \r
48                 //! constructor\r
49                 CIrrDeviceStub(const SIrrlichtCreationParameters& param);\r
50 \r
51                 //! destructor\r
52                 virtual ~CIrrDeviceStub();\r
53 \r
54                 //! returns the video driver\r
55                 video::IVideoDriver* getVideoDriver() override;\r
56 \r
57                 //! return file system\r
58                 io::IFileSystem* getFileSystem() override;\r
59 \r
60                 //! returns the gui environment\r
61                 gui::IGUIEnvironment* getGUIEnvironment() override;\r
62 \r
63                 //! returns the scene manager\r
64                 scene::ISceneManager* getSceneManager() override;\r
65 \r
66                 //! \return Returns a pointer to the mouse cursor control interface.\r
67                 gui::ICursorControl* getCursorControl() override;\r
68 \r
69                 //! return the context manager\r
70                 video::IContextManager* getContextManager() override;\r
71 \r
72                 //! Returns a pointer to the ITimer object. With it the current Time can be received.\r
73                 ITimer* getTimer() override;\r
74 \r
75                 //! Returns the version of the engine.\r
76                 const char* getVersion() const override;\r
77 \r
78                 //! send the event to the right receiver\r
79                 bool postEventFromUser(const SEvent& event) override;\r
80 \r
81                 //! Sets a new event receiver to receive events\r
82                 void setEventReceiver(IEventReceiver* receiver) override;\r
83 \r
84                 //! Returns pointer to the current event receiver. Returns 0 if there is none.\r
85                 IEventReceiver* getEventReceiver() override;\r
86 \r
87                 //! Sets the input receiving scene manager.\r
88                 /** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */\r
89                 void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) override;\r
90 \r
91                 //! Returns a pointer to the logger.\r
92                 ILogger* getLogger() override;\r
93 \r
94                 //! Returns the operation system opertator object.\r
95                 IOSOperator* getOSOperator() override;\r
96 \r
97                 //! Checks if the window is maximized.\r
98                 bool isWindowMaximized() const override;\r
99 \r
100                 //! Checks if the window is running in fullscreen mode.\r
101                 bool isFullscreen() const override;\r
102 \r
103                 //! get color format of the current window\r
104                 video::ECOLOR_FORMAT getColorFormat() const override;\r
105 \r
106                 //! Activate any joysticks, and generate events for them.\r
107                 bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) override;\r
108 \r
109                 //! Activate accelerometer.\r
110                 bool activateAccelerometer(float updateInterval = 0.016666f) override;\r
111 \r
112                 //! Deactivate accelerometer.\r
113                 bool deactivateAccelerometer() override;\r
114 \r
115                 //! Is accelerometer active.\r
116                 bool isAccelerometerActive() override;\r
117 \r
118                 //! Is accelerometer available.\r
119                 bool isAccelerometerAvailable() override;\r
120 \r
121                 //! Activate gyroscope.\r
122                 bool activateGyroscope(float updateInterval = 0.016666f) override;\r
123 \r
124                 //! Deactivate gyroscope.\r
125                 bool deactivateGyroscope() override;\r
126 \r
127                 //! Is gyroscope active.\r
128                 bool isGyroscopeActive() override;\r
129 \r
130                 //! Is gyroscope available.\r
131                 bool isGyroscopeAvailable() override;\r
132 \r
133                 //! Activate device motion.\r
134                 bool activateDeviceMotion(float updateInterval = 0.016666f) override;\r
135 \r
136                 //! Deactivate device motion.\r
137                 bool deactivateDeviceMotion() override;\r
138 \r
139                 //! Is device motion active.\r
140                 bool isDeviceMotionActive() override;\r
141 \r
142                 //! Is device motion available.\r
143                 bool isDeviceMotionAvailable() override;\r
144 \r
145                 //! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.\r
146                 //! When set to 0 no double- and tripleclicks will be generated.\r
147                 void setDoubleClickTime( u32 timeMs ) override;\r
148 \r
149                 //! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.\r
150                 u32 getDoubleClickTime() const override;\r
151 \r
152                 //! Remove all messages pending in the system message loop\r
153                 void clearSystemMessages() override;\r
154 \r
155                 //! Resize the render window.\r
156                 void setWindowSize(const irr::core::dimension2d<u32>& size) override {}\r
157 \r
158         protected:\r
159 \r
160                 void createGUIAndScene();\r
161 \r
162                 //! checks version of SDK and prints warning if there might be a problem\r
163                 bool checkVersion(const char* version);\r
164 \r
165                 //! Compares to the last call of this function to return double and triple clicks.\r
166                 /** Needed for win32 device event handling\r
167                 \return Returns only 1,2 or 3. A 4th click will start with 1 again.\r
168                 */\r
169                 virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent);\r
170 \r
171                 //! Checks whether the input device should take input from the IME\r
172                 bool acceptsIME();\r
173 \r
174                 video::IVideoDriver* VideoDriver;\r
175                 gui::IGUIEnvironment* GUIEnvironment;\r
176                 scene::ISceneManager* SceneManager;\r
177                 ITimer* Timer;\r
178                 gui::ICursorControl* CursorControl;\r
179                 IEventReceiver* UserReceiver;\r
180                 CLogger* Logger;\r
181                 IOSOperator* Operator;\r
182                 io::IFileSystem* FileSystem;\r
183                 scene::ISceneManager* InputReceivingSceneManager;\r
184 \r
185                 struct SMouseMultiClicks\r
186                 {\r
187                         SMouseMultiClicks()\r
188                                 : DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)\r
189                         {}\r
190 \r
191                         u32 DoubleClickTime;\r
192                         u32 CountSuccessiveClicks;\r
193                         u32 LastClickTime;\r
194                         core::position2di LastClick;\r
195                         EMOUSE_INPUT_EVENT LastMouseInputEvent;\r
196                 };\r
197                 SMouseMultiClicks MouseMultiClicks;\r
198                 video::IContextManager* ContextManager;\r
199                 SIrrlichtCreationParameters CreationParams;\r
200                 bool Close;\r
201         };\r
202 \r
203 } // end namespace irr\r
204 \r
205 #endif\r
206 \r