Commit 32ae11b4 authored by bitplane's avatar bitplane

Applied Hybrid's device creation parameter changes to the Win32 device.

Clarified docs on event types and added a couple of links.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1370 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f8010d72
...@@ -24,14 +24,14 @@ namespace irr ...@@ -24,14 +24,14 @@ namespace irr
//! A mouse input event. //! A mouse input event.
/** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser /** Mouse events are created by the device and passed to IrrlichtDevice::postEventFromUser
in response to mouse input received from the operating system. in response to mouse input received from the operating system.
Mouse events are first passed to the user receiver, then to the GUI environment (and possibly Mouse events are first passed to the user receiver, then to the GUI environment and its elements,
many GUI elements), then finally the input receiving scene manager (and possibly the active then finally the input receiving scene manager where it is passed to the active camera.
camera) */ */
EET_MOUSE_INPUT_EVENT, EET_MOUSE_INPUT_EVENT,
//! A key input event. //! A key input event.
/** Keyboard events are also created by the device and passed to IrrlichtDevice::postEventFromUser. /** Like mouse events, keyboard events are created by the device and passed to
They take the same path as mouse events. */ IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
EET_KEY_INPUT_EVENT, EET_KEY_INPUT_EVENT,
//! A log event //! A log event
...@@ -40,8 +40,7 @@ namespace irr ...@@ -40,8 +40,7 @@ namespace irr
EET_LOG_TEXT_EVENT, EET_LOG_TEXT_EVENT,
//! A user event with user data. //! A user event with user data.
/** This is not used by Irrlicht and can be used /** This is not used by Irrlicht and can be used to send user specific data though the system. */
to send user specific data though the system. */
EET_USER_EVENT EET_USER_EVENT
}; };
......
...@@ -161,8 +161,11 @@ namespace irr ...@@ -161,8 +161,11 @@ namespace irr
\return String which contains the version. */ \return String which contains the version. */
virtual const c8* getVersion() const = 0; virtual const c8* getVersion() const = 0;
//! Sets a new event receiver to receive events. //! Sets a new user event receiver which will receive events from the engine.
/** \param receiver New receiver to be used. */ /** 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.
\param receiver New receiver to be used. */
virtual void setEventReceiver(IEventReceiver* receiver) = 0; virtual void setEventReceiver(IEventReceiver* receiver) = 0;
//! Provides access to the current event receiver. //! Provides access to the current event receiver.
......
...@@ -277,33 +277,27 @@ namespace irr ...@@ -277,33 +277,27 @@ namespace irr
{ {
//! constructor //! constructor
CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType, CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
core::dimension2d<s32> windowSize, : CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false),
u32 bits, bool fullscreen, FullScreen(CreationParams.Fullscreen), IsNonNTWindows(false), Resized(false),
bool stencilbuffer, bool vsync,
bool antiAlias,
bool highPrecisionFPU,
HWND externalWindow,
const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(param), HWnd(0), ChangedToFullScreen(false),
FullScreen(fullscreen), IsNonNTWindows(false), Resized(false),
ExternalWindow(false), Win32CursorControl(0) ExternalWindow(false), Win32CursorControl(0)
{ {
#ifdef _DEBUG
setDebugName("CIrrDeviceWin32");
#endif
// get windows version and create OS operator
core::stringc winversion; core::stringc winversion;
getWindowsVersion(winversion); getWindowsVersion(winversion);
Operator = new COSOperator(winversion.c_str()); Operator = new COSOperator(winversion.c_str());
os::Printer::log(winversion.c_str(), ELL_INFORMATION); os::Printer::log(winversion.c_str(), ELL_INFORMATION);
// create window // get handle to exe file
HINSTANCE hInstance = GetModuleHandle(0); HINSTANCE hInstance = GetModuleHandle(0);
#ifdef _DEBUG // create the window if we need to and we do not use the null device
setDebugName("CIrrDeviceWin32"); if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
#endif
// create the window, only if we do not use the null device
if (driverType != video::EDT_NULL && externalWindow==0)
{ {
const c8* ClassName = "CIrrDeviceWin32"; const c8* ClassName = "CIrrDeviceWin32";
...@@ -332,12 +326,12 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType, ...@@ -332,12 +326,12 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType,
RECT clientSize; RECT clientSize;
clientSize.top = 0; clientSize.top = 0;
clientSize.left = 0; clientSize.left = 0;
clientSize.right = windowSize.Width; clientSize.right = CreationParams.WindowSize.Width;
clientSize.bottom = windowSize.Height; clientSize.bottom = CreationParams.WindowSize.Height;
DWORD style = WS_POPUP; DWORD style = WS_POPUP;
if (!fullscreen) if (!CreationParams.Fullscreen)
style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
AdjustWindowRect(&clientSize, style, FALSE); AdjustWindowRect(&clientSize, style, FALSE);
...@@ -348,7 +342,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType, ...@@ -348,7 +342,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType,
s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2; s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2; s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
if (fullscreen) if (CreationParams.Fullscreen)
{ {
windowLeft = 0; windowLeft = 0;
windowTop = 0; windowTop = 0;
...@@ -367,25 +361,25 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType, ...@@ -367,25 +361,25 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType,
} }
// attach external window // attach external window
if (externalWindow) if (CreationParams.WindowId)
{ {
HWnd = externalWindow; HWnd = static_cast<HWND>(CreationParams.WindowId);
RECT r; RECT r;
GetWindowRect(HWnd, &r); GetWindowRect(HWnd, &r);
windowSize.Width = r.right - r.left; CreationParams.WindowSize.Width = r.right - r.left;
windowSize.Height = r.bottom - r.top; CreationParams.WindowSize.Height = r.bottom - r.top;
fullscreen = false; CreationParams.Fullscreen = false;
ExternalWindow = true; ExternalWindow = true;
} }
// create cursor control // create cursor control
Win32CursorControl = new CCursorControl(windowSize, HWnd, fullscreen); Win32CursorControl = new CCursorControl(CreationParams.WindowSize, HWnd, CreationParams.Fullscreen);
CursorControl = Win32CursorControl; CursorControl = Win32CursorControl;
// create driver // create driver
createDriver(driverType, windowSize, bits, fullscreen, stencilbuffer, vsync, antiAlias, highPrecisionFPU); createDriver();
if (VideoDriver) if (VideoDriver)
createGUIAndScene(); createGUIAndScene();
...@@ -424,21 +418,18 @@ CIrrDeviceWin32::~CIrrDeviceWin32() ...@@ -424,21 +418,18 @@ CIrrDeviceWin32::~CIrrDeviceWin32()
//! create the driver //! create the driver
void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, void CIrrDeviceWin32::createDriver()
const core::dimension2d<s32>& windowSize,
u32 bits,
bool fullscreen,
bool stencilbuffer,
bool vsync,
bool antiAlias,
bool highPrecisionFPU)
{ {
switch(driverType) switch(CreationParams.DriverType)
{ {
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
VideoDriver = video::createDirectX8Driver(windowSize, HWnd, bits, fullscreen,
stencilbuffer, FileSystem, false, highPrecisionFPU, vsync, antiAlias); VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias);
if (!VideoDriver) if (!VideoDriver)
{ {
os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR); os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR);
...@@ -451,8 +442,12 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -451,8 +442,12 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
VideoDriver = video::createDirectX9Driver(windowSize, HWnd, bits, fullscreen,
stencilbuffer, FileSystem, false, highPrecisionFPU, vsync, antiAlias); VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd,
CreationParams.Bits, CreationParams.Fullscreen, CreationParams.Stencilbuffer,
FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync,
CreationParams.AntiAlias);
if (!VideoDriver) if (!VideoDriver)
{ {
os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR); os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR);
...@@ -466,9 +461,13 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -466,9 +461,13 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits);
VideoDriver = video::createOpenGLDriver(windowSize, HWnd, bits, fullscreen, stencilbuffer, FileSystem, if (CreationParams.Fullscreen)
vsync, antiAlias); switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
VideoDriver = video::createOpenGLDriver(CreationParams.WindowSize, HWnd, CreationParams.Bits,
CreationParams.Fullscreen, CreationParams.Stencilbuffer, FileSystem,
CreationParams.Vsync, CreationParams.AntiAlias);
if (!VideoDriver) if (!VideoDriver)
{ {
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR); os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
...@@ -481,8 +480,10 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -481,8 +480,10 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_SOFTWARE: case video::EDT_SOFTWARE:
#ifdef _IRR_COMPILE_WITH_SOFTWARE_ #ifdef _IRR_COMPILE_WITH_SOFTWARE_
if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits); if (CreationParams.Fullscreen)
VideoDriver = video::createSoftwareDriver(windowSize, fullscreen, FileSystem, this); switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
#else #else
os::Printer::log("Software driver was not compiled in.", ELL_ERROR); os::Printer::log("Software driver was not compiled in.", ELL_ERROR);
#endif #endif
...@@ -491,8 +492,10 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -491,8 +492,10 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_BURNINGSVIDEO: case video::EDT_BURNINGSVIDEO:
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
if (fullscreen) switchToFullScreen(windowSize.Width, windowSize.Height, bits); if (CreationParams.Fullscreen)
VideoDriver = video::createSoftwareDriver2(windowSize, fullscreen, FileSystem, this); switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
#else #else
os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR); os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR);
#endif #endif
...@@ -500,7 +503,7 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -500,7 +503,7 @@ void CIrrDeviceWin32::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_NULL: case video::EDT_NULL:
// create null driver // create null driver
VideoDriver = video::createNullDriver(FileSystem, windowSize); VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break; break;
default: default:
...@@ -928,17 +931,7 @@ void CIrrDeviceWin32::setResizeAble(bool resize) ...@@ -928,17 +931,7 @@ void CIrrDeviceWin32::setResizeAble(bool resize)
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx( IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters) const SIrrlichtCreationParameters& parameters)
{ {
CIrrDeviceWin32* dev = new CIrrDeviceWin32( CIrrDeviceWin32* dev = new CIrrDeviceWin32(parameters);
parameters.DriverType,
parameters.WindowSize,
parameters.Bits,
parameters.Fullscreen,
parameters.Stencilbuffer,
parameters.Vsync,
parameters.AntiAlias,
parameters.HighPrecisionFPU,
reinterpret_cast<HWND>(parameters.WindowId),
parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL) if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{ {
......
...@@ -22,12 +22,7 @@ namespace irr ...@@ -22,12 +22,7 @@ namespace irr
public: public:
//! constructor //! constructor
CIrrDeviceWin32(video::E_DRIVER_TYPE deviceType, CIrrDeviceWin32(const SIrrlichtCreationParameters& params);
core::dimension2d<s32> windowSize, u32 bits,
bool fullscreen, bool stencilbuffer, bool vsync,
bool antiAlias, bool highPrecisionFPU,
HWND window,
const SIrrlichtCreationParameters& params);
//! destructor //! destructor
virtual ~CIrrDeviceWin32(); virtual ~CIrrDeviceWin32();
...@@ -233,9 +228,7 @@ namespace irr ...@@ -233,9 +228,7 @@ namespace irr
private: private:
//! create the driver //! create the driver
void createDriver(video::E_DRIVER_TYPE driverType, void createDriver();
const core::dimension2d<s32>& windowSize, u32 bits, bool fullscreen,
bool stencilbuffer, bool vsync, bool antiAlias, bool highPrecisionFPU);
//! switchs to fullscreen //! switchs to fullscreen
bool switchToFullScreen(s32 width, s32 height, s32 bits); bool switchToFullScreen(s32 width, s32 height, s32 bits);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment