OSX, fixed mouse pos in event.
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1771 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
bef6b3bbf6
commit
f9c4740894
@ -79,7 +79,7 @@ public:
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext(SFContext* shared, const WindowImpl* owner,
|
SFContext(SFContext* shared, const WindowImpl* owner,
|
||||||
unsigned int bitsPerPixel, const ContextSettings& settings);
|
unsigned int bitsPerPixel, const ContextSettings& settings);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Destructor
|
/// \brief Destructor
|
||||||
@ -127,13 +127,13 @@ private:
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void CreateContext(SFContext* shared,
|
void CreateContext(SFContext* shared,
|
||||||
const ContextSettings& settings,
|
const ContextSettings& settings,
|
||||||
unsigned int bitsPerPixel);
|
unsigned int bitsPerPixel);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NSOpenGLContextRef myContext; ///< OpenGL context
|
NSOpenGLContextRef myContext; ///< OpenGL context
|
||||||
NSAutoreleasePoolRef myPool; ///< Memory manager for this class.
|
NSAutoreleasePoolRef myPool; ///< Memory manager for this class.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ SFContext::SFContext(SFContext* shared)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFContext::SFContext(SFContext* shared, const WindowImpl* owner,
|
SFContext::SFContext(SFContext* shared, const WindowImpl* owner,
|
||||||
unsigned int bitsPerPixel, const ContextSettings& settings)
|
unsigned int bitsPerPixel, const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
myPool = [[NSAutoreleasePool alloc] init];
|
myPool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
@ -79,7 +79,11 @@ SFContext::SFContext(SFContext* shared, const WindowImpl* owner,
|
|||||||
SFContext::~SFContext()
|
SFContext::~SFContext()
|
||||||
{
|
{
|
||||||
[myContext release];
|
[myContext release];
|
||||||
[myPool release];
|
[myPool drain]; // [1]
|
||||||
|
|
||||||
|
/*
|
||||||
|
[1] : Produce sometimes "*** attempt to pop an unknown autorelease pool"
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,8 +118,8 @@ void SFContext::EnableVerticalSync(bool enabled)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SFContext::CreateContext(SFContext* shared,
|
void SFContext::CreateContext(SFContext* shared,
|
||||||
const ContextSettings& settings,
|
const ContextSettings& settings,
|
||||||
unsigned int bitsPerPixel)
|
unsigned int bitsPerPixel)
|
||||||
{
|
{
|
||||||
// Choose the attributs of OGL context.
|
// Choose the attributs of OGL context.
|
||||||
std::vector<NSOpenGLPixelFormatAttribute> attrs;
|
std::vector<NSOpenGLPixelFormatAttribute> attrs;
|
||||||
@ -163,7 +167,7 @@ void SFContext::CreateContext(SFContext* shared,
|
|||||||
|
|
||||||
// Create the context.
|
// Create the context.
|
||||||
myContext = [[NSOpenGLContext alloc] initWithFormat:pixFmt
|
myContext = [[NSOpenGLContext alloc] initWithFormat:pixFmt
|
||||||
shareContext:sharedContext];
|
shareContext:sharedContext];
|
||||||
|
|
||||||
// Free up.
|
// Free up.
|
||||||
[pixFmt release];
|
[pixFmt release];
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseDownAt(sf::Mouse::Left, loc.x, h - loc.y);
|
myRequester->MouseDownAt(sf::Mouse::Left, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseUpAt(sf::Mouse::Left, loc.x, h - loc.y);
|
myRequester->MouseUpAt(sf::Mouse::Left, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y);
|
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +233,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseDownAt(sf::Mouse::Right, loc.x, h - loc.y);
|
myRequester->MouseDownAt(sf::Mouse::Right, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseUpAt(sf::Mouse::Right, loc.x, h - loc.y);
|
myRequester->MouseUpAt(sf::Mouse::Right, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseDownAt(button, loc.x, h - loc.y);
|
myRequester->MouseDownAt(button, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseUpAt(button, loc.x, h - loc.y);
|
myRequester->MouseUpAt(button, loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@
|
|||||||
|
|
||||||
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
NSPoint loc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [[theEvent window] frame].size.height;
|
float h = [self frame].size.height;
|
||||||
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
myRequester->MouseMovedAt(loc.x, h - loc.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ WindowImplCocoa::~WindowImplCocoa()
|
|||||||
[myDelegate closeWindow];
|
[myDelegate closeWindow];
|
||||||
|
|
||||||
[myDelegate release];
|
[myDelegate release];
|
||||||
[myPool release];
|
[myPool drain];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user