arsa  2.7
IrrlichtDevice.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_IRRLICHT_DEVICE_H_INCLUDED__
6 #define __I_IRRLICHT_DEVICE_H_INCLUDED__
7 
8 #include "IReferenceCounted.h"
9 #include "dimension2d.h"
10 #include "IVideoDriver.h"
11 #include "EDriverTypes.h"
12 #include "EDeviceTypes.h"
13 #include "IEventReceiver.h"
14 #include "ICursorControl.h"
15 #include "IVideoModeList.h"
16 #include "ITimer.h"
17 #include "IOSOperator.h"
18 
19 namespace irr
20 {
21  class ILogger;
22  class IEventReceiver;
23  class IRandomizer;
24 
25  namespace io {
26  class IFileSystem;
27  } // end namespace io
28 
29  namespace gui {
30  class IGUIEnvironment;
31  } // end namespace gui
32 
33  namespace scene {
34  class ISceneManager;
35  } // end namespace scene
36 
37  namespace video {
38  class IContextManager;
39  } // end namespace video
40 
42 
47  class IrrlichtDevice : public virtual IReferenceCounted
48  {
49  public:
50 
52 
76  virtual bool run() = 0;
77 
79 
81  virtual void yield() = 0;
82 
84 
88  virtual void sleep(u32 timeMs, bool pauseTimer=false) = 0;
89 
91 
92  virtual video::IVideoDriver* getVideoDriver() = 0;
93 
95 
96  virtual io::IFileSystem* getFileSystem() = 0;
97 
99 
101 
103 
104  virtual scene::ISceneManager* getSceneManager() = 0;
105 
107 
108  virtual gui::ICursorControl* getCursorControl() = 0;
109 
111 
112  virtual ILogger* getLogger() = 0;
113 
115 
121 
124 
126 
131  virtual IOSOperator* getOSOperator() = 0;
132 
134 
137  virtual ITimer* getTimer() = 0;
138 
140 
141  virtual IRandomizer* getRandomizer() const =0;
142 
144 
147  virtual void setRandomizer(IRandomizer* r) =0;
148 
150 
153  virtual IRandomizer* createDefaultRandomizer() const =0;
154 
156 
157  virtual void setWindowCaption(const wchar_t* text) = 0;
158 
160 
175  virtual bool isWindowActive() const = 0;
176 
178 
179  virtual bool isWindowFocused() const = 0;
180 
182 
183  virtual bool isWindowMinimized() const = 0;
184 
186 
187  virtual bool isFullscreen() const = 0;
188 
190 
191  virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
192 
194 
195  virtual void closeDevice() = 0;
196 
198 
201  virtual const c8* getVersion() const = 0;
202 
204 
208  virtual void setEventReceiver(IEventReceiver* receiver) = 0;
209 
211 
212  virtual IEventReceiver* getEventReceiver() = 0;
213 
215 
220  virtual bool postEventFromUser(const SEvent& event) = 0;
221 
223 
226  virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) = 0;
227 
229 
232  virtual void setResizable(bool resize=false) = 0;
233 
235 
239  virtual void setWindowSize(const irr::core::dimension2d<u32>& size) = 0;
240 
242  virtual void minimizeWindow() =0;
243 
245  virtual void maximizeWindow() =0;
246 
248  virtual void restoreWindow() =0;
249 
251  virtual core::position2di getWindowPosition() = 0;
252 
254 
261  virtual bool activateJoysticks(core::array<SJoystickInfo>& joystickInfo) =0;
262 
264  virtual bool activateAccelerometer(float updateInterval = 0.016666f) = 0;
265 
267  virtual bool deactivateAccelerometer() = 0;
268 
270  virtual bool isAccelerometerActive() = 0;
271 
273  virtual bool isAccelerometerAvailable() = 0;
274 
276  virtual bool activateGyroscope(float updateInterval = 0.016666f) = 0;
277 
279  virtual bool deactivateGyroscope() = 0;
280 
282  virtual bool isGyroscopeActive() = 0;
283 
285  virtual bool isGyroscopeAvailable() = 0;
286 
288  virtual bool activateDeviceMotion(float updateInterval = 0.016666f) = 0;
289 
291  virtual bool deactivateDeviceMotion() = 0;
292 
294  virtual bool isDeviceMotionActive() = 0;
295 
297  virtual bool isDeviceMotionAvailable() = 0;
298 
300  virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
301  f32 relativebrightness, f32 relativecontrast) =0;
302 
304  virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
305  f32 &brightness, f32 &contrast) =0;
306 
308 
311  virtual void setDoubleClickTime(u32 timeMs) =0;
312 
314 
317  virtual u32 getDoubleClickTime() const =0;
318 
320 
329  virtual void clearSystemMessages() = 0;
330 
332 
334  virtual E_DEVICE_TYPE getType() const = 0;
335 
337 
340  {
341  switch (driver)
342  {
343  case video::EDT_NULL:
344  return true;
345  case video::EDT_SOFTWARE:
346 #ifdef _IRR_COMPILE_WITH_SOFTWARE_
347  return true;
348 #else
349  return false;
350 #endif
352 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
353  return true;
354 #else
355  return false;
356 #endif
358 #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
359  return true;
360 #else
361  return false;
362 #endif
363  case video::EDT_OPENGL:
364 #ifdef _IRR_COMPILE_WITH_OPENGL_
365  return true;
366 #else
367  return false;
368 #endif
369  case video::EDT_OGLES1:
370 #ifdef _IRR_COMPILE_WITH_OGLES1_
371  return true;
372 #else
373  return false;
374 #endif
375  case video::EDT_OGLES2:
376 #ifdef _IRR_COMPILE_WITH_OGLES2_
377  return true;
378 #else
379  return false;
380 #endif
381  case video::EDT_WEBGL1:
382 #ifdef _IRR_COMPILE_WITH_WEBGL1_
383  return true;
384 #else
385  return false;
386 #endif
387  default:
388  return false;
389  }
390  }
391  };
392 
393 } // end namespace irr
394 
395 #endif
396 
virtual void setEventReceiver(IEventReceiver *receiver)=0
Sets a new user event receiver which will receive events from the engine.
The FileSystem manages files and archives and provides access to them.
Definition: IFileSystem.h:32
virtual IOSOperator * getOSOperator()=0
Provides access to the operation system operator object.
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
Check if a driver type is supported by the engine.
virtual void sleep(u32 timeMs, bool pauseTimer=false)=0
Pause execution and let other processes to run for a specified amount of time.
virtual bool isAccelerometerActive()=0
Is accelerometer active.
E_DEVICE_TYPE
An enum for the different device types supported by the Irrlicht Engine.
Definition: EDeviceTypes.h:12
virtual bool isWindowFocused() const =0
Checks if the Irrlicht window has the input focus.
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast)=0
Get the current Gamma Value for the Display.
virtual void restoreWindow()=0
Restore the window to normal size if possible.
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
Interface for generating random numbers.
Definition: IRandomizer.h:14
A list of all available video modes.
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
virtual void closeDevice()=0
Notifies the device that it should close itself.
virtual video::IContextManager * getContextManager()=0
Get context manager.
virtual bool deactivateDeviceMotion()=0
Deactivate device motion.
virtual bool deactivateGyroscope()=0
Deactivate gyroscope.
char c8
8 bit character variable.
Definition: irrTypes.h:35
Direct3D 9 device, only available on Win32 platforms.
Definition: EDriverTypes.h:48
GLbyte green
virtual E_DEVICE_TYPE getType() const =0
Get the type of the device.
The Irrlicht device. You can create it with createDevice() or createDeviceEx().
virtual video::ECOLOR_FORMAT getColorFormat() const =0
Get the current color format of the window.
virtual ITimer * getTimer()=0
Provides access to the engine's timer.
virtual bool postEventFromUser(const SEvent &event)=0
Sends a user created event to the engine.
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition: SColor.h:20
OpenGL device, available on most platforms.
Definition: EDriverTypes.h:53
virtual bool deactivateAccelerometer()=0
Deactivate accelerometer.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
virtual bool activateJoysticks(core::array< SJoystickInfo > &joystickInfo)=0
Activate any joysticks, and generate events for them.
virtual IRandomizer * getRandomizer() const =0
Provides access to the engine's currently set randomizer.
virtual void clearSystemMessages()=0
Remove messages pending in the system message loop.
GUI Environment. Used as factory and manager of all other GUI elements.
GLsizeiptr size
The Irrlicht Engine Software renderer.
Definition: EDriverTypes.h:28
png_structrp int png_fixed_point red
Definition: png.h:1118
virtual bool activateDeviceMotion(float updateInterval=0.016666f)=0
Activate device motion.
virtual void setRandomizer(IRandomizer *r)=0
Sets a new randomizer.
virtual void setDoubleClickTime(u32 timeMs)=0
Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse....
virtual IEventReceiver * getEventReceiver()=0
Provides access to the current event receiver.
Interface of an object which can receive events.
virtual bool activateGyroscope(float updateInterval=0.016666f)=0
Activate gyroscope.
E_DRIVER_TYPE
An enum for all types of drivers the Irrlicht Engine supports.
Definition: EDriverTypes.h:16
virtual bool setGammaRamp(f32 red, f32 green, f32 blue, f32 relativebrightness, f32 relativecontrast)=0
Set the current Gamma Value for the Display.
Null driver, useful for applications to run the engine without visualization.
Definition: EDriverTypes.h:21
virtual bool isGyroscopeActive()=0
Is gyroscope active.
struct _cl_event * event
GLfloat f
virtual bool isWindowMinimized() const =0
Checks if the Irrlicht window is minimized.
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
Interface for logging messages, warnings and errors.
Definition: ILogger.h:38
virtual void setResizable(bool resize=false)=0
Sets if the window should be resizable in windowed mode.
Interface for getting and manipulating the virtual time.
Definition: ITimer.h:14
virtual void yield()=0
Cause the device to temporarily pause execution and let other processes run.
Interface to manipulate the mouse cursor.
virtual bool isDeviceMotionActive()=0
Is device motion active.
virtual scene::ISceneManager * getSceneManager()=0
Provides access to the scene manager.
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition: IVideoDriver.h:151
The Operating system operator provides operation system specific methods and information.
Definition: IOSOperator.h:15
virtual IRandomizer * createDefaultRandomizer() const =0
Creates a new default randomizer.
virtual void setInputReceivingSceneManager(scene::ISceneManager *sceneManager)=0
Sets the input receiving scene manager.
OpenGL-ES 2.x driver, for embedded and mobile systems.
Definition: EDriverTypes.h:60
virtual bool isFullscreen() const =0
Checks if the Irrlicht window is running in fullscreen mode.
virtual bool isGyroscopeAvailable()=0
Is gyroscope available.
The Burning's Software Renderer, an alternative software renderer.
Definition: EDriverTypes.h:40
virtual bool activateAccelerometer(float updateInterval=0.016666f)=0
Activate accelerometer.
virtual bool run()=0
Runs the device.
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
Self reallocating template array (like stl vector) with additional features.
Definition: irrArray.h:22
virtual void setWindowCaption(const wchar_t *text)=0
Sets the caption of the window.
2d vector template class with lots of operators and methods.
Definition: dimension2d.h:16
GLbyte GLbyte blue
virtual u32 getDoubleClickTime() const =0
Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
Base class of most objects of the Irrlicht Engine.
virtual bool isDeviceMotionAvailable()=0
Is device motion available.
virtual bool isAccelerometerAvailable()=0
Is accelerometer available.
virtual core::position2di getWindowPosition()=0
Get the position of the frame on-screen.
virtual io::IFileSystem * getFileSystem()=0
Provides access to the virtual file system.
virtual void setWindowSize(const irr::core::dimension2d< u32 > &size)=0
Resize the render window.
virtual void minimizeWindow()=0
Minimizes the window if possible.
virtual void maximizeWindow()=0
Maximizes the window if possible.
WebGL1 friendly subset of OpenGL-ES 2.x driver for Emscripten.
Definition: EDriverTypes.h:63
virtual video::IVideoModeList * getVideoModeList()=0
Gets a list with all video modes available.
virtual bool isWindowActive() const =0
Returns if the window is active.
OpenGL-ES 1.x driver, for embedded and mobile systems.
Definition: EDriverTypes.h:56
virtual video::IVideoDriver * getVideoDriver()=0
Provides access to the video driver for drawing 3d and 2d geometry.
virtual gui::ICursorControl * getCursorControl()=0
Provides access to the cursor control.
virtual gui::IGUIEnvironment * getGUIEnvironment()=0
Provides access to the 2d user interface environment.
virtual const c8 * getVersion() const =0
Get the version of the engine.
virtual ILogger * getLogger()=0
Provides access to the message logger.