Moved window resize messages to sdlinputwrapper

actorid
scrawl 12 years ago
parent 0880805559
commit 4fb32f7f05

@ -136,6 +136,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
void OMW::Engine::handleSDLMessages()
{
/*
//Pump messages since the last frame
const int max_events = 20;
SDL_Event events[max_events];
@ -174,6 +175,7 @@ void OMW::Engine::handleSDLMessages()
//user requested a quit, break out.
mOgre->getRoot()->queueEndRendering();
}
*/
}
OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)

@ -65,7 +65,7 @@ namespace MWInput
Ogre::RenderWindow* window = ogre.getWindow ();
mInputManager = new SFO::InputWrapper(mOgre.getSDLWindow());
mInputManager = new SFO::InputWrapper(mOgre.getSDLWindow(), mOgre.getWindow());
mInputManager->setMouseEventCallback (this);
mInputManager->setKeyboardEventCallback (this);
mInputManager->setWindowEventCallback(this);
@ -912,9 +912,9 @@ namespace MWInput
void InputManager::keyBindingDetected(ICS::InputControlSystem* ICS, ICS::Control* control
, SDL_Keycode key, ICS::Control::ControlChangingDirection direction)
{
//Disallow binding escape key, and unassigned keys
if(key==OIS::KC_ESCAPE || key==OIS::KC_UNASSIGNED)
return
//Disallow binding escape key
if(key==SDLK_ESCAPE)
return;
clearAllBindings(control);
ICS::DetectingBindingListener::keyBindingDetected (ICS, control, key, direction);

@ -16,8 +16,9 @@ namespace SFO
{
/// \brief General purpose wrapper for OGRE applications around SDL's event
/// queue, mostly used for handling input-related events.
InputWrapper::InputWrapper(SDL_Window* window) :
InputWrapper::InputWrapper(SDL_Window* window, Ogre::RenderWindow* ogreWindow) :
mSDLWindow(window),
mOgreWindow(ogreWindow),
mOwnWindow(false),
mWarpCompensate(false),
mMouseRelative(false),
@ -98,6 +99,9 @@ namespace SFO
void InputWrapper::capture()
{
SDL_Event evt;
bool resize=false;
size_t size_x = 0;
size_t size_y = 0;
while(SDL_PollEvent(&evt))
{
switch(evt.type)
@ -128,8 +132,18 @@ namespace SFO
case SDL_KEYUP:
mKeyboardListener->keyReleased(evt.key);
break;
case SDL_WINDOWEVENT_RESIZED:
resize = true;
size_x = evt.window.data1;
size_y = evt.window.data2;
break;
case SDL_QUIT:
Ogre::Root::getSingleton().queueEndRendering();
break;
}
}
if (resize)
mOgreWindow->resize(size_x, size_y);
}
bool InputWrapper::isModifierHeld(int mod)

@ -16,7 +16,7 @@ namespace SFO
class InputWrapper
{
public:
InputWrapper(SDL_Window *window=NULL);
InputWrapper(SDL_Window *window, Ogre::RenderWindow* ogreWindow);
~InputWrapper();
//void initFromRenderWindow(Ogre::RenderWindow* win);
@ -65,6 +65,7 @@ namespace SFO
Sint32 mMouseY;
SDL_Window* mSDLWindow;
Ogre::RenderWindow* mOgreWindow;
bool mOwnWindow;
};

Loading…
Cancel
Save