2019-12-12 17:32:41 +01:00
|
|
|
// 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
|
|
|
|
|
2021-08-27 17:55:04 +02:00
|
|
|
#ifndef IRR_C_IRR_DEVICE_STUB_H_INCLUDED
|
|
|
|
#define IRR_C_IRR_DEVICE_STUB_H_INCLUDED
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
#include "IrrlichtDevice.h"
|
|
|
|
#include "IImagePresenter.h"
|
|
|
|
#include "SIrrCreationParameters.h"
|
|
|
|
#include "CVideoModeList.h"
|
|
|
|
#include "IContextManager.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
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::IVideoDriver* getVideoDriver() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! return file system
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual io::IFileSystem* getFileSystem() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! returns the gui environment
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual gui::IGUIEnvironment* getGUIEnvironment() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! returns the scene manager
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual scene::ISceneManager* getSceneManager() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! \return Returns a pointer to the mouse cursor control interface.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual gui::ICursorControl* getCursorControl() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns a pointer to a list with all video modes supported by the gfx adapter.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::IVideoModeList* getVideoModeList() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! return the context manager
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::IContextManager* getContextManager() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns a pointer to the ITimer object. With it the current Time can be received.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual ITimer* getTimer() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns the version of the engine.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual const char* getVersion() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! send the event to the right receiver
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool postEventFromUser(const SEvent& event) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets a new event receiver to receive events
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setEventReceiver(IEventReceiver* receiver) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns pointer to the current event receiver. Returns 0 if there is none.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IEventReceiver* getEventReceiver() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets the input receiving scene manager.
|
|
|
|
/** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns a pointer to the logger.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual ILogger* getLogger() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Provides access to the engine's currently set randomizer.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IRandomizer* getRandomizer() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Sets a new randomizer.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setRandomizer(IRandomizer* r) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Creates a new default randomizer.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IRandomizer* createDefaultRandomizer() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Returns the operation system opertator object.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual IOSOperator* getOSOperator() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Checks if the window is running in fullscreen mode.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool isFullscreen() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! get color format of the current window
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual video::ECOLOR_FORMAT getColorFormat() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Activate any joysticks, and generate events for them.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Set the current Gamma Value for the Display
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast ) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Get the current Gamma Value for the Display
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast ) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! 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.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setDoubleClickTime( u32 timeMs ) IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual u32 getDoubleClickTime() const IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Remove all messages pending in the system message loop
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void clearSystemMessages() IRR_OVERRIDE;
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
//! Resize the render window.
|
2021-08-27 14:55:10 +02:00
|
|
|
virtual void setWindowSize(const irr::core::dimension2d<u32>& size) IRR_OVERRIDE {}
|
2019-12-12 17:32:41 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
/** Needed for win32 device event handling
|
|
|
|
\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;
|
|
|
|
video::IContextManager* ContextManager;
|
|
|
|
SIrrlichtCreationParameters CreationParams;
|
|
|
|
bool Close;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif
|