The Irrlicht device. You can create it with createDevice() or createDeviceEx().
More...
#include <SagaDevice.h>
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 35 of file SagaDevice.h.
◆ ~SagaDevice()
virtual saga::SagaDevice::~SagaDevice |
( |
| ) |
|
|
inlinevirtual |
◆ addEventReceiver()
virtual void saga::SagaDevice::addEventReceiver |
( |
IEventReceiver * |
receiver | ) |
|
|
pure virtual |
Register your event listener, which receives SDL_Event.
- Parameters
-
◆ closeDevice()
virtual void saga::SagaDevice::closeDevice |
( |
| ) |
|
|
pure virtual |
Notifies the device that it should close itself.
IrrlichtDevice::run() will always return false after closeDevice() was called.
◆ getAspectRatio()
virtual float saga::SagaDevice::getAspectRatio |
( |
| ) |
const |
|
pure virtual |
◆ getHeight()
virtual std::uint32_t saga::SagaDevice::getHeight |
( |
| ) |
const |
|
pure virtual |
◆ getSceneManager()
Provides access to the scene manager.
- Returns
- Pointer to the scene manager.
◆ getTime()
virtual std::uint32_t saga::SagaDevice::getTime |
( |
| ) |
const |
|
pure virtual |
Returns time elapsed in milliseconds since initialization.
- Returns
- Time in milliseconds
◆ getVideoDriver()
Provides access to the video driver for drawing 3d and 2d geometry.
- Returns
- Pointer the video driver.
◆ getWidth()
virtual std::uint32_t saga::SagaDevice::getWidth |
( |
| ) |
const |
|
pure virtual |
◆ getWindowPosition()
virtual glm::ivec2 saga::SagaDevice::getWindowPosition |
( |
| ) |
|
|
pure virtual |
Get the position of the frame on-screen.
◆ isFullscreen()
virtual bool saga::SagaDevice::isFullscreen |
( |
| ) |
const |
|
pure virtual |
Checks if the Irrlicht window is running in fullscreen mode.
- Returns
- True if window is fullscreen.
◆ isWindowActive()
virtual bool saga::SagaDevice::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:
while(device->run())
{
if (device->isWindowActive())
{
}
else
device->yield();
}
- Returns
- True if window is active.
◆ isWindowFocused()
virtual bool saga::SagaDevice::isWindowFocused |
( |
| ) |
const |
|
pure virtual |
Checks if the Irrlicht window has focus.
- Returns
- True if window has focus.
◆ isWindowMinimized()
virtual bool saga::SagaDevice::isWindowMinimized |
( |
| ) |
const |
|
pure virtual |
Checks if the Irrlicht window is minimized.
- Returns
- True if window is minimized.
◆ maximizeWindow()
virtual void saga::SagaDevice::maximizeWindow |
( |
| ) |
|
|
pure virtual |
Maximizes the window if possible.
◆ minimizeWindow()
virtual void saga::SagaDevice::minimizeWindow |
( |
| ) |
|
|
pure virtual |
Minimizes the window if possible.
◆ restoreWindow()
virtual void saga::SagaDevice::restoreWindow |
( |
| ) |
|
|
pure virtual |
Restore the window to normal size if possible.
◆ run()
virtual bool saga::SagaDevice::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:
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 saga::SDeviceCreationParameters::WindowId for more information and example code.
◆ setResizable()
virtual void saga::SagaDevice::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.
- Parameters
-
resize | Flag whether the window should be resizable. |
◆ setWindowCaption()
virtual void saga::SagaDevice::setWindowCaption |
( |
const std::string & |
text | ) |
|
|
pure virtual |
Sets the caption of the window.
- Parameters
-
text | New text of the window caption. |
◆ setWindowSize()
virtual void saga::SagaDevice::setWindowSize |
( |
const glm::uvec2 & |
size | ) |
|
|
pure virtual |
Resize the render window.
This will only work in windowed mode and is not yet supported on all systems. It does set the drawing/clientDC size of the window, the window decorations are added to that. You get the current window size with IVideoDriver::getScreenSize() (might be unified in future)
◆ sleep()
virtual void saga::SagaDevice::sleep |
( |
std::uint32_t |
timeMs | ) |
|
|
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
- Parameters
-
timeMs | Time to sleep for in milliseconds. |
◆ yield()
virtual void saga::SagaDevice::yield |
( |
| ) |
|
|
pure virtual |
Cause the device to temporarily pause execution for 500ms and let other processes run.
This should bring down processor usage without major performance loss
The documentation for this class was generated from the following file: