Irrlicht 3D Engine
irr::IrrlichtDevice Class Reference

The Irrlicht device. You can create it with createDevice() or createDeviceEx(). More...

#include <IrrlichtDevice.h>

+ Inheritance diagram for irr::IrrlichtDevice:

List of all members.

Public Member Functions

Static Public Member Functions

Detailed Description

The Irrlicht device. You can create it with createDevice() or createDeviceEx().

This is the most important class of the Irrlicht Engine. You can access everything in the engine if you have a pointer to an instance of this class. There should be only one instance of this class at any time.

Definition at line 43 of file IrrlichtDevice.h.

Member Function Documentation

virtual bool irr::IrrlichtDevice::activateJoysticks ( core::array< SJoystickInfo > &  joystickInfo) [pure virtual]

Activate any joysticks, and generate events for them.

Irrlicht contains support for joysticks, but does not generate joystick events by default, as this would consume joystick info that 3rd party libraries might rely on. Call this method to activate joystick support in Irrlicht and to receive irr::SJoystickEvent events.

joystickInfoOn return, this will contain an array of each joystick that was found and activated.
true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, false if joysticks are not supported or support is compiled out.
virtual void irr::IrrlichtDevice::clearSystemMessages ( ) [pure virtual]

Remove messages pending in the system message loop.

This function is usually used after messages have been buffered for a longer time, for example when loading a large scene. Clearing the message loop prevents that mouse- or buttonclicks which users have pressed in the meantime will now trigger unexpected actions in the gui.
So far the following messages are cleared:
Win32: All keyboard and mouse messages
Linux: All keyboard and mouse messages
All other devices are not yet supported here.
The function is still somewhat experimental, as the kind of messages we clear is based on just a few use-cases. If you think further messages should be cleared, or some messages should not be cleared here, then please tell us.

virtual void irr::IrrlichtDevice::closeDevice ( ) [pure virtual]

Notifies the device that it should close itself.

IrrlichtDevice::run() will always return false after closeDevice() was called.

virtual IRandomizer* irr::IrrlichtDevice::createDefaultRandomizer ( ) const [pure virtual]

Creates a new default randomizer.

The default randomizer provides the random sequence known from previous Irrlicht versions and is the initial randomizer set on device creation.

Pointer to the default IRandomizer object.
virtual video::ECOLOR_FORMAT irr::IrrlichtDevice::getColorFormat ( ) const [pure virtual]

Get the current color format of the window.

Color format of the window.
virtual gui::ICursorControl* irr::IrrlichtDevice::getCursorControl ( ) [pure virtual]

Provides access to the cursor control.

Pointer to the mouse cursor control interface.
virtual IEventReceiver* irr::IrrlichtDevice::getEventReceiver ( ) [pure virtual]

Provides access to the current event receiver.

Pointer to the current event receiver. Returns 0 if there is none.
virtual io::IFileSystem* irr::IrrlichtDevice::getFileSystem ( ) [pure virtual]

Provides access to the virtual file system.

Pointer to the file system.
virtual bool irr::IrrlichtDevice::getGammaRamp ( f32 red,
f32 green,
f32 blue,
f32 brightness,
f32 contrast 
) [pure virtual]

Get the current Gamma Value for the Display.

virtual gui::IGUIEnvironment* irr::IrrlichtDevice::getGUIEnvironment ( ) [pure virtual]

Provides access to the 2d user interface environment.

Pointer to the gui environment.
virtual ILogger* irr::IrrlichtDevice::getLogger ( ) [pure virtual]

Provides access to the message logger.

Pointer to the logger.
virtual IOSOperator* irr::IrrlichtDevice::getOSOperator ( ) [pure virtual]

Provides access to the operation system operator object.

The OS operator provides methods for getting system specific informations and doing system specific operations, such as exchanging data with the clipboard or reading the operation system version.

Pointer to the OS operator.
virtual IRandomizer* irr::IrrlichtDevice::getRandomizer ( ) const [pure virtual]

Provides access to the engine's currently set randomizer.

Pointer to the IRandomizer object.
virtual scene::ISceneManager* irr::IrrlichtDevice::getSceneManager ( ) [pure virtual]

Provides access to the scene manager.

Pointer to the scene manager.
virtual ITimer* irr::IrrlichtDevice::getTimer ( ) [pure virtual]

Provides access to the engine's timer.

The system time can be retrieved by it as well as the virtual time, which also can be manipulated.

Pointer to the ITimer object.
virtual E_DEVICE_TYPE irr::IrrlichtDevice::getType ( ) const [pure virtual]

Get the type of the device.

This allows the user to check which windowing system is currently being used.

virtual const c8* irr::IrrlichtDevice::getVersion ( ) const [pure virtual]

Get the version of the engine.

The returned string will look like this: "1.2.3" or this: "1.2".

String which contains the version.
virtual video::IVideoDriver* irr::IrrlichtDevice::getVideoDriver ( ) [pure virtual]

Provides access to the video driver for drawing 3d and 2d geometry.

Pointer the video driver.
virtual video::IVideoModeList* irr::IrrlichtDevice::getVideoModeList ( ) [pure virtual]

Gets a list with all video modes available.

