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
5 #ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__
\r
6 #define __C_IRR_DEVICE_STUB_H_INCLUDED__
\r
8 #include "IrrlichtDevice.h"
\r
9 #include "SIrrCreationParameters.h"
\r
10 #include "IContextManager.h"
\r
14 // lots of prototypes:
\r
20 class IGUIEnvironment;
\r
21 IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
\r
22 video::IVideoDriver* Driver, IOSOperator* op);
\r
27 ISceneManager* createSceneManager(video::IVideoDriver* driver,
\r
28 io::IFileSystem* fs, gui::ICursorControl* cc, gui::IGUIEnvironment *gui);
\r
33 IFileSystem* createFileSystem();
\r
38 IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
\r
43 //! Stub for an Irrlicht Device implementation
\r
44 class CIrrDeviceStub : public IrrlichtDevice
\r
49 CIrrDeviceStub(const SIrrlichtCreationParameters& param);
\r
52 virtual ~CIrrDeviceStub();
\r
54 //! returns the video driver
\r
55 video::IVideoDriver* getVideoDriver() override;
\r
57 //! return file system
\r
58 io::IFileSystem* getFileSystem() override;
\r
60 //! returns the gui environment
\r
61 gui::IGUIEnvironment* getGUIEnvironment() override;
\r
63 //! returns the scene manager
\r
64 scene::ISceneManager* getSceneManager() override;
\r
66 //! \return Returns a pointer to the mouse cursor control interface.
\r
67 gui::ICursorControl* getCursorControl() override;
\r
69 //! return the context manager
\r
70 video::IContextManager* getContextManager() override;
\r
72 //! Returns a pointer to the ITimer object. With it the current Time can be received.
\r
73 ITimer* getTimer() override;
\r
75 //! Returns the version of the engine.
\r
76 const char* getVersion() const override;
\r
78 //! send the event to the right receiver
\r
79 bool postEventFromUser(const SEvent& event) override;
\r
81 //! Sets a new event receiver to receive events
\r
82 void setEventReceiver(IEventReceiver* receiver) override;
\r
84 //! Returns pointer to the current event receiver. Returns 0 if there is none.
\r
85 IEventReceiver* getEventReceiver() override;
\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
91 //! Returns a pointer to the logger.
\r
92 ILogger* getLogger() override;
\r
94 //! Returns the operation system opertator object.
\r
95 IOSOperator* getOSOperator() override;
\r
97 //! Checks if the window is maximized.
\r
98 bool isWindowMaximized() const override;
\r
100 //! Checks if the window is running in fullscreen mode.
\r
101 bool isFullscreen() const override;
\r
103 //! get color format of the current window
\r
104 video::ECOLOR_FORMAT getColorFormat() const override;
\r
106 //! Activate any joysticks, and generate events for them.
\r
107 bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) override;
\r
109 //! Activate accelerometer.
\r
110 bool activateAccelerometer(float updateInterval = 0.016666f) override;
\r
112 //! Deactivate accelerometer.
\r
113 bool deactivateAccelerometer() override;
\r
115 //! Is accelerometer active.
\r
116 bool isAccelerometerActive() override;
\r
118 //! Is accelerometer available.
\r
119 bool isAccelerometerAvailable() override;
\r
121 //! Activate gyroscope.
\r
122 bool activateGyroscope(float updateInterval = 0.016666f) override;
\r
124 //! Deactivate gyroscope.
\r
125 bool deactivateGyroscope() override;
\r
127 //! Is gyroscope active.
\r
128 bool isGyroscopeActive() override;
\r
130 //! Is gyroscope available.
\r
131 bool isGyroscopeAvailable() override;
\r
133 //! Activate device motion.
\r
134 bool activateDeviceMotion(float updateInterval = 0.016666f) override;
\r
136 //! Deactivate device motion.
\r
137 bool deactivateDeviceMotion() override;
\r
139 //! Is device motion active.
\r
140 bool isDeviceMotionActive() override;
\r
142 //! Is device motion available.
\r
143 bool isDeviceMotionAvailable() override;
\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
149 //! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
\r
150 u32 getDoubleClickTime() const override;
\r
152 //! Remove all messages pending in the system message loop
\r
153 void clearSystemMessages() override;
\r
155 //! Resize the render window.
\r
156 void setWindowSize(const irr::core::dimension2d<u32>& size) override {}
\r
160 void createGUIAndScene();
\r
162 //! checks version of SDK and prints warning if there might be a problem
\r
163 bool checkVersion(const char* version);
\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
169 virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent);
\r
171 //! Checks whether the input device should take input from the IME
\r
174 video::IVideoDriver* VideoDriver;
\r
175 gui::IGUIEnvironment* GUIEnvironment;
\r
176 scene::ISceneManager* SceneManager;
\r
178 gui::ICursorControl* CursorControl;
\r
179 IEventReceiver* UserReceiver;
\r
181 IOSOperator* Operator;
\r
182 io::IFileSystem* FileSystem;
\r
183 scene::ISceneManager* InputReceivingSceneManager;
\r
185 struct SMouseMultiClicks
\r
187 SMouseMultiClicks()
\r
188 : DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)
\r
191 u32 DoubleClickTime;
\r
192 u32 CountSuccessiveClicks;
\r
194 core::position2di LastClick;
\r
195 EMOUSE_INPUT_EVENT LastMouseInputEvent;
\r
197 SMouseMultiClicks MouseMultiClicks;
\r
198 video::IContextManager* ContextManager;
\r
199 SIrrlichtCreationParameters CreationParams;
\r
203 } // end namespace irr
\r