Compile fixed for OSX.

Thanks @Maksym Hamarnyk for sending those.
Note: More patches are needed and I can only apply, not test, this.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6123 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-06-18 19:40:56 +00:00
parent 01a4f5d359
commit 49d7850d1e
4 changed files with 12 additions and 11 deletions

View File

@ -176,13 +176,13 @@ namespace irr
} }
//! Returns the current position of the mouse cursor. //! Returns the current position of the mouse cursor.
virtual const core::position2d<s32>& getPosition() virtual const core::position2d<s32>& getPosition(bool updateCursor) _IRR_OVERRIDE_
{ {
return CursorPos; return CursorPos;
} }
//! Returns the current position of the mouse cursor. //! Returns the current position of the mouse cursor.
virtual core::position2d<f32> getRelativePosition() virtual core::position2d<f32> getRelativePosition(bool updateCursor) _IRR_OVERRIDE_
{ {
if (!UseReferenceRect) if (!UseReferenceRect)
{ {

View File

@ -1222,7 +1222,7 @@ void CIrrDeviceMacOSX::storeMouseLocation()
x = (int)point.x; x = (int)point.x;
y = (int)point.y; y = (int)point.y;
const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition(); const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition(true);
if (curr.X != x || curr.Y != y) if (curr.X != x || curr.Y != y)
{ {
// In fullscreen mode, events are not sent regularly so rely on polling // In fullscreen mode, events are not sent regularly so rely on polling
@ -1262,7 +1262,7 @@ void CIrrDeviceMacOSX::setMouseLocation(int x,int y)
c.y = p.y; c.y = p.y;
#ifdef __MAC_10_6 #ifdef __MAC_10_6
CGEventRef ev = CGEventCreateMouseEvent(0, kCGEventMouseMoved, c, 0); CGEventRef ev = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, c, static_cast<CGMouseButton>(kCGEventMouseMoved));
CGEventPost(kCGHIDEventTap, ev); CGEventPost(kCGHIDEventTap, ev);
CFRelease(ev); CFRelease(ev);
#else #else

View File

@ -52,7 +52,7 @@ namespace video
const SExposedVideoData& getContext() const; const SExposedVideoData& getContext() const;
//! Change render context, disable old and activate new defined by videoData //! Change render context, disable old and activate new defined by videoData
bool activateContext(const SExposedVideoData& videoData); bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) _IRR_OVERRIDE_;
// Swap buffers. // Swap buffers.
bool swapBuffers(); bool swapBuffers();

View File

@ -51,12 +51,12 @@ bool CNSOGLManager::generateSurface()
NSOpenGLPFANoRecovery, NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated, NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer, NSOpenGLPFADoubleBuffer,
NSOpenGLPFADepthSize, depthSize, NSOpenGLPFADepthSize, static_cast<NSOpenGLPixelFormatAttribute>(depthSize),
NSOpenGLPFAColorSize, Params.Bits, NSOpenGLPFAColorSize, Params.Bits,
NSOpenGLPFAAlphaSize, alphaSize, NSOpenGLPFAAlphaSize, static_cast<NSOpenGLPixelFormatAttribute>(alphaSize),
NSOpenGLPFASampleBuffers, 1, NSOpenGLPFASampleBuffers, 1,
NSOpenGLPFASamples, Params.AntiAlias, NSOpenGLPFASamples, Params.AntiAlias,
NSOpenGLPFAStencilSize, Params.Stencilbuffer ? 1 : 0, NSOpenGLPFAStencilSize, static_cast<NSOpenGLPixelFormatAttribute>(Params.Stencilbuffer ? 1 : 0),
//NSOpenGLPFAFullScreen, //NSOpenGLPFAFullScreen,
0 0
}; };
@ -188,8 +188,9 @@ const SExposedVideoData& CNSOGLManager::getContext() const
return CurrentContext; return CurrentContext;
} }
bool CNSOGLManager::activateContext(const SExposedVideoData& videoData) bool CNSOGLManager::activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero)
{ {
//TODO: handle restorePrimaryOnZero
if (videoData.OpenGLOSX.Context) if (videoData.OpenGLOSX.Context)
{ {
if ((NSOpenGLContext*)videoData.OpenGLOSX.Context != [NSOpenGLContext currentContext]) if ((NSOpenGLContext*)videoData.OpenGLOSX.Context != [NSOpenGLContext currentContext])