If you are confused now, because you think you have to create an Irrlicht Device with a video mode before being able to get the video mode list, let me tell you that there is no need to start up an Irrlicht Device with EDT_DIRECT3D8, EDT_OPENGL or EDT_SOFTWARE: For this (and for lots of other reasons) the null driver, EDT_NULL exists.

Pointer to a list with all video modes supported by the gfx adapter.
static bool irr::IrrlichtDevice::isDriverSupported ( video::E_DRIVER_TYPE  driver) [inline, static]

Check if a driver type is supported by the engine.

Even if true is returned the driver may not be available for a configuration requested when creating the device.

Definition at line 277 of file IrrlichtDevice.h.

References irr::video::EDT_BURNINGSVIDEO, irr::video::EDT_DIRECT3D8, irr::video::EDT_DIRECT3D9, irr::video::EDT_NULL, irr::video::EDT_OPENGL, and irr::video::EDT_SOFTWARE.

virtual bool irr::IrrlichtDevice::isFullscreen ( ) const [pure virtual]

Checks if the Irrlicht window is running in fullscreen mode.

True if window is fullscreen.
virtual bool irr::IrrlichtDevice::isWindowActive ( ) const [pure virtual]

Returns if the window is active.

If the window is inactive, nothing needs to be drawn. So if you don't want to draw anything when the window is inactive, create your drawing loop this way:

            if (device->isWindowActive())
                // draw everything here
True if window is active.
virtual bool irr::IrrlichtDevice::isWindowFocused ( ) const [pure virtual]

Checks if the Irrlicht window has focus.

True if window has focus.
virtual bool irr::IrrlichtDevice::isWindowMinimized ( ) const [pure virtual]

Checks if the Irrlicht window is minimized.

True if window is minimized.
virtual void irr::IrrlichtDevice::maximizeWindow ( ) [pure virtual]

Maximizes the window if possible.

virtual void irr::IrrlichtDevice::minimizeWindow ( ) [pure virtual]

Minimizes the window if possible.

virtual bool irr::IrrlichtDevice::postEventFromUser ( const SEvent event) [pure virtual]

Sends a user created event to the engine.

Is is usually not necessary to use this. However, if you are using an own input library for example for doing joystick input, you can use this to post key or mouse input events to the engine. Internally, this method only delegates the events further to the scene manager and the GUI environment.

virtual void irr::IrrlichtDevice::restoreWindow ( ) [pure virtual]

Restore the window to normal size if possible.

virtual bool irr::IrrlichtDevice::run ( ) [pure virtual]

Runs the device.

Also increments the virtual timer by calling ITimer::tick();. You can prevent this by calling ITimer::stop(); before and ITimer::start() after calling IrrlichtDevice::run(). Returns false if device wants to be deleted. Use it in this way:

            // draw everything here

If you want the device to do nothing if the window is inactive (recommended), use the slightly enhanced code shown at isWindowActive().

Note if you are running Irrlicht inside an external, custom created window: Calling Device->run() will cause Irrlicht to dispatch windows messages internally. If you are running Irrlicht in your own custom window, you can also simply use your own message loop using GetMessage, DispatchMessage and whatever and simply don't use this method. But note that Irrlicht will not be able to fetch user input then. See irr::SIrrlichtCreationParameters::WindowId for more informations and example code.

virtual void irr::IrrlichtDevice::setEventReceiver ( IEventReceiver receiver) [pure virtual]

Sets a new user event receiver which will receive events from the engine.

Return true in IEventReceiver::OnEvent to prevent the event from continuing along the chain of event receivers. The path that an event takes through the system depends on its type. See irr::EEVENT_TYPE for details.

receiverNew receiver to be used.
virtual bool irr::IrrlichtDevice::setGammaRamp ( f32  red,
f32  green,
f32  blue,
f32  relativebrightness,
f32  relativecontrast 
) [pure virtual]

Set the current Gamma Value for the Display.

virtual void irr::IrrlichtDevice::setInputReceivingSceneManager ( scene::ISceneManager sceneManager) [pure virtual]

Sets the input receiving scene manager.

If set to null, the main scene manager (returned by GetSceneManager()) will receive the input

sceneManagerNew scene manager to be used.
virtual void irr::IrrlichtDevice::setRandomizer ( IRandomizer r) [pure virtual]

Sets a new randomizer.

rPointer to the new IRandomizer object. This object is grab()'ed by the engine and will be released upon the next setRandomizer call or upon device destruction.
virtual void irr::IrrlichtDevice::setResizable ( bool  resize = false) [pure virtual]

Sets if the window should be resizable in windowed mode.

The default is false. This method only works in windowed mode.

resizeFlag whether the window should be resizable.
virtual void irr::IrrlichtDevice::setWindowCaption ( const wchar_t *  text) [pure virtual]

Sets the caption of the window.

text,:New text of the window caption.
virtual void irr::IrrlichtDevice::sleep ( u32  timeMs,
bool  pauseTimer = false 
) [pure virtual]

Pause execution and let other processes to run for a specified amount of time.

It may not wait the full given time, as sleep may be interrupted

timeMs,:Time to sleep for in milisecs.
pauseTimer,:If true, pauses the device timer while sleeping
virtual void irr::IrrlichtDevice::yield ( ) [pure virtual]

Cause the device to temporarily pause execution and let other processes run.

This should bring down processor usage without major performance loss for Irrlicht

The documentation for this class was generated from the following file: