From 98216544dee9877bcf3557b5b1ecb491e421b2bb Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Thu, 1 Aug 2013 10:52:50 +0400 Subject: [PATCH] screw tabs --- extern/sdl4ogre/osx_utils.mm | 9 +-- extern/sdl4ogre/sdlinputwrapper.cpp | 108 ++++++++++++++-------------- 2 files changed, 59 insertions(+), 58 deletions(-) diff --git a/extern/sdl4ogre/osx_utils.mm b/extern/sdl4ogre/osx_utils.mm index 0ba17b30c..4069959cb 100644 --- a/extern/sdl4ogre/osx_utils.mm +++ b/extern/sdl4ogre/osx_utils.mm @@ -1,14 +1,15 @@ #include "osx_utils.h" - #import + namespace SFO { unsigned long WindowContentViewHandle(SDL_SysWMinfo &info) { - NSWindow *window = info.info.cocoa.window; - NSView *view = [window contentView]; - return (unsigned long)view; + NSWindow *window = info.info.cocoa.window; + NSView *view = [window contentView]; + + return (unsigned long)view; } } diff --git a/extern/sdl4ogre/sdlinputwrapper.cpp b/extern/sdl4ogre/sdlinputwrapper.cpp index a6c0e1ccf..4343faaa1 100644 --- a/extern/sdl4ogre/sdlinputwrapper.cpp +++ b/extern/sdl4ogre/sdlinputwrapper.cpp @@ -19,11 +19,11 @@ namespace SFO mMouseZ(0), mMouseY(0), mMouseX(0), - mMouseInWindow(true), - mJoyListener(NULL), - mKeyboardListener(NULL), - mMouseListener(NULL), - mWindowListener(NULL) + mMouseInWindow(true), + mJoyListener(NULL), + mKeyboardListener(NULL), + mMouseListener(NULL), + mWindowListener(NULL) { _setupOISKeys(); } @@ -72,25 +72,25 @@ namespace SFO case SDL_TEXTINPUT: mKeyboardListener->textInput(evt.text); break; - case SDL_JOYAXISMOTION: - if (mJoyListener) - mJoyListener->axisMoved(evt.jaxis, evt.jaxis.axis); - break; - case SDL_JOYBUTTONDOWN: - if (mJoyListener) - mJoyListener->buttonPressed(evt.jbutton, evt.jbutton.button); - break; - case SDL_JOYBUTTONUP: - if (mJoyListener) - mJoyListener->buttonReleased(evt.jbutton, evt.jbutton.button); - break; - case SDL_JOYDEVICEADDED: - //SDL_JoystickOpen(evt.jdevice.which); - //std::cout << "Detected a new joystick: " << SDL_JoystickNameForIndex(evt.jdevice.which) << std::endl; - break; - case SDL_JOYDEVICEREMOVED: - //std::cout << "A joystick has been removed" << std::endl; - break; + case SDL_JOYAXISMOTION: + if (mJoyListener) + mJoyListener->axisMoved(evt.jaxis, evt.jaxis.axis); + break; + case SDL_JOYBUTTONDOWN: + if (mJoyListener) + mJoyListener->buttonPressed(evt.jbutton, evt.jbutton.button); + break; + case SDL_JOYBUTTONUP: + if (mJoyListener) + mJoyListener->buttonReleased(evt.jbutton, evt.jbutton.button); + break; + case SDL_JOYDEVICEADDED: + //SDL_JoystickOpen(evt.jdevice.which); + //std::cout << "Detected a new joystick: " << SDL_JoystickNameForIndex(evt.jdevice.which) << std::endl; + break; + case SDL_JOYDEVICEREMOVED: + //std::cout << "A joystick has been removed" << std::endl; + break; case SDL_WINDOWEVENT: handleWindowEvent(evt); break; @@ -115,61 +115,61 @@ namespace SFO SDL_SetWindowGrab(mSDLWindow, SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); break; - case SDL_WINDOWEVENT_SIZE_CHANGED: - int w,h; - SDL_GetWindowSize(mSDLWindow, &w, &h); - // TODO: Fix Ogre to handle this more consistently + case SDL_WINDOWEVENT_SIZE_CHANGED: + int w,h; + SDL_GetWindowSize(mSDLWindow, &w, &h); + // TODO: Fix Ogre to handle this more consistently #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX - mOgreWindow->resize(w, h); + mOgreWindow->resize(w, h); #else - mOgreWindow->windowMovedOrResized(); + mOgreWindow->windowMovedOrResized(); #endif - if (mWindowListener) - mWindowListener->windowResized(evt.window.data1, evt.window.data2); + if (mWindowListener) + mWindowListener->windowResized(evt.window.data1, evt.window.data2); - case SDL_WINDOWEVENT_RESIZED: - // TODO: Fix Ogre to handle this more consistently + case SDL_WINDOWEVENT_RESIZED: + // TODO: Fix Ogre to handle this more consistently #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX - mOgreWindow->resize(evt.window.data1, evt.window.data2); + mOgreWindow->resize(evt.window.data1, evt.window.data2); #else - mOgreWindow->windowMovedOrResized(); + mOgreWindow->windowMovedOrResized(); #endif - if (mWindowListener) - mWindowListener->windowResized(evt.window.data1, evt.window.data2); - break; + if (mWindowListener) + mWindowListener->windowResized(evt.window.data1, evt.window.data2); + break; case SDL_WINDOWEVENT_FOCUS_GAINED: - if (mWindowListener) - mWindowListener->windowFocusChange(true); - break; + if (mWindowListener) + mWindowListener->windowFocusChange(true); + break; case SDL_WINDOWEVENT_FOCUS_LOST: - if (mWindowListener) - mWindowListener->windowFocusChange(false); - break; + if (mWindowListener) + mWindowListener->windowFocusChange(false); + break; case SDL_WINDOWEVENT_CLOSE: break; case SDL_WINDOWEVENT_SHOWN: mOgreWindow->setVisible(true); - if (mWindowListener) - mWindowListener->windowVisibilityChange(true); + if (mWindowListener) + mWindowListener->windowVisibilityChange(true); break; case SDL_WINDOWEVENT_HIDDEN: mOgreWindow->setVisible(false); - if (mWindowListener) - mWindowListener->windowVisibilityChange(false); + if (mWindowListener) + mWindowListener->windowVisibilityChange(false); break; } } - bool InputWrapper::isModifierHeld(SDL_Keymod mod) + bool InputWrapper::isModifierHeld(SDL_Keymod mod) { return SDL_GetModState() & mod; } - bool InputWrapper::isKeyDown(SDL_Scancode key) - { - return SDL_GetKeyboardState(NULL)[key]; - } + bool InputWrapper::isKeyDown(SDL_Scancode key) + { + return SDL_GetKeyboardState(NULL)[key]; + } /// \brief Moves the mouse to the specified point within the viewport void InputWrapper::warpMouse(int x, int y)