mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
SDL2 input: seems to work on OS X, has some input issues though
This commit is contained in:
parent
3fded2d8bf
commit
6abb7a18b0
@ -79,6 +79,11 @@ set(OENGINE_OGRE
|
||||
${LIBDIR}/openengine/ogre/selectionbuffer.cpp
|
||||
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
set(OENGINE_OGRE ${OENGINE_OGRE} ${LIBDIR}/openengine/ogre/osx_utils.mm)
|
||||
endif ()
|
||||
|
||||
set(OENGINE_GUI
|
||||
${LIBDIR}/openengine/gui/manager.cpp
|
||||
)
|
||||
|
14
libs/openengine/ogre/osx_utils.h
Normal file
14
libs/openengine/ogre/osx_utils.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef OENGINE_OGRE_OSX_UTILS_H
|
||||
#define OENGINE_OGRE_OSX_UTILS_H
|
||||
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
namespace OEngine {
|
||||
namespace Render {
|
||||
|
||||
extern unsigned long WindowContentViewHandle(SDL_SysWMinfo &info);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
16
libs/openengine/ogre/osx_utils.mm
Normal file
16
libs/openengine/ogre/osx_utils.mm
Normal file
@ -0,0 +1,16 @@
|
||||
#include "osx_utils.h"
|
||||
|
||||
#import <AppKit/NSWindow.h>
|
||||
|
||||
namespace OEngine {
|
||||
namespace Render {
|
||||
|
||||
unsigned long WindowContentViewHandle(SDL_SysWMinfo &info)
|
||||
{
|
||||
NSWindow *window = info.info.cocoa.window;
|
||||
NSView *view = [window contentView];
|
||||
return (unsigned long)view;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -23,6 +23,10 @@
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef __MACOSX__
|
||||
#include "osx_utils.h"
|
||||
#endif
|
||||
|
||||
using namespace Ogre;
|
||||
using namespace OEngine::Render;
|
||||
|
||||
@ -257,13 +261,13 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
|
||||
// Windows code
|
||||
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window);
|
||||
break;
|
||||
#elif __APPLE__
|
||||
#elif __MACOSX__
|
||||
case SDL_SYSWM_COCOA:
|
||||
//required to make OGRE play nice with our window
|
||||
params.insert(std::make_pair("macAPI", "cocoa"));
|
||||
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
|
||||
|
||||
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.cocoa.window);
|
||||
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
||||
break;
|
||||
#else
|
||||
case SDL_SYSWM_X11:
|
||||
|
Loading…
x
Reference in New Issue
Block a user