summaryrefslogtreecommitdiff
path: root/src/SFML/Window/OSXCarbon
diff options
context:
space:
mode:
authorChristoph Egger <Christoph.Egger@gmx.de>2008-11-01 18:41:44 +0100
committerChristoph Egger <Christoph.Egger@gmx.de>2008-11-01 18:41:44 +0100
commit58905d98572ab7078eda45bbb50fd1cbf900e7d2 (patch)
treee6731fb6ac94377b0dc2f5634f764506e1adf8e4 /src/SFML/Window/OSXCarbon
parent9035708f4c5f7a78d8fb810e87e183fd61fd3350 (diff)
* Removing .svn entries got in by accident
* Do repacking
Diffstat (limited to 'src/SFML/Window/OSXCarbon')
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/all-wcprops53
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/entries300
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/format1
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.cpp.svn-base79
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.hpp.svn-base132
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.cpp.svn-base287
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.hpp.svn-base103
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.cpp.svn-base85
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.hpp.svn-base68
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.cpp.svn-base919
-rw-r--r--src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.hpp.svn-base257
11 files changed, 0 insertions, 2284 deletions
diff --git a/src/SFML/Window/OSXCarbon/.svn/all-wcprops b/src/SFML/Window/OSXCarbon/.svn/all-wcprops
deleted file mode 100644
index d6927c4..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/all-wcprops
+++ /dev/null
@@ -1,53 +0,0 @@
-K 25
-svn:wc:ra_dav:version-url
-V 52
-/svnroot/sfml/!svn/ver/584/src/SFML/Window/OSXCarbon
-END
-WindowImplCarbon.cpp
-K 25
-svn:wc:ra_dav:version-url
-V 73
-/svnroot/sfml/!svn/ver/584/src/SFML/Window/OSXCarbon/WindowImplCarbon.cpp
-END
-Joystick.cpp
-K 25
-svn:wc:ra_dav:version-url
-V 65
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/Joystick.cpp
-END
-JoystickSupport.hpp
-K 25
-svn:wc:ra_dav:version-url
-V 72
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/JoystickSupport.hpp
-END
-WindowImplCarbon.hpp
-K 25
-svn:wc:ra_dav:version-url
-V 73
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/WindowImplCarbon.hpp
-END
-Joystick.hpp
-K 25
-svn:wc:ra_dav:version-url
-V 65
-/svnroot/sfml/!svn/ver/568/src/SFML/Window/OSXCarbon/Joystick.hpp
-END
-VideoModeSupport.cpp
-K 25
-svn:wc:ra_dav:version-url
-V 73
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/VideoModeSupport.cpp
-END
-JoystickSupport.cpp
-K 25
-svn:wc:ra_dav:version-url
-V 72
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/JoystickSupport.cpp
-END
-VideoModeSupport.hpp
-K 25
-svn:wc:ra_dav:version-url
-V 73
-/svnroot/sfml/!svn/ver/554/src/SFML/Window/OSXCarbon/VideoModeSupport.hpp
-END
diff --git a/src/SFML/Window/OSXCarbon/.svn/entries b/src/SFML/Window/OSXCarbon/.svn/entries
deleted file mode 100644
index 8a56c0d..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/entries
+++ /dev/null
@@ -1,300 +0,0 @@
-9
-
-dir
-915
-https://sfml.svn.sourceforge.net/svnroot/sfml/src/SFML/Window/OSXCarbon
-https://sfml.svn.sourceforge.net/svnroot/sfml
-
-
-
-2008-04-08T10:07:48.169051Z
-584
-ceylo
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-4e206d99-4929-0410-ac5d-dfc041789085
-
-WindowImplCarbon.cpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-d55af7c0490d5ef3935257fd99c21d8a
-2008-04-08T10:07:48.169051Z
-584
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-30725
-
-Joystick.cpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-98443ddcf084445c7b30acbc5f4db892
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2582
-
-JoystickSupport.hpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-7af3d85293bcdf7ca223feba9b0e533a
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3758
-
-WindowImplCarbon.hpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-072cda785bb4dc4b5b2679c5b26cb3c9
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-10298
-
-Joystick.hpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-59cf44d331366656f677fedad10576a3
-2008-03-29T12:14:52.659579Z
-568
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-4299
-
-VideoModeSupport.cpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-7dd65be66ab8847ba9c10aa18cad2b9a
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-3478
-
-JoystickSupport.cpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-4cff21b9e473dde8aa7a1c20d018a388
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-8956
-
-VideoModeSupport.hpp
-file
-
-
-
-
-2008-11-01T16:23:45.000000Z
-95c6de5afaf7a434be5f76370e0d252f
-2008-03-26T16:22:12.129629Z
-554
-ceylo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-2386
-
diff --git a/src/SFML/Window/OSXCarbon/.svn/format b/src/SFML/Window/OSXCarbon/.svn/format
deleted file mode 100644
index ec63514..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/format
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.cpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.cpp.svn-base
deleted file mode 100644
index eac7bac..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.cpp.svn-base
+++ /dev/null
@@ -1,79 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2008 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 <SFML/Window/Joystick.hpp>
-#include "Joystick.hpp"
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Initialize the instance and bind it to a physical joystick
-////////////////////////////////////////////////////////////
-void Joystick::Initialize(unsigned int Index)
-{
- // Reset the joystick state
-
- // Initialize the Index-th available joystick
-}
-
-
-////////////////////////////////////////////////////////////
-/// Update the current joystick and return its new state
-////////////////////////////////////////////////////////////
-JoystickState Joystick::UpdateState()
-{
- // Fill a JoystickState instance with the current joystick state
- JoystickState s = {0};
- return s;
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get the number of axes supported by the joystick
-////////////////////////////////////////////////////////////
-unsigned int Joystick::GetAxesCount() const
-{
- // Return number of supported axes
- return 0;
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get the number of buttons supported by the joystick
-////////////////////////////////////////////////////////////
-unsigned int Joystick::GetButtonsCount() const
-{
- // Return number of supported buttons
- return 0;
-}
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.hpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.hpp.svn-base
deleted file mode 100644
index 36f56dc..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/Joystick.hpp.svn-base
+++ /dev/null
@@ -1,132 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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_JOYSTICKOSX_HPP
-#define SFML_JOYSTICKOSX_HPP
-
-#warning Old Joystick header.
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <CoreFoundation/CoreFoundation.h>
-#include <Carbon/Carbon.h>
-#include <IOKit/IOCFPlugIn.h>
-#include <IOKit/hid/IOHIDLib.h>
-#include <IOKit/hid/IOHIDUsageTables.h>
-#include <string>
-#include <vector>
-
-
-namespace sf
-{
-namespace priv
-{
-
-////////////////////////////////////////////////////////////
-/// ****** implementation of Joystick (unknown implementation kind for now)
-////////////////////////////////////////////////////////////
-class Joystick
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Initialize the instance and bind it to a physical joystick
- ///
- /// \param Index : Index of the physical joystick to bind to
- ///
- ////////////////////////////////////////////////////////////
- void Initialize(unsigned int Index);
-
- ////////////////////////////////////////////////////////////
- /// Update the current joystick and return its new state
- ///
- /// \return Current state of the joystick
- ///
- ////////////////////////////////////////////////////////////
- JoystickState UpdateState();
-
- ////////////////////////////////////////////////////////////
- /// Get the number of axes supported by the joystick
- ///
- /// \return Number of axis
- ///
- ////////////////////////////////////////////////////////////
- unsigned int GetAxesCount() const;
-
- ////////////////////////////////////////////////////////////
- /// Get the number of buttons supported by the joystick
- ///
- /// \return Number of buttons
- ///
- ////////////////////////////////////////////////////////////
- unsigned int GetButtonsCount() const;
-};
-
-
-
-////////////////////////////////////////////////////////////
-/// MacOS X implementation of JoystickElement
-/// Storage class for a single joystick button or axis
-////////////////////////////////////////////////////////////
-class JoystickElement
-{
-
-public:
- IOHIDElementCookie cookie;
- std::string name;
- long elementType;
- long usagePage;
- long usage;
- long min;
- long max;
- long scaledMin;
- long scaledMax;
- float value;
-};
-
-////////////////////////////////////////////////////////////
-/// MacOS X implementation of JoystickDevice
-/// Storage class for one joystick or gamepad
-////////////////////////////////////////////////////////////
-class JoystickDevice
-{
-
-public:
- IOHIDDeviceInterface **hidDeviceInterface;
- CFMutableDictionaryRef deviceProps;
- long usagePage;
- long usage;
- long locationID;
- long productID;
- long vendorID;
- std::vector<JoystickElement> buttons;
- std::vector<JoystickElement> axis;
-};
-
-} // namespace priv
-
-} // namespace sf
-
-#endif // SFML_JOYSTICKOSX_HPP
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.cpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.cpp.svn-base
deleted file mode 100644
index 4cbb137..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.cpp.svn-base
+++ /dev/null
@@ -1,287 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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 <SFML/Window/Event.hpp>
-#include "JoystickSupport.hpp"
-#include <iostream>
-
-namespace sf
-{
-namespace priv
-{
-
-
-////////////////////////////////////////////////////////////
-/// Enumerate all attached joystick/gamepad controllers
-////////////////////////////////////////////////////////////
-int JoystickSupport::EnumerateDevices(std::vector<JoystickDevice> &devices)
-{
- IOReturn ioRes = IOMasterPort(bootstrap_port, &myMasterPort);
-
- if (ioRes != kIOReturnSuccess)
- return 0;
-
- CFMutableDictionaryRef hidMatchDictionary = 0;
- io_iterator_t hidObjectIterator = 0;
-
- hidMatchDictionary = IOServiceMatching(kIOHIDDeviceKey);
-
- ioRes = IOServiceGetMatchingServices( myMasterPort, hidMatchDictionary, &hidObjectIterator );
-
- if ((ioRes != kIOReturnSuccess) || (hidObjectIterator == nil))
- {
- return 0;
- }
-
- io_object_t hidDevice;
- kern_return_t result;
- CFMutableDictionaryRef properties;
- CFTypeRef object;
- long usagePage, usage, locationID;
-
- while ((hidDevice = IOIteratorNext(hidObjectIterator)))
- {
- result = IORegistryEntryCreateCFProperties(hidDevice, &properties, kCFAllocatorDefault, kNilOptions);
-
- if ((result != KERN_SUCCESS) || (properties == nil))
- continue;
-
- object = CFDictionaryGetValue(properties, CFSTR(kIOHIDPrimaryUsagePageKey));
- if (object)
- {
- if (!CFNumberGetValue((CFNumberRef)object, kCFNumberLongType, &usagePage))
- continue;
-
- object = CFDictionaryGetValue(properties, CFSTR(kIOHIDPrimaryUsageKey));
-
- if (object)
- {
- if(!CFNumberGetValue((CFNumberRef)object, kCFNumberLongType, &usage))
- continue;
- }
- }
-
- object = CFDictionaryGetValue(properties, CFSTR(kIOHIDLocationIDKey));
- if (!object)
- locationID = 0;
- else
- {
- if(!CFNumberGetValue((CFNumberRef)object, kCFNumberLongType, &locationID))
- locationID = 0;
- }
-
- if (usagePage == kHIDPage_GenericDesktop)
- {
- switch(usage)
- {
- case kHIDUsage_GD_Joystick :
- case kHIDUsage_GD_GamePad :
- {
- JoystickDevice Joystick;
-
- EnumerateElements(properties, &Joystick);
-
- if (GetDeviceInterface(&hidDevice, Joystick) == kIOReturnSuccess)
- {
- devices.push_back(Joystick);
- std::cout << "Device with " << Joystick.axis.size() << " axes and " << Joystick.buttons.size() << " buttons was found." << std::endl;
- }
- }
- break;
- }
- }
-
- CFRelease(properties);
-
- ioRes = IOObjectRelease(hidDevice);
-
- if(ioRes != kIOReturnSuccess)
- std::cout << "Error releasing device" << std::endl;
- }
-
- IOObjectRelease(hidObjectIterator);
-
- return 1;
-}
-
-
-////////////////////////////////////////////////////////////
-/// Enumerate all elements of a joystick/gamepad controller
-////////////////////////////////////////////////////////////
-bool JoystickSupport::EnumerateElements(CFDictionaryRef dictionary, JoystickDevice *joystick)
-{
- CFTypeRef Object;
- CFTypeID Type;
-
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementKey));
-
- if (Object)
- {
- Type = CFGetTypeID(Object);
-
- if (Type == CFArrayGetTypeID())
- {
- CFRange Range;
- Range.location = 0;
- Range.length = CFArrayGetCount((CFArrayRef)Object);
-
- CFArrayApplyFunction((CFArrayRef)Object, Range, (CFArrayApplierFunction)JoystickSupport::ElementArrayCallback, (void*)joystick);
- }
- else if (Type == CFDictionaryGetTypeID())
- {
- ValidateElement((CFDictionaryRef)Object, joystick);
- }
- }
-
- return 1;
-}
-
-
-////////////////////////////////////////////////////////////
-/// Enumerate all elements of a joystick/gamepad controller
-////////////////////////////////////////////////////////////
-void JoystickSupport::ElementArrayCallback(const void *Object, void *Value)
-{
- if (CFGetTypeID(Object) != CFDictionaryGetTypeID())
- return;
-
- ValidateElement((CFDictionaryRef)Object, (JoystickDevice*)Value);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Classify the type and parameters of a controller element
-////////////////////////////////////////////////////////////
-void JoystickSupport::ValidateElement(CFDictionaryRef dictionary, JoystickDevice *joystick)
-{
- CFTypeRef Object;
-
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementTypeKey));
-
- if (Object)
- {
- JoystickElement JoyElement;
-
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.elementType));
-
- if (JoyElement.elementType == kIOHIDElementTypeInput_Misc || JoyElement.elementType == kIOHIDElementTypeInput_Button || JoyElement.elementType == kIOHIDElementTypeInput_Axis)
- {
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementCookieKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.cookie));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementUsagePageKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.usagePage));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementUsageKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.usage));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementMinKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.min));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementMaxKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.max));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementScaledMinKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.scaledMin));
- Object = CFDictionaryGetValue(dictionary, CFSTR(kIOHIDElementScaledMaxKey));
- CFNumberGetValue((CFNumberRef)Object, kCFNumberLongType, &(JoyElement.scaledMax));
-
- switch (JoyElement.usage)
- {
- case kHIDUsage_GD_X :
- case kHIDUsage_GD_Rx :
- case kHIDUsage_GD_Y :
- case kHIDUsage_GD_Ry :
- case kHIDUsage_GD_Z :
- case kHIDUsage_GD_Rz :
- {
- joystick->axis.push_back(JoyElement);
- }
- break;
-
- default :
- {
- if (JoyElement.usagePage != kHIDPage_Button)
- break;
-
- joystick->buttons.push_back(JoyElement);
- }
- break;
- }
- }
- }
-
- EnumerateElements(dictionary, joystick);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Store the interface to the joystick/gamepad for future usage
-////////////////////////////////////////////////////////////
-int JoystickSupport::GetDeviceInterface(io_object_t *hidDevice, JoystickDevice &joystick)
-{
- IOCFPlugInInterface **plugInInterface;
- HRESULT plugInResult;
- SInt32 score = 0;
- IOReturn ioRes;
-
- if (IOCreatePlugInInterfaceForService(*hidDevice, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score) == kIOReturnSuccess)
- {
- plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID*)&(joystick.hidDeviceInterface));
-
- if( plugInResult == S_OK )
- {
- (*plugInInterface)->Release(plugInInterface);
-
- ioRes = (*(joystick.hidDeviceInterface))->open(joystick.hidDeviceInterface, 0);
- }
- }
-
- return ioRes;
-}
-
-////////////////////////////////////////////////////////////
-/// Release all joystick/gamepad devices
-////////////////////////////////////////////////////////////
-void JoystickSupport::ReleaseDevices(std::vector<JoystickDevice> &joysticks)
-{
- std::vector<JoystickDevice>::iterator end = joysticks.end();
- std::vector<JoystickDevice>::iterator iter = joysticks.begin();
-
- for( ; iter != end; ++iter )
- {
- IOHIDDeviceInterface **interface = (*iter).hidDeviceInterface;
-
- (*interface)->close( interface );
- (*interface)->Release( interface );
- }
-
- joysticks.clear();
-
- if( myMasterPort )
- mach_port_deallocate( mach_task_self(), myMasterPort );
-}
-
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.hpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.hpp.svn-base
deleted file mode 100644
index 08252da..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/JoystickSupport.hpp.svn-base
+++ /dev/null
@@ -1,103 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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_JOYSTICKSUPPORTOSX_HPP
-#define SFML_JOYSTICKSUPPORTOSX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Window/OSXCarbon/Joystick.hpp>
-#include <Carbon/Carbon.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <IOKit/IOCFPlugIn.h>
-#include <IOKit/hid/IOHIDLib.h>
-#include <IOKit/hid/IOHIDUsageTables.h>
-#include <mach/mach_port.h>
-#include <string>
-#include <vector>
-
-
-namespace sf
-{
-namespace priv
-{
-
-////////////////////////////////////////////////////////////
-/// MacOS X implementation of JoystickSupport
-/// Give access to joystick related OS-specific functions
-////////////////////////////////////////////////////////////
-class JoystickSupport
-{
-
-public :
- ////////////////////////////////////////////////////////////
- /// Get all attached Joystick/Gamepad devices
- ///
- /// \return Error state of device retrieval
- ///
- ////////////////////////////////////////////////////////////
- int EnumerateDevices(std::vector<JoystickDevice> &devices);
-
- ////////////////////////////////////////////////////////////
- /// Enumerate all elements of a joystick/gamepad
- ///
- /// \return Error state of element enumeration
- ///
- ////////////////////////////////////////////////////////////
- static bool EnumerateElements(CFDictionaryRef dictionary, JoystickDevice *joystick);
-
- ////////////////////////////////////////////////////////////
- /// Callback for joystick elements
- ////////////////////////////////////////////////////////////
- static void ElementArrayCallback(const void *Object, void *Value);
-
- ////////////////////////////////////////////////////////////
- /// Determine the type and viability of a joystick element
- ////////////////////////////////////////////////////////////
- static void ValidateElement(CFDictionaryRef dictionary, JoystickDevice *joystick);
-
- ////////////////////////////////////////////////////////////
- /// Get an interface to the joystick
- ///
- /// \return Error state of device interface
- ///
- ////////////////////////////////////////////////////////////
- int GetDeviceInterface(io_object_t *hidDevice, JoystickDevice &joystick);
-
- ////////////////////////////////////////////////////////////
- /// Release all joysticks
- ////////////////////////////////////////////////////////////
- void ReleaseDevices(std::vector<JoystickDevice> &joysticks);
-
-private:
-
- mach_port_t myMasterPort;
-};
-
-} // namespace priv
-
-} // namespace sf
-
-#endif // SFML_JOYSTICKSUPPORTOSX_HPP
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.cpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.cpp.svn-base
deleted file mode 100644
index b16e5b1..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.cpp.svn-base
+++ /dev/null
@@ -1,85 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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 <SFML/Window/OSXCarbon/VideoModeSupport.hpp>
-#include <Carbon/Carbon.h>
-#include <algorithm>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Get supported video modes
-////////////////////////////////////////////////////////////
-void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& Modes)
-{
- // First, clear array to fill
- Modes.clear();
-
- // Enumerate all available video modes for primary display adapter
- CFArrayRef DisplayModes = CGDisplayAvailableModes( kCGDirectMainDisplay );
- CFIndex DisplayModeCount = CFArrayGetCount( DisplayModes );
- CFDictionaryRef CurrentMode;
-
- for (int Count = 0; Count < DisplayModeCount; ++Count)
- {
- CurrentMode = (CFDictionaryRef)CFArrayGetValueAtIndex( DisplayModes, Count );
-
- VideoMode Mode;
-
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayWidth), kCFNumberIntType, &(Mode.Width));
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayHeight), kCFNumberIntType, &(Mode.Height));
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentMode, kCGDisplayBitsPerPixel), kCFNumberIntType, &(Mode.BitsPerPixel));
-
- // Add it only if it is not already in the array
- if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end())
- Modes.push_back(Mode);
- }
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get current desktop video mode
-////////////////////////////////////////////////////////////
-VideoMode VideoModeSupport::GetDesktopVideoMode()
-{
- CFDictionaryRef CurrentVideoMode = CGDisplayCurrentMode(kCGDirectMainDisplay);
-
- VideoMode DesktopMode;
-
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayWidth), kCFNumberIntType, &(DesktopMode.Width));
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayHeight), kCFNumberIntType, &(DesktopMode.Height));
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayBitsPerPixel), kCFNumberIntType, &(DesktopMode.BitsPerPixel));
-
- return DesktopMode;
-}
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.hpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.hpp.svn-base
deleted file mode 100644
index 175deae..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/VideoModeSupport.hpp.svn-base
+++ /dev/null
@@ -1,68 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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_VIDEOMODESUPPORTCARBON_HPP
-#define SFML_VIDEOMODESUPPORTCARBON_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Window/VideoMode.hpp>
-#include <vector>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// MacOS X implementation of VideoModeSupport
-/// Give access to video mode related OS-specific functions
-////////////////////////////////////////////////////////////
-class VideoModeSupport
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Get supported video modes
- ///
- /// \param Modes : Array to fill with available video modes
- ///
- ////////////////////////////////////////////////////////////
- static void GetSupportedVideoModes(std::vector<VideoMode>& Modes);
-
- ////////////////////////////////////////////////////////////
- /// Get current desktop video mode
- ///
- /// \return Current desktop video mode
- ///
- ////////////////////////////////////////////////////////////
- static VideoMode GetDesktopVideoMode();
-};
-
-} // namespace priv
-
-} // namespace sf
-
-#endif // SFML_VIDEOMODESUPPORTCARBON_HPP
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.cpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.cpp.svn-base
deleted file mode 100644
index 1b83197..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.cpp.svn-base
+++ /dev/null
@@ -1,919 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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 <SFML/Window/OSXCarbon/WindowImplCarbon.hpp>
-// #include <SFML/Window/OSXCarbon/JoystickSupport.hpp>
-#include <SFML/Window/WindowStyle.hpp>
-#include <iostream>
-#include <vector>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-// Static member data
-////////////////////////////////////////////////////////////
-unsigned int WindowImplCarbon::ourWindowCount = 0;
-WindowImplCarbon* WindowImplCarbon::ourDummyWindow = NULL;
-
-#if SFML_JOYSTICK_SUPPORT
-JoystickSupport joySupport;
-std::vector<JoystickDevice> joysticks;
-#endif // SFML_JOYSTICK_SUPPORT
-
-WindowAttributes windowAttrib = kWindowStandardDocumentAttributes |
- kWindowStandardHandlerAttribute;
-
-EventTypeSpec eventSpec[] = { { kEventClassCommand, kEventCommandProcess },
- { kEventClassMouse, kEventMouseDown },
- { kEventClassMouse, kEventMouseUp },
- { kEventClassMouse, kEventMouseDragged },
- { kEventClassMouse, kEventMouseWheelMoved },
- { kEventClassWindow, kEventWindowCollapsing },
- { kEventClassWindow, kEventWindowActivated },
- { kEventClassWindow, kEventWindowClose },
- { kEventClassWindow, kEventWindowDrawContent },
- { kEventClassWindow, kEventWindowBoundsChanged },
- { kEventClassWindow, kEventWindowBoundsChanging },
- { kEventClassKeyboard, kEventRawKeyDown },
- { kEventClassKeyboard, kEventRawKeyUp },
-/* { kEventClassKeyboard, kEventRawKeyModifiersChanged }*/ };
-
-////////////////////////////////////////////////////////////
-/// Default constructor
-/// (creates a dummy window to provide a valid OpenGL context)
-////////////////////////////////////////////////////////////
-WindowImplCarbon::WindowImplCarbon() :
-myHandle (NULL),
-myGLContext (0)
-{
- // Use small dimensions
- myWidth = 1;
- myHeight = 1;
-
- Rect viewRect = { 0, 0, myHeight, myWidth };
-
- // Create a dummy window (disabled and hidden)
- CreateNewWindow(kDocumentWindowClass, windowAttrib, &viewRect, &myHandle);
- HideWindow(myHandle);
-
- // Create the rendering context
- if (myHandle)
- CreateContext(VideoMode(myWidth, myHeight, 32), false, 0);
-
- // Save as the dummy window
- if (!ourDummyWindow)
- ourDummyWindow = this;
-}
-
-
-////////////////////////////////////////////////////////////
-/// Create the window implementation from an existing control
-////////////////////////////////////////////////////////////
-WindowImplCarbon::WindowImplCarbon(WindowHandle Handle, int AntialiasingLevel) :
-myGLContext (0)
-{
- // Save window handle
- myHandle = static_cast <WindowRef> (Handle);
-
- if (myHandle)
- {
- // Get window client size
- Rect viewRect;
- GetWindowBounds(myHandle, kWindowContentRgn, &viewRect);
- myWidth = viewRect.right - viewRect.left;
- myHeight = viewRect.bottom - viewRect.top;
-
- // Create the rendering context
- VideoMode Mode = VideoMode::GetDesktopMode();
- Mode.Width = myWidth;
- Mode.Height = myHeight;
- CreateContext(Mode, false, AntialiasingLevel);
-
-#if SFML_JOYSTICK_SUPPORT
- // Setup joysticks
- SetupJoysticks();
-#endif // SFML_JOYSTICK_SUPPORT
- }
-}
-
-////////////////////////////////////////////////////////////
-/// Create the window implementation
-////////////////////////////////////////////////////////////
-WindowImplCarbon::WindowImplCarbon(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, int AntialiasingLevel) :
-myHandle (NULL),
-myGLContext (0)
-{
- PreInitialize();
-
- // Compute position and size
- Rect viewRect;
- int desktopWidth;
- int desktopHeight;
-
- int useFullscreen = (WindowStyle & Style::Fullscreen);
-
- if (useFullscreen)
- {
- CFDictionaryRef desktopVideoMode = CGDisplayCurrentMode(kCGDirectMainDisplay);
-
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(desktopVideoMode, kCGDisplayWidth), kCFNumberIntType, &desktopWidth);
- CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(desktopVideoMode, kCGDisplayHeight), kCFNumberIntType, &desktopHeight);
-
- viewRect.left = (desktopWidth - Mode.Width) / 2;
- viewRect.top = (desktopHeight - Mode.Height) / 2;
- }
- else
- {
- viewRect.left = 0;
- viewRect.top = 0;
- }
-
- viewRect.right = myWidth = (viewRect.left + Mode.Width);
- viewRect.bottom = myHeight = (viewRect.top + Mode.Height);
-
- windowAttrib ^= ((WindowStyle & Style::Titlebar) ? kWindowResizableAttribute | kWindowLiveResizeAttribute : 0 );
-
- // Create the window
- CreateNewWindow(kDocumentWindowClass, windowAttrib, &viewRect, &myHandle);
-
- // Create the rendering context
- if (myHandle)
- CreateContext(Mode, useFullscreen, AntialiasingLevel);
-
- PostInitialize();
-
- // Increment window count
-#if SFML_JOYSTICK_SUPPORT
- if (ourWindowCount == 0)
- SetupJoysticks();
-#endif // SFML_JOYSTICK_SUPPORT
-
- ourWindowCount++;
-
- if (!useFullscreen)
- {
- CFStringRef windowTitle = CFStringCreateWithCString(kCFAllocatorDefault, Title.c_str(), kCFStringEncodingUTF8);
- SetWindowTitleWithCFString(myHandle, windowTitle);
- RepositionWindow(myHandle, NULL, kWindowCenterOnMainScreen);
- }
-
- ShowWindow(myHandle);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Destructor
-////////////////////////////////////////////////////////////
-WindowImplCarbon::~WindowImplCarbon()
-{
- if (myHandle)
- {
- Cleanup();
- DisposeWindow(myHandle);
- }
-
- // Decrement the window count
- ourWindowCount--;
-
- if (ourWindowCount == 0)
- {
-#if SFML_JOYSTICK_SUPPORT
- joySupport.ReleaseDevices(joysticks);
- joysticks.clear();
-#endif // SFML_JOYSTICK_SUPPORT
- }
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::Display
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::Display()
-{
- if (myGLContext)
- aglSwapBuffers(myGLContext);
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::ProcessEvents
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::ProcessEvents()
-{
- EventRef event;
- EventTargetRef target = GetEventDispatcherTarget();
-
- while (ReceiveNextEvent(0, NULL, 0.0, true, &event)== noErr)
- {
- SendEventToEventTarget (event, target);
- ReleaseEvent(event);
- }
-
-#if SFML_JOYSTICK_SUPPORT
- ReadJoystickStates();
-#endif // SFML_JOYSTICK_SUPPORT
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::MakeCurrent
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::MakeActive(bool Active) const
-{
- if (myGLContext)
- {
- if (Active)
- aglSetCurrentContext(myGLContext);
- else
- aglSetCurrentContext(NULL);
- }
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::UseVerticalSync
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::UseVerticalSync(bool Enabled)
-{
- aglSetInteger(myGLContext, AGL_SWAP_INTERVAL, (GLint*)&Enabled);
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::ShowMouseCursor
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::ShowMouseCursor(bool Show)
-{
- if (Show)
- ShowCursor();
- else
- HideCursor();
-}
-
-////////////////////////////////////////////////////////////
-/// See WindowImple::SetCursorPosition
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::SetCursorPosition(unsigned int Left, unsigned int Top)
-{
-#warning TO DO
-}
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetPosition
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::SetPosition(int Left, int Top)
-{
- MoveWindow(myHandle, Left, Top, false);
-}
-
-////////////////////////////////////////////////////////////
-/// See WindowImpl::Show
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::Show(bool State)
-{
-#warning TO DO
-}
-
-////////////////////////////////////////////////////////////
-/// See WindowImpl::EnableKeyRepeat
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::EnableKeyRepeat(bool Enabled)
-{
-#warning TO DO
-}
-
-////////////////////////////////////////////////////////////
-/// Do some common initializations before the window can be created
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::PreInitialize()
-{
- CFBundleRef bundle = CFBundleGetMainBundle();
- CFURLRef bundle_url = CFBundleCopyBundleURL( bundle );
-
- if (bundle && bundle_url)
- {
- CFStringRef sRef = CFURLCopyFileSystemPath( bundle_url, kCFURLPOSIXPathStyle );
-
- if (sRef)
- {
- char myPath[FILENAME_MAX];
- CFStringGetCString( sRef, myPath, FILENAME_MAX, kCFStringEncodingASCII );
-
-
- // -- Ceylo --
- // CFBundleGetMainBundle() should return NULL if we're not using a bundle application
- // but it doesn't, so we check the bundle path is a directory and has .app suffix.
- // This assumes .app directories are bundle applications, which is actually
- // the case most of the time (always the case until the user wants to trap SFML).
- if (CFURLHasDirectoryPath(bundle_url) && CFStringHasSuffix(sRef, CFSTR(".app"))) {
- chdir( "../" );
- }
-
- CFRelease( sRef );
- }
-
- CFRelease( bundle_url );
- }
-}
-
-////////////////////////////////////////////////////////////
-/// Run the event loop after the window has been created
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::PostInitialize()
-{
- EventHandlerUPP CommandHandler = NewEventHandlerUPP(reinterpret_cast<EventHandlerProcPtr>(&WindowImplCarbon::GlobalOnEvent));
- InstallEventHandler(GetWindowEventTarget(myHandle), CommandHandler, GetEventTypeCount(eventSpec), eventSpec, this, 0 );
-}
-
-
-////////////////////////////////////////////////////////////
-/// Create the OpenGL rendering context
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::CreateContext(VideoMode Mode, bool Fullscreen, int AntialiasingLevel)
-{
- GLint attributes[] =
- {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_DEPTH_SIZE, Mode.BitsPerPixel,
- AGL_SAMPLES_ARB, AntialiasingLevel,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_FULLSCREEN,
- AGL_NONE
- };
-
- AGLPixelFormat myAGLPixelFormat = 0;
- if (Fullscreen)
- {
- boolean_t exactMatch;
-
- CGDisplayCapture(kCGDirectMainDisplay);
- CFDictionaryRef displayMode = CGDisplayBestModeForParametersAndRefreshRate(kCGDirectMainDisplay, Mode.BitsPerPixel, Mode.Width, Mode.Height, 60, &exactMatch);
-
- if (displayMode && exactMatch)
- {
- GDHandle gdhDisplay;
- CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode);
-
- if (DMGetGDeviceByDisplayID ((DisplayIDType)CGMainDisplayID(), &gdhDisplay, false) == noErr)
- {
- if (AntialiasingLevel > 0)
- {
- myAGLPixelFormat = aglChoosePixelFormat(&gdhDisplay, 1, attributes);
- if (!myAGLPixelFormat && AntialiasingLevel > 2)
- {
- // No format matching our needs : reduce the multisampling level
- std::cerr << "Failed to find a pixel format supporting " << AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl;
-
- attributes[5] = 2;
- myAGLPixelFormat = aglChoosePixelFormat(&gdhDisplay, 1, attributes);
-
- if (!myAGLPixelFormat)
- {
- // Cannot find any pixel format supporting multisampling ; disabling antialiasing
- std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl;
- }
- }
- }
-
- if (!myAGLPixelFormat)
- {
- attributes[4] = attributes[8];
- attributes[5] = AGL_NONE;
- myAGLPixelFormat = aglChoosePixelFormat(&gdhDisplay, 1, attributes);
- }
- }
- }
- }
- else
- {
- attributes[8] = AGL_NONE;
-
- if (AntialiasingLevel > 0)
- {
- myAGLPixelFormat = aglChoosePixelFormat(NULL, 0, attributes);
- if (!myAGLPixelFormat && AntialiasingLevel > 2)
- {
- // No format matching our needs : reduce the multisampling level
- std::cerr << "Failed to find a pixel format supporting " << AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl;
-
- attributes[5] = 2;
- myAGLPixelFormat = aglChoosePixelFormat(NULL, 0, attributes);
-
- if (!myAGLPixelFormat)
- {
- // Cannot find any pixel format supporting multisampling ; disabling antialiasing
- std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl;
- }
- }
- }
-
- if (!myAGLPixelFormat)
- {
- attributes[4] = AGL_NONE;
- myAGLPixelFormat = aglChoosePixelFormat(NULL, 0, attributes);
- }
- }
-
- if (myAGLPixelFormat)
- {
- if (Fullscreen)
- {
- // NOTE: Fullscreen contexts don't seem to share well so we don't do it for now
- myGLContext = aglCreateContext(myAGLPixelFormat, NULL);
- aglDestroyPixelFormat(myAGLPixelFormat);
-
- if (myGLContext)
- {
- if (aglSetCurrentContext(myGLContext) == GL_TRUE)
- {
- if (aglSetFullScreen(myGLContext, Mode.Width, Mode.Height, 0, 0) == GL_TRUE)
- {
- GLint swap = 1;
- aglSetInteger(myGLContext, AGL_SWAP_INTERVAL, &swap);
- }
- }
- }
- }
- else
- {
- // If a current context exists, share it's objects with this new context
- myGLContext = aglCreateContext(myAGLPixelFormat, aglGetCurrentContext());
- aglDestroyPixelFormat(myAGLPixelFormat);
-
- if (myGLContext)
- {
- aglSetDrawable(myGLContext, GetWindowPort(myHandle));
- }
- }
-
- // Set our context as the current OpenGL context for rendering
- SetActive();
- }
-}
-
-////////////////////////////////////////////////////////////
-/// Free all the graphical resources attached to the window
-////////////////////////////////////////////////////////////
-void WindowImplCarbon::Cleanup()
-{
- // Unhide the mouse cursor (in case it was hidden)
- ShowMouseCursor(true);
-
- // Destroy the OpenGL context
- if (myGLContext)
- {
- // If this is not the dummy window, we must set it as the valid rendering context to avoid a crash with next OpenGL command
- if (this != ourDummyWindow)
- {
- if (ourDummyWindow)
- ourDummyWindow->SetActive();
- }
- else
- {
- ourDummyWindow = NULL;
- aglSetCurrentContext(NULL);
- }
-
- // Destroy the context
- aglSetDrawable(myGLContext, NULL);
- aglDestroyContext(myGLContext);
- myGLContext = NULL;
- }
-}
-
-////////////////////////////////////////////////////////////
-/// Function called whenever one of our windows receives a message
-////////////////////////////////////////////////////////////
-OSStatus WindowImplCarbon::CommandEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData)
-{
- HICommand command;
- GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(command), NULL, &command);
-
- switch(command.commandID)
- {
- case kHICommandNew :
- return noErr;
- break;
-
- case kHICommandQuit :
- case kHICommandClose :
- return noErr;
- break;
- }
-
- return CallNextEventHandler(nextHandler, event);
-}
-
-////////////////////////////////////////////////////////////
-/// Function called whenever a mouse event occurs
-////////////////////////////////////////////////////////////
-OSStatus WindowImplCarbon::MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData)
-{
- EventMouseButton button = 0;
- HIPoint location = {0.0f, 0.0f};
-
- GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button);
- GetEventParameter(event, kEventParamWindowMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &location);
-
- Event Evt;
- Evt.MouseButton.Button = Mouse::Left;
- Evt.MouseMove.X = (unsigned)location.x;
- Evt.MouseMove.Y = (unsigned)location.y;
- switch( button )
- {
- case kEventMouseButtonPrimary :
- Evt.MouseButton.Button = Mouse::Left;
- break;
- case kEventMouseButtonSecondary :
- Evt.MouseButton.Button = Mouse::Right;
- break;
- case kEventMouseButtonTertiary :
- Evt.MouseButton.Button = Mouse::Middle;
- break;
- }
-
- switch(GetEventKind(event))
- {
- // Mouse button down event
- case kEventMouseDown :
- {
- Evt.Type = Event::MouseButtonPressed;
- SendEvent(Evt);
- break;
- }
-
- // Mouse button up event
- case kEventMouseUp :
- {
- Evt.Type = Event::MouseButtonReleased;
- SendEvent(Evt);
- break;
- }
-
- // Mouse moved event
- case kEventMouseMoved :
- case kEventMouseDragged :
- {
- Evt.Type = Event::MouseMoved;
- SendEvent(Evt);
- break;
- }
-
- // Mouse wheel event
- case kEventMouseWheelMoved :
- {
- long wheelDelta = 0;
- GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(long), NULL, &wheelDelta);
-
- Evt.Type = Event::MouseWheelMoved;
- Evt.MouseWheel.Delta = wheelDelta;
- SendEvent(Evt);
- break;
- }
- }
-
- return CallNextEventHandler(nextHandler, event);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Function called whenever a keyboard event occurs
-////////////////////////////////////////////////////////////
-OSStatus WindowImplCarbon::KeyboardEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData)
-{
- UInt32 keyCode;
- UInt32 modifiers;
-
- GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
- GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0, sizeof(UInt32), 0, &modifiers);
-
- Event Evt;
- Evt.Key.Code = VirtualKeyCodeToSF(keyCode);
- Evt.Key.Alt = (modifiers & optionKey) || (modifiers & rightOptionKey);
- Evt.Key.Control = (modifiers & controlKey) || (modifiers & rightControlKey);
- Evt.Key.Shift = (modifiers & shiftKey) || (modifiers & rightShiftKey);
-
- switch(GetEventKind(event))
- {
- case kEventRawKeyDown :
- {
- Evt.Type = Event::KeyPressed;
- SendEvent(Evt);
- break;
- }
- case kEventRawKeyUp :
- {
- Evt.Type = Event::KeyReleased;
- SendEvent(Evt);
- break;
- }
- }
-
- return CallNextEventHandler(nextHandler, event);
-}
-
-////////////////////////////////////////////////////////////
-/// Process a Carbon window event
-////////////////////////////////////////////////////////////
-OSStatus WindowImplCarbon::WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData)
-{
- Event Evt;
-
- switch(GetEventKind(event))
- {
- case kEventWindowDrawContent :
- break;
-
- // Window closed event
- case kEventWindowClose :
- {
- Evt.Type = Event::Closed;
- SendEvent(Evt);
- break;
- }
-
- // Update window size
- case kEventWindowBoundsChanging :
- case kEventWindowBoundsChanged :
- {
- SetActive();
- aglUpdateContext(myGLContext);
-
- Rect viewRect;
- GetWindowBounds(myHandle, kWindowContentRgn, &viewRect);
-
- myWidth = viewRect.right - viewRect.left;
- myHeight = viewRect.bottom - viewRect.top;
-
- Evt.Type = Event::Resized;
- Evt.Size.Width = myWidth;
- Evt.Size.Height = myHeight;
- SendEvent(Evt);
- break;
- }
-
- // Gain focus event
- case kEventWindowActivated :
- {
- Evt.Type = Event::GainedFocus;
- SendEvent(Evt);
- break;
- }
-
- // Lost focus event
- case kEventWindowCollapsing :
- {
- Evt.Type = Event::LostFocus;
- SendEvent(Evt);
- break;
- }
- }
-
- return CallNextEventHandler(nextHandler, event);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Setup the joysticks
-////////////////////////////////////////////////////////////
-#if SFML_JOYSTICK_SUPPORT
-void WindowImplCarbon::SetupJoysticks()
-{
- joySupport.EnumerateDevices(joysticks);
-}
-#endif // SFML_JOYSTICK_SUPPORT
-
-
-////////////////////////////////////////////////////////////
-/// Read the joystick states
-////////////////////////////////////////////////////////////
-#if SFML_JOYSTICK_SUPPORT
-void WindowImplCarbon::ReadJoystickStates()
-{
- std::vector<JoystickDevice>::iterator end = joysticks.end();
- std::vector<JoystickDevice>::iterator iter = joysticks.begin();
-
- for (; iter != end; ++iter)
- {
- IOHIDDeviceInterface **interface = (*iter).hidDeviceInterface;
- IOHIDElementCookie cookie;
- IOHIDEventStruct hidEvent;
- int count;
-
- for (count = 0; count < (*iter).axis.size(); ++count)
- {
- cookie = (*iter).axis[count].cookie;
-
- if ((*interface)->getElementValue(interface, cookie, &hidEvent) == noErr)
- {
- if (hidEvent.value != (*iter).axis[count].value)
- {
- Event Evt;
- Evt.Type = Event::JoyMoved;
- Evt.JoyMove.JoystickId = (*iter).locationID;
-
- switch((*iter).axis[count].usage)
- {
- case kHIDUsage_GD_X :
- case kHIDUsage_GD_Rx :
- Evt.JoyMove.Axis.AxisX = (2.0f*(hidEvent.value - (*iter).axis[count].min) / ((*iter).axis[count].max - (*iter).axis[count].min)) - 1.0f;
- break;
- case kHIDUsage_GD_Y :
- case kHIDUsage_GD_Ry :
- Evt.JoyMove.AxisY = (2.0f*(hidEvent.value - (*iter).axis[count].min) / ((*iter).axis[count].max - (*iter).axis[count].min)) - 1.0f;
- break;
- case kHIDUsage_GD_Z :
- case kHIDUsage_GD_Rz :
- Evt.JoyMove.AxisZ = (2.0f*(hidEvent.value - (*iter).axis[count].min) / ((*iter).axis[count].max - (*iter).axis[count].min)) - 1.0f;
- break;
- }
-
- SendEvent(Evt);
- (*iter).axis[count].value = hidEvent.value;
- }
- }
- }
-
- for (count = 0; count < (*iter).axis.size(); ++count)
- {
- cookie = (*iter).buttons[count].cookie;
-
- if ((*interface)->getElementValue(interface, cookie, &hidEvent) == noErr)
- {
- if (hidEvent.value)
- {
- std::cout << "HID event type: " << hidEvent.type << std::endl;
- std::cout << "HID event value: " << hidEvent.value << std::endl;
- }
- if (hidEvent.value != (*iter).buttons[count].value)
- {
- Event Evt;
- Evt.Type = (hidEvent.value == 0) ? Event::JoyButtonPressed : Event::JoyButtonReleased;
- Evt.JoyMove.JoystickId = (*iter).locationID;
- Evt.JoyButton.Button = count;
- std::cout << "Sending button event" << std::endl;
-
- SendEvent(Evt);
- }
- (*iter).buttons[count].value = hidEvent.value;
- }
- }
- }
-}
-#endif
-
-
-////////////////////////////////////////////////////////////
-/// Convert a Carbon key code to a SFML key code
-////////////////////////////////////////////////////////////
-Key::Code WindowImplCarbon::VirtualKeyCodeToSF(UInt32 VirtualKey)
-{
- switch (VirtualKey)
- {
- case 0x35 : return Key::Escape;
- case 0x31 : return Key::Space;
- case 0x4C : return Key::Return;
- case 0x33 : return Key::Back;
- case 0x30 : return Key::Tab;
- case 0x74 : return Key::PageUp;
- case 0x79 : return Key::PageDown;
- case 0x77 : return Key::End;
- case 0x73 : return Key::Home;
- case 0x72 : return Key::Insert;
- case 0x75 : return Key::Delete;
- case 0x45 : return Key::Add;
- case 0x4E : return Key::Subtract;
- case 0x43 : return Key::Multiply;
- case 0x4B : return Key::Divide;
- case 0x7A : return Key::F1;
- case 0x78 : return Key::F2;
- case 0x63 : return Key::F3;
- case 0x76 : return Key::F4;
- case 0x60 : return Key::F5;
- case 0x61 : return Key::F6;
- case 0x62 : return Key::F7;
- case 0x64 : return Key::F8;
- case 0x65 : return Key::F9;
- case 0x6D : return Key::F10;
- case 0x67 : return Key::F11;
- case 0x6F : return Key::F12;
- case 0x69 : return Key::F13;
- case 0x6B : return Key::F14;
- case 0x71 : return Key::F15;
- case 0x7B : return Key::Left;
- case 0x7C : return Key::Right;
- case 0x7E : return Key::Up;
- case 0x7D : return Key::Down;
- case 0x52 : return Key::Numpad0;
- case 0x53 : return Key::Numpad1;
- case 0x54 : return Key::Numpad2;
- case 0x55 : return Key::Numpad3;
- case 0x56 : return Key::Numpad4;
- case 0x57 : return Key::Numpad5;
- case 0x58 : return Key::Numpad6;
- case 0x59 : return Key::Numpad7;
- case 0x5B : return Key::Numpad8;
- case 0x5C : return Key::Numpad9;
- case 0x00 : return Key::A;
- case 0x0B : return Key::B;
- case 0x08 : return Key::C;
- case 0x02 : return Key::D;
- case 0x0E : return Key::E;
- case 0x03 : return Key::F;
- case 0x05 : return Key::G;
- case 0x04 : return Key::H;
- case 0x22 : return Key::I;
- case 0x26 : return Key::J;
- case 0x28 : return Key::K;
- case 0x25 : return Key::L;
- case 0x2E : return Key::M;
- case 0x2D : return Key::N;
- case 0x1F : return Key::O;
- case 0x23 : return Key::P;
- case 0x0C : return Key::Q;
- case 0x0F : return Key::R;
- case 0x01 : return Key::S;
- case 0x11 : return Key::T;
- case 0x20 : return Key::U;
- case 0x09 : return Key::V;
- case 0x0D : return Key::W;
- case 0x07 : return Key::X;
- case 0x10 : return Key::Y;
- case 0x06 : return Key::Z;
- case 0x1D : return Key::Num0;
- case 0x12 : return Key::Num1;
- case 0x13 : return Key::Num2;
- case 0x14 : return Key::Num3;
- case 0x15 : return Key::Num4;
- case 0x17 : return Key::Num5;
- case 0x16 : return Key::Num6;
- case 0x1A : return Key::Num7;
- case 0x1C : return Key::Num8;
- case 0x19 : return Key::Num9;
- }
-
- return Key::Code(0);
-}
-
-
-////////////////////////////////////////////////////////////
-/// Function called whenever one of our windows receives a message
-////////////////////////////////////////////////////////////
-OSStatus WindowImplCarbon::GlobalOnEvent(EventHandlerCallRef nextHandler, EventRef event, void* userData)
-{
- WindowImplCarbon* This = (WindowImplCarbon*)userData;
-
- // Forward the event to the appropriate function
- if (This)
- {
- switch (GetEventClass(event))
- {
- case kEventClassCommand :
- This->CommandEventHandler( nextHandler, event, userData );
- break;
- case kEventClassWindow :
- This->WindowEventHandler( nextHandler, event, userData );
- break;
- case kEventClassMouse :
- This->MouseEventHandler( nextHandler, event, userData );
- break;
- case kEventClassKeyboard :
- This->KeyboardEventHandler( nextHandler, event, userData );
- break;
- }
- }
-
- return noErr;
-}
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.hpp.svn-base b/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.hpp.svn-base
deleted file mode 100644
index 6ed7216..0000000
--- a/src/SFML/Window/OSXCarbon/.svn/text-base/WindowImplCarbon.hpp.svn-base
+++ /dev/null
@@ -1,257 +0,0 @@
-////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 Brad Leffler (brad.leffler@gmail.com) and 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_WINDOWIMPLCARBON_HPP
-#define SFML_WINDOWIMPLCARBON_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Window/Event.hpp>
-#include <SFML/Window/WindowImpl.hpp>
-#include <Carbon/Carbon.h>
-#include <AGL/agl.h>
-#include <set>
-#include <string>
-
-
-namespace sf
-{
- namespace priv
-{
- ////////////////////////////////////////////////////////////
- /// WindowImplCarbon is the Carbon implementation of WindowImpl
- ////////////////////////////////////////////////////////////
- class WindowImplCarbon : public WindowImpl
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Default constructor
- /// (creates a dummy window to provide a valid OpenGL context)
- ///
- ////////////////////////////////////////////////////////////
- WindowImplCarbon();
-
- ////////////////////////////////////////////////////////////
- /// Construct the window implementation from an existing control
- ///
- /// \param Handle : Platform-specific handle of the control
- /// \param AntialiasingLevel : Level of antialiasing
- ///
- ////////////////////////////////////////////////////////////
- WindowImplCarbon(WindowHandle Handle, int AntialiasingLevel);
-
- ////////////////////////////////////////////////////////////
- /// Create the window implementation
- ///
- /// \param Mode : Video mode to use
- /// \param Title : Title of the window
- /// \param WindowStyle : Window style (resizable, fixed, or fullscren)
- /// \param AntialiasingLevel : Level of antialiasing
- ///
- ////////////////////////////////////////////////////////////
- WindowImplCarbon(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, int AntialiasingLevel);
-
- ////////////////////////////////////////////////////////////
- /// Destructor
- ///
- ////////////////////////////////////////////////////////////
- ~WindowImplCarbon();
-
-private :
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::Display
- ///
- ///////////////////////////////////////////////////////////
- virtual void Display();
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::ProcessEvents
- ///
- ////////////////////////////////////////////////////////////
- virtual void ProcessEvents();
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::MakeActive
- ///
- ////////////////////////////////////////////////////////////
- virtual void MakeActive(bool Active = true) const;
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::UseVerticalSync
- ///
- ////////////////////////////////////////////////////////////
- virtual void UseVerticalSync(bool Enabled);
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::ShowMouseCursor
- ///
- ////////////////////////////////////////////////////////////
- virtual void ShowMouseCursor(bool Show);
-
- ////////////////////////////////////////////////////////////
- /// Change the position of the mouse cursor
- ///
- /// \param Left : Left coordinate of the cursor, relative to the window
- /// \param Top : Top coordinate of the cursor, relative to the window
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetCursorPosition(unsigned int Left, unsigned int Top);
-
- ////////////////////////////////////////////////////////////
- /// /see sfWindowImpl::SetPosition
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetPosition(int Left, int Top);
-
- ////////////////////////////////////////////////////////////
- /// See WindowImpl::Show
- ////////////////////////////////////////////////////////////
- virtual void Show(bool State);
-
- ////////////////////////////////////////////////////////////
- /// See WindowImpl::EnableKeyRepeat
- ////////////////////////////////////////////////////////////
- virtual void EnableKeyRepeat(bool Enabled);
-
- ////////////////////////////////////////////////////////////
- /// Create the OpenGL rendering context
- ///
- /// \param Mode : Video mode to use
- /// \param Fullscreen : True to set fullscreen, false to stay in windowed mode
- /// \param AntialiasingLevel : Level of antialiasing
- ///
- ////////////////////////////////////////////////////////////
- void CreateContext(VideoMode Mode, bool Fullscreen, int AntialiasingLevel);
-
- ////////////////////////////////////////////////////////////
- /// Do some common initializations before the window can be created
- ///
- ////////////////////////////////////////////////////////////
- void PreInitialize();
-
- ////////////////////////////////////////////////////////////
- /// Run the event loop after the window has been created
- ///
- ////////////////////////////////////////////////////////////
- void PostInitialize();
-
- ////////////////////////////////////////////////////////////
- /// Free all the graphical resources attached to the window
- ///
- ////////////////////////////////////////////////////////////
- void Cleanup();
-
- ////////////////////////////////////////////////////////////
- /// Process a Carbon command event
- ///
- /// \param nextHandler : Next registered handler for this event type
- /// \param event : The event
- /// \param userData : Data passed in by the caller
- ///
- ////////////////////////////////////////////////////////////
- OSStatus CommandEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData);
-
- ////////////////////////////////////////////////////////////
- /// Process a Carbon mouse event
- ///
- /// \param nextHandler : Next registered handler for this event type
- /// \param event : The event
- /// \param userData : Data passed in by the caller
- ///
- ////////////////////////////////////////////////////////////
- OSStatus MouseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData);
-
- ////////////////////////////////////////////////////////////
- /// Process a Carbon keyboard event
- ///
- /// \param nextHandler : Next registered handler for this event type
- /// \param event : The event
- /// \param userData : Data passed in by the caller
- ///
- ////////////////////////////////////////////////////////////
- OSStatus KeyboardEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData);
-
- ////////////////////////////////////////////////////////////
- /// Process a Carbon window event
- ///
- /// \param nextHandler : Next registered handler for this event type
- /// \param event : The event
- /// \param userData : Data passed in by the caller
- ///
- ////////////////////////////////////////////////////////////
- OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData);
-
- ////////////////////////////////////////////////////////////
- /// Setup the joysticks
- ////////////////////////////////////////////////////////////
- void SetupJoysticks();
-
- ////////////////////////////////////////////////////////////
- /// Process the joystick state
- ////////////////////////////////////////////////////////////
- void ReadJoystickStates();
-
- ////////////////////////////////////////////////////////////
- /// Convert a Carbon key code to a SFML key code
- ///
- /// \param VirtualKey : Virtual key code to convert
- ///
- /// \return SFML key code corresponding to VirtualKey
- ///
- ////////////////////////////////////////////////////////////
- static Key::Code VirtualKeyCodeToSF(UInt32 VirtualKey);
-
- ////////////////////////////////////////////////////////////
- /// Function called whenever one of our windows receives a message
- ///
- /// \param Handler : Carbon handle of the window
- /// \param Event : Message received
- /// \param userData : First parameter of the message
- ///
- /// \return Something...
- ///
- ////////////////////////////////////////////////////////////
- static OSStatus GlobalOnEvent(EventHandlerCallRef nextHandler, EventRef event, void* userData);
-
- ////////////////////////////////////////////////////////////
- // Static member data
- ////////////////////////////////////////////////////////////
- static unsigned int ourWindowCount; ///< Number of windows that we own
- static WindowImplCarbon* ourDummyWindow; ///< Dummy window
-
- ////////////////////////////////////////////////////////////
- // Member data
- ////////////////////////////////////////////////////////////
- WindowRef myHandle; ///< Carbon handle of the window
- AGLContext myGLContext; ///< OpenGL rendering context associated to the window
-};
-
-} // namespace priv
-
-} // namespace sf
-
-#endif // SFML_WINDOWIMPLCARBON_HPP