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