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, io::IFileSystem* fs, gui::ICursorControl* cc);
\r
32 IFileSystem* createFileSystem();
\r
37 IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
\r
42 //! Stub for an Irrlicht Device implementation
\r
43 class CIrrDeviceStub : public IrrlichtDevice
\r
48 CIrrDeviceStub(const SIrrlichtCreationParameters& param);
\r
51 virtual ~CIrrDeviceStub();
\r
53 //! returns the video driver
\r
54 video::IVideoDriver* getVideoDriver() override;
\r
56 //! return file system
\r
57 io::IFileSystem* getFileSystem() override;
\r
59 //! returns the gui environment
\r
60 gui::IGUIEnvironment* getGUIEnvironment() override;
\r
62 //! returns the scene manager
\r
63 scene::ISceneManager* getSceneManager() override;
\r
65 //! \return Returns a pointer to the mouse cursor control interface.
\r
66 gui::ICursorControl* getCursorControl() override;
\r
68 //! return the context manager
\r
69 video::IContextManager* getContextManager() override;
\r
71 //! Returns a pointer to the ITimer object. With it the current Time can be received.
\r
72 ITimer* getTimer() override;
\r
74 //! Returns the version of the engine.
\r
75 const char* getVersion() const override;
\r
77 //! send the event to the right receiver
\r
78 bool postEventFromUser(const SEvent& event) override;
\r
80 //! Sets a new event receiver to receive events
\r
81 void setEventReceiver(IEventReceiver* receiver) override;
\r
83 //! Returns pointer to the current event receiver. Returns 0 if there is none.
\r
84 IEventReceiver* getEventReceiver() override;
\r
86 //! Sets the input receiving scene manager.
\r
87 /** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */
\r
88 void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) override;
\r
90 //! Returns a pointer to the logger.
\r
91 ILogger* getLogger() override;
\r
93 //! Returns the operation system opertator object.
\r
94 IOSOperator* getOSOperator() override;
\r
96 //! Checks if the window is maximized.
\r
97 bool isWindowMaximized() const override;
\r
99 //! Checks if the window is running in fullscreen mode.
\r
100 bool isFullscreen() const override;
\r
102 //! get color format of the current window
\r
103 video::ECOLOR_FORMAT getColorFormat() const override;
\r
105 //! Activate any joysticks, and generate events for them.
\r
106 bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) override;
\r
108 //! Activate accelerometer.
\r
109 bool activateAccelerometer(float updateInterval = 0.016666f) override;
\r
111 //! Deactivate accelerometer.
\r
112 bool deactivateAccelerometer() override;
\r
114 //! Is accelerometer active.
\r
115 bool isAccelerometerActive() override;
\r
117 //! Is accelerometer available.
\r
118 bool isAccelerometerAvailable() override;
\r
120 //! Activate gyroscope.
\r
121 bool activateGyroscope(float updateInterval = 0.016666f) override;
\r
123 //! Deactivate gyroscope.
\r
124 bool deactivateGyroscope() override;
\r
126 //! Is gyroscope active.
\r
127 bool isGyroscopeActive() override;
\r
129 //! Is gyroscope available.
\r
130 bool isGyroscopeAvailable() override;
\r
132 //! Activate device motion.
\r
133 bool activateDeviceMotion(float updateInterval = 0.016666f) override;
\r
135 //! Deactivate device motion.
\r
136 bool deactivateDeviceMotion() override;
\r
138 //! Is device motion active.
\r
139 bool isDeviceMotionActive() override;
\r
141 //! Is device motion available.
\r
142 bool isDeviceMotionAvailable() override;
\r
144 //! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behavior.
\r
145 //! When set to 0 no double- and tripleclicks will be generated.
\r
146 void setDoubleClickTime( u32 timeMs ) override;
\r
148 //! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
\r
149 u32 getDoubleClickTime() const override;
\r
151 //! Remove all messages pending in the system message loop
\r
152 void clearSystemMessages() override;
\r
154 //! Resize the render window.
\r
155 void setWindowSize(const irr::core::dimension2d<u32>& size) override {}
\r
159 void createGUIAndScene();
\r
161 //! checks version of SDK and prints warning if there might be a problem
\r
162 bool checkVersion(const char* version);
\r
164 //! Compares to the last call of this function to return double and triple clicks.
\r
165 /** Needed for win32 device event handling
\r
166 \return Returns only 1,2 or 3. A 4th click will start with 1 again.
\r
168 virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent);
\r
170 //! Checks whether the input device should take input from the IME
\r
173 video::IVideoDriver* VideoDriver;
\r
174 gui::IGUIEnvironment* GUIEnvironment;
\r
175 scene::ISceneManager* SceneManager;
\r
177 gui::ICursorControl* CursorControl;
\r
178 IEventReceiver* UserReceiver;
\r
180 IOSOperator* Operator;
\r
181 io::IFileSystem* FileSystem;
\r
182 scene::ISceneManager* InputReceivingSceneManager;
\r
184 struct SMouseMultiClicks
\r
186 SMouseMultiClicks()
\r
187 : DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)
\r
190 u32 DoubleClickTime;
\r
191 u32 CountSuccessiveClicks;
\r
193 core::position2di LastClick;
\r
194 EMOUSE_INPUT_EVENT LastMouseInputEvent;
\r
196 SMouseMultiClicks MouseMultiClicks;
\r
197 video::IContextManager* ContextManager;
\r
198 SIrrlichtCreationParameters CreationParams;
\r
202 } // end namespace irr
\r