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