diff options
author | Christoph Egger <Christoph.Egger@gmx.de> | 2009-01-10 16:57:24 +0100 |
---|---|---|
committer | Christoph Egger <Christoph.Egger@gmx.de> | 2009-01-10 16:57:24 +0100 |
commit | 9f9ee9c9f37ae026eb06e897a313aa26f68bf612 (patch) | |
tree | b25b7f4dc4fa8958ee78fa0db70b77a2ad4466f6 /src/SFML | |
parent | bc4a35d2daf373cbf5b957234447ba80abd25eb8 (diff) |
Imported Upstream version 1.4
Diffstat (limited to 'src/SFML')
120 files changed, 7 insertions, 5170 deletions
diff --git a/src/SFML/Audio/AudioDevice.cpp b/src/SFML/Audio/AudioDevice.cpp index 3049f7f..3049f7f 100644..100755 --- a/src/SFML/Audio/AudioDevice.cpp +++ b/src/SFML/Audio/AudioDevice.cpp diff --git a/src/SFML/Audio/AudioDevice.hpp b/src/SFML/Audio/AudioDevice.hpp index 1d71a37..1d71a37 100644..100755 --- a/src/SFML/Audio/AudioDevice.hpp +++ b/src/SFML/Audio/AudioDevice.hpp diff --git a/src/SFML/Audio/AudioResource.cpp b/src/SFML/Audio/AudioResource.cpp index 28e9475..28e9475 100644..100755 --- a/src/SFML/Audio/AudioResource.cpp +++ b/src/SFML/Audio/AudioResource.cpp diff --git a/src/SFML/Audio/Listener.cpp b/src/SFML/Audio/Listener.cpp index 1dd9a31..1dd9a31 100644..100755 --- a/src/SFML/Audio/Listener.cpp +++ b/src/SFML/Audio/Listener.cpp diff --git a/src/SFML/Audio/Makefile b/src/SFML/Audio/Makefile index 109a00a..109a00a 100644..100755 --- a/src/SFML/Audio/Makefile +++ b/src/SFML/Audio/Makefile diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index a4d9d76..a4d9d76 100644..100755 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp diff --git a/src/SFML/Audio/OpenAL.hpp b/src/SFML/Audio/OpenAL.hpp index e6ab6d4..e6ab6d4 100644..100755 --- a/src/SFML/Audio/OpenAL.hpp +++ b/src/SFML/Audio/OpenAL.hpp diff --git a/src/SFML/Audio/Sound.cpp b/src/SFML/Audio/Sound.cpp index 01d792b..01d792b 100644..100755 --- a/src/SFML/Audio/Sound.cpp +++ b/src/SFML/Audio/Sound.cpp diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 136b338..136b338 100644..100755 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp diff --git a/src/SFML/Audio/SoundBufferRecorder.cpp b/src/SFML/Audio/SoundBufferRecorder.cpp index 78859fd..78859fd 100644..100755 --- a/src/SFML/Audio/SoundBufferRecorder.cpp +++ b/src/SFML/Audio/SoundBufferRecorder.cpp diff --git a/src/SFML/Audio/SoundFile.cpp b/src/SFML/Audio/SoundFile.cpp index 78ac35b..78ac35b 100644..100755 --- a/src/SFML/Audio/SoundFile.cpp +++ b/src/SFML/Audio/SoundFile.cpp diff --git a/src/SFML/Audio/SoundFile.hpp b/src/SFML/Audio/SoundFile.hpp index 6ad68cb..6ad68cb 100644..100755 --- a/src/SFML/Audio/SoundFile.hpp +++ b/src/SFML/Audio/SoundFile.hpp diff --git a/src/SFML/Audio/SoundFileDefault.cpp b/src/SFML/Audio/SoundFileDefault.cpp index b1b4b7c..b1b4b7c 100644..100755 --- a/src/SFML/Audio/SoundFileDefault.cpp +++ b/src/SFML/Audio/SoundFileDefault.cpp diff --git a/src/SFML/Audio/SoundFileDefault.hpp b/src/SFML/Audio/SoundFileDefault.hpp index cc4a567..cc4a567 100644..100755 --- a/src/SFML/Audio/SoundFileDefault.hpp +++ b/src/SFML/Audio/SoundFileDefault.hpp diff --git a/src/SFML/Audio/SoundFileOgg.cpp b/src/SFML/Audio/SoundFileOgg.cpp index 3bbcef0..3bbcef0 100644..100755 --- a/src/SFML/Audio/SoundFileOgg.cpp +++ b/src/SFML/Audio/SoundFileOgg.cpp diff --git a/src/SFML/Audio/SoundFileOgg.hpp b/src/SFML/Audio/SoundFileOgg.hpp index 38cc079..38cc079 100644..100755 --- a/src/SFML/Audio/SoundFileOgg.hpp +++ b/src/SFML/Audio/SoundFileOgg.hpp diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp index a1a9601..a1a9601 100644..100755 --- a/src/SFML/Audio/SoundRecorder.cpp +++ b/src/SFML/Audio/SoundRecorder.cpp diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 991a0bc..991a0bc 100644..100755 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp diff --git a/src/SFML/Graphics/Arial.hpp b/src/SFML/Graphics/Arial.hpp index 2b224d8..2b224d8 100644..100755 --- a/src/SFML/Graphics/Arial.hpp +++ b/src/SFML/Graphics/Arial.hpp diff --git a/src/SFML/Graphics/Color.cpp b/src/SFML/Graphics/Color.cpp index 3623e92..3623e92 100644..100755 --- a/src/SFML/Graphics/Color.cpp +++ b/src/SFML/Graphics/Color.cpp diff --git a/src/SFML/Graphics/Drawable.cpp b/src/SFML/Graphics/Drawable.cpp index 04f3167..04f3167 100644..100755 --- a/src/SFML/Graphics/Drawable.cpp +++ b/src/SFML/Graphics/Drawable.cpp diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index cc22f30..cc22f30 100644..100755 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp diff --git a/src/SFML/Graphics/FontLoader.cpp b/src/SFML/Graphics/FontLoader.cpp index fbf0dfa..fbf0dfa 100644..100755 --- a/src/SFML/Graphics/FontLoader.cpp +++ b/src/SFML/Graphics/FontLoader.cpp diff --git a/src/SFML/Graphics/FontLoader.hpp b/src/SFML/Graphics/FontLoader.hpp index 0b6a10c..0b6a10c 100644..100755 --- a/src/SFML/Graphics/FontLoader.hpp +++ b/src/SFML/Graphics/FontLoader.hpp diff --git a/src/SFML/Graphics/GraphicsContext.cpp b/src/SFML/Graphics/GraphicsContext.cpp index d9a9c2f..d9a9c2f 100644..100755 --- a/src/SFML/Graphics/GraphicsContext.cpp +++ b/src/SFML/Graphics/GraphicsContext.cpp diff --git a/src/SFML/Graphics/GraphicsContext.hpp b/src/SFML/Graphics/GraphicsContext.hpp index 0a76001..0a76001 100644..100755 --- a/src/SFML/Graphics/GraphicsContext.hpp +++ b/src/SFML/Graphics/GraphicsContext.hpp diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index 09b0ef8..09b0ef8 100644..100755 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp diff --git a/src/SFML/Graphics/ImageLoader.cpp b/src/SFML/Graphics/ImageLoader.cpp index b9c6a1b..b9c6a1b 100644..100755 --- a/src/SFML/Graphics/ImageLoader.cpp +++ b/src/SFML/Graphics/ImageLoader.cpp diff --git a/src/SFML/Graphics/ImageLoader.hpp b/src/SFML/Graphics/ImageLoader.hpp index 45b2b20..45b2b20 100644..100755 --- a/src/SFML/Graphics/ImageLoader.hpp +++ b/src/SFML/Graphics/ImageLoader.hpp diff --git a/src/SFML/Graphics/Makefile b/src/SFML/Graphics/Makefile index f1cc6ff..f1cc6ff 100644..100755 --- a/src/SFML/Graphics/Makefile +++ b/src/SFML/Graphics/Makefile diff --git a/src/SFML/Graphics/Matrix3.cpp b/src/SFML/Graphics/Matrix3.cpp index 705e06f..705e06f 100644..100755 --- a/src/SFML/Graphics/Matrix3.cpp +++ b/src/SFML/Graphics/Matrix3.cpp diff --git a/src/SFML/Graphics/PostFX.cpp b/src/SFML/Graphics/PostFX.cpp index 39371f4..39371f4 100644..100755 --- a/src/SFML/Graphics/PostFX.cpp +++ b/src/SFML/Graphics/PostFX.cpp diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 5a34f6d..5a34f6d 100644..100755 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index 9ef4e8d..9ef4e8d 100644..100755 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index a5c9524..a5c9524 100644..100755 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp diff --git a/src/SFML/Graphics/Sprite.cpp b/src/SFML/Graphics/Sprite.cpp index c1f6536..c1f6536 100644..100755 --- a/src/SFML/Graphics/Sprite.cpp +++ b/src/SFML/Graphics/Sprite.cpp diff --git a/src/SFML/Graphics/String.cpp b/src/SFML/Graphics/String.cpp index bb20932..bb20932 100644..100755 --- a/src/SFML/Graphics/String.cpp +++ b/src/SFML/Graphics/String.cpp diff --git a/src/SFML/Graphics/View.cpp b/src/SFML/Graphics/View.cpp index 7801d22..7801d22 100644..100755 --- a/src/SFML/Graphics/View.cpp +++ b/src/SFML/Graphics/View.cpp diff --git a/src/SFML/Main/SFML_Main.cpp b/src/SFML/Main/SFML_Main.cpp index 0d64b03..0d64b03 100644..100755 --- a/src/SFML/Main/SFML_Main.cpp +++ b/src/SFML/Main/SFML_Main.cpp diff --git a/src/SFML/Makefile b/src/SFML/Makefile index 98617ec..98617ec 100644..100755 --- a/src/SFML/Makefile +++ b/src/SFML/Makefile diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index df0976e..df0976e 100644..100755 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp diff --git a/src/SFML/Network/Http.cpp b/src/SFML/Network/Http.cpp index 1becb80..1becb80 100644..100755 --- a/src/SFML/Network/Http.cpp +++ b/src/SFML/Network/Http.cpp diff --git a/src/SFML/Network/IPAddress.cpp b/src/SFML/Network/IPAddress.cpp index cd34613..cd34613 100644..100755 --- a/src/SFML/Network/IPAddress.cpp +++ b/src/SFML/Network/IPAddress.cpp diff --git a/src/SFML/Network/Makefile b/src/SFML/Network/Makefile index d30da62..d30da62 100644..100755 --- a/src/SFML/Network/Makefile +++ b/src/SFML/Network/Makefile diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index df693d5..df693d5 100644..100755 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp diff --git a/src/SFML/Network/SelectorBase.cpp b/src/SFML/Network/SelectorBase.cpp index 6631753..6631753 100644..100755 --- a/src/SFML/Network/SelectorBase.cpp +++ b/src/SFML/Network/SelectorBase.cpp diff --git a/src/SFML/Network/SocketTCP.cpp b/src/SFML/Network/SocketTCP.cpp index b472473..b472473 100644..100755 --- a/src/SFML/Network/SocketTCP.cpp +++ b/src/SFML/Network/SocketTCP.cpp diff --git a/src/SFML/Network/SocketUDP.cpp b/src/SFML/Network/SocketUDP.cpp index 091155a..091155a 100644..100755 --- a/src/SFML/Network/SocketUDP.cpp +++ b/src/SFML/Network/SocketUDP.cpp diff --git a/src/SFML/Network/Unix/SocketHelper.cpp b/src/SFML/Network/Unix/SocketHelper.cpp index 5fdf9d3..5fdf9d3 100644..100755 --- a/src/SFML/Network/Unix/SocketHelper.cpp +++ b/src/SFML/Network/Unix/SocketHelper.cpp diff --git a/src/SFML/Network/Win32/SocketHelper.cpp b/src/SFML/Network/Win32/SocketHelper.cpp index 972aeb7..972aeb7 100644..100755 --- a/src/SFML/Network/Win32/SocketHelper.cpp +++ b/src/SFML/Network/Win32/SocketHelper.cpp diff --git a/src/SFML/System/Clock.cpp b/src/SFML/System/Clock.cpp index 1cbb5d9..1cbb5d9 100644..100755 --- a/src/SFML/System/Clock.cpp +++ b/src/SFML/System/Clock.cpp diff --git a/src/SFML/System/Lock.cpp b/src/SFML/System/Lock.cpp index c31de5c..c31de5c 100644..100755 --- a/src/SFML/System/Lock.cpp +++ b/src/SFML/System/Lock.cpp diff --git a/src/SFML/System/Makefile b/src/SFML/System/Makefile index 04514f5..04514f5 100644..100755 --- a/src/SFML/System/Makefile +++ b/src/SFML/System/Makefile diff --git a/src/SFML/System/Platform.hpp b/src/SFML/System/Platform.hpp index d94dee3..d94dee3 100644..100755 --- a/src/SFML/System/Platform.hpp +++ b/src/SFML/System/Platform.hpp diff --git a/src/SFML/System/Randomizer.cpp b/src/SFML/System/Randomizer.cpp index a3266fd..a3266fd 100644..100755 --- a/src/SFML/System/Randomizer.cpp +++ b/src/SFML/System/Randomizer.cpp diff --git a/src/SFML/System/Sleep.cpp b/src/SFML/System/Sleep.cpp index 1c22054..1c22054 100644..100755 --- a/src/SFML/System/Sleep.cpp +++ b/src/SFML/System/Sleep.cpp diff --git a/src/SFML/System/Unicode.cpp b/src/SFML/System/Unicode.cpp index da211b1..da211b1 100644..100755 --- a/src/SFML/System/Unicode.cpp +++ b/src/SFML/System/Unicode.cpp diff --git a/src/SFML/System/Unix/Mutex.cpp b/src/SFML/System/Unix/Mutex.cpp index 9614361..9614361 100644..100755 --- a/src/SFML/System/Unix/Mutex.cpp +++ b/src/SFML/System/Unix/Mutex.cpp diff --git a/src/SFML/System/Unix/Platform.cpp b/src/SFML/System/Unix/Platform.cpp index 0149c36..0149c36 100644..100755 --- a/src/SFML/System/Unix/Platform.cpp +++ b/src/SFML/System/Unix/Platform.cpp diff --git a/src/SFML/System/Unix/Platform.hpp b/src/SFML/System/Unix/Platform.hpp index 0cd0990..0cd0990 100644..100755 --- a/src/SFML/System/Unix/Platform.hpp +++ b/src/SFML/System/Unix/Platform.hpp diff --git a/src/SFML/System/Unix/Thread.cpp b/src/SFML/System/Unix/Thread.cpp index 3268f61..3268f61 100644..100755 --- a/src/SFML/System/Unix/Thread.cpp +++ b/src/SFML/System/Unix/Thread.cpp diff --git a/src/SFML/System/Win32/Mutex.cpp b/src/SFML/System/Win32/Mutex.cpp index 6817a2a..6817a2a 100644..100755 --- a/src/SFML/System/Win32/Mutex.cpp +++ b/src/SFML/System/Win32/Mutex.cpp diff --git a/src/SFML/System/Win32/Platform.cpp b/src/SFML/System/Win32/Platform.cpp index 2a9c084..2a9c084 100644..100755 --- a/src/SFML/System/Win32/Platform.cpp +++ b/src/SFML/System/Win32/Platform.cpp diff --git a/src/SFML/System/Win32/Platform.hpp b/src/SFML/System/Win32/Platform.hpp index ddcf2fd..ddcf2fd 100644..100755 --- a/src/SFML/System/Win32/Platform.hpp +++ b/src/SFML/System/Win32/Platform.hpp diff --git a/src/SFML/System/Win32/Thread.cpp b/src/SFML/System/Win32/Thread.cpp index 67afb26..67afb26 100644..100755 --- a/src/SFML/System/Win32/Thread.cpp +++ b/src/SFML/System/Win32/Thread.cpp diff --git a/src/SFML/Window/Cocoa/AppController.h b/src/SFML/Window/Cocoa/AppController.h index 365afc9..365afc9 100644..100755 --- a/src/SFML/Window/Cocoa/AppController.h +++ b/src/SFML/Window/Cocoa/AppController.h diff --git a/src/SFML/Window/Cocoa/AppController.mm b/src/SFML/Window/Cocoa/AppController.mm index a6b7310..a6b7310 100644..100755 --- a/src/SFML/Window/Cocoa/AppController.mm +++ b/src/SFML/Window/Cocoa/AppController.mm diff --git a/src/SFML/Window/Cocoa/Joystick.cpp b/src/SFML/Window/Cocoa/Joystick.cpp index 6b456a1..6b456a1 100644..100755 --- a/src/SFML/Window/Cocoa/Joystick.cpp +++ b/src/SFML/Window/Cocoa/Joystick.cpp diff --git a/src/SFML/Window/Cocoa/Joystick.hpp b/src/SFML/Window/Cocoa/Joystick.hpp index 7a78c93..7a78c93 100644..100755 --- a/src/SFML/Window/Cocoa/Joystick.hpp +++ b/src/SFML/Window/Cocoa/Joystick.hpp diff --git a/src/SFML/Window/Cocoa/VideoModeSupport.cpp b/src/SFML/Window/Cocoa/VideoModeSupport.cpp index 75f5d8e..75f5d8e 100644..100755 --- a/src/SFML/Window/Cocoa/VideoModeSupport.cpp +++ b/src/SFML/Window/Cocoa/VideoModeSupport.cpp diff --git a/src/SFML/Window/Cocoa/VideoModeSupport.hpp b/src/SFML/Window/Cocoa/VideoModeSupport.hpp index 2b64685..2b64685 100644..100755 --- a/src/SFML/Window/Cocoa/VideoModeSupport.hpp +++ b/src/SFML/Window/Cocoa/VideoModeSupport.hpp diff --git a/src/SFML/Window/Cocoa/WindowController.h b/src/SFML/Window/Cocoa/WindowController.h index 4c40825..4c40825 100644..100755 --- a/src/SFML/Window/Cocoa/WindowController.h +++ b/src/SFML/Window/Cocoa/WindowController.h diff --git a/src/SFML/Window/Cocoa/WindowController.mm b/src/SFML/Window/Cocoa/WindowController.mm index 286a3ed..286a3ed 100644..100755 --- a/src/SFML/Window/Cocoa/WindowController.mm +++ b/src/SFML/Window/Cocoa/WindowController.mm diff --git a/src/SFML/Window/Cocoa/WindowImplCocoa.hpp b/src/SFML/Window/Cocoa/WindowImplCocoa.hpp index 1b2e96b..1b2e96b 100644..100755 --- a/src/SFML/Window/Cocoa/WindowImplCocoa.hpp +++ b/src/SFML/Window/Cocoa/WindowImplCocoa.hpp diff --git a/src/SFML/Window/Cocoa/WindowImplCocoa.mm b/src/SFML/Window/Cocoa/WindowImplCocoa.mm index 460c765..7950ab2 100644..100755 --- a/src/SFML/Window/Cocoa/WindowImplCocoa.mm +++ b/src/SFML/Window/Cocoa/WindowImplCocoa.mm @@ -391,10 +391,9 @@ int WindowImplCocoa::HandleKeyDown(void *eventRef) Event sfEvent; unichar chr = 0, rawchr = 0; - unsigned long length = [[event characters] length]; unsigned mods = [event modifierFlags]; - if (length) { + if ([[event characters] length]) { chr = [[event characters] characterAtIndex:0]; // Note : I got a crash (out of bounds exception) while typing so now I test... @@ -417,29 +416,10 @@ int WindowImplCocoa::HandleKeyDown(void *eventRef) #if 1 // Is it also a text event ? if (IsTextEvent(event)) { - // tampon d'accueil des caracteres UTF-16 recuperes a partir de l'evenement clavier - unichar *utf16Characters = new unichar[length]; - - // recuperation des caracteres - [[event characters] getCharacters:utf16Characters]; - - // tampon d'accueil des caracteres convertis en UTF-32 - Uint32 utf32Characters[2]; - - // conversion des caracteres - const Uint32 *addr = Unicode::UTF16ToUTF32(utf16Characters, - utf16Characters + length, - utf32Characters); - - // si il y a eu des caracteres convertis ? - if (addr > utf32Characters) { - sfEvent.Type = Event::TextEntered; - sfEvent.Text.Unicode = utf32Characters[0]; - - SendEvent(sfEvent); - } + sfEvent.Type = Event::TextEntered; + sfEvent.Text.Unicode = chr; - delete[] utf16Characters; + SendEvent(sfEvent); } #else // Is it also a text event ? @@ -473,7 +453,7 @@ int WindowImplCocoa::HandleKeyDown(void *eventRef) sfEvent.Type = Event::KeyPressed; // Get the keys - if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(rawchr))) { + if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(chr))) { sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); } @@ -498,14 +478,10 @@ int WindowImplCocoa::HandleKeyUp(void *eventRef) Event sfEvent; unsigned mods = [event modifierFlags]; - unichar chr = 0, rawchr = 0; + unichar chr = 0; if ([[event characters] length]) { chr = [[event characters] characterAtIndex:0]; - - if ([[event charactersIgnoringModifiers] length]) - rawchr = [[event charactersIgnoringModifiers] characterAtIndex:0]; - } if (mods & NSCommandKeyMask) { @@ -515,7 +491,7 @@ int WindowImplCocoa::HandleKeyUp(void *eventRef) sfEvent.Type = Event::KeyReleased; // Get the code - if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(rawchr))) { + if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(chr))) { sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); } diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index 5f4cd74..5f4cd74 100644..100755 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp diff --git a/src/SFML/Window/Input.cpp b/src/SFML/Window/Input.cpp index d5fac6e..d5fac6e 100644..100755 --- a/src/SFML/Window/Input.cpp +++ b/src/SFML/Window/Input.cpp diff --git a/src/SFML/Window/Joystick.hpp b/src/SFML/Window/Joystick.hpp index 6bb1f2a..6bb1f2a 100644..100755 --- a/src/SFML/Window/Joystick.hpp +++ b/src/SFML/Window/Joystick.hpp diff --git a/src/SFML/Window/Linux/Joystick.cpp b/src/SFML/Window/Linux/Joystick.cpp index ba85ccd..ba85ccd 100644..100755 --- a/src/SFML/Window/Linux/Joystick.cpp +++ b/src/SFML/Window/Linux/Joystick.cpp diff --git a/src/SFML/Window/Linux/Joystick.hpp b/src/SFML/Window/Linux/Joystick.hpp index 1c1e4a2..1c1e4a2 100644..100755 --- a/src/SFML/Window/Linux/Joystick.hpp +++ b/src/SFML/Window/Linux/Joystick.hpp diff --git a/src/SFML/Window/Linux/VideoModeSupport.cpp b/src/SFML/Window/Linux/VideoModeSupport.cpp index d328702..d328702 100644..100755 --- a/src/SFML/Window/Linux/VideoModeSupport.cpp +++ b/src/SFML/Window/Linux/VideoModeSupport.cpp diff --git a/src/SFML/Window/Linux/VideoModeSupport.hpp b/src/SFML/Window/Linux/VideoModeSupport.hpp index 87291fc..87291fc 100644..100755 --- a/src/SFML/Window/Linux/VideoModeSupport.hpp +++ b/src/SFML/Window/Linux/VideoModeSupport.hpp diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index 0659089..0659089 100644..100755 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp index b4506fc..b4506fc 100644..100755 --- a/src/SFML/Window/Linux/WindowImplX11.hpp +++ b/src/SFML/Window/Linux/WindowImplX11.hpp diff --git a/src/SFML/Window/Makefile b/src/SFML/Window/Makefile index 956b34b..956b34b 100644..100755 --- a/src/SFML/Window/Makefile +++ b/src/SFML/Window/Makefile diff --git a/src/SFML/Window/OSXCarbon/Joystick.cpp b/src/SFML/Window/OSXCarbon/Joystick.cpp deleted file mode 100644 index eac7bac..0000000 --- a/src/SFML/Window/OSXCarbon/Joystick.cpp +++ /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/Joystick.hpp b/src/SFML/Window/OSXCarbon/Joystick.hpp deleted file mode 100644 index 36f56dc..0000000 --- a/src/SFML/Window/OSXCarbon/Joystick.hpp +++ /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/JoystickSupport.cpp b/src/SFML/Window/OSXCarbon/JoystickSupport.cpp deleted file mode 100644 index 4cbb137..0000000 --- a/src/SFML/Window/OSXCarbon/JoystickSupport.cpp +++ /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/JoystickSupport.hpp b/src/SFML/Window/OSXCarbon/JoystickSupport.hpp deleted file mode 100644 index 08252da..0000000 --- a/src/SFML/Window/OSXCarbon/JoystickSupport.hpp +++ /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/VideoModeSupport.cpp b/src/SFML/Window/OSXCarbon/VideoModeSupport.cpp deleted file mode 100644 index b16e5b1..0000000 --- a/src/SFML/Window/OSXCarbon/VideoModeSupport.cpp +++ /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/VideoModeSupport.hpp b/src/SFML/Window/OSXCarbon/VideoModeSupport.hpp deleted file mode 100644 index 175deae..0000000 --- a/src/SFML/Window/OSXCarbon/VideoModeSupport.hpp +++ /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/WindowImplCarbon.cpp b/src/SFML/Window/OSXCarbon/WindowImplCarbon.cpp deleted file mode 100644 index 1b83197..0000000 --- a/src/SFML/Window/OSXCarbon/WindowImplCarbon.cpp +++ /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/WindowImplCarbon.hpp b/src/SFML/Window/OSXCarbon/WindowImplCarbon.hpp deleted file mode 100644 index 6ed7216..0000000 --- a/src/SFML/Window/OSXCarbon/WindowImplCarbon.hpp +++ /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 diff --git a/src/SFML/Window/OSXCocoa/AppController.h b/src/SFML/Window/OSXCocoa/AppController.h deleted file mode 100644 index 685285d..0000000 --- a/src/SFML/Window/OSXCocoa/AppController.h +++ /dev/null @@ -1,98 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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 -//////////////////////////////////////////////////////////// -#import <SFML/Window/OSXCocoa/WindowImplCocoa.hpp> -#import <SFML/System/Clock.hpp> -#import <Cocoa/Cocoa.h> -#import <vector> - -#define SharedAppController [AppController sharedController] - -@interface AppController : NSObject { - // Note: objc allocation doesn't call C++ constructor - std::vector <sf::priv::WindowImplCocoa *> *windows; - - NSAutoreleasePool *mainPool; - sf::Clock *cleaner; -} - -//////////////////////////////////////////////////////////// -/// Return the shared AppController object. Makes one if needed -//////////////////////////////////////////////////////////// -+ (AppController *)sharedController; - -//////////////////////////////////////////////////////////// -/// Reallocate main pool to release autoreleased objects -//////////////////////////////////////////////////////////// -- (void)resetPool; - -//////////////////////////////////////////////////////////// -/// Register our application and launch it if needed -//////////////////////////////////////////////////////////// -- (void)runApplication; - -//////////////////////////////////////////////////////////// -/// Terminate the current running application -//////////////////////////////////////////////////////////// -- (void)quitApplication:(id)sender; - -//////////////////////////////////////////////////////////// -/// Make menu bar -//////////////////////////////////////////////////////////// -- (void)makeMenuBar; - -//////////////////////////////////////////////////////////// -/// Get the events and put them into an array for each window -//////////////////////////////////////////////////////////// -- (void)processEvents; - -//////////////////////////////////////////////////////////// -/// Add the 'windowImplObj' object to the list of known windows -//////////////////////////////////////////////////////////// -- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj; - -//////////////////////////////////////////////////////////// -/// Remove the 'windowImplObj' object from the list of known windows -//////////////////////////////////////////////////////////// -- (void)unregisterWindow:(sf::priv::WindowImplCocoa *)windowImplObj; - -@end - - -#pragma mark Debug - -// Simple shortcut -#ifndef line -#define line __LINE__ -#endif - -//////////////////////////////////////////////////////////// -/// Print error and abort -//////////////////////////////////////////////////////////// -void error (char const *filename, unsigned ln, char const *description, ...); - diff --git a/src/SFML/Window/OSXCocoa/AppController.mm b/src/SFML/Window/OSXCocoa/AppController.mm deleted file mode 100644 index a997c61..0000000 --- a/src/SFML/Window/OSXCocoa/AppController.mm +++ /dev/null @@ -1,370 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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 -//////////////////////////////////////////////////////////// -#import <SFML/Window/OSXCocoa/AppController.h> -#import <SFML/Window/OSXCocoa/WindowImplCocoa.hpp> - - -static AppController *shared = nil; - - -/* setAppleMenu disappeared from the headers in 10.4 */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 -@interface NSApplication (SFML) -- (void)setAppleMenu:(NSMenu *)menu; -@end -#endif - -@implementation NSApplication (SFML) - -- (void)setRunning:(BOOL)flag -{ - // Note: _running is a short, not a BOOL - if (flag) - _running = 1; - else - _running = 0; -} - -@end - -@implementation AppController - -- (id)init -{ - self = [super init]; - - if (self != nil) { - windows = new std::vector <sf::priv::WindowImplCocoa *>; - cleaner = new sf::Clock; - } - - return self; -} - -- (void)dealloc -{ - delete windows; - delete cleaner; - [super dealloc]; -} - -//////////////////////////////////////////////////////////// -/// Return the shared AppController object. Makes one if needed -//////////////////////////////////////////////////////////// -+ (AppController *)sharedController -{ - if (nil == shared) - shared = [[AppController alloc] init]; - - return shared; -} - -//////////////////////////////////////////////////////////// -/// Reallocate main pool to release autoreleased objects -//////////////////////////////////////////////////////////// -- (void)resetPool -{ - [mainPool release]; - - if (nil == (mainPool = [[NSAutoreleasePool alloc] init])) { - error(__FILE__, __LINE__, "couldn't create main autorelease pool"); - } -} - -//////////////////////////////////////////////////////////// -/// Register our application and launch it if needed -//////////////////////////////////////////////////////////// -- (void)runApplication -{ - if ([NSApp isRunning]) - return; - - // We want our application to appear in the Dock and be able - // to get focus - ProcessSerialNumber psn; - - if (!GetCurrentProcess(&psn)) { - TransformProcessType(&psn, kProcessTransformToForegroundApplication); - SetFrontProcess(&psn); - } - - if (NSApp == nil) { - if (nil == [NSApplication sharedApplication]) { - error(__FILE__, __LINE__, "failed to make application instance"); - } - } - - if ([NSApp mainMenu] == nil) { - [self makeMenuBar]; - } - - [NSApp finishLaunching]; - [NSApp setRunning:YES]; - [NSApp setDelegate:self]; -} - -//////////////////////////////////////////////////////////// -/// Terminate the current running application -//////////////////////////////////////////////////////////// -- (void)quitApplication:(id)sender -{ - // Close all windows - // SFML user has to detect when all windows are closed - NSWindow *current = nil; - sf::priv::WindowImplCocoa *priv = NULL; - - while (windows->size()) { - priv = windows->at(0); - current = static_cast <NSWindow *> (priv->CocoaWindow()); - [current close]; - windows->erase(windows->begin()); - } -} - -//////////////////////////////////////////////////////////// -/// Make menu bar -//////////////////////////////////////////////////////////// -- (void)makeMenuBar -{ - // Source taken from SDL 1.3 >> - - NSString *appName = nil; - NSString *title = nil; - NSMenu *appleMenu = nil; - NSMenu *fileMenu = nil; - NSMenu *windowMenu = nil; - NSMenuItem *menuItem = nil; - NSMenuItem *quitMenuItem = nil; - - /* Determine the application name */ - appName = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"CFBundleName"]; - - if (![appName length]) - appName = [[NSProcessInfo processInfo] processName]; - - - /* Create the main menu bar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; - - /* Create the application menu */ - appleMenu = [[NSMenu alloc] initWithTitle:@""]; - - /* Add menu items */ - title = [@"About " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Hide " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; - - menuItem = static_cast <NSMenuItem *> ([appleMenu addItemWithTitle:@"Hide Others" - action:@selector(hideOtherApplications:) - keyEquivalent:@"h"]); - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; - - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Quit " stringByAppendingString:appName]; - quitMenuItem = [[[NSMenuItem alloc] initWithTitle:title - action:@selector(quitApplication:) - keyEquivalent:@"q"] autorelease]; - - // My personal addition : i want to be the target :P - [quitMenuItem setTarget:self]; - [appleMenu addItem:quitMenuItem]; - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:appleMenu]; - [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; - - /* Tell the application object that this is now the application menu */ - [NSApp setAppleMenu:appleMenu]; - [appleMenu release]; - - - fileMenu = [[NSMenu alloc] initWithTitle:@"File"]; - menuItem = [[NSMenuItem alloc] initWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"]; - [fileMenu addItem:menuItem]; - [menuItem release]; - - menuItem = [[NSMenuItem alloc] initWithTitle:@"File" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:fileMenu]; - [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; - - /* Create the window menu */ - windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - - /* "Minimize" item */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; - [windowMenu addItem:menuItem]; - [menuItem release]; - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:windowMenu]; - [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; - - /* Tell the application object that this is now the window menu */ - [NSApp setWindowsMenu:windowMenu]; - [windowMenu release]; -} - -//////////////////////////////////////////////////////////// -/// Delegate method in order to prevent usual -terminate: -//////////////////////////////////////////////////////////// -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender -{ - [self quitApplication:nil]; - return NSTerminateCancel; -} - -//////////////////////////////////////////////////////////// -/// Get the events and put them into an array for each window -//////////////////////////////////////////////////////////// -- (void)processEvents -{ - // Release the main autorelease pool every second - if (cleaner->GetElapsedTime() > 1.0f) { - cleaner->Reset(); - [self resetPool]; - } - - NSEvent *event = nil; - - while (nil != (event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:nil - inMode:NSEventTrackingRunLoopMode - dequeue:YES])) { - NSWindow *keyWindow = [NSApp keyWindow]; - - if (keyWindow == nil) { - // Is there a fullscreen WindowImpl object ? - [NSApp sendEvent:event]; - } else { - - std::vector<sf::priv::WindowImplCocoa *>::size_type cnt = windows->size(); - std::vector<sf::priv::WindowImplCocoa *>::size_type idx; - - // is the key window a SFML window ? - for (idx = 0;idx < cnt; idx++) { - sf::priv::WindowImplCocoa *ptr = windows->at(idx);; - - if (ptr->CocoaWindow() == keyWindow) { - // yup, it is - ptr->HandleEvent(static_cast <void *> (event)); - break; - } - } - - // nop, it isn't - if (idx == cnt) { - [NSApp sendEvent:event]; - } - } - } -} - -//////////////////////////////////////////////////////////// -/// Add the 'windowImplObj' object to the list of known windows -//////////////////////////////////////////////////////////// -- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj -{ - - if (windowImplObj != NULL) { - std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size(); - std::vector<sf::priv::WindowImplCocoa *>::size_type idx; - - for (idx = 0; idx < sz; idx++) { - if (windows->at(idx) == windowImplObj) { - break; - } - } - - - // Register window only if not already registered - if (sz == idx) { - windows->push_back(windowImplObj); - } - } -} - -//////////////////////////////////////////////////////////// -/// Remove the 'windowImplObj' object from the list of known windows -//////////////////////////////////////////////////////////// -- (void)unregisterWindow:(sf::priv::WindowImplCocoa *)windowImplObj -{ - if (windowImplObj != NULL) { - std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size(); - std::vector<sf::priv::WindowImplCocoa *>::size_type idx; - - for (idx = 0; idx < sz; idx++) { - if (windows->at(idx) == windowImplObj) { - break; - } - } - - if (idx < sz) { - windows->erase(windows->begin() + idx); - } - } -} - -@end - - -#pragma mark - -#pragma mark Debug - -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> - - -void error (char const *filename, unsigned ln, char const *description, ...) -{ - va_list ap; - char *buffer = NULL; - - va_start(ap, description); - vasprintf(&buffer, description, ap); - - printf("*** [SFML] A critical error occured in %s line %d : %s\n", - (filename != NULL) ? filename : "<no file>", - ln, - (buffer != NULL) ? buffer : "no available description"); - - abort(); -} diff --git a/src/SFML/Window/OSXCocoa/Joystick.cpp b/src/SFML/Window/OSXCocoa/Joystick.cpp deleted file mode 100644 index 6b456a1..0000000 --- a/src/SFML/Window/OSXCocoa/Joystick.cpp +++ /dev/null @@ -1,78 +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> - - -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/OSXCocoa/Joystick.hpp b/src/SFML/Window/OSXCocoa/Joystick.hpp deleted file mode 100644 index 7a78c93..0000000 --- a/src/SFML/Window/OSXCocoa/Joystick.hpp +++ /dev/null @@ -1,82 +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. -// -//////////////////////////////////////////////////////////// - -#ifndef SFML_JOYSTICKCARBON_HPP -#define SFML_JOYSTICKCARBON_HPP - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// - - -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; -}; - -} // namespace priv - -} // namespace sf - - -#endif // SFML_JOYSTICKCARBON_HPP diff --git a/src/SFML/Window/OSXCocoa/VideoModeSupport.cpp b/src/SFML/Window/OSXCocoa/VideoModeSupport.cpp deleted file mode 100644 index 2e4a41a..0000000 --- a/src/SFML/Window/OSXCocoa/VideoModeSupport.cpp +++ /dev/null @@ -1,101 +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/OSXCocoa/VideoModeSupport.hpp> -#include <ApplicationServices/ApplicationServices.h> -#include <algorithm> - -namespace sf -{ -namespace priv -{ -//////////////////////////////////////////////////////////// -/// Get supported video modes -//////////////////////////////////////////////////////////// -void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& Modes) -{ - // Ceylo -- using same implementation as in OSXCarbon - - // 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() -{ - // Ceylo -- using same implementation as in OSXCarbon - - CFDictionaryRef CurrentVideoMode = CGDisplayCurrentMode(kCGDirectMainDisplay); - - VideoMode DesktopMode; - - - // Get video mode width - CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayWidth), - kCFNumberIntType, - &(DesktopMode.Width)); - - // Get video mode height - CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayHeight), - kCFNumberIntType, - &(DesktopMode.Height)); - - // Get video mode depth - CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(CurrentVideoMode, kCGDisplayBitsPerPixel), - kCFNumberIntType, - &(DesktopMode.BitsPerPixel)); - - - return DesktopMode; -} - -} // namespace priv - -} // namespace sf diff --git a/src/SFML/Window/OSXCocoa/VideoModeSupport.hpp b/src/SFML/Window/OSXCocoa/VideoModeSupport.hpp deleted file mode 100644 index 2b64685..0000000 --- a/src/SFML/Window/OSXCocoa/VideoModeSupport.hpp +++ /dev/null @@ -1,69 +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. -// -//////////////////////////////////////////////////////////// - -#ifndef SFML_VIDEOMODESUPPORTCOCOA_HPP -#define SFML_VIDEOMODESUPPORTCOCOA_HPP - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include <SFML/Window/VideoMode.hpp> -#include <vector> - - -namespace sf -{ -namespace priv -{ -//////////////////////////////////////////////////////////// -/// Cocoa 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_VIDEOMODESUPPORTCOCOA_HPP diff --git a/src/SFML/Window/OSXCocoa/WindowController.h b/src/SFML/Window/OSXCocoa/WindowController.h deleted file mode 100644 index b748976..0000000 --- a/src/SFML/Window/OSXCocoa/WindowController.h +++ /dev/null @@ -1,69 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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 -//////////////////////////////////////////////////////////// -#import <Cocoa/Cocoa.h> -#import <SFML/Window/OSXCocoa/WindowImplCocoa.hpp> -#import <SFML/Window/Event.hpp> - - -//////////////////////////////////////////////////////////// -/// WindowController is a Cocoa notification receiver -//////////////////////////////////////////////////////////// -@interface WindowController : NSObject { - sf::priv::WindowImplCocoa *parentWindow; -} - -//////////////////////////////////////////////////////////// -/// Return a new autoreleased WindowController object linked -/// to the 'window' WindowImplCocoa object. -//////////////////////////////////////////////////////////// -+ (WindowController *)controllerWithWindow:(sf::priv::WindowImplCocoa *)window; -- (WindowController *)initWithWindow:(sf::priv::WindowImplCocoa *)window; - -//////////////////////////////////////////////////////////// -/// Notification method receiver when OpenGL view size changes -//////////////////////////////////////////////////////////// -- (void)viewFrameDidChange:(NSNotification *)notification; - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window gains focus -//////////////////////////////////////////////////////////// -- (void)windowDidBecomeMain:(NSNotification *)notification; - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window loses focus -//////////////////////////////////////////////////////////// -- (void)windowDidResignMain:(NSNotification *)notification; - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window closes -//////////////////////////////////////////////////////////// -- (void)windowWillClose:(NSNotification *)notification; - -@end - diff --git a/src/SFML/Window/OSXCocoa/WindowController.mm b/src/SFML/Window/OSXCocoa/WindowController.mm deleted file mode 100644 index f4ea78f..0000000 --- a/src/SFML/Window/OSXCocoa/WindowController.mm +++ /dev/null @@ -1,143 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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 -//////////////////////////////////////////////////////////// -#import <SFML/Window/OSXCocoa/WindowController.h> -#import <SFML/Window/OSXCocoa/WindowImplCocoa.hpp> -#import <OpenGL/gl.h> -#import <iostream> - -@implementation WindowController - -//////////////////////////////////////////////////////////// -/// Forbide use of WindowController without any linked WindowImplCocoa object -//////////////////////////////////////////////////////////// -- (id)init -{ - return [self initWithWindow:NULL]; -} - -//////////////////////////////////////////////////////////// -/// Initialize a new WindowController object and link it -/// to the 'window' object. -//////////////////////////////////////////////////////////// -- (WindowController *)initWithWindow:(sf::priv::WindowImplCocoa *)window -{ - if (window == NULL) { - std::cout << "*** -[WindowController initWithWindow:NULL] -- initialization without any linked window is forbidden ; nil returned" << std::endl; - [self release]; - return nil; - } - - self = [super init]; - - if (self != nil) { - parentWindow = window; - } - - return self; -} - -//////////////////////////////////////////////////////////// -/// Return a new autoreleased WindowController object linked -/// to the 'window' WindowImplCocoa object. -//////////////////////////////////////////////////////////// -+ (WindowController *)controllerWithWindow:(sf::priv::WindowImplCocoa *)window -{ - WindowController *ctrl = [WindowController alloc]; - return [[ctrl initWithWindow:window] autorelease]; -} - -//////////////////////////////////////////////////////////// -/// Send event to the linked window -//////////////////////////////////////////////////////////// -- (void)pushEvent:(sf::Event)sfEvent -{ - if (parentWindow != NULL) { - parentWindow->HandleNotifiedEvent(sfEvent); - } -} - -//////////////////////////////////////////////////////////// -/// Notification method receiver when OpenGL view size changes -//////////////////////////////////////////////////////////// -- (void)viewFrameDidChange:(NSNotification *)notification -{ - NSOpenGLView *glView = [notification object]; - [[glView openGLContext] update]; - - sf::Event ev; - ev.Type = sf::Event::Resized; - ev.Size.Width = (unsigned) [glView frame].size.width; - ev.Size.Height = (unsigned) [glView frame].size.height; - - [self pushEvent:ev]; -} - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window gains focus -//////////////////////////////////////////////////////////// -- (void)windowDidBecomeMain:(NSNotification *)notification -{ - sf::Event ev; - ev.Type = sf::Event::GainedFocus; - - [self pushEvent:ev]; -} - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window loses focus -//////////////////////////////////////////////////////////// -- (void)windowDidResignMain:(NSNotification *)notification -{ - sf::Event ev; - ev.Type = sf::Event::LostFocus; - - [self pushEvent:ev]; -} - -//////////////////////////////////////////////////////////// -/// Notification method receiver when the window closes -//////////////////////////////////////////////////////////// -- (void)windowWillClose:(NSNotification *)notification -{ - sf::Event ev; - ev.Type = sf::Event::Closed; - - [self pushEvent:ev]; -} - -- (void)windowDidMove:(NSNotification *)notification -{ - NSWindow *sender = [notification object]; - - if (!([sender styleMask] & NSTitledWindowMask)) - [sender center]; -} - -@end - diff --git a/src/SFML/Window/OSXCocoa/WindowImplCocoa.hpp b/src/SFML/Window/OSXCocoa/WindowImplCocoa.hpp deleted file mode 100644 index b6c8beb..0000000 --- a/src/SFML/Window/OSXCocoa/WindowImplCocoa.hpp +++ /dev/null @@ -1,218 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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_WINDOWIMPLCOCOA_HPP -#define SFML_WINDOWIMPLCOCOA_HPP - -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include <SFML/Window/Event.hpp> -#include <SFML/Window/WindowImpl.hpp> -#include <string> - -namespace sf -{ -namespace priv -{ - -typedef struct objc_members objc_members; - -//////////////////////////////////////////////////////////// -/// WindowImplCocoa is the Cocoa implementation of WindowImpl -//////////////////////////////////////////////////////////// -class WindowImplCocoa : public WindowImpl -{ -public : - - //////////////////////////////////////////////////////////// - /// Default constructor - /// (creates a dummy window to provide a valid OpenGL context) - /// - //////////////////////////////////////////////////////////// - WindowImplCocoa(); - - //////////////////////////////////////////////////////////// - /// Construct the window implementation from an existing control - /// - /// \param Handle : Platform-specific handle of the control - /// \param Params : Creation parameters - /// - /// Note: the NSWindow object must not be defered ! - //////////////////////////////////////////////////////////// - WindowImplCocoa(WindowHandle Handle, WindowSettings& params); - - //////////////////////////////////////////////////////////// - /// Create the window implementation - /// - /// \param Mode : Video mode to use - /// \param Title : Title of the window - /// \param WindowStyle : Window style - /// \param Params : Creation parameters - /// - //////////////////////////////////////////////////////////// - WindowImplCocoa(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& params); - - //////////////////////////////////////////////////////////// - /// Destructor - /// - //////////////////////////////////////////////////////////// - ~WindowImplCocoa(); - - //////////////////////////////////////////////////////////// - /// Check if there's an active context on the current thread - /// - /// \return True if there's a context bound to the current thread - /// - //////////////////////////////////////////////////////////// - static bool IsContextActive(); - - //////////////////////////////////////////////////////////// - /// Handle Cocoa NSEvent - //////////////////////////////////////////////////////////// - void HandleEvent(void *event); - - //////////////////////////////////////////////////////////// - /// Handle event sent by the default NSNotificationCenter - //////////////////////////////////////////////////////////// - void HandleNotifiedEvent(Event& event); - - //////////////////////////////////////////////////////////// - /// Return a pointer to the NSWindow (objc->windowHandle) object - //////////////////////////////////////////////////////////// - void *CocoaWindow(void); -private : - - //////////////////////////////////////////////////////////// - /// see WindowImpl::Display - /// - //////////////////////////////////////////////////////////// - virtual void Display(); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::ProcessEvents - /// - //////////////////////////////////////////////////////////// - virtual void ProcessEvents(); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::MakeActive - /// - //////////////////////////////////////////////////////////// - virtual void SetActive(bool Active = true) const; - - //////////////////////////////////////////////////////////// - /// see WindowImpl::UseVerticalSync - /// - //////////////////////////////////////////////////////////// - virtual void UseVerticalSync(bool Enabled); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::ShowMouseCursor - /// - //////////////////////////////////////////////////////////// - virtual void ShowMouseCursor(bool Show); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::SetCursorPosition - /// - //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int Left, unsigned int Top); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::SetPosition - /// - //////////////////////////////////////////////////////////// - virtual void SetPosition(int Left, int Top); - - //////////////////////////////////////////////////////////// - /// /see WindowImpl::SetSize - /// - //////////////////////////////////////////////////////////// - virtual void SetSize(unsigned int Width, unsigned int Height); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::Show - /// - //////////////////////////////////////////////////////////// - virtual void Show(bool State); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::EnableKeyRepeat - /// - //////////////////////////////////////////////////////////// - virtual void EnableKeyRepeat(bool Enabled); - - //////////////////////////////////////////////////////////// - /// see WindowImpl::SetIcon - /// - //////////////////////////////////////////////////////////// - virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels); - - - - //////////////////////////////////////////////////////////// - /// My own part starts here ! - //////////////////////////////////////////////////////////// - - - //////////////////////////////////////////////////////////// - /// Event handling for every event type. - /// 'event' is a NSEvent. - //////////////////////////////////////////////////////////// - int HandleKeyDown(void *event); - int HandleKeyUp(void *event); - int HandleModifierKey(void *event); - int HandleMouseDown(void *event); - int HandleMouseUp(void *event); - int HandleMouseMove(void *event); - int HandleMouseWheel(void *event); - - //////////////////////////////////////////////////////////// - /// Make some allocations and initializations - //////////////////////////////////////////////////////////// - void Initialize(void); - - - //////////////////////////////////////////////////////////// - // Member data - //////////////////////////////////////////////////////////// - - // An opaque structure that contains all obj-C objects - objc_members *members; - - bool useKeyRepeat; - bool mouseIn; - float wheelStatus; - - bool fullscreen; - VideoMode fullscreenMode; - VideoMode desktopMode; -}; - -} // namespace priv - -} // namespace sf - -#endif // SFML_WINDOWIMPLCOCOA_HPP diff --git a/src/SFML/Window/OSXCocoa/WindowImplCocoa.mm b/src/SFML/Window/OSXCocoa/WindowImplCocoa.mm deleted file mode 100644 index 070194d..0000000 --- a/src/SFML/Window/OSXCocoa/WindowImplCocoa.mm +++ /dev/null @@ -1,1298 +0,0 @@ -//////////////////////////////////////////////////////////// -// -// SFML - Simple and Fast Multimedia Library -// Copyright (C) 2007-2008 Lucas Soltic (elmerod@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 -//////////////////////////////////////////////////////////// -#import <SFML/Window/OSXCocoa/WindowImplCocoa.hpp> -#import <SFML/Window/OSXCocoa/WindowController.h> -#import <SFML/Window/OSXCocoa/AppController.h> -#import <SFML/Window/WindowStyle.hpp> -#import <OpenGL/OpenGL.h> -#import <OpenGL/gl.h> -#import <Cocoa/Cocoa.h> -#import <iostream> - - -@implementation NSWindow (SFML) -- (BOOL)canBecomeKeyWindow -{ - return YES; -} -@end - - -namespace sf -{ -namespace priv -{ - - -#define ONCE(make) \ -{ static int __done = 0;\ -if (!__done) {\ -make;\ -__done = 1;\ -} } - - -enum { - ConsumedEvent, - UnusedEvent -}; - - -//////////////////////////////////////////////////////////// -/// Structure containing all the members I can't directly put in the class definition -/// because I would have to hide them in a #ifdef __OBJC__ block and the object -/// allocator would allocate space for it as it would be called from a C++ code -/// that wouldn't see these members -//////////////////////////////////////////////////////////// -struct objc_members { - WindowController *controller; - NSWindow *window; - NSOpenGLContext *context; - NSOpenGLView *view; -}; - -//////////////////////////////////////////////////////////// -/// Pointer to the shared OpenGL context -//////////////////////////////////////////////////////////// -static NSOpenGLContext *sharedContext = nil; - - -//////////////////////////////////////////////////////////// -/// Private function declarations -//////////////////////////////////////////////////////////// -static NSWindow * MakeWindow(WindowSettings& params, unsigned long style, VideoMode& mode, NSString *title); -static NSOpenGLContext *MakeOpenGLContext(WindowSettings& params); -static NSOpenGLView * MakeOpenGLView(NSWindow *window, NSOpenGLContext *context, WindowSettings& params); -static void ConfigureWindow(NSWindow *window, NSOpenGLView *view, WindowController *controller); -static Key::Code KeyForVirtualCode(unsigned short vCode); -static Key::Code KeyForUnicode(unsigned short uniCode); -static bool IsTextEvent(NSEvent *event); -static bool MouseInside(NSWindow *window, NSView *view); - - -//////////////////////////////////////////////////////////// -/// Default constructor -/// (creates a dummy window to provide a valid OpenGL context) -//////////////////////////////////////////////////////////// -WindowImplCocoa::WindowImplCocoa() : -members(NULL), -useKeyRepeat(false), -mouseIn(false), -wheelStatus(0.0f), -fullscreen(false), -fullscreenMode(0, 0, 0), -desktopMode(0, 0, 0) -{ - Initialize(); - - // -- Ceylo -- - // We just want to have a valid support for an OpenGL context - - // So we create the OpenGL context - WindowSettings params(0, 0, 0); - members->context = MakeOpenGLContext(params); - - if (members->context != nil) { - sharedContext = [members->context retain]; - - // And we make it the current active OpenGL context - SetActive(); - } else { - error(__FILE__, __LINE__, "unable to make the main shared OpenGL context"); - } -} - - -//////////////////////////////////////////////////////////// -/// Create the window implementation from an existing control -//////////////////////////////////////////////////////////// -WindowImplCocoa::WindowImplCocoa(WindowHandle Handle, WindowSettings& params) : -members(NULL), -useKeyRepeat(false), -mouseIn(false), -wheelStatus(0.0f), -fullscreen(false), -fullscreenMode(0, 0, 0), -desktopMode(0, 0, 0) -{ - Initialize(); - - // Register ourselves for event handling - [[AppController sharedController] registerWindow:this]; - - // Make a WindowController to handle notifications - members->controller = [[WindowController controllerWithWindow:this] retain]; - - // Use existing window - members->window = [static_cast <NSWindow *> (Handle) retain]; - - if (members->window != nil) { - // We make the OpenGL context, associate it to the OpenGL view - // and add the view to our window - members->context = MakeOpenGLContext(params); - - if (members->context != nil) { - members->view = MakeOpenGLView(members->window, members->context, params); - - if (members->view != nil) { - // initial mouse state - mouseIn = MouseInside(members->window, members->view); - - // Initialize myWidth and myHeight members from base class with the window size - myWidth = (unsigned) [members->window frame].size.width; - myHeight = (unsigned) [members->window frame].size.height; - } else { - error(__FILE__, __LINE__, "failed to make OpenGL view for public window"); - } - } else { - error(__FILE__, __LINE__, "failed to make OpenGL context for public window"); - } - } else { - error(__FILE__, __LINE__, "invalid imported window"); - } -} - - -//////////////////////////////////////////////////////////// -/// Create the window implementation -//////////////////////////////////////////////////////////// -WindowImplCocoa::WindowImplCocoa(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& params) : -members(NULL), -useKeyRepeat(false), -mouseIn(false), -wheelStatus(0.0f), -fullscreen(WindowStyle & Style::Fullscreen), -fullscreenMode(0, 0, 0), -desktopMode(0, 0, 0) -{ - Initialize(); - - // Make a WindowController to handle notifications - members->controller = [[WindowController controllerWithWindow:this] retain]; - - // Create a new window with given size, title and style - // First we define some objects used for our window - NSString *title = [NSString stringWithUTF8String:Title.c_str()]; - - // We create the window - members->window = MakeWindow(params, WindowStyle, Mode, title); - - - if (members->window != nil) { - members->context = MakeOpenGLContext(params); - - if (members->context != nil) { - // We make the OpenGL context, associate it to the OpenGL view - // and add the view to our window - members->view = MakeOpenGLView(members->window, members->context, params); - - if (members->view != nil) { - // Set observers and some window settings - ConfigureWindow(members->window, members->view, members->controller); - - // initial mouse state - mouseIn = MouseInside(members->window, members->view); - - // We set the myWidth and myHeight members to the correct values - myWidth = Mode.Width; - myHeight = Mode.Height; - - if (WindowStyle & Style::Fullscreen) { - fullscreenMode = Mode; - } - } else { - error(__FILE__, __LINE__, "failed to make OpenGL view for public window"); - } - } else { - error(__FILE__, __LINE__, "failed to make OpenGL context for public window"); - } - } else { - error(__FILE__, __LINE__, "failed to make window"); - } -} - - -//////////////////////////////////////////////////////////// -/// Destructor -//////////////////////////////////////////////////////////// -WindowImplCocoa::~WindowImplCocoa() -{ - // Destroy the OpenGL context, the window and every resource allocated by this class - Show(false); - - [[NSNotificationCenter defaultCenter] removeObserver:members->window]; - [[NSNotificationCenter defaultCenter] removeObserver:members->view]; - [members->controller release]; - - [sharedContext release]; - [members->context release]; - [members->view release]; - [members->window release]; - - [[AppController sharedController] unregisterWindow:this]; - free (members); -} - - -//////////////////////////////////////////////////////////// -/// Check if there's an active context on the current thread -//////////////////////////////////////////////////////////// -bool WindowImplCocoa::IsContextActive() -{ - return ([NSOpenGLContext currentContext] != NULL); -} - - -//////////////////////////////////////////////////////////// -/// Handle a Cocoa NSEvent -//////////////////////////////////////////////////////////// -void WindowImplCocoa::HandleEvent(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - int eventStatus = UnusedEvent; - - switch ([event type]) { - case NSKeyDown: - eventStatus = HandleKeyDown(eventPtr); - break; - - case NSKeyUp: - eventStatus = HandleKeyUp(eventPtr); - break; - - case NSFlagsChanged: - eventStatus = HandleModifierKey(eventPtr); - break; - - case NSScrollWheel: - eventStatus = HandleMouseWheel(eventPtr); - break; - - case NSLeftMouseDown: - case NSRightMouseDown: - eventStatus = HandleMouseDown(eventPtr); - break; - - case NSLeftMouseUp: - case NSRightMouseUp: - eventStatus = HandleMouseUp(eventPtr); - break; - - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: - eventStatus = HandleMouseMove(eventPtr); - break; - - default: - break; - } - - if (eventStatus == UnusedEvent) { - [NSApp sendEvent:event]; - } -} - - -//////////////////////////////////////////////////////////// -/// Handle event sent by the default NSNotificationCenter -//////////////////////////////////////////////////////////// -void WindowImplCocoa::HandleNotifiedEvent(Event& event) -{ - // Set myWidth and myHeight to correct value if - // window size changed - switch (event.Type) { - case Event::Resized: - myWidth = event.Size.Width; - myHeight = event.Size.Height; - break; - - default: - break; - } - - // And send the event - SendEvent(event); -} - - -//////////////////////////////////////////////////////////// -/// Handle a key down event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleKeyDown(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - - Event sfEvent; - unichar chr = 0, rawchr = 0; - unsigned mods = [event modifierFlags]; - - if ([[event characters] length]) { - chr = [[event characters] characterAtIndex:0]; - - // Note : I got a crash (out of bounds exception) while typing so now I test... - if ([[event charactersIgnoringModifiers] length]) - rawchr = [[event charactersIgnoringModifiers] characterAtIndex:0]; - - } - - if (mods & NSCommandKeyMask) { - // Application commands - [NSApp sendEvent:event]; - } - - // User events - - if (!useKeyRepeat && [event isARepeat]) { - return ConsumedEvent; - } - - // Is it also a text event ? - if (IsTextEvent(event)) { - sfEvent.Type = Event::TextEntered; - sfEvent.Text.Unicode = chr; - - SendEvent(sfEvent); - } - - // Anyway it's also a KeyPressed event - sfEvent.Type = Event::KeyPressed; - - // Get the keys - if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(chr))) { - sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); - } - - // Get the modifiers - sfEvent.Key.Alt = mods & NSAlternateKeyMask; - sfEvent.Key.Control = mods & NSControlKeyMask; - sfEvent.Key.Shift = mods & NSShiftKeyMask; - - SendEvent(sfEvent); - - return ConsumedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Handle a key up event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleKeyUp(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - - Event sfEvent; - unsigned mods = [event modifierFlags]; - unichar chr = 0; - - if ([[event characters] length]) { - chr = [[event characters] characterAtIndex:0]; - } - - if (mods & NSCommandKeyMask) { - [NSApp sendEvent:event]; - } - - sfEvent.Type = Event::KeyReleased; - - // Get the code - if (Key::Code(0) == (sfEvent.Key.Code = KeyForUnicode(chr))) { - sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); - } - - // Get the modifiers - sfEvent.Key.Alt = mods & NSAlternateKeyMask; - sfEvent.Key.Control = mods & NSControlKeyMask; - sfEvent.Key.Shift = mods & NSShiftKeyMask; - - SendEvent(sfEvent); - - return ConsumedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Handle a key modifier event [Command, Option, Control, Shift] -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleModifierKey(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - Event sfEvent; - unsigned mods = [event modifierFlags]; - - sfEvent.Type = Event::KeyPressed; - sfEvent.Key.Code = KeyForVirtualCode([event keyCode]); - - sfEvent.Key.Alt = mods & NSAlternateKeyMask; - sfEvent.Key.Control = mods & NSControlKeyMask; - sfEvent.Key.Shift = mods & NSShiftKeyMask; - - if (!(mods & NSAlternateKeyMask) && - (sfEvent.Key.Code == Key::LAlt || sfEvent.Key.Code == Key::RAlt)) { - sfEvent.Type = Event::KeyReleased; - } - - if (!(mods & NSControlKeyMask) && - (sfEvent.Key.Code == Key::LControl || sfEvent.Key.Code == Key::RControl)) { - sfEvent.Type = Event::KeyReleased; - } - - if (!(mods & NSShiftKeyMask) && - (sfEvent.Key.Code == Key::LShift || sfEvent.Key.Code == Key::RShift)) { - sfEvent.Type = Event::KeyReleased; - } - - if (!(mods & NSCommandKeyMask) && - (sfEvent.Key.Code == Key::LSystem || sfEvent.Key.Code == Key::RSystem)) { - sfEvent.Type = Event::KeyReleased; - } - - SendEvent(sfEvent); - - return UnusedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Handle a mouse down event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleMouseDown(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - Event sfEvent; - NSPoint loc = {0, 0}, relativeLoc = {0, 0}; - unsigned mods = [event modifierFlags]; - - switch ([event type]) { - case NSLeftMouseDown: - sfEvent.Type = Event::MouseButtonPressed; - - if (mods & NSControlKeyMask) { - sfEvent.MouseButton.Button = Mouse::Right; - } else { - sfEvent.MouseButton.Button = Mouse::Left; - } - - // Get mouse position - loc = [NSEvent mouseLocation]; - - relativeLoc = [members->window convertScreenToBase:loc]; - relativeLoc.y = [[members->window contentView] frame].size.height - relativeLoc.y; - - sfEvent.MouseButton.X = (int) relativeLoc.x; - sfEvent.MouseButton.Y = (int) relativeLoc.y; - - SendEvent(sfEvent); - break; - - case NSRightMouseDown: - sfEvent.Type = Event::MouseButtonPressed; - sfEvent.MouseButton.Button = Mouse::Right; - - // Get mouse position - loc = [NSEvent mouseLocation]; - - relativeLoc = [members->window convertScreenToBase:loc]; - relativeLoc.y = [[members->window contentView] frame].size.height - relativeLoc.y; - - sfEvent.MouseButton.X = (int) relativeLoc.x; - sfEvent.MouseButton.Y = (int) relativeLoc.y; - - SendEvent(sfEvent); - break; - - default: - break; - } - - return UnusedEvent; - -} - - -//////////////////////////////////////////////////////////// -/// Handle a mouse up event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleMouseUp(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - Event sfEvent; - NSPoint loc = {0, 0}, relativeLoc = {0, 0}; - unsigned mods = [event modifierFlags]; - - switch ([event type]) { - case NSLeftMouseUp: - sfEvent.Type = Event::MouseButtonReleased; - - if (mods & NSControlKeyMask) { - sfEvent.MouseButton.Button = Mouse::Right; - } else { - sfEvent.MouseButton.Button = Mouse::Left; - } - - // Get mouse position - loc = [NSEvent mouseLocation]; - - relativeLoc = [members->window convertScreenToBase:loc]; - relativeLoc.y = [[members->window contentView] frame].size.height - relativeLoc.y; - - sfEvent.MouseButton.X = (int) relativeLoc.x; - sfEvent.MouseButton.Y = (int) relativeLoc.y; - - SendEvent(sfEvent); - break; - - case NSRightMouseUp: - sfEvent.Type = Event::MouseButtonReleased; - sfEvent.MouseButton.Button = Mouse::Right; - - // Get mouse position - loc = [NSEvent mouseLocation]; - relativeLoc = [members->window convertScreenToBase:loc]; - relativeLoc.y = [[members->window contentView] frame].size.height - relativeLoc.y; - - sfEvent.MouseButton.X = (int) relativeLoc.x; - sfEvent.MouseButton.Y = (int) relativeLoc.y; - - SendEvent(sfEvent); - break; - - default: - break; - } - - return UnusedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Handle a mouse move event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleMouseMove(void *eventPtr) -{ - Event sfEvent; - NSPoint loc = {0, 0}, relativeLoc = {0, 0}; - - loc = [NSEvent mouseLocation]; - relativeLoc = [members->window convertScreenToBase:loc]; - relativeLoc.y = [[members->window contentView] frame].size.height - relativeLoc.y; - sfEvent.Type = Event::MouseMoved; - - sfEvent.MouseMove.X = (int) relativeLoc.x; - sfEvent.MouseMove.Y = (int) relativeLoc.y; - - SendEvent(sfEvent); - - // MouseEntered and MouseLeft events - if (MouseInside(members->window, members->view) && !mouseIn) { - sfEvent.Type = Event::MouseEntered; - mouseIn = true; - SendEvent(sfEvent); - } else if (!MouseInside(members->window, members->view) && mouseIn) { - sfEvent.Type = Event::MouseLeft; - mouseIn = false; - SendEvent(sfEvent); - } - - return UnusedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Handle a mouse wheel event (NSEvent) -//////////////////////////////////////////////////////////// -int WindowImplCocoa::HandleMouseWheel(void *eventPtr) -{ - NSEvent *event = static_cast <NSEvent *> (eventPtr); - - wheelStatus += [event deltaY]; - - if (wheelStatus > 1.0f || wheelStatus < -1.0f) { - Event sfEvent; - sfEvent.Type = Event::MouseWheelMoved; - sfEvent.MouseWheel.Delta = (int)wheelStatus; - SendEvent(sfEvent); - - wheelStatus -= (int)wheelStatus; - } - - return UnusedEvent; -} - - -//////////////////////////////////////////////////////////// -/// Return a pointer to the NSWindow object -//////////////////////////////////////////////////////////// -void *WindowImplCocoa::CocoaWindow(void) -{ - return static_cast <void *> (members->window); -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::Display -//////////////////////////////////////////////////////////// -void WindowImplCocoa::Display() -{ - [members->context flushBuffer]; -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::ProcessEvents -//////////////////////////////////////////////////////////// -void WindowImplCocoa::ProcessEvents() -{ - if (![NSApp isRunning]) - return; - - [[AppController sharedController] processEvents]; -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::MakeActive -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetActive(bool Active) const -{ - if (Active) { - if ([NSOpenGLContext currentContext] != members->context) - [members->context makeCurrentContext]; - } else { - if ([NSOpenGLContext currentContext] == members->context) - [NSOpenGLContext clearCurrentContext]; - } -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::UseVerticalSync -//////////////////////////////////////////////////////////// -void WindowImplCocoa::UseVerticalSync(bool Enabled) -{ - GLint enable = (Enabled) ? 1 : 0; - [members->context setValues:&enable forParameter:NSOpenGLCPSwapInterval]; -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::ShowMouseCursor -//////////////////////////////////////////////////////////// -void WindowImplCocoa::ShowMouseCursor(bool flag) -{ - if (flag) { - [NSCursor unhide]; - } else { - [NSCursor hide]; - } -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::SetCursorPosition -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetCursorPosition(unsigned int Left, unsigned int Top) -{ - // Change the cursor position (Left and Top are relative to this window) - NSPoint pos = NSMakePoint ((float) Left, (float) Top); - - // Flip for SFML window coordinate system - pos.y = [members->window frame].size.height - pos.y; - - // Adjust for view reference instead of window - pos.y -= [members->window frame].size.height - [members->view frame].size.height; - - // Convert to screen coordinates - NSPoint absolute = [members->window convertBaseToScreen:pos]; - - // Flip screen coodinates - absolute.y = [[NSScreen mainScreen] frame].size.height - absolute.y; - - // Move cursor - CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, CGPointMake(absolute.x, absolute.y)); -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::SetPosition -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetPosition(int Left, int Top) -{ - if (!fullscreen) { - // Change the window position - Top = (int) [[members->window screen] frame].size.height - Top; - [members->window setFrameTopLeftPoint:NSMakePoint(Left, Top)]; - } -} - - -//////////////////////////////////////////////////////////// -/// /see WindowImpl::SetSize -/// -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetSize(unsigned int Width, unsigned int Height) -{ - if (!fullscreen) { - [members->window setFrame:NSMakeRect([members->window frame].origin.x, - [members->window frame].origin.y, - (float) Width, (float) Height) - display:YES]; - } -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::Show -//////////////////////////////////////////////////////////// -void WindowImplCocoa::Show(bool State) -{ - if (State) { - // Register ourselves for event handling - [[AppController sharedController] registerWindow:this]; - - if (fullscreen) { - desktopMode = VideoMode::GetDesktopMode(); - [NSMenu setMenuBarVisible:NO]; - - CFDictionaryRef bestMode = CGDisplayBestModeForParameters (CGMainDisplayID(), - fullscreenMode.BitsPerPixel, - fullscreenMode.Width, - fullscreenMode.Height, - NULL); - - CGDisplaySwitchToMode(CGMainDisplayID(), bestMode); - [members->window center]; - } - - // Show the window - [members->window makeKeyAndOrderFront:nil]; - } else { - // Close the window - [members->window close]; - - if (fullscreen) { - CFDictionaryRef bestMode = CGDisplayBestModeForParameters (CGMainDisplayID(), - desktopMode.BitsPerPixel, - desktopMode.Width, - desktopMode.Height, - NULL); - - CGDisplaySwitchToMode(CGMainDisplayID(), bestMode); - [NSMenu setMenuBarVisible:YES]; - } - - // Unregister ourselves from the event handler - [[AppController sharedController] unregisterWindow:this]; - } -} - - -//////////////////////////////////////////////////////////// -/// /see sfWindowImpl::EnableKeyRepeat -//////////////////////////////////////////////////////////// -void WindowImplCocoa::EnableKeyRepeat(bool Enabled) -{ - useKeyRepeat = Enabled; -} - - -//////////////////////////////////////////////////////////// -/// see WindowImpl::SetIcon -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels) -{ - // Nothing to do -} - - -//////////////////////////////////////////////////////////// -/// Make some allocations and initializations -//////////////////////////////////////////////////////////// -void WindowImplCocoa::Initialize(void) -{ - // Allocate mem for the private objc members - members = new objc_members; - if (!members) { - error(__FILE__, __LINE__, "couldn't allocate private objc members structure"); - } - bzero(members, sizeof(*members)); - - // Needed to always have an autorelease pool as soon as application is launched - [SharedAppController resetPool]; - - // Register application if needed and launch it - [SharedAppController runApplication]; -} - - -//////////////////////////////////////////////////////////// -/// Make the window -//////////////////////////////////////////////////////////// -static NSWindow *MakeWindow(WindowSettings& params, unsigned long style, VideoMode& mode, NSString *title) -{ - NSWindow *window = nil; - - NSRect frame = NSMakeRect (0.0f, 0.0f, (float) mode.Width, (float) mode.Height); - unsigned int mask = 0; - - // We grab options from WindowStyle and add them to our window mask - if (style & Style::None || style & Style::Fullscreen) { - mask |= NSBorderlessWindowMask; - - if (style & style & Style::Fullscreen) { - // Check display mode and put new values in 'mode' if needed - boolean_t exact = true; - CFDictionaryRef properties = CGDisplayBestModeForParameters(kCGDirectMainDisplay, mode.BitsPerPixel, - mode.Width, mode.Height, &exact); - - if (!properties) - return nil; - - if (exact == false) { - CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayWidth), - kCFNumberIntType, &mode.Width); - - CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayHeight), - kCFNumberIntType, &mode.Height); - - CFNumberGetValue((CFNumberRef) CFDictionaryGetValue(properties, kCGDisplayBitsPerPixel), - kCFNumberIntType, &mode.BitsPerPixel); - } - } - - } else { - if (style & Style::Titlebar) { - mask |= NSTitledWindowMask; - mask |= NSMiniaturizableWindowMask; - } - - if (style & Style::Resize) { - mask |= NSTitledWindowMask; - mask |= NSMiniaturizableWindowMask; - mask |= NSResizableWindowMask; - } - - if (style & Style::Close) { - mask |= NSTitledWindowMask; - mask |= NSClosableWindowMask; - mask |= NSMiniaturizableWindowMask; - } - } - - // Now we make the window with the values we got - // Note: defer flag set to NO to be able to use OpenGL in our window - window = [[NSWindow alloc] initWithContentRect:frame - styleMask:mask - backing:NSBackingStoreBuffered - defer:NO]; - - if (window != nil) { - // We set title and window position - [window setTitle:title]; - [window center]; - } - - return window; -} - - -//////////////////////////////////////////////////////////// -/// Make the OpenGL pixel format from the given attributes -//////////////////////////////////////////////////////////// -static NSOpenGLContext *MakeOpenGLContext(WindowSettings& params) -{ - NSOpenGLPixelFormat *pixFormat = nil; - NSOpenGLContext *context = nil; - unsigned idx = 0, samplesIdx = 0; - - // Attributes list - NSOpenGLPixelFormatAttribute attribs[15] = {(NSOpenGLPixelFormatAttribute) 0}; - - // Accelerated, double buffered - attribs[idx++] = NSOpenGLPFAClosestPolicy; - attribs[idx++] = NSOpenGLPFADoubleBuffer; - attribs[idx++] = NSOpenGLPFAAccelerated; - - // windowed context - attribs[idx++] = NSOpenGLPFAWindow; - - // Color size ; usually 32 bits per pixel - attribs[idx++] = NSOpenGLPFAColorSize; - attribs[idx++] = (NSOpenGLPixelFormatAttribute) VideoMode::GetDesktopMode().BitsPerPixel; - - // Z-buffer size - attribs[idx++] = NSOpenGLPFADepthSize; - attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.DepthBits; - - // Stencil bits (I don't really know what's that...) - attribs[idx++] = NSOpenGLPFAStencilSize; - attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.StencilBits; - - // Antialiasing settings - if (params.AntialiasingLevel) { - samplesIdx = idx; - - attribs[idx++] = NSOpenGLPFASamples; - attribs[idx++] = (NSOpenGLPixelFormatAttribute) params.AntialiasingLevel; - - attribs[idx++] = NSOpenGLPFASampleBuffers; - attribs[idx++] = (NSOpenGLPixelFormatAttribute) GL_TRUE; - } - - pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - - // If pixel format creation fails and antialiasing level is - // greater than 2, we set it to 2. - if (pixFormat == nil && params.AntialiasingLevel > 2) { - std::cerr << "Failed to find a pixel format supporting " << params.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl; - params.AntialiasingLevel = attribs[samplesIdx + 1] = (NSOpenGLPixelFormatAttribute) 2; - - pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - } - - // If pixel format creation fails and antialiasing is enabled, - // we disable it. - if (pixFormat == nil && params.AntialiasingLevel > 0) { - std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl; - attribs[samplesIdx] = (NSOpenGLPixelFormatAttribute) nil; - - pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - } - - if (pixFormat) { - context = [[NSOpenGLContext alloc] initWithFormat:pixFormat - shareContext:[sharedContext retain]]; - - // Grab the effective properties from our OpenGL context - GLint tmpColorSize = 0, tmpDepthSize = 0, tmpStencilBits = 0, tmpAntialiasingLevel = 0; - - if (context) { - [pixFormat getValues:&tmpColorSize - forAttribute:NSOpenGLPFAColorSize - forVirtualScreen:[context currentVirtualScreen]]; - - [pixFormat getValues:&tmpDepthSize - forAttribute:NSOpenGLPFADepthSize - forVirtualScreen:[context currentVirtualScreen]]; - - [pixFormat getValues:&tmpStencilBits - forAttribute:NSOpenGLPFAStencilSize - forVirtualScreen:[context currentVirtualScreen]]; - - [pixFormat getValues:&tmpAntialiasingLevel - forAttribute:NSOpenGLPFASamples - forVirtualScreen:[context currentVirtualScreen]]; - } - - - params.DepthBits = (unsigned) tmpDepthSize; - params.StencilBits = (unsigned) tmpStencilBits; - params.AntialiasingLevel = (unsigned) tmpAntialiasingLevel; - - [pixFormat release]; - } - - return context; -} - - -static NSOpenGLView * MakeOpenGLView(NSWindow *window, NSOpenGLContext *context, WindowSettings& params) -{ - assert(window != nil); - assert(context != nil); - - NSOpenGLView *view = nil; - - - // We make the NSOpenGLView - view = [[NSOpenGLView alloc] initWithFrame:[[window contentView] bounds] - pixelFormat:nil]; - - if (view) { - // We add the NSOpenGLView to the window - [[window contentView] addSubview:view]; - - [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; - [view clearGLContext]; - [view setOpenGLContext:context]; - [context setView:view]; - } else { - error(__FILE__, __LINE__, "failed to make view"); - } - - return view; -} - - -static void ConfigureWindow(NSWindow *window, NSOpenGLView *view, WindowController *controller) -{ - assert(window != nil); - assert(view != nil); - assert(controller != nil); - - // We need to update the OpenGL view when it changes - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:controller - selector:@selector(viewFrameDidChange:) - name:NSViewFrameDidChangeNotification - object:view]; - - // We want to know when our window got the focus - [nc addObserver:controller - selector:@selector(windowDidBecomeMain:) - name:NSWindowDidBecomeMainNotification - object:window]; - - // We want to know when our window lost the focus - [nc addObserver:controller - selector:@selector(windowDidResignMain:) - name:NSWindowDidResignMainNotification - object:window]; - - // We want to know when the user closes the window - [nc addObserver:controller - selector:@selector(windowWillClose:) - name:NSWindowWillCloseNotification - object:window]; - - // I want to re-center the window if it's a full screen one and moved by Spaces - [nc addObserver:controller - selector:@selector(windowDidMove:) - name:NSWindowDidMoveNotification - object:window]; - - - // Needed not to make application crash when releasing the window in our destructor - // (I prefer to take control of everything :P) - [window setReleasedWhenClosed:NO]; - [window setAcceptsMouseMovedEvents:YES]; -} - - -//////////////////////////////////////////////////////////// -/// Return the SFML key corresponding to a key code -//////////////////////////////////////////////////////////// -static Key::Code KeyForVirtualCode(unsigned short vCode) -{ - static struct { - unsigned short code; - Key::Code sfKey; - } virtualTable[] = - { - {0x35, Key::Escape}, - {0x31, Key::Space}, - {0x24, Key::Return}, // main Return key - {0x4C, Key::Return}, // pav Return key - {0x33, Key::Back}, - {0x30, Key::Tab}, - {0x74, Key::PageUp}, - {0x79, Key::PageDown}, - {0x77, Key::End}, - {0x73, Key::Home}, - {0x72, Key::Insert}, - {0x75, Key::Delete}, - {0x45, Key::Add}, - {0x4E, Key::Subtract}, - {0x43, Key::Multiply}, - {0x4B, Key::Divide}, - - {0x7A, Key::F1}, {0x78, Key::F2}, {0x63, Key::F3}, - {0x76, Key::F4}, {0x60, Key::F5}, {0x61, Key::F6}, - {0x62, Key::F7}, {0x64, Key::F8}, {0x65, Key::F9}, - {0x6D, Key::F10}, {0x67, Key::F11}, {0x6F, Key::F12}, - {0x69, Key::F13}, {0x6B, Key::F14}, {0x71, Key::F15}, - - {0x7B, Key::Left}, - {0x7C, Key::Right}, - {0x7E, Key::Up}, - {0x7D, Key::Down}, - - {0x52, Key::Numpad0}, {0x53, Key::Numpad1}, {0x54, Key::Numpad2}, - {0x55, Key::Numpad3}, {0x56, Key::Numpad4}, {0x57, Key::Numpad5}, - {0x58, Key::Numpad6}, {0x59, Key::Numpad7}, {0x5B, Key::Numpad8}, - {0x5C, Key::Numpad9}, - - {0x1D, Key::Num0}, {0x12, Key::Num1}, {0x13, Key::Num2}, - {0x14, Key::Num3}, {0x15, Key::Num4}, {0x17, Key::Num5}, - {0x16, Key::Num6}, {0x1A, Key::Num7}, {0x1C, Key::Num8}, - {0x19, Key::Num9}, - - {0x3B, Key::LControl}, //< Left Ctrl - {0x3A, Key::LAlt}, //< Left Option/Alt - {0x37, Key::LSystem}, //< Left Command - {0x38, Key::LShift}, //< Left Shift - {0x3E, Key::RControl}, //< Right Ctrl - {0x3D, Key::RAlt}, //< Right Option/Alt - {0x36, Key::RSystem}, //< Right Command - {0x3C, Key::RShift}, //< Right Shift - - {0x39, Key::Code(0)} //< Caps Lock - }; - - Key::Code result = Key::Code(0); - - for (unsigned i = 0;virtualTable[i].code;i++) { - if (virtualTable[i].code == vCode) { - result = virtualTable[i].sfKey; - break; - } - } - - return result; -} - - -//////////////////////////////////////////////////////////// -/// Return the SFML key corresponding to a unicode code -//////////////////////////////////////////////////////////// -static Key::Code KeyForUnicode(unsigned short uniCode) -{ - static struct { - unsigned short character; - Key::Code sfKey; - } unicodeTable[] = - { - {'!', Key::Code(0)}, //< No Key for this code - {'"', Key::Code(0)}, //< No Key for this code - {'#', Key::Code(0)}, //< No Key for this code - {'$', Key::Code(0)}, //< No Key for this code - {'%', Key::Code(0)}, //< No Key for this code - {'&', Key::Code(0)}, //< No Key for this code - {'\'', Key::Quote}, - {'(', Key::Code(0)}, //< No Key for this code - {')', Key::Code(0)}, //< No Key for this code - {'*', Key::Multiply}, - {'+', Key::Add}, - {',', Key::Comma}, - {'-', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'.', Key::Period}, - {'/', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'0', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'1', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'2', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'3', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'4', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'5', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'6', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'7', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'8', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {'9', Key::Code(0)}, //< Handled by KeyForVirtualCode() - {':', Key::Code(0)}, //< No Key for this code - {';', Key::SemiColon}, - {'<', Key::Code(0)}, //< No Key for this code - {'=', Key::Equal}, - {'>', Key::Code(0)}, //< No Key for this code - {'?', Key::Code(0)}, //< No Key for this code - {'@', Key::Code(0)}, //< No Key for this code - {'A', Key::A}, {'B', Key::B}, {'C', Key::C}, - {'D', Key::D}, {'E', Key::E}, {'F', Key::F}, - {'G', Key::G}, {'H', Key::H}, {'I', Key::I}, - {'J', Key::J}, {'K', Key::K}, {'L', Key::L}, - {'M', Key::M}, {'N', Key::N}, {'O', Key::O}, - {'P', Key::P}, {'Q', Key::Q}, {'R', Key::R}, - {'S', Key::S}, {'T', Key::T}, {'U', Key::U}, - {'V', Key::V}, {'W', Key::W}, {'X', Key::X}, - {'Y', Key::Y}, {'Z', Key::Z}, - {'[', Key::LBracket}, - {'\\', Key::BackSlash}, - {']', Key::RBracket}, - {'^', Key::Code(0)}, //< No Key for this code - {'_', Key::Code(0)}, //< No Key for this code - {'`', Key::Code(0)}, //< No Key for this code - {'a', Key::A}, {'b', Key::B}, {'c', Key::C}, - {'d', Key::D}, {'e', Key::E}, {'f', Key::F}, - {'g', Key::G}, {'h', Key::H}, {'i', Key::I}, - {'j', Key::J}, {'k', Key::K}, {'l', Key::L}, - {'m', Key::M}, {'n', Key::N}, {'o', Key::O}, - {'p', Key::P}, {'q', Key::Q}, {'r', Key::R}, - {'s', Key::S}, {'t', Key::T}, {'u', Key::U}, - {'v', Key::V}, {'w', Key::W}, {'x', Key::X}, - {'y', Key::Y}, {'z', Key::Z}, - {'{', Key::Code(0)}, //< No Key for this code - {'|', Key::Code(0)}, //< No Key for this code - {'}', Key::Code(0)}, //< No Key for this code - {'~', Key::Tilde}, - {0, Key::Code(0)} - }; - - Key::Code result = Key::Code(0); - - for (unsigned i = 0;unicodeTable[i].character;i++) { - if (unicodeTable[i].character == uniCode) { - result = unicodeTable[i].sfKey; - break; - } - } - - return result; -} - - -//////////////////////////////////////////////////////////// -/// Return whether 'ev' must be considered as a TextEntered event -//////////////////////////////////////////////////////////// -static bool IsTextEvent(NSEvent *event) -{ - bool res = false; - - if (event && [event type] == NSKeyDown && [[event characters] length]) { - unichar code = [[event characters] characterAtIndex:0]; - - // Codes from 0xF700 to 0xF8FF are non text keys (see NSEvent.h) - if (code < 0xF700 || code > 0xF8FF) - res = true; - } - - return res; -} - - -//////////////////////////////////////////////////////////// -/// Return whether the mouse is on our OpenGL view -//////////////////////////////////////////////////////////// -static bool MouseInside(NSWindow *window, NSView *view) -{ - bool res = false; - - if (window && view && [window isVisible]) { - NSPoint relativeToWindow = [window mouseLocationOutsideOfEventStream]; - NSPoint relativeToView = [view convertPoint:relativeToWindow fromView:nil]; - - if (NSPointInRect (relativeToView, [view bounds])) - res = true; - } - - return res; -} - -} // namespace priv - -} // namespace sf - diff --git a/src/SFML/Window/Template for new ports/Joystick.cpp b/src/SFML/Window/Template for new ports/Joystick.cpp deleted file mode 100644 index 77f06a3..0000000 --- a/src/SFML/Window/Template for new ports/Joystick.cpp +++ /dev/null @@ -1,74 +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/xxx/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
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get the number of axes supported by the joystick
-////////////////////////////////////////////////////////////
-unsigned int Joystick::GetAxesCount() const
-{
- // Return number of supported axes
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get the number of buttons supported by the joystick
-////////////////////////////////////////////////////////////
-unsigned int Joystick::GetButtonsCount() const
-{
- // Return number of supported buttons
-}
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/Template for new ports/Joystick.hpp b/src/SFML/Window/Template for new ports/Joystick.hpp deleted file mode 100644 index 037f65c..0000000 --- a/src/SFML/Window/Template for new ports/Joystick.hpp +++ /dev/null @@ -1,82 +0,0 @@ -////////////////////////////////////////////////////////////
-//
-// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007 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_JOYSTICKXXX_HPP
-#define SFML_JOYSTICKXXX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Linux implementation of Joystick
-////////////////////////////////////////////////////////////
-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;
-};
-
-} // namespace priv
-
-} // namespace sf
-
-
-#endif // SFML_JOYSTICKXXX_HPP
diff --git a/src/SFML/Window/Template for new ports/VideoModeSupport.cpp b/src/SFML/Window/Template for new ports/VideoModeSupport.cpp deleted file mode 100644 index 8259256..0000000 --- a/src/SFML/Window/Template for new ports/VideoModeSupport.cpp +++ /dev/null @@ -1,60 +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/XXX/VideoModeSupport.hpp>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Get supported video modes
-////////////////////////////////////////////////////////////
-void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& Modes)
-{
- // Get all the supported fullscreen modes and put them in Modes array
-
- // Just care about width, height and bpp (ignore frequency and other attributes)
-
- // You must remove duplicates
-
- // Order doesn't matter (the array will be sorted later)
-}
-
-
-////////////////////////////////////////////////////////////
-/// Get current desktop video mode
-////////////////////////////////////////////////////////////
-VideoMode VideoModeSupport::GetDesktopVideoMode()
-{
- // Return the current desktop video mode
-}
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/Template for new ports/VideoModeSupport.hpp b/src/SFML/Window/Template for new ports/VideoModeSupport.hpp deleted file mode 100644 index e515cc7..0000000 --- a/src/SFML/Window/Template for new ports/VideoModeSupport.hpp +++ /dev/null @@ -1,69 +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.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_VIDEOMODESUPPORTXXX_HPP
-#define SFML_VIDEOMODESUPPORTXXX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Window/VideoMode.hpp>
-#include <vector>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// XXX 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_VIDEOMODESUPPORTXXX_HPP
diff --git a/src/SFML/Window/Template for new ports/WindowImplXXX.cpp b/src/SFML/Window/Template for new ports/WindowImplXXX.cpp deleted file mode 100644 index 44383ec..0000000 --- a/src/SFML/Window/Template for new ports/WindowImplXXX.cpp +++ /dev/null @@ -1,231 +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/XXX/WindowImplXXX.hpp>
-#include <SFML/Window/WindowStyle.hpp>
-#include <GL/gl.h>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// Default constructor
-/// (creates a dummy window to provide a valid OpenGL context)
-////////////////////////////////////////////////////////////
-WindowImplXXX::WindowImplXXX()
-{
- // Create a dummy window (with the fewest attributes -- it's just to have a valid support for an OpenGL context)
-
- // Initialize myWidth and myHeight members from base class with the window size
-
- // Create an OpenGL context in this window and DO NOT make it active
-}
-
-
-////////////////////////////////////////////////////////////
-/// Create the window implementation from an existing control
-////////////////////////////////////////////////////////////
-WindowImplXXX::WindowImplXXX(WindowHandle Handle, WindowSettings& Params)
-{
- // Make sure we'll be able to catch all the events of the given window
-
- // Initialize myWidth and myHeight members from base class with the window size
-
- // Create an OpenGL context in this window and make it active
-}
-
-
-////////////////////////////////////////////////////////////
-/// Create the window implementation
-////////////////////////////////////////////////////////////
-WindowImplXXX::WindowImplXXX(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params) :
-{
- // Create a new window with given size, title and style
-
- // Initialize myWidth and myHeight members from base class with the window size
-
- // Create an OpenGL context in this window and make it active
-}
-
-
-////////////////////////////////////////////////////////////
-/// Destructor
-////////////////////////////////////////////////////////////
-WindowImplXXX::~WindowImplXXX()
-{
- // Destroy the OpenGL context, the window and every resource allocated by this class
-}
-
-
-////////////////////////////////////////////////////////////
-/// Check if there's an active context on the current thread
-////////////////////////////////////////////////////////////
-bool WindowImplXXX::IsContextActive()
-{
- // Should return whether xxxGetCurrentContext() is NULL or not;
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::Display
-////////////////////////////////////////////////////////////
-void WindowImplXXX::Display()
-{
- // Swap OpenGL buffers (should be a call to xxxSwapBuffers)
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::ProcessEvents
-////////////////////////////////////////////////////////////
-void WindowImplXXX::ProcessEvents()
-{
- // Process every event for this window
-
- // Generate a sf::Event and call SendEvent(Evt) for each event
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetActive
-////////////////////////////////////////////////////////////
-void WindowImplXXX::SetActive(bool Active) const
-{
- // Bind / unbind OpenGL context (should be a call to xxxMakeCurrent)
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::UseVerticalSync
-////////////////////////////////////////////////////////////
-void WindowImplXXX::UseVerticalSync(bool Enabled)
-{
- // Activate / deactivate vertical synchronization
- // usually using an OpenGL extension (should be a call to xxxSwapInterval)
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::ShowMouseCursor
-////////////////////////////////////////////////////////////
-void WindowImplXXX::ShowMouseCursor(bool Show)
-{
- // Show or hide the system cursor in this window
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetCursorPosition
-////////////////////////////////////////////////////////////
-void WindowImplXXX::SetCursorPosition(unsigned int Left, unsigned int Top)
-{
- // Change the cursor position (Left and Top are relative to this window)
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetPosition
-////////////////////////////////////////////////////////////
-void WindowImplXXX::SetPosition(int Left, int Top)
-{
- // Change the window position
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetSize
-////////////////////////////////////////////////////////////
-void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height)
-{
- // Change the window size
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::Show
-////////////////////////////////////////////////////////////
-void WindowImplXXX::Show(bool State)
-{
- // Show or hide the window
-}
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::EnableKeyRepeat
-////////////////////////////////////////////////////////////
-void WindowImplXXX::EnableKeyRepeat(bool Enabled)
-{
- // Enable or disable automatic key-repeat for keydown events
-}
-
-
-////////////////////////////////////////////////////////////
-/// /see WindowImpl::SetIcon
-////////////////////////////////////////////////////////////
-void WindowImplXXX::SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels)
-{
- // Change all the necessary icons of the window (titlebar, task bar, ...) with the
- // provided array of 32 bits RGBA pixels
-}
-
-
-/*===========================================================
- STRATEGY FOR OPENGL CONTEXT CREATION
-
-- If the requested level of anti-aliasing is not supported and is greater than 2, try with 2
- --> if level 2 fails, disable anti-aliasing
- --> it's important not to generate an error if anti-aliasing is not supported
-
-- Use a matching pixel mode, or the best of all available pixel modes if no perfect match ;
- You should use the function EvaluateConfig to get a score for a given configuration
-
-- Don't forget to fill Params (see constructors) back with the actual parameters we got from the chosen pixel format
-
-- IMPORTANT : all OpenGL contexts must be shared (usually a call to xxxShareLists)
-
-===========================================================*/
-
-
-/*===========================================================
- STRATEGY FOR EVENT HANDLING
-
-- Process any event matching with the ones in sf::Event::EventType
- --> Create a sf::Event, fill the members corresponding to the event type
- --> No need to handle joystick events, they are handled by WindowImpl::ProcessJoystickEvents
- --> Event::TextEntered must provide UTF-16 characters
- (see http://www.unicode.org/Public/PROGRAMS/CVTUTF/ for unicode conversions)
- --> Don't forget to process any destroy-like event (ie. when the window is destroyed externally)
-
-- Use SendEvent function from base class to propagate the created events
-
-===========================================================*/
-
-
-} // namespace priv
-
-} // namespace sf
diff --git a/src/SFML/Window/Template for new ports/WindowImplXXX.hpp b/src/SFML/Window/Template for new ports/WindowImplXXX.hpp deleted file mode 100644 index d396161..0000000 --- a/src/SFML/Window/Template for new ports/WindowImplXXX.hpp +++ /dev/null @@ -1,167 +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.
-//
-////////////////////////////////////////////////////////////
-
-#ifndef SFML_WINDOWIMPLXXX_HPP
-#define SFML_WINDOWIMPLXXX_HPP
-
-////////////////////////////////////////////////////////////
-// Headers
-////////////////////////////////////////////////////////////
-#include <SFML/Window/Event.hpp>
-#include <SFML/Window/WindowImpl.hpp>
-#include <string>
-
-
-namespace sf
-{
-namespace priv
-{
-////////////////////////////////////////////////////////////
-/// WindowImplXXX is the XXX implementation of WindowImpl
-////////////////////////////////////////////////////////////
-class WindowImplXXX : public WindowImpl
-{
-public :
-
- ////////////////////////////////////////////////////////////
- /// Default constructor
- /// (creates a dummy window to provide a valid OpenGL context)
- ///
- ////////////////////////////////////////////////////////////
- WindowImplXXX();
-
- ////////////////////////////////////////////////////////////
- /// Construct the window implementation from an existing control
- ///
- /// \param Handle : Platform-specific handle of the control
- /// \param Params : Creation parameters
- ///
- ////////////////////////////////////////////////////////////
- WindowImplXXX(WindowHandle Handle, WindowSettings& Params);
-
- ////////////////////////////////////////////////////////////
- /// Create the window implementation
- ///
- /// \param Mode : Video mode to use
- /// \param Title : Title of the window
- /// \param WindowStyle : Window style
- /// \param Params : Creation parameters
- ///
- ////////////////////////////////////////////////////////////
- WindowImplXXX(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, WindowSettings& Params);
-
- ////////////////////////////////////////////////////////////
- /// Destructor
- ///
- ////////////////////////////////////////////////////////////
- ~WindowImplXXX();
-
- ////////////////////////////////////////////////////////////
- /// Check if there's an active context on the current thread
- ///
- /// \return True if there's a context bound to the current thread
- ///
- ////////////////////////////////////////////////////////////
- static bool IsContextActive();
-
-private :
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::Display
- ///
- ////////////////////////////////////////////////////////////
- virtual void Display();
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::ProcessEvents
- ///
- ////////////////////////////////////////////////////////////
- virtual void ProcessEvents();
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::SetActive
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetActive(bool Active = true) const;
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::IsActive
- ///
- ////////////////////////////////////////////////////////////
- virtual bool IsActive() const;
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::UseVerticalSync
- ///
- ////////////////////////////////////////////////////////////
- virtual void UseVerticalSync(bool Enabled);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::ShowMouseCursor
- ///
- ////////////////////////////////////////////////////////////
- virtual void ShowMouseCursor(bool Show);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::SetCursorPosition
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetCursorPosition(unsigned int Left, unsigned int Top);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::SetPosition
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetPosition(int Left, int Top);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::SetSize
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetSize(unsigned int Width, unsigned int Height);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::Show
- ///
- ////////////////////////////////////////////////////////////
- virtual void Show(bool State);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::EnableKeyRepeat
- ///
- ////////////////////////////////////////////////////////////
- virtual void EnableKeyRepeat(bool Enabled);
-
- ////////////////////////////////////////////////////////////
- /// /see WindowImpl::SetIcon
- ///
- ////////////////////////////////////////////////////////////
- virtual void SetIcon(unsigned int Width, unsigned int Height, const Uint8* Pixels);
-};
-
-} // namespace priv
-
-} // namespace sf
-
-#endif // SFML_WINDOWIMPLXXX_HPP
diff --git a/src/SFML/Window/VideoMode.cpp b/src/SFML/Window/VideoMode.cpp index 8efff0f..8efff0f 100644..100755 --- a/src/SFML/Window/VideoMode.cpp +++ b/src/SFML/Window/VideoMode.cpp diff --git a/src/SFML/Window/VideoModeSupport.hpp b/src/SFML/Window/VideoModeSupport.hpp index 63ee1e9..63ee1e9 100644..100755 --- a/src/SFML/Window/VideoModeSupport.hpp +++ b/src/SFML/Window/VideoModeSupport.hpp diff --git a/src/SFML/Window/Win32/Joystick.cpp b/src/SFML/Window/Win32/Joystick.cpp index 9cf195f..9cf195f 100644..100755 --- a/src/SFML/Window/Win32/Joystick.cpp +++ b/src/SFML/Window/Win32/Joystick.cpp diff --git a/src/SFML/Window/Win32/Joystick.hpp b/src/SFML/Window/Win32/Joystick.hpp index 95019cb..95019cb 100644..100755 --- a/src/SFML/Window/Win32/Joystick.hpp +++ b/src/SFML/Window/Win32/Joystick.hpp diff --git a/src/SFML/Window/Win32/VideoModeSupport.cpp b/src/SFML/Window/Win32/VideoModeSupport.cpp index cd5f650..cd5f650 100644..100755 --- a/src/SFML/Window/Win32/VideoModeSupport.cpp +++ b/src/SFML/Window/Win32/VideoModeSupport.cpp diff --git a/src/SFML/Window/Win32/VideoModeSupport.hpp b/src/SFML/Window/Win32/VideoModeSupport.hpp index f00d474..f00d474 100644..100755 --- a/src/SFML/Window/Win32/VideoModeSupport.hpp +++ b/src/SFML/Window/Win32/VideoModeSupport.hpp diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index e07eeab..e07eeab 100644..100755 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index 7b6a425..7b6a425 100644..100755 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 7539bde..7539bde 100644..100755 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index fde2d44..fde2d44 100644..100755 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index e231ff3..e231ff3 100644..100755 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp |