Commit db988e35 authored by hybrid's avatar hybrid

Fix screen creation and key handling of unknown keycodes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2316 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 70a1d335
......@@ -166,9 +166,6 @@ bool CIrrDeviceSDL::createWindow()
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias );
}
}
if ( !Screen )
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
if ( !Screen && CreationParams.AntiAlias>1)
......@@ -189,10 +186,16 @@ bool CIrrDeviceSDL::createWindow()
os::Printer::log("AntiAliasing disabled due to lack of support!" );
}
}
}
else if ( !Screen )
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
if ( !Screen && CreationParams.Doublebuffer)
{
// Try single buffer
if (CreationParams.DriverType == video::EDT_OPENGL)
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
SDL_Flags &= ~SDL_DOUBLEBUF;
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
}
if ( !Screen )
......@@ -377,9 +380,11 @@ bool CIrrDeviceSDL::run()
mp.SDLKey = SDL_event.key.keysym.sym;
s32 idx = KeyMap.binary_search(mp);
if (idx != -1)
{
EKEY_CODE key = (EKEY_CODE)KeyMap[idx].Win32Key;
EKEY_CODE key;
if (idx == -1)
key = (EKEY_CODE)0;
else
key = (EKEY_CODE)KeyMap[idx].Win32Key;
#ifdef _IRR_WINDOWS_API_
// handle alt+f4 in Windows, because SDL seems not to
......@@ -397,9 +402,6 @@ bool CIrrDeviceSDL::run()
irrevent.KeyInput.Control = (SDL_event.key.keysym.mod & KMOD_CTRL ) != 0;
postEventFromUser(irrevent);
}
else
os::Printer::log("Could not find win32 key for SDL key.");
}
break;
case SDL_QUIT:
......@@ -420,7 +422,7 @@ bool CIrrDeviceSDL::run()
{
Width = SDL_event.resize.w;
Height = SDL_event.resize.h;
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
Screen = SDL_SetVideoMode( Width, Height, 0, SDL_Flags );
if (VideoDriver)
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
}
......@@ -718,7 +720,7 @@ void CIrrDeviceSDL::setResizable(bool resize)
SDL_Flags |= SDL_RESIZABLE;
else
SDL_Flags &= ~SDL_RESIZABLE;
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
Screen = SDL_SetVideoMode( 0, 0, 0, SDL_Flags );
Resizable = resize;
}
}
......
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