Commit f8010d72 authored by hybrid's avatar hybrid

Changed the device creation to make more use of SIrrlichtCreationParameters....

Changed the device creation to make more use of SIrrlichtCreationParameters. This should increase maintainability and ease addition of more configurable properties. The windows devices need to be adapted still, but should compile for now...

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1369 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 93ec1e0a
...@@ -41,9 +41,6 @@ namespace irr ...@@ -41,9 +41,6 @@ namespace irr
{ {
public: public:
//! Destructor
virtual ~IrrlichtDevice() {}
//! Runs the device. //! Runs the device.
/** Also increments the virtual timer by calling /** Also increments the virtual timer by calling
ITimer::tick();. You can prevent this ITimer::tick();. You can prevent this
......
...@@ -37,19 +37,12 @@ namespace irr ...@@ -37,19 +37,12 @@ namespace irr
const char* wmDeleteWindow = "WM_DELETE_WINDOW"; const char* wmDeleteWindow = "WM_DELETE_WINDOW";
//! constructor //! constructor
CIrrDeviceLinux::CIrrDeviceLinux(video::E_DRIVER_TYPE driverType, CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
const core::dimension2d<s32>& windowSize, : CIrrDeviceStub(param),
u32 bits, bool fullscreen,
bool sbuffer, bool vsync, bool antiAlias,
IEventReceiver* receiver,
Window externalWindow,
const char* version)
: CIrrDeviceStub(version, receiver),
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0), display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0),
#endif #endif
Fullscreen(fullscreen), StencilBuffer(sbuffer), AntiAlias(antiAlias), DriverType(driverType), Width(param.WindowSize.Width), Height(param.WindowSize.Height), Depth(24),
Width(windowSize.Width), Height(windowSize.Height), Depth(24),
Close(false), WindowActive(false), WindowMinimized(false), UseXVidMode(false), UseXRandR(false), UseGLXWindow(false), AutorepeatSupport(0) Close(false), WindowActive(false), WindowMinimized(false), UseXVidMode(false), UseXRandR(false), UseGLXWindow(false), AutorepeatSupport(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -77,18 +70,18 @@ CIrrDeviceLinux::CIrrDeviceLinux(video::E_DRIVER_TYPE driverType, ...@@ -77,18 +70,18 @@ CIrrDeviceLinux::CIrrDeviceLinux(video::E_DRIVER_TYPE driverType,
createKeyMap(); createKeyMap();
// create window // create window
if (driverType != video::EDT_NULL) if (CreationParams.DriverType != video::EDT_NULL)
{ {
// create the window, only if we do not use the null device // create the window, only if we do not use the null device
if (!createWindow(windowSize, bits, externalWindow)) if (!createWindow())
return; return;
} }
// create cursor control // create cursor control
CursorControl = new CCursorControl(this, driverType == video::EDT_NULL); CursorControl = new CCursorControl(this, CreationParams.DriverType == video::EDT_NULL);
// create driver // create driver
createDriver(windowSize, vsync); createDriver();
if (!VideoDriver) if (!VideoDriver)
return; return;
...@@ -97,7 +90,6 @@ CIrrDeviceLinux::CIrrDeviceLinux(video::E_DRIVER_TYPE driverType, ...@@ -97,7 +90,6 @@ CIrrDeviceLinux::CIrrDeviceLinux(video::E_DRIVER_TYPE driverType,
} }
//! destructor //! destructor
CIrrDeviceLinux::~CIrrDeviceLinux() CIrrDeviceLinux::~CIrrDeviceLinux()
{ {
...@@ -119,14 +111,14 @@ CIrrDeviceLinux::~CIrrDeviceLinux() ...@@ -119,14 +111,14 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_ #endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (UseXVidMode && Fullscreen) if (UseXVidMode && CreationParams.Fullscreen)
{ {
XF86VidModeSwitchToMode(display, screennr, &oldVideoMode); XF86VidModeSwitchToMode(display, screennr, &oldVideoMode);
XF86VidModeSetViewPort(display, screennr, 0, 0); XF86VidModeSetViewPort(display, screennr, 0, 0);
} }
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (UseXRandR && Fullscreen) if (UseXRandR && CreationParams.Fullscreen)
{ {
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display)); XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display));
XRRSetScreenConfig(display,config,DefaultRootWindow(display),oldRandrMode,oldRandrRotation,CurrentTime); XRRSetScreenConfig(display,config,DefaultRootWindow(display),oldRandrMode,oldRandrRotation,CurrentTime);
...@@ -134,7 +126,7 @@ CIrrDeviceLinux::~CIrrDeviceLinux() ...@@ -134,7 +126,7 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
} }
#endif #endif
if (DriverType == video::EDT_SOFTWARE || DriverType == video::EDT_BURNINGSVIDEO) if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO)
XDestroyImage(SoftwareImage); XDestroyImage(SoftwareImage);
XDestroyWindow(display,window); XDestroyWindow(display,window);
XCloseDisplay(display); XCloseDisplay(display);
...@@ -160,12 +152,8 @@ int IrrPrintXError(Display *display, XErrorEvent *event) ...@@ -160,12 +152,8 @@ int IrrPrintXError(Display *display, XErrorEvent *event)
bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, bool CIrrDeviceLinux::createWindow()
u32 bits, Window externalWindow)
{ {
Width = windowSize.Width;
Height = windowSize.Height;
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
#ifdef _DEBUG #ifdef _DEBUG
os::Printer::log("Creating X window...", ELL_INFORMATION); os::Printer::log("Creating X window...", ELL_INFORMATION);
...@@ -183,7 +171,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -183,7 +171,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
// query extension // query extension
if (Fullscreen) if (CreationParams.Fullscreen)
{ {
s32 eventbase, errorbase; s32 eventbase, errorbase;
s32 bestMode = -1; s32 bestMode = -1;
...@@ -228,7 +216,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -228,7 +216,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
else else
{ {
os::Printer::log("Could not find specified video mode, running windowed.", ELL_WARNING); os::Printer::log("Could not find specified video mode, running windowed.", ELL_WARNING);
Fullscreen = false; CreationParams.Fullscreen = false;
} }
XFree(modes); XFree(modes);
...@@ -269,7 +257,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -269,7 +257,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
{ {
os::Printer::log("VidMode or RandR extension must be installed to allow Irrlicht " os::Printer::log("VidMode or RandR extension must be installed to allow Irrlicht "
"to switch to fullscreen mode. Running in windowed mode instead.", ELL_WARNING); "to switch to fullscreen mode. Running in windowed mode instead.", ELL_WARNING);
Fullscreen = false; CreationParams.Fullscreen = false;
} }
} }
...@@ -279,7 +267,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -279,7 +267,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
GLXFBConfig glxFBConfig; GLXFBConfig glxFBConfig;
int major, minor; int major, minor;
bool isAvailableGLX=false; bool isAvailableGLX=false;
if (DriverType==video::EDT_OPENGL) if (CreationParams.DriverType==video::EDT_OPENGL)
{ {
isAvailableGLX=glXQueryExtension(display,&major,&minor); isAvailableGLX=glXQueryExtension(display,&major,&minor);
if (isAvailableGLX && glXQueryVersion(display, &major, &minor)) if (isAvailableGLX && glXQueryVersion(display, &major, &minor))
...@@ -294,7 +282,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -294,7 +282,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
GLX_RED_SIZE, 4, GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4, GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4, GLX_BLUE_SIZE, 4,
GLX_ALPHA_SIZE, 4, GLX_ALPHA_SIZE, 0,
GLX_DEPTH_SIZE, 16, GLX_DEPTH_SIZE, 16,
GLX_DOUBLEBUFFER, GL_TRUE, GLX_DOUBLEBUFFER, GL_TRUE,
GLX_STENCIL_SIZE, 1, GLX_STENCIL_SIZE, 1,
...@@ -305,15 +293,15 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -305,15 +293,15 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
GLXFBConfig *configList=0; GLXFBConfig *configList=0;
int nitems=0; int nitems=0;
if (!AntiAlias) if (!CreationParams.AntiAlias)
{ {
visualAttrBuffer[17] = GL_FALSE; visualAttrBuffer[17] = GL_FALSE;
visualAttrBuffer[19] = 0; visualAttrBuffer[19] = 0;
} }
if (StencilBuffer) if (CreationParams.Stencilbuffer)
{ {
configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems);
if (!configList && AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
...@@ -328,7 +316,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -328,7 +316,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
AntiAlias=false; CreationParams.AntiAlias=false;
} }
else else
{ {
...@@ -342,13 +330,13 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -342,13 +330,13 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
// Next try without stencil buffer // Next try without stencil buffer
if (!configList) if (!configList)
{ {
if (StencilBuffer) if (CreationParams.Stencilbuffer)
os::Printer::log("No stencilbuffer available, disabling stencil shadows.", ELL_WARNING); os::Printer::log("No stencilbuffer available, disabling stencil shadows.", ELL_WARNING);
StencilBuffer = false; CreationParams.Stencilbuffer = false;
visualAttrBuffer[15]=0; visualAttrBuffer[15]=0;
configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems);
if (!configList && AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
...@@ -363,7 +351,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -363,7 +351,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
AntiAlias=false; CreationParams.AntiAlias=false;
} }
else else
{ {
...@@ -380,7 +368,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -380,7 +368,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
os::Printer::log("No doublebuffering available.", ELL_WARNING); os::Printer::log("No doublebuffering available.", ELL_WARNING);
visualAttrBuffer[13] = GL_FALSE; visualAttrBuffer[13] = GL_FALSE;
configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glXChooseFBConfig(display, screennr, visualAttrBuffer,&nitems);
if (!configList && AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
...@@ -395,7 +383,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -395,7 +383,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
AntiAlias=false; CreationParams.AntiAlias=false;
} }
else else
{ {
...@@ -423,21 +411,21 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -423,21 +411,21 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
GLX_RED_SIZE, 4, GLX_RED_SIZE, 4,
GLX_GREEN_SIZE, 4, GLX_GREEN_SIZE, 4,
GLX_BLUE_SIZE, 4, GLX_BLUE_SIZE, 4,
GLX_ALPHA_SIZE, 4, GLX_ALPHA_SIZE, 0,
GLX_DEPTH_SIZE, 16, GLX_DEPTH_SIZE, 16,
GLX_DOUBLEBUFFER, GL_TRUE, GLX_DOUBLEBUFFER, GL_TRUE,
GLX_STENCIL_SIZE, 1, GLX_STENCIL_SIZE, 1,
None None
}; };
if (StencilBuffer) if (CreationParams.Stencilbuffer)
visual=glXChooseVisual(display, screennr, visualAttrBuffer); visual=glXChooseVisual(display, screennr, visualAttrBuffer);
if (!visual) if (!visual)
{ {
if (StencilBuffer) if (CreationParams.Stencilbuffer)
{ {
os::Printer::log("No stencilbuffer available, disabling stencil shadows.", ELL_WARNING); os::Printer::log("No stencilbuffer available, disabling stencil shadows.", ELL_WARNING);
StencilBuffer = false; CreationParams.Stencilbuffer = false;
} }
visualAttrBuffer[15]=0; visualAttrBuffer[15]=0;
...@@ -494,7 +482,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -494,7 +482,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
ButtonReleaseMask | KeyReleaseMask; ButtonReleaseMask | KeyReleaseMask;
// create Window, either for Fullscreen or windowed mode // create Window, either for Fullscreen or windowed mode
if (Fullscreen) if (CreationParams.Fullscreen)
{ {
attributes.override_redirect = True; attributes.override_redirect = True;
...@@ -517,7 +505,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -517,7 +505,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
attributes.event_mask |= ExposureMask; attributes.event_mask |= ExposureMask;
attributes.event_mask |= FocusChangeMask; attributes.event_mask |= FocusChangeMask;
if(!externalWindow) if(!CreationParams.WindowId)
{ {
window = XCreateWindow(display, window = XCreateWindow(display,
RootWindow(display, visual->screen), RootWindow(display, visual->screen),
...@@ -529,7 +517,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -529,7 +517,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
else else
{ {
window = XCreateWindow(display, window = XCreateWindow(display,
externalWindow, (Window)CreationParams.WindowId,
0, 0, Width, Height, 0, visual->depth, 0, 0, Width, Height, 0, visual->depth,
InputOutput, visual->visual, InputOutput, visual->visual,
CWBorderPixel | CWColormap | CWEventMask, CWBorderPixel | CWColormap | CWEventMask,
...@@ -547,7 +535,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -547,7 +535,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
// connect glx context to window // connect glx context to window
if (isAvailableGLX && DriverType==video::EDT_OPENGL) if (isAvailableGLX && CreationParams.DriverType==video::EDT_OPENGL)
{ {
if (UseGLXWindow) if (UseGLXWindow)
{ {
...@@ -605,7 +593,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -605,7 +593,7 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
// create an XImage for the software renderer // create an XImage for the software renderer
//(thx to Nadav for some clues on how to do that!) //(thx to Nadav for some clues on how to do that!)
if (DriverType == video::EDT_SOFTWARE || DriverType == video::EDT_BURNINGSVIDEO) if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO)
{ {
SoftwareImage = XCreateImage(display, SoftwareImage = XCreateImage(display,
visual->visual, visual->depth, visual->visual, visual->depth,
...@@ -622,16 +610,15 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize, ...@@ -622,16 +610,15 @@ bool CIrrDeviceLinux::createWindow(const core::dimension2d<s32>& windowSize,
//! create the driver //! create the driver
void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize, void CIrrDeviceLinux::createDriver()
bool vsync)
{ {
switch(DriverType) switch(CreationParams.DriverType)
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
case video::EDT_SOFTWARE: case video::EDT_SOFTWARE:
#ifdef _IRR_COMPILE_WITH_SOFTWARE_ #ifdef _IRR_COMPILE_WITH_SOFTWARE_
VideoDriver = video::createSoftwareDriver(windowSize, Fullscreen, FileSystem, this); VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
#else #else
os::Printer::log("No Software driver support compiled in.", ELL_ERROR); os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
#endif #endif
...@@ -639,7 +626,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize, ...@@ -639,7 +626,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize,
case video::EDT_BURNINGSVIDEO: case video::EDT_BURNINGSVIDEO:
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
VideoDriver = video::createSoftwareDriver2(windowSize, Fullscreen, FileSystem, this); 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
...@@ -648,7 +635,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize, ...@@ -648,7 +635,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize,
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context) if (Context)
VideoDriver = video::createOpenGLDriver(windowSize, Fullscreen, StencilBuffer, FileSystem, vsync, AntiAlias); VideoDriver = video::createOpenGLDriver(CreationParams.WindowSize, CreationParams.Fullscreen, CreationParams.Stencilbuffer, FileSystem, CreationParams.Vsync, CreationParams.AntiAlias);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
...@@ -661,7 +648,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize, ...@@ -661,7 +648,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize,
break; break;
case video::EDT_NULL: case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, windowSize); VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break; break;
default: default:
...@@ -669,7 +656,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize, ...@@ -669,7 +656,7 @@ void CIrrDeviceLinux::createDriver(const core::dimension2d<s32>& windowSize,
break; break;
#else #else
case video::EDT_NULL: case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, windowSize); VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break; break;
default: default:
os::Printer::log("No X11 support compiled in. Only Null driver available.", ELL_ERROR); os::Printer::log("No X11 support compiled in. Only Null driver available.", ELL_ERROR);
...@@ -686,7 +673,7 @@ bool CIrrDeviceLinux::run() ...@@ -686,7 +673,7 @@ bool CIrrDeviceLinux::run()
os::Timer::tick(); os::Timer::tick();
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
if ((DriverType != video::EDT_NULL) && display) if ((CreationParams.DriverType != video::EDT_NULL) && display)
{ {
SEvent irrevent; SEvent irrevent;
...@@ -706,7 +693,7 @@ bool CIrrDeviceLinux::run() ...@@ -706,7 +693,7 @@ bool CIrrDeviceLinux::run()
Height = event.xconfigure.height; Height = event.xconfigure.height;
// resize image data // resize image data
if (DriverType == video::EDT_SOFTWARE || DriverType == video::EDT_BURNINGSVIDEO) if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO)
{ {
XDestroyImage(SoftwareImage); XDestroyImage(SoftwareImage);
...@@ -814,11 +801,10 @@ bool CIrrDeviceLinux::run() ...@@ -814,11 +801,10 @@ bool CIrrDeviceLinux::run()
case KeyPress: case KeyPress:
{ {
SKeyMap mp; SKeyMap mp;
//mp.X11Key = XLookupKeysym(&event.xkey, 0); char buf[8]={0};
char buf[5]="\0\0\0\0"; XLookupString(&event.xkey, buf, sizeof(buf), &mp.X11Key, NULL);
XLookupString(&event.xkey, buf, 4, &mp.X11Key, NULL);
s32 idx = KeyMap.binary_search(mp); const s32 idx = KeyMap.binary_search(mp);
if (idx != -1) if (idx != -1)
irrevent.KeyInput.Key = (EKEY_CODE)KeyMap[idx].Win32Key; irrevent.KeyInput.Key = (EKEY_CODE)KeyMap[idx].Win32Key;
...@@ -829,7 +815,7 @@ bool CIrrDeviceLinux::run() ...@@ -829,7 +815,7 @@ bool CIrrDeviceLinux::run()
} }
irrevent.EventType = irr::EET_KEY_INPUT_EVENT; irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
irrevent.KeyInput.PressedDown = (event.type == KeyPress); irrevent.KeyInput.PressedDown = (event.type == KeyPress);
mbtowc(&irrevent.KeyInput.Char, buf, 4); mbtowc(&irrevent.KeyInput.Char, buf, sizeof(buf));
irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0; irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0; irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0;
postEventFromUser(irrevent); postEventFromUser(irrevent);
...@@ -889,7 +875,7 @@ void CIrrDeviceLinux::sleep(u32 timeMs, bool pauseTimer=false) ...@@ -889,7 +875,7 @@ void CIrrDeviceLinux::sleep(u32 timeMs, bool pauseTimer=false)
void CIrrDeviceLinux::setWindowCaption(const wchar_t* text) void CIrrDeviceLinux::setWindowCaption(const wchar_t* text)
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
if (DriverType == video::EDT_NULL) if (CreationParams.DriverType == video::EDT_NULL)
return; return;
XTextProperty txt; XTextProperty txt;
...@@ -907,7 +893,7 @@ void CIrrDeviceLinux::present(video::IImage* image, void* windowId, core::rect<s ...@@ -907,7 +893,7 @@ void CIrrDeviceLinux::present(video::IImage* image, void* windowId, core::rect<s
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
// this is only necessary for software drivers. // this is only necessary for software drivers.
if (DriverType != video::EDT_SOFTWARE && DriverType != video::EDT_BURNINGSVIDEO) if (CreationParams.DriverType != video::EDT_SOFTWARE && CreationParams.DriverType != video::EDT_BURNINGSVIDEO)
return; return;
// thx to Nadav, who send me some clues of how to display the image // thx to Nadav, who send me some clues of how to display the image
...@@ -1033,7 +1019,7 @@ bool CIrrDeviceLinux::isWindowActive() const ...@@ -1033,7 +1019,7 @@ bool CIrrDeviceLinux::isWindowActive() const
void CIrrDeviceLinux::setResizeAble(bool resize) void CIrrDeviceLinux::setResizeAble(bool resize)
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
if (DriverType == video::EDT_NULL) if (CreationParams.DriverType == video::EDT_NULL)
return; return;
XUnmapWindow(display, window); XUnmapWindow(display, window);
...@@ -1335,17 +1321,7 @@ void CIrrDeviceLinux::createKeyMap() ...@@ -1335,17 +1321,7 @@ void CIrrDeviceLinux::createKeyMap()
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param) IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
{ {
CIrrDeviceLinux* dev = new CIrrDeviceLinux( CIrrDeviceLinux* dev = new CIrrDeviceLinux(param);
param.DriverType,
param.WindowSize,
param.Bits,
param.Fullscreen,
param.Stencilbuffer,
param.Vsync,
param.AntiAlias,
param.EventReceiver,
(Window)param.WindowId,
param.SDK_version_do_not_use);
if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL) if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL)
{ {
......
...@@ -47,10 +47,7 @@ namespace irr ...@@ -47,10 +47,7 @@ namespace irr
public: public:
//! constructor //! constructor
CIrrDeviceLinux(video::E_DRIVER_TYPE deviceType, CIrrDeviceLinux(const SIrrlichtCreationParameters& param);
const core::dimension2d<s32>& windowSize, u32 bits,
bool fullscreen, bool stencilbuffer, bool vsync, bool antiAlias, IEventReceiver* receiver,
Window window, const char* version);
//! destructor //! destructor
virtual ~CIrrDeviceLinux(); virtual ~CIrrDeviceLinux();
...@@ -87,11 +84,9 @@ namespace irr ...@@ -87,11 +84,9 @@ namespace irr
private: private:
//! create the driver //! create the driver
void createDriver(const core::dimension2d<s32>& windowSize, void createDriver();
bool vsync);
bool createWindow(const core::dimension2d<s32>& windowSize, u32 bits, bool createWindow();
Window externalWindow);
void createKeyMap(); void createKeyMap();
...@@ -308,11 +303,6 @@ namespace irr ...@@ -308,11 +303,6 @@ namespace irr
GLXContext Context; GLXContext Context;
#endif #endif
#endif #endif
bool Fullscreen;
bool StencilBuffer;
bool AntiAlias;
video::E_DRIVER_TYPE DriverType;
u32 Width, Height, Depth; u32 Width, Height, Depth;
bool Close; bool Close;
bool WindowActive; bool WindowActive;
......
...@@ -37,17 +37,10 @@ namespace irr ...@@ -37,17 +37,10 @@ namespace irr
const char* wmDeleteWindow = "WM_DELETE_WINDOW"; const char* wmDeleteWindow = "WM_DELETE_WINDOW";
//! constructor //! constructor
CIrrDeviceSDL::CIrrDeviceSDL(video::E_DRIVER_TYPE driverType, CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
const core::dimension2d<s32>& windowSize, : CIrrDeviceStub(param), Resizeable(false),
u32 bits, Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_HWSURFACE|SDL_ANYFORMAT),
bool fullscreen, bool stencilbuffer, bool vsync, Width(param.WindowSize.Width), Height(param.WindowSize.Height), Close(0),
bool antiAlias, IEventReceiver* receiver,
void* windowID, const char* version)
: CIrrDeviceStub(version, receiver), Depth(bits),
Fullscreen(fullscreen), Stencilbuffer(stencilbuffer), Vsync(vsync),
AntiAlias(antiAlias), Resizeable(false),
Screen((SDL_Surface*)windowID), SDL_Flags(SDL_HWSURFACE|SDL_ANYFORMAT),
Width(windowSize.Width), Height(windowSize.Height), Close(0),
WindowActive(false) WindowActive(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
...@@ -56,7 +49,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(video::E_DRIVER_TYPE driverType, ...@@ -56,7 +49,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(video::E_DRIVER_TYPE driverType,
// Initialize SDL... Timer for sleep, video for the obvious, and // Initialize SDL... Timer for sleep, video for the obvious, and
// noparachute prevents SDL from catching fatal errors. // noparachute prevents SDL from catching fatal errors.
if ( SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE ) < 0 ) if (SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE ) < 0)
{ {
os::Printer::log( "Unable to initialize SDL!", SDL_GetError()); os::Printer::log( "Unable to initialize SDL!", SDL_GetError());
Close = 1; Close = 1;
...@@ -81,31 +74,30 @@ CIrrDeviceSDL::CIrrDeviceSDL(video::E_DRIVER_TYPE driverType, ...@@ -81,31 +74,30 @@ CIrrDeviceSDL::CIrrDeviceSDL(video::E_DRIVER_TYPE driverType,
// enable key to character translation // enable key to character translation
SDL_EnableUNICODE(1); SDL_EnableUNICODE(1);
if ( Fullscreen ) if ( CreationParams.Fullscreen )
SDL_Flags |= SDL_FULLSCREEN; SDL_Flags |= SDL_FULLSCREEN;
if (driverType == video::EDT_OPENGL) if (CreationParams.DriverType == video::EDT_OPENGL)
SDL_Flags |= SDL_OPENGL; SDL_Flags |= SDL_OPENGL;
else else
SDL_Flags |= SDL_DOUBLEBUF; SDL_Flags |= SDL_DOUBLEBUF;
// create window // create window
if (driverType != video::EDT_NULL) if (CreationParams.DriverType != video::EDT_NULL)
{ {
// create the window, only if we do not use the null device // create the window, only if we do not use the null device
createWindow(driverType); createWindow();
} }
// create cursor control // create cursor control
CursorControl = new CCursorControl(this); CursorControl = new CCursorControl(this);
// create driver // create driver
createDriver(driverType, windowSize); createDriver();
if (VideoDriver) if (VideoDriver)
createGUIAndScene(); createGUIAndScene();
} }
//! destructor //! destructor
CIrrDeviceSDL::~CIrrDeviceSDL() CIrrDeviceSDL::~CIrrDeviceSDL()
{ {
...@@ -115,15 +107,14 @@ CIrrDeviceSDL::~CIrrDeviceSDL() ...@@ -115,15 +107,14 @@ CIrrDeviceSDL::~CIrrDeviceSDL()
} }
bool CIrrDeviceSDL::createWindow()
bool CIrrDeviceSDL::createWindow(video::E_DRIVER_TYPE driverType)
{ {
if ( Close ) if ( Close )
return false; return false;
if (driverType == video::EDT_OPENGL) if (CreationParams.DriverType == video::EDT_OPENGL)
{ {
if (Depth==16) if (CreationParams.Bits==16)
{ {
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
...@@ -135,12 +126,12 @@ bool CIrrDeviceSDL::createWindow(video::E_DRIVER_TYPE driverType) ...@@ -135,12 +126,12 @@ bool CIrrDeviceSDL::createWindow(video::E_DRIVER_TYPE driverType)
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
} }
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, Depth); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, CreationParams.Bits);
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
} }
if ( !Screen ) if ( !Screen )
Screen = SDL_SetVideoMode( Width, Height, Depth, SDL_Flags ); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
if ( !Screen ) if ( !Screen )
{ {
os::Printer::log( "Could not initialize display!" ); os::Printer::log( "Could not initialize display!" );
...@@ -152,10 +143,9 @@ bool CIrrDeviceSDL::createWindow(video::E_DRIVER_TYPE driverType) ...@@ -152,10 +143,9 @@ bool CIrrDeviceSDL::createWindow(video::E_DRIVER_TYPE driverType)
//! create the driver //! create the driver
void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType, void CIrrDeviceSDL::createDriver()
const core::dimension2d<s32>& windowSize)
{ {
switch(driverType) switch(CreationParams.DriverType)
{ {
case video::EDT_DIRECT3D8: case video::EDT_DIRECT3D8:
case video::EDT_DIRECT3D9: case video::EDT_DIRECT3D9:
...@@ -164,7 +154,7 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -164,7 +154,7 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_SOFTWARE: case video::EDT_SOFTWARE:
#ifdef _IRR_COMPILE_WITH_SOFTWARE_ #ifdef _IRR_COMPILE_WITH_SOFTWARE_
VideoDriver = video::createSoftwareDriver(windowSize, Fullscreen, FileSystem, this); VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
#else #else
os::Printer::log("No Software driver support compiled in.", ELL_ERROR); os::Printer::log("No Software driver support compiled in.", ELL_ERROR);
#endif #endif
...@@ -172,7 +162,7 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -172,7 +162,7 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_BURNINGSVIDEO: case video::EDT_BURNINGSVIDEO:
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
VideoDriver = video::createSoftwareDriver2(windowSize, Fullscreen, FileSystem, this); 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
...@@ -180,14 +170,14 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType, ...@@ -180,14 +170,14 @@ void CIrrDeviceSDL::createDriver(video::E_DRIVER_TYPE driverType,
case video::EDT_OPENGL: case video::EDT_OPENGL:
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
VideoDriver = video::createOpenGLDriver(windowSize, Fullscreen, Stencilbuffer, FileSystem, Vsync, AntiAlias); VideoDriver = video::createOpenGLDriver(CreationParams.WindowSize, CreationParams.Fullscreen, CreationParams.Stencilbuffer, FileSystem, CreationParams.Vsync, CreationParams.AntiAlias);
#else #else
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
#endif #endif
break; break;
case video::EDT_NULL: case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, windowSize); VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break; break;
default: default:
...@@ -388,7 +378,7 @@ void CIrrDeviceSDL::setResizeAble(bool resize) ...@@ -388,7 +378,7 @@ void CIrrDeviceSDL::setResizeAble(bool resize)
else else
SDL_Flags &= ~SDL_RESIZABLE; SDL_Flags &= ~SDL_RESIZABLE;
SDL_FreeSurface(Screen); SDL_FreeSurface(Screen);
Screen = SDL_SetVideoMode( Width, Height, Depth, SDL_Flags ); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
Resizeable = resize; Resizeable = resize;
} }
} }
...@@ -543,17 +533,7 @@ void CIrrDeviceSDL::createKeyMap() ...@@ -543,17 +533,7 @@ void CIrrDeviceSDL::createKeyMap()
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param) IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param)
{ {
CIrrDeviceSDL* dev = new CIrrDeviceSDL( CIrrDeviceSDL* dev = new CIrrDeviceSDL(param);
param.DriverType,
param.WindowSize,
param.Bits,
param.Fullscreen,
param.Stencilbuffer,
param.Vsync,
param.AntiAlias,
param.EventReceiver,
param.WindowId,
param.SDK_version_do_not_use);
if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL) if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL)
{ {
......
...@@ -26,11 +26,7 @@ namespace irr ...@@ -26,11 +26,7 @@ namespace irr
public: public:
//! constructor //! constructor
CIrrDeviceSDL(video::E_DRIVER_TYPE deviceType, CIrrDeviceSDL(const SIrrlichtCreationParameters& param);
const core::dimension2d<s32>& windowSize, u32 bits,
bool fullscreen, bool stencilbuffer, bool vsync,
bool antiAlias, IEventReceiver* receiver,
void* windowID, const char* version);
//! destructor //! destructor
virtual ~CIrrDeviceSDL(); virtual ~CIrrDeviceSDL();
...@@ -156,19 +152,13 @@ namespace irr ...@@ -156,19 +152,13 @@ namespace irr
private: private:
//! create the driver //! create the driver
void createDriver(video::E_DRIVER_TYPE driverType, void createDriver();
const core::dimension2d<s32>& windowSize);
bool createWindow(video::E_DRIVER_TYPE driverType); bool createWindow();
void createKeyMap(); void createKeyMap();
s32 MouseX, MouseY; s32 MouseX, MouseY;
u32 Depth;
bool Fullscreen;
bool Stencilbuffer;
bool Vsync;
bool AntiAlias;
bool Resizeable; bool Resizeable;
SDL_Surface* Screen; SDL_Surface* Screen;
......
...@@ -17,10 +17,10 @@ namespace irr ...@@ -17,10 +17,10 @@ namespace irr
{ {
//! constructor //! constructor
CIrrDeviceStub::CIrrDeviceStub(const char* version, IEventReceiver* recv) CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0), : IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
Timer(0), CursorControl(0), UserReceiver(recv), Logger(0), Operator(0), Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(0),
FileSystem(io::createFileSystem()), InputReceivingSceneManager(0) FileSystem(0), InputReceivingSceneManager(0), CreationParams(params)
{ {
Timer = new CTimer(); Timer = new CTimer();
if (os::Printer::Logger) if (os::Printer::Logger)
...@@ -37,11 +37,12 @@ CIrrDeviceStub::CIrrDeviceStub(const char* version, IEventReceiver* recv) ...@@ -37,11 +37,12 @@ CIrrDeviceStub::CIrrDeviceStub(const char* version, IEventReceiver* recv)
os::Printer::Logger = Logger; os::Printer::Logger = Logger;
FileSystem = io::createFileSystem();
core::stringc s = "Irrlicht Engine version "; core::stringc s = "Irrlicht Engine version ";
s.append(getVersion()); s.append(getVersion());
os::Printer::log(s.c_str(), ELL_INFORMATION); os::Printer::log(s.c_str(), ELL_INFORMATION);
checkVersion(version); checkVersion(params.SDK_version_do_not_use);
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "IrrlichtDevice.h" #include "IrrlichtDevice.h"
#include "IImagePresenter.h" #include "IImagePresenter.h"
#include "SIrrCreationParameters.h"
#include "CVideoModeList.h" #include "CVideoModeList.h"
namespace irr namespace irr
...@@ -52,7 +53,7 @@ namespace irr ...@@ -52,7 +53,7 @@ namespace irr
public: public:
//! constructor //! constructor
CIrrDeviceStub(const char* version, IEventReceiver* resv); CIrrDeviceStub(const SIrrlichtCreationParameters& param);
//! destructor //! destructor
virtual ~CIrrDeviceStub(); virtual ~CIrrDeviceStub();
...@@ -114,12 +115,13 @@ namespace irr ...@@ -114,12 +115,13 @@ namespace irr
scene::ISceneManager* SceneManager; scene::ISceneManager* SceneManager;
ITimer* Timer; ITimer* Timer;
gui::ICursorControl* CursorControl; gui::ICursorControl* CursorControl;
video::CVideoModeList VideoModeList;
IEventReceiver* UserReceiver; IEventReceiver* UserReceiver;
CLogger* Logger; CLogger* Logger;
IOSOperator* Operator; IOSOperator* Operator;
io::IFileSystem* FileSystem; io::IFileSystem* FileSystem;
scene::ISceneManager* InputReceivingSceneManager; scene::ISceneManager* InputReceivingSceneManager;
video::CVideoModeList VideoModeList;
SIrrlichtCreationParameters CreationParams;
}; };
} // end namespace irr } // end namespace irr
......
...@@ -283,10 +283,9 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType, ...@@ -283,10 +283,9 @@ CIrrDeviceWin32::CIrrDeviceWin32(video::E_DRIVER_TYPE driverType,
bool stencilbuffer, bool vsync, bool stencilbuffer, bool vsync,
bool antiAlias, bool antiAlias,
bool highPrecisionFPU, bool highPrecisionFPU,
IEventReceiver* receiver,
HWND externalWindow, HWND externalWindow,
const char* version) const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(version, receiver), HWnd(0), ChangedToFullScreen(false), : CIrrDeviceStub(param), HWnd(0), ChangedToFullScreen(false),
FullScreen(fullscreen), IsNonNTWindows(false), Resized(false), FullScreen(fullscreen), IsNonNTWindows(false), Resized(false),
ExternalWindow(false), Win32CursorControl(0) ExternalWindow(false), Win32CursorControl(0)
{ {
...@@ -938,9 +937,8 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx( ...@@ -938,9 +937,8 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
parameters.Vsync, parameters.Vsync,
parameters.AntiAlias, parameters.AntiAlias,
parameters.HighPrecisionFPU, parameters.HighPrecisionFPU,
parameters.EventReceiver,
reinterpret_cast<HWND>(parameters.WindowId), reinterpret_cast<HWND>(parameters.WindowId),
parameters.SDK_version_do_not_use); parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL) if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{ {
......
...@@ -26,9 +26,8 @@ namespace irr ...@@ -26,9 +26,8 @@ namespace irr
core::dimension2d<s32> windowSize, u32 bits, core::dimension2d<s32> windowSize, u32 bits,
bool fullscreen, bool stencilbuffer, bool vsync, bool fullscreen, bool stencilbuffer, bool vsync,
bool antiAlias, bool highPrecisionFPU, bool antiAlias, bool highPrecisionFPU,
IEventReceiver* receiver,
HWND window, HWND window,
const char* version); const SIrrlichtCreationParameters& params);
//! destructor //! destructor
virtual ~CIrrDeviceWin32(); virtual ~CIrrDeviceWin32();
......
...@@ -282,10 +282,9 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType, ...@@ -282,10 +282,9 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType,
bool stencilbuffer, bool vsync, bool stencilbuffer, bool vsync,
bool antiAlias, bool antiAlias,
bool highPrecisionFPU, bool highPrecisionFPU,
IEventReceiver* receiver,
HWND externalWindow, HWND externalWindow,
const char* version) const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(version, receiver), HWnd(0), ChangedToFullScreen(false), : CIrrDeviceStub(params), HWnd(externalWindow), ChangedToFullScreen(false),
FullScreen(fullscreen), Resized(false), FullScreen(fullscreen), Resized(false),
ExternalWindow(false), Win32CursorControl(0) ExternalWindow(false), Win32CursorControl(0)
{ {
...@@ -303,7 +302,7 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType, ...@@ -303,7 +302,7 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType,
#endif #endif
// create the window, only if we do not use the null device // create the window, only if we do not use the null device
if (driverType != video::EDT_NULL && externalWindow==0) if (driverType != video::EDT_NULL && HWnd==0)
{ {
const wchar_t* ClassName = L"CIrrDeviceWinCE"; const wchar_t* ClassName = L"CIrrDeviceWinCE";
...@@ -361,7 +360,6 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType, ...@@ -361,7 +360,6 @@ CIrrDeviceWinCE::CIrrDeviceWinCE(video::E_DRIVER_TYPE driverType,
// attach external window // attach external window
if (externalWindow) if (externalWindow)
{ {
HWnd = externalWindow;
RECT r; RECT r;
GetWindowRect(HWnd, &r); GetWindowRect(HWnd, &r);
windowSize.Width = r.right - r.left; windowSize.Width = r.right - r.left;
...@@ -789,9 +787,8 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx( ...@@ -789,9 +787,8 @@ IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
parameters.Vsync, parameters.Vsync,
parameters.AntiAlias, parameters.AntiAlias,
parameters.HighPrecisionFPU, parameters.HighPrecisionFPU,
parameters.EventReceiver,
reinterpret_cast<HWND>(parameters.WindowId), reinterpret_cast<HWND>(parameters.WindowId),
parameters.SDK_version_do_not_use); parameters);
if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL) if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL)
{ {
......
...@@ -30,9 +30,8 @@ namespace irr ...@@ -30,9 +30,8 @@ namespace irr
core::dimension2d<s32> windowSize, u32 bits, core::dimension2d<s32> windowSize, u32 bits,
bool fullscreen, bool stencilbuffer, bool vsync, bool fullscreen, bool stencilbuffer, bool vsync,
bool antiAlias, bool highPrecisionFPU, bool antiAlias, bool highPrecisionFPU,
IEventReceiver* receiver,
HWND window, HWND window,
const char* version); const SIrrlichtCreationParameters& params);
//! destructor //! destructor
virtual ~CIrrDeviceWinCE(); virtual ~CIrrDeviceWinCE();
......
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