Implemented OSX/InputImpl::GetMousePosition()
This commit is contained in:
parent
a609a7114e
commit
a55ae4b758
@ -67,7 +67,7 @@ else() # MACOSX
|
||||
${SRCROOT}/OSX/cpp_objc_conversion.mm
|
||||
${SRCROOT}/OSX/cg_sf_conversion.hpp
|
||||
${SRCROOT}/OSX/cg_sf_conversion.cpp
|
||||
${SRCROOT}/OSX/InputImpl.cpp
|
||||
${SRCROOT}/OSX/InputImpl.mm
|
||||
${SRCROOT}/OSX/InputImpl.hpp
|
||||
${SRCROOT}/OSX/JoystickImpl.cpp
|
||||
${SRCROOT}/OSX/JoystickImpl.hpp
|
||||
|
@ -26,7 +26,8 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/OSX/InputImpl.hpp>
|
||||
|
||||
#include <SFML/Window/VideoMode.hpp>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace sf
|
||||
{
|
||||
@ -51,8 +52,11 @@ bool InputImpl::IsMouseButtonPressed(Mouse::Button button)
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2i InputImpl::GetMousePosition()
|
||||
{
|
||||
// @to be implemented
|
||||
return Vector2i();
|
||||
// Reverse Y axis to match SFML coord.
|
||||
NSPoint pos = [NSEvent mouseLocation];
|
||||
pos.y = sf::VideoMode::GetDesktopMode().Height - pos.y;
|
||||
|
||||
return Vector2i(pos.x, pos.y);
|
||||
}
|
||||
|
||||
} // namespace priv
|
@ -192,7 +192,8 @@ sf::Keyboard::Key NonLocalizedKeys(unsigned short keycode);
|
||||
// Place the cursor.
|
||||
CGEventRef event = CGEventCreateMouseEvent(NULL,
|
||||
kCGEventMouseMoved,
|
||||
CGPointMake(screenCoord.x, screenCoord.y),
|
||||
CGPointMake(screenCoord.x,
|
||||
screenCoord.y),
|
||||
/*we don't care about this : */0);
|
||||
CGEventPost(kCGHIDEventTap, event);
|
||||
CFRelease(event);
|
||||
|
Loading…
Reference in New Issue
Block a user