From acfdc5b8f2fe38204e59e4965b2693d8fb3d5386 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Sat, 23 Jul 2011 13:41:57 +0200 Subject: [PATCH 1/4] Minor Antialiasing update for Mac OS X --- src/SFML/Window/OSX/SFContext.mm | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/SFML/Window/OSX/SFContext.mm b/src/SFML/Window/OSX/SFContext.mm index e542e172a..d1b3bf21b 100644 --- a/src/SFML/Window/OSX/SFContext.mm +++ b/src/SFML/Window/OSX/SFContext.mm @@ -32,20 +32,6 @@ #import -/* - * DISCUSSION : - * ============ - * - * [1] (2010_07) - * should AA-related NSOpenGLPixelFormatAttribute not be in the array - * if AA is not enable (settings.AntialiasingLevel == 0) ? - * => will not be present in attributs array if 0. - * - * [2] (2010_07) - * how many buffer should be used for AA ? - * => «1» was choosen. - */ - namespace sf { namespace priv @@ -172,14 +158,31 @@ void SFContext::CreateContext(SFContext* shared, attrs.push_back(NSOpenGLPFAStencilSize); attrs.push_back((NSOpenGLPixelFormatAttribute)settings.StencilBits); - if (settings.AntialiasingLevel > 0) { // [1] + if (settings.AntialiasingLevel > 0) { + /* + * Antialiasing techniques are described in the + * "OpenGL Programming Guide for Mac OS X" document. + * + * According to this document, there is currently only one + * supported sample buffer the antialisaing level. + * + * The document also states that software renderers should be avoided + * because antialisaing techniques are very slow with them. + */ + + // Prefer multisampling over supersampling attrs.push_back(NSOpenGLPFAMultisample); + // Only one buffer is currently available. attrs.push_back(NSOpenGLPFASampleBuffers); - attrs.push_back((NSOpenGLPixelFormatAttribute)1); // [2] + attrs.push_back((NSOpenGLPixelFormatAttribute)1); + // Antialiasing level attrs.push_back(NSOpenGLPFASamples); attrs.push_back((NSOpenGLPixelFormatAttribute)settings.AntialiasingLevel); + + // No software renderer + attrs.push_back(NSOpenGLPFANoRecovery); } attrs.push_back((NSOpenGLPixelFormatAttribute)0); // end of array From fe3ef8c34c0fac24a269b1d9ca116a8ba5668429 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Mon, 25 Jul 2011 02:57:41 -0700 Subject: [PATCH 2/4] Minor comment update via GitHub --- src/SFML/Window/OSX/SFContext.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SFML/Window/OSX/SFContext.mm b/src/SFML/Window/OSX/SFContext.mm index d1b3bf21b..a9f50df20 100644 --- a/src/SFML/Window/OSX/SFContext.mm +++ b/src/SFML/Window/OSX/SFContext.mm @@ -163,8 +163,8 @@ void SFContext::CreateContext(SFContext* shared, * Antialiasing techniques are described in the * "OpenGL Programming Guide for Mac OS X" document. * - * According to this document, there is currently only one - * supported sample buffer the antialisaing level. + * According to this document, the specification currently allows + * only one multisample buffer. * * The document also states that software renderers should be avoided * because antialisaing techniques are very slow with them. From b93e980e27d9e77526fcf84ad101fde5fd363404 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Tue, 26 Jul 2011 12:17:16 +0200 Subject: [PATCH 3/4] Updated xocde templates --- .../SFML Application Base.xctemplate/TemplateInfo.plist | 2 +- .../SFML Application.xctemplate/TemplateInfo.plist | 6 ++++++ .../TemplateInfo.plist | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xcode/templates/SFML Application Base.xctemplate/TemplateInfo.plist b/xcode/templates/SFML Application Base.xctemplate/TemplateInfo.plist index 886438fb2..0937a42b4 100644 --- a/xcode/templates/SFML Application Base.xctemplate/TemplateInfo.plist +++ b/xcode/templates/SFML Application Base.xctemplate/TemplateInfo.plist @@ -521,7 +521,7 @@ while (window.IsOpened()) window.Close(); // Escape pressed : exit - if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape) + if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Keyboard::Escape) window.Close(); } diff --git a/xcode/templates/SFML Application.xctemplate/TemplateInfo.plist b/xcode/templates/SFML Application.xctemplate/TemplateInfo.plist index b5fc367b1..f401bfea3 100644 --- a/xcode/templates/SFML Application.xctemplate/TemplateInfo.plist +++ b/xcode/templates/SFML Application.xctemplate/TemplateInfo.plist @@ -84,6 +84,12 @@ subject to the following restrictions: WRAPPER_EXTENSION app + + GCC_PRECOMPILE_PREFIX_HEADER + NO + + GCC_PREFIX_HEADER + Configurations diff --git a/xcode/templates/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist b/xcode/templates/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist index 4cb77db99..6c1ac4466 100644 --- a/xcode/templates/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist +++ b/xcode/templates/SFML Command Line Tool Base.xctemplate/TemplateInfo.plist @@ -506,7 +506,7 @@ while (window.IsOpened()) window.Close(); // Escape pressed : exit - if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape) + if (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Keyboard::Escape) window.Close(); } From 732b789e2e8e38bbca6c3f97b4e3b4fc933ee872 Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Thu, 28 Jul 2011 02:10:35 +0200 Subject: [PATCH 4/4] Improved OSX/Joysticks performance --- src/SFML/Window/CMakeLists.txt | 2 + src/SFML/Window/OSX/HIDInputManager.hpp | 31 ++--- src/SFML/Window/OSX/HIDInputManager.mm | 53 ++++----- src/SFML/Window/OSX/HIDJoystickManager.cpp | 127 ++++++++++++++++++++ src/SFML/Window/OSX/HIDJoystickManager.hpp | 128 +++++++++++++++++++++ src/SFML/Window/OSX/JoystickImpl.cpp | 83 +++++++------ src/SFML/Window/OSX/JoystickImpl.hpp | 2 +- 7 files changed, 340 insertions(+), 86 deletions(-) create mode 100644 src/SFML/Window/OSX/HIDJoystickManager.cpp create mode 100644 src/SFML/Window/OSX/HIDJoystickManager.hpp diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index c74367012..ab8b1edf5 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -71,6 +71,8 @@ else() # MACOSX ${SRCROOT}/OSX/InputImpl.hpp ${SRCROOT}/OSX/HIDInputManager.hpp ${SRCROOT}/OSX/HIDInputManager.mm + ${SRCROOT}/OSX/HIDJoystickManager.hpp + ${SRCROOT}/OSX/HIDJoystickManager.cpp ${SRCROOT}/OSX/JoystickImpl.cpp ${SRCROOT}/OSX/JoystickImpl.hpp ${SRCROOT}/OSX/SFApplication.h diff --git a/src/SFML/Window/OSX/HIDInputManager.hpp b/src/SFML/Window/OSX/HIDInputManager.hpp index 81befac89..3ae33ff01 100644 --- a/src/SFML/Window/OSX/HIDInputManager.hpp +++ b/src/SFML/Window/OSX/HIDInputManager.hpp @@ -47,9 +47,6 @@ namespace priv /// keyboard and mouse states. It's only purpose is /// to help sf::priv::InputImpl class. /// -/// HIDInputManager provides a function to get all connected joysticks -/// to help sf::priv::JoystickImpl. -/// //////////////////////////////////////////////////////////// class HIDInputManager : NonCopyable { @@ -84,14 +81,6 @@ public : /// //////////////////////////////////////////////////////////// bool IsMouseButtonPressed(Mouse::Button button); - - //////////////////////////////////////////////////////////// - /// \brief List all connected joysticks - /// - /// \return a retained CFSetRef of IOHIDDeviceRef or NULL - /// - //////////////////////////////////////////////////////////// - CFSetRef CopyJoystickDevices(); public : @@ -106,6 +95,16 @@ public : //////////////////////////////////////////////////////////// static long GetLocationID(IOHIDDeviceRef device); + //////////////////////////////////////////////////////////// + /// \brief Create a mask (dictionary) for an IOHIDManager + /// + /// \param page HID page + /// \param usage HID usage page + /// \return a retained CFDictionaryRef + /// + //////////////////////////////////////////////////////////// + static CFDictionaryRef CopyDevicesMask(UInt32 page, UInt32 usage); + //////////////////////////////////////////////////////////// /// Try to convert a character into a SFML key code. /// @@ -208,16 +207,6 @@ private : //////////////////////////////////////////////////////////// void FreeUp(); - //////////////////////////////////////////////////////////// - /// \brief Create a mask (dictionary) for an IOHIDManager - /// - /// \param page HID page - /// \param usage HID usage page - /// \return a retained CFDictionaryRef - /// - //////////////////////////////////////////////////////////// - static CFDictionaryRef CopyDevicesMaskForManager(UInt32 page, UInt32 usage); - //////////////////////////////////////////////////////////// /// \brief Filter the devices and return them. /// diff --git a/src/SFML/Window/OSX/HIDInputManager.mm b/src/SFML/Window/OSX/HIDInputManager.mm index 84b51db9e..3e6fc657a 100644 --- a/src/SFML/Window/OSX/HIDInputManager.mm +++ b/src/SFML/Window/OSX/HIDInputManager.mm @@ -127,13 +127,6 @@ bool HIDInputManager::IsMouseButtonPressed(Mouse::Button button) } -//////////////////////////////////////////////////////////// -CFSetRef HIDInputManager::CopyJoystickDevices() -{ - return CopyDevices(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick); -} - - //////////////////////////////////////////////////////////// long HIDInputManager::GetLocationID(IOHIDDeviceRef device) { @@ -156,6 +149,28 @@ long HIDInputManager::GetLocationID(IOHIDDeviceRef device) } +//////////////////////////////////////////////////////////// +CFDictionaryRef HIDInputManager::CopyDevicesMask(UInt32 page, UInt32 usage) +{ + // Create the dictionary. + CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + // Add the page value. + CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); + CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), value); + CFRelease(value); + + // Add the usage value (which is only valid if page value exists). + value = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); + CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), value); + CFRelease(value); + + return dict; +} + + //////////////////////////////////////////////////////////// HIDInputManager::HIDInputManager() : amIValid(true) @@ -514,35 +529,13 @@ void HIDInputManager::FreeUp() myButtons[i].clear(); } } - - -//////////////////////////////////////////////////////////// -CFDictionaryRef HIDInputManager::CopyDevicesMaskForManager(UInt32 page, UInt32 usage) -{ - // Create the dictionary. - CFMutableDictionaryRef dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - // Add the page value. - CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page); - CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), value); - CFRelease(value); - - // Add the usage value (which is only valid if page value exists). - value = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage); - CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), value); - CFRelease(value); - - return dict; -} //////////////////////////////////////////////////////////// CFSetRef HIDInputManager::CopyDevices(UInt32 page, UInt32 usage) { // Filter and keep only the requested devices - CFDictionaryRef mask = CopyDevicesMaskForManager(page, usage); + CFDictionaryRef mask = CopyDevicesMask(page, usage); IOHIDManagerSetDeviceMatching(myManager, mask); diff --git a/src/SFML/Window/OSX/HIDJoystickManager.cpp b/src/SFML/Window/OSX/HIDJoystickManager.cpp new file mode 100644 index 000000000..aaab48424 --- /dev/null +++ b/src/SFML/Window/OSX/HIDJoystickManager.cpp @@ -0,0 +1,127 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2011 Marco Antognini (antognini.marco@gmail.com), +// Laurent Gomila (laurent.gom@gmail.com), +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +HIDJoystickManager& HIDJoystickManager::GetInstance() +{ + static HIDJoystickManager manager; + return manager; +} + + +//////////////////////////////////////////////////////////// +unsigned int HIDJoystickManager::GetJoystickCount() +{ + Update(); + return myJoystickCount; +} + + +//////////////////////////////////////////////////////////// +CFSetRef HIDJoystickManager::CopyJoysticks() +{ + CFSetRef devices = IOHIDManagerCopyDevices(myHIDManager); + return devices; +} + + +//////////////////////////////////////////////////////////// +HIDJoystickManager::HIDJoystickManager() +: myHIDManager(0) +, myJoystickCount(0) +{ + myHIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + + CFDictionaryRef mask = HIDInputManager::CopyDevicesMask(kHIDPage_GenericDesktop, + kHIDUsage_GD_Joystick); + IOHIDManagerSetDeviceMatching(myHIDManager, mask); + CFRelease(mask); + + IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, pluggedIn, this); + IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, pluggedOut, this); + + IOHIDManagerScheduleWithRunLoop(myHIDManager, + CFRunLoopGetCurrent(), + kCFRunLoopDefaultMode); + + IOHIDManagerOpen(myHIDManager, kIOHIDOptionsTypeNone); +} + + +//////////////////////////////////////////////////////////// +HIDJoystickManager::~HIDJoystickManager() +{ + IOHIDManagerUnscheduleFromRunLoop(myHIDManager, + CFRunLoopGetCurrent(), + kCFRunLoopDefaultMode); + + IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, NULL, 0); + IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, NULL, 0); + + IOHIDManagerClose(myHIDManager, kIOHIDOptionsTypeNone); +} + + +//////////////////////////////////////////////////////////// +void HIDJoystickManager::Update() +{ + SInt32 status = kCFRunLoopRunHandledSource; + + while (status == kCFRunLoopRunHandledSource) { + status = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true); + } +} + + +//////////////////////////////////////////////////////////// +void HIDJoystickManager::pluggedIn(void * context, IOReturn, void *, IOHIDDeviceRef) +{ + HIDJoystickManager* manager = (HIDJoystickManager*)context; + manager->myJoystickCount++; +} + + +//////////////////////////////////////////////////////////// +void HIDJoystickManager::pluggedOut(void * context, IOReturn, void *, IOHIDDeviceRef) +{ + HIDJoystickManager* manager = (HIDJoystickManager*)context; + manager->myJoystickCount--; +} + + +} // namespace priv + +} // namespace sf + diff --git a/src/SFML/Window/OSX/HIDJoystickManager.hpp b/src/SFML/Window/OSX/HIDJoystickManager.hpp new file mode 100644 index 000000000..52711cd91 --- /dev/null +++ b/src/SFML/Window/OSX/HIDJoystickManager.hpp @@ -0,0 +1,128 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2011 Marco Antognini (antognini.marco@gmail.com), +// Laurent Gomila (laurent.gom@gmail.com), +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HIDJOYSTICKMANAGER_HPP +#define SFML_HIDJOYSTICKMANAGER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + +namespace sf +{ +namespace priv +{ +//////////////////////////////////////////////////////////// +/// \brief This class manage as a singleton instance the +/// joysticks. It's only purpose is +/// to help sf::priv::JoystickImpl class. +/// +//////////////////////////////////////////////////////////// +class HIDJoystickManager : NonCopyable +{ +public: + + //////////////////////////////////////////////////////////// + /// \brief Get the unique instance of the class + /// + /// \note Private use only + /// + /// \return Reference to the HIDJoystickManager instance + /// + //////////////////////////////////////////////////////////// + static HIDJoystickManager& GetInstance(); + +public: + + //////////////////////////////////////////////////////////// + /// \brief Get the number of currently connected joystick + /// + //////////////////////////////////////////////////////////// + unsigned int GetJoystickCount(); + + //////////////////////////////////////////////////////////// + /// \brief Copy the devices assosiated with this HID manager + /// + /// \return a retained CFSetRef of IOHIDDeviceRef or NULL + /// + //////////////////////////////////////////////////////////// + CFSetRef CopyJoysticks(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + HIDJoystickManager(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~HIDJoystickManager(); + + //////////////////////////////////////////////////////////// + /// \brief Make sur all event have been processed in the run loop + /// + //////////////////////////////////////////////////////////// + void Update(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Private "plug-in" callback + /// \note Only 'context' parametre is used. + /// \see IOHIDDeviceCallback + /// + //////////////////////////////////////////////////////////// + static void pluggedIn(void * context, IOReturn, void *, IOHIDDeviceRef); + + //////////////////////////////////////////////////////////// + /// \brief Private "plug-out" callback + /// \note Only 'context' parametre is used. + /// \see IOHIDDeviceCallback + /// + //////////////////////////////////////////////////////////// + static void pluggedOut(void * context, IOReturn, void *, IOHIDDeviceRef); + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + IOHIDManagerRef myHIDManager; ///< HID Manager + unsigned int myJoystickCount;///< Number of joysticks currently connected +}; + + +} // namespace priv + +} // namespace sf + +#endif \ No newline at end of file diff --git a/src/SFML/Window/OSX/JoystickImpl.cpp b/src/SFML/Window/OSX/JoystickImpl.cpp index becb38578..a144e2077 100644 --- a/src/SFML/Window/OSX/JoystickImpl.cpp +++ b/src/SFML/Window/OSX/JoystickImpl.cpp @@ -28,6 +28,8 @@ //////////////////////////////////////////////////////////// #include #include +#include + namespace sf { @@ -50,49 +52,62 @@ bool JoystickImpl::IsConnected(unsigned int index) // Otherwise, let's check if it is now connected : else { // i.e., myLocationIDs[index] == 0 - - // Get all devices - CFSetRef devices = HIDInputManager::GetInstance().CopyJoystickDevices(); - if (devices != NULL) { + // if there is more connected joystick to the HID manager than + // opened joystick devices then we find the new one. + + unsigned int openedCount = 0; + for (unsigned int i(0); i < sf::Joystick::Count; ++i) { + if (myLocationIDs[i] != 0) openedCount++; + } + + unsigned int connectedCount = HIDJoystickManager::GetInstance().GetJoystickCount(); + + if (connectedCount > openedCount) { + + // Get all devices + CFSetRef devices = HIDJoystickManager::GetInstance().CopyJoysticks(); - CFIndex size = CFSetGetCount(devices); - - if (size > 0) { - - CFTypeRef array[size]; // array of IOHIDDeviceRef - CFSetGetValues(devices, array); + if (devices != NULL) { - // If there exists a device d s.t. there is no j s.t. - // myLocationIDs[j] == d's location then we have a new device. + CFIndex size = CFSetGetCount(devices); - for (CFIndex didx(0); didx < size; ++didx) { - IOHIDDeviceRef d = (IOHIDDeviceRef)array[didx]; - Location dloc = HIDInputManager::GetLocationID(d); + if (size > 0) { - bool foundJ = false; - for (unsigned int j(0); j < Joystick::Count; ++j) { - if (myLocationIDs[j] == dloc) { - foundJ = true; - break; // no need to loop again + CFTypeRef array[size]; // array of IOHIDDeviceRef + CFSetGetValues(devices, array); + + // If there exists a device d s.t. there is no j s.t. + // myLocationIDs[j] == d's location then we have a new device. + + for (CFIndex didx(0); didx < size; ++didx) { + IOHIDDeviceRef d = (IOHIDDeviceRef)array[didx]; + Location dloc = HIDInputManager::GetLocationID(d); + + bool foundJ = false; + for (unsigned int j(0); j < Joystick::Count; ++j) { + if (myLocationIDs[j] == dloc) { + foundJ = true; + break; // no need to loop again + } + } + + if (foundJ) { + // This is a known device + // Nothing else to do + } else { + // This is a new device + // We set it up for Open(..) + myLocationIDs[index] = dloc; + state = true; + break; // We stop looking for a new device } } - if (foundJ) { - // This is a known device - // Nothing else to do - } else { - // This is a new device - // We set it up for Open(..) - myLocationIDs[index] = dloc; - state = true; - break; // We stop looking for a new device - } } + CFRelease(devices); } - - CFRelease(devices); } } @@ -107,7 +122,7 @@ bool JoystickImpl::Open(unsigned int index) Location deviceLoc = myLocationIDs[index]; // The device we need to load // Get all devices - CFSetRef devices = HIDInputManager::GetInstance().CopyJoystickDevices(); + CFSetRef devices = HIDJoystickManager::GetInstance().CopyJoysticks(); if (devices == NULL) { return false; } @@ -274,7 +289,7 @@ JoystickState JoystickImpl::Update() Location selfLoc = myLocationIDs[myIndex]; // Get all devices - CFSetRef devices = HIDInputManager::GetInstance().CopyJoystickDevices(); + CFSetRef devices = HIDJoystickManager::GetInstance().CopyJoysticks(); if (devices == NULL) { return disconnectedState; } diff --git a/src/SFML/Window/OSX/JoystickImpl.hpp b/src/SFML/Window/OSX/JoystickImpl.hpp index e0c0add8c..f178de9f3 100644 --- a/src/SFML/Window/OSX/JoystickImpl.hpp +++ b/src/SFML/Window/OSX/JoystickImpl.hpp @@ -93,7 +93,7 @@ private : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - typedef long Location; + typedef long Location; typedef std::map AxisMap; typedef std::vector ButtonsVector;