1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__
6
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
8
#include "IrrlichtDevice.h"
9
#include "IImagePresenter.h"
10
#include "SIrrCreationParameters.h"
11
#include "CVideoModeList.h"
15
// lots of prototypes:
22
class IGUIEnvironment;
23
IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
24
video::IVideoDriver* Driver, IOSOperator* op);
29
ISceneManager* createSceneManager(video::IVideoDriver* driver,
30
io::IFileSystem* fs, gui::ICursorControl* cc, gui::IGUIEnvironment *gui);
35
IFileSystem* createFileSystem();
40
IVideoDriver* createSoftwareDriver(const core::dimension2d<u32>& windowSize,
41
bool fullscreen, io::IFileSystem* io,
42
video::IImagePresenter* presenter);
43
IVideoDriver* createBurningVideoDriver(const irr::SIrrlichtCreationParameters& params,
44
io::IFileSystem* io, video::IImagePresenter* presenter);
45
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
50
//! Stub for an Irrlicht Device implementation
51
class CIrrDeviceStub : public IrrlichtDevice
56
CIrrDeviceStub(const SIrrlichtCreationParameters& param);
59
virtual ~CIrrDeviceStub();
61
//! returns the video driver
62
virtual video::IVideoDriver* getVideoDriver();
64
//! return file system
65
virtual io::IFileSystem* getFileSystem();
67
//! returns the gui environment
68
virtual gui::IGUIEnvironment* getGUIEnvironment();
70
//! returns the scene manager
71
virtual scene::ISceneManager* getSceneManager();
73
//! \return Returns a pointer to the mouse cursor control interface.
74
virtual gui::ICursorControl* getCursorControl();
76
//! Returns a pointer to a list with all video modes supported by the gfx adapter.
77
virtual video::IVideoModeList* getVideoModeList();
79
//! Returns a pointer to the ITimer object. With it the current Time can be received.
80
virtual ITimer* getTimer();
82
//! Returns the version of the engine.
83
virtual const char* getVersion() const;
85
//! send the event to the right receiver
86
virtual bool postEventFromUser(const SEvent& event);
88
//! Sets a new event receiver to receive events
89
virtual void setEventReceiver(IEventReceiver* receiver);
91
//! Returns pointer to the current event receiver. Returns 0 if there is none.
92
virtual IEventReceiver* getEventReceiver();
94
//! Sets the input receiving scene manager.
95
/** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */
96
virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager);
98
//! Returns a pointer to the logger.
99
virtual ILogger* getLogger();
101
//! Provides access to the engine's currently set randomizer.
102
virtual IRandomizer* getRandomizer() const;
104
//! Sets a new randomizer.
105
virtual void setRandomizer(IRandomizer* r);
107
//! Creates a new default randomizer.
108
virtual IRandomizer* createDefaultRandomizer() const;
110
//! Returns the operation system opertator object.
111
virtual IOSOperator* getOSOperator();
113
//! Checks if the window is running in fullscreen mode.
114
virtual bool isFullscreen() const;
116
//! get color format of the current window
117
virtual video::ECOLOR_FORMAT getColorFormat() const;
119
//! Activate any joysticks, and generate events for them.
120
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
122
//! Set the current Gamma Value for the Display
123
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast );
125
//! Get the current Gamma Value for the Display
126
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast );
128
//! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behaviour.
129
//! When set to 0 no double- and tripleclicks will be generated.
130
virtual void setDoubleClickTime( u32 timeMs );
132
//! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
133
virtual u32 getDoubleClickTime() const;
135
//! Remove all messages pending in the system message loop
136
virtual void clearSystemMessages();
141
void createGUIAndScene();
143
//! checks version of SDK and prints warning if there might be a problem
144
bool checkVersion(const char* version);
146
//! Compares to the last call of this function to return double and triple clicks.
147
//! \return Returns only 1,2 or 3. A 4th click will start with 1 again.
148
virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent );
150
void calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast );
151
void calculateGammaFromRamp ( f32 &gamma, const u16 *ramp );
153
video::IVideoDriver* VideoDriver;
154
gui::IGUIEnvironment* GUIEnvironment;
155
scene::ISceneManager* SceneManager;
157
gui::ICursorControl* CursorControl;
158
IEventReceiver* UserReceiver;
160
IOSOperator* Operator;
161
IRandomizer* Randomizer;
162
io::IFileSystem* FileSystem;
163
scene::ISceneManager* InputReceivingSceneManager;
165
struct SMouseMultiClicks
168
: DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)
172
u32 CountSuccessiveClicks;
174
core::position2di LastClick;
175
EMOUSE_INPUT_EVENT LastMouseInputEvent;
177
SMouseMultiClicks MouseMultiClicks;
178
video::CVideoModeList VideoModeList;
179
SIrrlichtCreationParameters CreationParams;
183
} // end namespace irr