Nirtcpp 2.0.0
Nirtcpp is a high-performance c++ graphics engine.
NirtcppDevice.hpp
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 nirtcpp/nirtcpp.hpp
4
5#ifndef NIRT_I_NIRTCPP_DEVICE_HPP_INCLUDED
6#define NIRT_I_NIRTCPP_DEVICE_HPP_INCLUDED
7
8#include <nirtcpp/IReferenceCounted.hpp>
9#include <nirtcpp/dimension2d.hpp>
10#include <nirtcpp/IVideoDriver.hpp>
11#include <nirtcpp/EDriverTypes.hpp>
12#include <nirtcpp/EDeviceTypes.hpp>
13#include <nirtcpp/IEventReceiver.hpp>
14#include <nirtcpp/ICursorControl.hpp>
15#include <nirtcpp/IVideoModeList.hpp>
16#include <nirtcpp/ITimer.hpp>
17#include <nirtcpp/IOSOperator.hpp>
18
19namespace nirt
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 NirtcppDevice : 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
93
95
97
99
101
103
105
107
109
111
112 virtual ILogger* getLogger() = 0;
113
115
121
124
126
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
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
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
213
215
220 virtual bool postEventFromUser(const SEvent& event) = 0;
221
223
227
229
232 virtual void setResizable(bool resize=false) = 0;
233
235
239 virtual void setWindowSize(const nirt::core::dimension2d<u32>& size) = 0;
240
242 virtual void minimizeWindow() =0;
243
245 virtual void maximizeWindow() =0;
246
248 virtual void restoreWindow() =0;
249
252
254
261 virtual bool activateJoysticks(core::array<SJoystickInfo>& joystickInfo) =0;
262
264 virtual bool setGammaRamp(f32 red, f32 green, f32 blue,
265 f32 relativebrightness, f32 relativecontrast) =0;
266
268 virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
269 f32 &brightness, f32 &contrast) =0;
270
272
275 virtual void setDoubleClickTime(u32 timeMs) =0;
276
278
281 virtual u32 getDoubleClickTime() const =0;
282
284
293 virtual void clearSystemMessages() = 0;
294
296
298 virtual E_DEVICE_TYPE getType() const = 0;
299
301
304 {
305 switch (driver)
306 {
307 case video::EDT_NULL:
308 return true;
310#ifdef _NIRT_COMPILE_WITH_SOFTWARE_
311 return true;
312#else
313 return false;
314#endif
316#ifdef _NIRT_COMPILE_WITH_BURNINGSVIDEO_
317 return true;
318#else
319 return false;
320#endif
322#ifdef _NIRT_COMPILE_WITH_DIRECT3D_9_
323 return true;
324#else
325 return false;
326#endif
328#ifdef _NIRT_COMPILE_WITH_OPENGL_
329 return true;
330#else
331 return false;
332#endif
333 default:
334 return false;
335 }
336 }
337 };
338
339} // end namespace nirt
340
341#endif
Interface of an object which can receive events.
Definition: IEventReceiver.hpp:471
Interface for logging messages, warnings and errors.
Definition: ILogger.hpp:39
The Operating system operator provides operation system specific methods and information.
Definition: IOSOperator.hpp:16
Interface for generating random numbers.
Definition: IRandomizer.hpp:15
Base class of most objects of the Nirtcpp Engine.
Definition: IReferenceCounted.hpp:46
Interface for getting and manipulating the virtual time.
Definition: ITimer.hpp:15
The Nirtcpp device. You can create it with createDevice() or createDeviceEx().
Definition: NirtcppDevice.hpp:48
virtual void maximizeWindow()=0
Maximizes the window if possible.
virtual E_DEVICE_TYPE getType() const =0
Get the type of the device.
virtual video::IVideoModeList * getVideoModeList()=0
Gets a list with all video modes available.
virtual gui::ICursorControl * getCursorControl()=0
Provides access to the cursor control.
virtual IRandomizer * createDefaultRandomizer() const =0
Creates a new default randomizer.
virtual u32 getDoubleClickTime() const =0
Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
virtual gui::IGUIEnvironment * getGUIEnvironment()=0
Provides access to the 2d user interface environment.
virtual scene::ISceneManager * getSceneManager()=0
Provides access to the scene manager.
virtual bool postEventFromUser(const SEvent &event)=0
Sends a user created event to the engine.
virtual void clearSystemMessages()=0
Remove messages pending in the system message loop.
virtual core::position2di getWindowPosition()=0
Get the position of the frame on-screen.
virtual bool isWindowFocused() const =0
Checks if the Nirtcpp window has the input focus.
virtual void setEventReceiver(IEventReceiver *receiver)=0
Sets a new user event receiver which will receive events from the engine.
virtual void setResizable(bool resize=false)=0
Sets if the window should be resizable in windowed mode.
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 activateJoysticks(core::array< SJoystickInfo > &joystickInfo)=0
Activate any joysticks, and generate events for them.
virtual bool isFullscreen() const =0
Checks if the Nirtcpp window is running in fullscreen mode.
virtual bool isWindowMinimized() const =0
Checks if the Nirtcpp window is minimized.
virtual bool setGammaRamp(f32 red, f32 green, f32 blue, f32 relativebrightness, f32 relativecontrast)=0
Set the current Gamma Value for the Display.
virtual void setDoubleClickTime(u32 timeMs)=0
Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse....
virtual bool isWindowActive() const =0
Returns if the window is active.
virtual video::ECOLOR_FORMAT getColorFormat() const =0
Get the current color format of the window.
virtual void setInputReceivingSceneManager(scene::ISceneManager *sceneManager)=0
Sets the input receiving scene manager.
virtual void minimizeWindow()=0
Minimizes the window if possible.
virtual io::IFileSystem * getFileSystem()=0
Provides access to the virtual file system.
virtual ITimer * getTimer()=0
Provides access to the engine's timer.
virtual IRandomizer * getRandomizer() const =0
Provides access to the engine's currently set randomizer.
virtual video::IContextManager * getContextManager()=0
Get context manager.
virtual void yield()=0
Cause the device to temporarily pause execution and let other processes run.
virtual void closeDevice()=0
Notifies the device that it should close itself.
virtual void restoreWindow()=0
Restore the window to normal size if possible.
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast)=0
Get the current Gamma Value for the Display.
virtual video::IVideoDriver * getVideoDriver()=0
Provides access to the video driver for drawing 3d and 2d geometry.
virtual bool run()=0
Runs the device.
virtual ILogger * getLogger()=0
Provides access to the message logger.
virtual void setWindowCaption(const wchar_t *text)=0
Sets the caption of the window.
virtual void setRandomizer(IRandomizer *r)=0
Sets a new randomizer.
virtual IEventReceiver * getEventReceiver()=0
Provides access to the current event receiver.
virtual IOSOperator * getOSOperator()=0
Provides access to the operation system operator object.
virtual const c8 * getVersion() const =0
Get the version of the engine.
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
Check if a driver type is supported by the engine.
Definition: NirtcppDevice.hpp:303
virtual void setWindowSize(const nirt::core::dimension2d< u32 > &size)=0
Resize the render window.
Self reallocating template array (like stl vector) with additional features.
Definition: irrArray.hpp:23
2d vector template class with lots of operators and methods.
Definition: vector2d.hpp:22
Interface to manipulate the mouse cursor.
Definition: ICursorControl.hpp:98
GUI Environment. Used as factory and manager of all other GUI elements.
Definition: IGUIEnvironment.hpp:73
The FileSystem manages files and archives and provides access to them.
Definition: IFileSystem.hpp:33
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
Definition: ISceneManager.hpp:160
Definition: IContextManager.hpp:17
Interface to driver which is able to perform 2d and 3d graphics functions.
Definition: IVideoDriver.hpp:152
A list of all available video modes.
Definition: IVideoModeList.hpp:20
ECOLOR_FORMAT
An enum for the color format of textures used by the Nirtcpp Engine.
Definition: SColor.hpp:21
E_DRIVER_TYPE
An enum for all types of drivers the Nirtcpp Engine supports.
Definition: EDriverTypes.hpp:17
@ EDT_DIRECT3D9
Direct3D 9 device, only available on Win32 platforms.
Definition: EDriverTypes.hpp:48
@ EDT_NULL
Null driver, useful for applications to run the engine without visualization.
Definition: EDriverTypes.hpp:21
@ EDT_SOFTWARE
The Nirtcpp Engine Software renderer.
Definition: EDriverTypes.hpp:28
@ EDT_OPENGL
OpenGL device, available on most platforms.
Definition: EDriverTypes.hpp:53
@ EDT_BURNINGSVIDEO
The Burning's Software Renderer, an alternative software renderer.
Definition: EDriverTypes.hpp:40
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition: vector3d.hpp:11
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.hpp:64
char c8
8 bit character variable.
Definition: irrTypes.hpp:37
float f32
32 bit floating point variable.
Definition: irrTypes.hpp:110
E_DEVICE_TYPE
An enum for the different device types supported by the Nirtcpp Engine.
Definition: EDeviceTypes.hpp:13
SEvents hold information about an event. See nirt::IEventReceiver for details on event handling.
Definition: IEventReceiver.hpp:282