Synchronized with trunk

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1068 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-03-28 19:24:12 +00:00
commit b194b9969a
81 changed files with 4492 additions and 2174 deletions

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -21,11 +21,13 @@ EXPORTS
sfMusic_SetPitch
sfMusic_SetVolume
sfMusic_SetPosition
sfMusic_SetRelativeToListener
sfMusic_SetMinDistance
sfMusic_SetAttenuation
sfMusic_GetPitch
sfMusic_GetVolume
sfMusic_GetPosition
sfMusic_IsRelativeToListener
sfMusic_GetMinDistance
sfMusic_GetAttenuation
sfMusic_GetPlayingOffset
@ -42,12 +44,14 @@ EXPORTS
sfSound_SetPitch
sfSound_SetVolume
sfSound_SetPosition
sfSound_SetRelativeToListener
sfSound_SetMinDistance
sfSound_SetAttenuation
sfSound_SetPlayingOffset
sfSound_GetPitch
sfSound_GetVolume
sfSound_GetPosition
sfSound_IsRelativeToListener
sfSound_GetPlayingOffset
sfSound_GetMinDistance
sfSound_GetAttenuation
@ -84,12 +88,14 @@ EXPORTS
sfSoundStream_SetPitch
sfSoundStream_SetVolume
sfSoundStream_SetPosition
sfSoundStream_SetRelativeToListener
sfSoundStream_SetMinDistance
sfSoundStream_SetAttenuation
sfSoundStream_SetLoop
sfSoundStream_GetPitch
sfSoundStream_GetVolume
sfSoundStream_GetPosition
sfSoundStream_IsRelativeToListener
sfSoundStream_GetMinDistance
sfSoundStream_GetAttenuation
sfSoundStream_GetLoop

View File

@ -184,6 +184,17 @@ CSFML_API void sfMusic_SetVolume(sfMusic* Music, float Volume);
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the music's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Music : Music to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_SetRelativeToListener(sfMusic* Music, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the music at its maximum volume.
@ -237,6 +248,17 @@ CSFML_API float sfMusic_GetVolume(sfMusic* Music);
////////////////////////////////////////////////////////////
CSFML_API void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the music's position is relative to the listener's
/// position, or if it's absolute
///
/// \param Music : Music to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* Music);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a music
///

View File

@ -150,6 +150,17 @@ CSFML_API void sfSound_SetVolume(sfSound* Sound, float Volume);
////////////////////////////////////////////////////////////
CSFML_API void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Sound : Sound to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -212,6 +223,17 @@ CSFML_API float sfSound_GetVolume(sfSound* Sound);
////////////////////////////////////////////////////////////
CSFML_API void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
///
/// \param Sound : Sound to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* Sound);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound
///

View File

@ -157,6 +157,17 @@ CSFML_API void sfSoundStream_SetVolume(sfSoundStream* SoundStream, float Volume)
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, float Z);
////////////////////////////////////////////////////////////
/// Make the sound stream's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param SoundStream : Sound stream to modify
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound stream at its maximum volume.
@ -219,6 +230,17 @@ CSFML_API float sfSoundStream_GetVolume(sfSoundStream* SoundStream);
////////////////////////////////////////////////////////////
CSFML_API void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, float* Z);
////////////////////////////////////////////////////////////
/// Tell if the sound stream's position is relative to the listener's
/// position, or if it's absolute
///
/// \param SoundStream : Sound stream to check
///
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream);
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound stream
///

View File

@ -198,6 +198,17 @@ void sfMusic_SetPosition(sfMusic* Music, float X, float Y, float Z)
}
////////////////////////////////////////////////////////////
/// Make the music's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfMusic_SetRelativeToListener(sfMusic* music, sfBool Relative)
{
CSFML_CALL(music, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the music at its maximum volume.
@ -255,6 +266,16 @@ void sfMusic_GetPosition(sfMusic* Music, float* X, float* Y, float* Z)
}
////////////////////////////////////////////////////////////
/// Tell if the music's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfMusic_IsRelativeToListener(sfMusic* Music)
{
CSFML_CALL_RETURN(Music, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a music
////////////////////////////////////////////////////////////

View File

@ -168,6 +168,17 @@ void sfSound_SetPosition(sfSound* Sound, float X, float Y, float Z)
}
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfSound_SetRelativeToListener(sfSound* Sound, sfBool Relative)
{
CSFML_CALL(Sound, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -231,6 +242,16 @@ void sfSound_GetPosition(sfSound* Sound, float* X, float* Y, float* Z)
}
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSound_IsRelativeToListener(sfSound* Sound)
{
CSFML_CALL_RETURN(Sound, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound
////////////////////////////////////////////////////////////

View File

@ -195,6 +195,17 @@ void sfSoundStream_SetPosition(sfSoundStream* SoundStream, float X, float Y, flo
}
////////////////////////////////////////////////////////////
/// Make the sound stream's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void sfSoundStream_SetRelativeToListener(sfSoundStream* SoundStream, sfBool Relative)
{
CSFML_CALL(SoundStream, SetRelativeToListener(Relative == sfTrue));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound stream at its maximum volume.
@ -258,6 +269,16 @@ void sfSoundStream_GetPosition(sfSoundStream* SoundStream, float* X, float* Y, f
}
////////////////////////////////////////////////////////////
/// Tell if the sound stream's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
CSFML_API sfBool sfSoundStream_IsRelativeToListener(sfSoundStream* SoundStream)
{
CSFML_CALL_RETURN(SoundStream, IsRelativeToListener(), sfFalse);
}
////////////////////////////////////////////////////////////
/// Get the minimum distance of a sound stream
////////////////////////////////////////////////////////////

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.sfml.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -25,12 +25,14 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
A011E8070F65B35400FAE48D /* GLKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = A011E8060F65B35400FAE48D /* GLKit.mm */; };
A018A2AF0EA21A2C005FFAC3 /* Http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A2AD0EA21A2C005FFAC3 /* Http.cpp */; };
A018A2B00EA21A2C005FFAC3 /* Ftp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A018A2AE0EA21A2C005FFAC3 /* Ftp.cpp */; };
A01BEF080F6BF0140095262C /* Initializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A01BEF070F6BF0140095262C /* Initializer.cpp */; };
A01BEF0C0F6BF0550095262C /* sndfile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A01BEF0B0F6BF0550095262C /* sndfile.framework */; };
A04C5A9D0EDDD88B00935061 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A940EDDD88B00935061 /* AppController.mm */; };
A04C5A9E0EDDD88B00935061 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A950EDDD88B00935061 /* Joystick.cpp */; };
A04C5A9F0EDDD88B00935061 /* VideoModeSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */; };
A04C5AA00EDDD88B00935061 /* WindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A9A0EDDD88B00935061 /* WindowController.mm */; };
A04C5AA10EDDD88B00935061 /* WindowImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */; };
A0660EBA0E89051400D39DEB /* Clock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EA90E89051400D39DEB /* Clock.cpp */; };
A0660EBC0E89051400D39DEB /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0660EAB0E89051400D39DEB /* Lock.cpp */; };
@ -197,21 +199,23 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
A01269660E6318C000B96A5D /* libsfml-system.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-system.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A012696F0E6318FE00B96A5D /* libsfml-network.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-network.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A01269760E63190F00B96A5D /* libsfml-audio.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-audio.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A012697D0E63192000B96A5D /* libsfml-window.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-window.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A01269840E63192B00B96A5D /* libsfml-graphics.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-graphics.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A011E8050F65B35400FAE48D /* GLKit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GLKit.h; sourceTree = "<group>"; };
A011E8060F65B35400FAE48D /* GLKit.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = GLKit.mm; sourceTree = "<group>"; };
A01269660E6318C000B96A5D /* libsfml-system-d.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-system-d.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A012696F0E6318FE00B96A5D /* libsfml-network-d.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-network-d.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A01269760E63190F00B96A5D /* libsfml-audio-d.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-audio-d.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A012697D0E63192000B96A5D /* libsfml-window-d.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-window-d.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A01269840E63192B00B96A5D /* libsfml-graphics-d.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "libsfml-graphics-d.dylib"; sourceTree = BUILT_PRODUCTS_DIR; };
A018A2AD0EA21A2C005FFAC3 /* Http.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Http.cpp; path = ../../src/SFML/Network/Http.cpp; sourceTree = SOURCE_ROOT; };
A018A2AE0EA21A2C005FFAC3 /* Ftp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ftp.cpp; path = ../../src/SFML/Network/Ftp.cpp; sourceTree = SOURCE_ROOT; };
A01BEF070F6BF0140095262C /* Initializer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Initializer.cpp; path = ../../src/SFML/System/Initializer.cpp; sourceTree = SOURCE_ROOT; };
A01BEF0B0F6BF0550095262C /* sndfile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = sndfile.framework; path = "../../extlibs/libs-xcode/sndfile.framework"; sourceTree = SOURCE_ROOT; };
A04C5A930EDDD88B00935061 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = ../../src/SFML/Window/Cocoa/AppController.h; sourceTree = SOURCE_ROOT; };
A04C5A940EDDD88B00935061 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = AppController.mm; path = ../../src/SFML/Window/Cocoa/AppController.mm; sourceTree = SOURCE_ROOT; };
A04C5A950EDDD88B00935061 /* Joystick.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Joystick.cpp; path = ../../src/SFML/Window/Cocoa/Joystick.cpp; sourceTree = SOURCE_ROOT; };
A04C5A960EDDD88B00935061 /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Cocoa/Joystick.hpp; sourceTree = SOURCE_ROOT; };
A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoModeSupport.cpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.cpp; sourceTree = SOURCE_ROOT; };
A04C5A980EDDD88B00935061 /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; };
A04C5A990EDDD88B00935061 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WindowController.h; path = ../../src/SFML/Window/Cocoa/WindowController.h; sourceTree = SOURCE_ROOT; };
A04C5A9A0EDDD88B00935061 /* WindowController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowController.mm; path = ../../src/SFML/Window/Cocoa/WindowController.mm; sourceTree = SOURCE_ROOT; };
A04C5A9B0EDDD88B00935061 /* WindowImplCocoa.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImplCocoa.hpp; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.hpp; sourceTree = SOURCE_ROOT; };
A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowImplCocoa.mm; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.mm; sourceTree = SOURCE_ROOT; };
A0660EA90E89051400D39DEB /* Clock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Clock.cpp; path = ../../src/SFML/System/Clock.cpp; sourceTree = SOURCE_ROOT; };
@ -406,6 +410,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A01BEF0C0F6BF0550095262C /* sndfile.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -441,11 +446,11 @@
A01269670E6318C000B96A5D /* Products */ = {
isa = PBXGroup;
children = (
A01269660E6318C000B96A5D /* libsfml-system.dylib */,
A012696F0E6318FE00B96A5D /* libsfml-network.dylib */,
A01269760E63190F00B96A5D /* libsfml-audio.dylib */,
A012697D0E63192000B96A5D /* libsfml-window.dylib */,
A01269840E63192B00B96A5D /* libsfml-graphics.dylib */,
A01269660E6318C000B96A5D /* libsfml-system-d.dylib */,
A012696F0E6318FE00B96A5D /* libsfml-network-d.dylib */,
A01269760E63190F00B96A5D /* libsfml-audio-d.dylib */,
A012697D0E63192000B96A5D /* libsfml-window-d.dylib */,
A01269840E63192B00B96A5D /* libsfml-graphics-d.dylib */,
);
name = Products;
sourceTree = "<group>";
@ -453,6 +458,7 @@
A01269870E63193B00B96A5D /* sfml-system */ = {
isa = PBXGroup;
children = (
A01BEF070F6BF0140095262C /* Initializer.cpp */,
A0660EA90E89051400D39DEB /* Clock.cpp */,
A0660EAA0E89051400D39DEB /* Platform.hpp */,
A0660EAB0E89051400D39DEB /* Lock.cpp */,
@ -482,6 +488,7 @@
A012698D0E63194600B96A5D /* sfml-audio */ = {
isa = PBXGroup;
children = (
A01BEF0B0F6BF0550095262C /* sndfile.framework */,
A0660EDB0E89054E00D39DEB /* AudioDevice.cpp */,
A0660EDC0E89054E00D39DEB /* AudioDevice.hpp */,
A0660EDD0E89054E00D39DEB /* AudioResource.cpp */,
@ -554,14 +561,14 @@
A04C5A920EDDD88B00935061 /* Cocoa */ = {
isa = PBXGroup;
children = (
A011E8050F65B35400FAE48D /* GLKit.h */,
A011E8060F65B35400FAE48D /* GLKit.mm */,
A04C5A930EDDD88B00935061 /* AppController.h */,
A04C5A940EDDD88B00935061 /* AppController.mm */,
A04C5A950EDDD88B00935061 /* Joystick.cpp */,
A04C5A960EDDD88B00935061 /* Joystick.hpp */,
A04C5A970EDDD88B00935061 /* VideoModeSupport.cpp */,
A04C5A980EDDD88B00935061 /* VideoModeSupport.hpp */,
A04C5A990EDDD88B00935061 /* WindowController.h */,
A04C5A9A0EDDD88B00935061 /* WindowController.mm */,
A04C5A9B0EDDD88B00935061 /* WindowImplCocoa.hpp */,
A04C5A9C0EDDD88B00935061 /* WindowImplCocoa.mm */,
);
@ -765,7 +772,7 @@
);
name = "sfml-system";
productName = "sfml-system";
productReference = A01269660E6318C000B96A5D /* libsfml-system.dylib */;
productReference = A01269660E6318C000B96A5D /* libsfml-system-d.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
A012696E0E6318FE00B96A5D /* sfml-network */ = {
@ -781,7 +788,7 @@
);
name = "sfml-network";
productName = "sfml-network";
productReference = A012696F0E6318FE00B96A5D /* libsfml-network.dylib */;
productReference = A012696F0E6318FE00B96A5D /* libsfml-network-d.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
A01269750E63190F00B96A5D /* sfml-audio */ = {
@ -797,7 +804,7 @@
);
name = "sfml-audio";
productName = "sfml-audio";
productReference = A01269760E63190F00B96A5D /* libsfml-audio.dylib */;
productReference = A01269760E63190F00B96A5D /* libsfml-audio-d.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
A012697C0E63192000B96A5D /* sfml-window */ = {
@ -813,7 +820,7 @@
);
name = "sfml-window";
productName = "sfml-window";
productReference = A012697D0E63192000B96A5D /* libsfml-window.dylib */;
productReference = A012697D0E63192000B96A5D /* libsfml-window-d.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
A01269830E63192B00B96A5D /* sfml-graphics */ = {
@ -829,7 +836,7 @@
);
name = "sfml-graphics";
productName = "sfml-graphics";
productReference = A01269840E63192B00B96A5D /* libsfml-graphics.dylib */;
productReference = A01269840E63192B00B96A5D /* libsfml-graphics-d.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
/* End PBXNativeTarget section */
@ -868,6 +875,7 @@
A0660EC00E89051400D39DEB /* Platform.cpp in Sources */,
A0660EC20E89051400D39DEB /* Thread.cpp in Sources */,
A0660EC40E89051400D39DEB /* Sleep.cpp in Sources */,
A01BEF080F6BF0140095262C /* Initializer.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -918,8 +926,8 @@
A04C5A9D0EDDD88B00935061 /* AppController.mm in Sources */,
A04C5A9E0EDDD88B00935061 /* Joystick.cpp in Sources */,
A04C5A9F0EDDD88B00935061 /* VideoModeSupport.cpp in Sources */,
A04C5AA00EDDD88B00935061 /* WindowController.mm in Sources */,
A04C5AA10EDDD88B00935061 /* WindowImplCocoa.mm in Sources */,
A011E8070F65B35400FAE48D /* GLKit.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1104,6 +1112,10 @@
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_LDFLAGS = (
"-framework",
CoreFoundation,
);
PREBINDING = NO;
PRODUCT_NAME = "sfml-system-d";
};
@ -1119,6 +1131,10 @@
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_MODEL_TUNING = G5;
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
OTHER_LDFLAGS = (
"-framework",
CoreFoundation,
);
PREBINDING = NO;
PRODUCT_NAME = "sfml-system";
ZERO_LINK = NO;
@ -1161,6 +1177,11 @@
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
EXECUTABLE_PREFIX = lib;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/libs-xcode\"";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
@ -1168,7 +1189,6 @@
OTHER_LDFLAGS = (
"-framework",
OpenAL,
"$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a",
"-lsfml-system-d",
);
PREBINDING = NO;
@ -1183,12 +1203,16 @@
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
EXECUTABLE_PREFIX = lib;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/libs-xcode\"";
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_MODEL_TUNING = G5;
OTHER_LDFLAGS = (
"-framework",
OpenAL,
"$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a",
"-lsfml-system",
);
PREBINDING = NO;

View File

@ -54,13 +54,11 @@
A04C59B20EDDBA9C00935061 /* Joystick.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59A80EDDBA9C00935061 /* Joystick.hpp */; };
A04C59B30EDDBA9C00935061 /* VideoModeSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */; };
A04C59B40EDDBA9C00935061 /* VideoModeSupport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */; };
A04C59B50EDDBA9C00935061 /* WindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AB0EDDBA9C00935061 /* WindowController.h */; };
A04C59B60EDDBA9C00935061 /* WindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C59AC0EDDBA9C00935061 /* WindowController.mm */; };
A04C59B70EDDBA9C00935061 /* WindowImplCocoa.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */; };
A04C59B80EDDBA9C00935061 /* WindowImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */; };
A05EEF700E5CF18F00572B7E /* sfml-window.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */; };
A05EEF700E5CF18F00572B7E /* sfml-window-d.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0C93EB40D9A9CA000B9E0C8 /* sfml-window-d.framework */; };
A093E3D00D8BF918002236B4 /* dummy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A093E3CF0D8BF918002236B4 /* dummy.cpp */; };
A093E5480D8BFEAE002236B4 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; };
A093E5480D8BFEAE002236B4 /* sfml-system-d.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */; };
A09EEBF70D8C19BF00F6C625 /* Platform.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A09EEBED0D8C19BF00F6C625 /* Platform.hpp */; };
A09EEBF80D8C19BF00F6C625 /* Randomizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBEE0D8C19BF00F6C625 /* Randomizer.cpp */; };
A09EEBF90D8C19BF00F6C625 /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF00D8C19BF00F6C625 /* Mutex.cpp */; };
@ -70,8 +68,13 @@
A09EEBFD0D8C19BF00F6C625 /* Clock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF40D8C19BF00F6C625 /* Clock.cpp */; };
A09EEBFE0D8C19BF00F6C625 /* Lock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF50D8C19BF00F6C625 /* Lock.cpp */; };
A09EEBFF0D8C19BF00F6C625 /* Sleep.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */; };
A0BE1A200D917332007D4CAD /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; };
A0C93F930D9AA9FA00B9E0C8 /* sfml-system.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system.framework */; };
A0B617730F66936F005E0970 /* sndfile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A0B617720F66936F005E0970 /* sndfile.framework */; };
A0B617780F66938D005E0970 /* sndfile.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A0B617720F66936F005E0970 /* sndfile.framework */; };
A0BE1A200D917332007D4CAD /* sfml-system-d.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */; };
A0C93F930D9AA9FA00B9E0C8 /* sfml-system-d.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */; };
A0CE9FE70F46F72500FD00CE /* GLKit.h in Headers */ = {isa = PBXBuildFile; fileRef = A0CE9FE50F46F72500FD00CE /* GLKit.h */; };
A0CE9FE80F46F72500FD00CE /* GLKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0CE9FE60F46F72500FD00CE /* GLKit.mm */; };
A0EEDE990F59D49C0023A7F7 /* Initializer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EEDE980F59D49C0023A7F7 /* Initializer.cpp */; };
A0F1E68A0E75440800778F12 /* IPAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6800E75440800778F12 /* IPAddress.cpp */; };
A0F1E68C0E75440800778F12 /* Packet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6820E75440800778F12 /* Packet.cpp */; };
A0F1E68D0E75440800778F12 /* SelectorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0F1E6830E75440800778F12 /* SelectorBase.cpp */; };
@ -306,6 +309,19 @@
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
A0B617500F66926C005E0970 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
A0B617780F66938D005E0970 /* sndfile.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
A018A2790EA21866005FFAC3 /* Http.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Http.cpp; path = ../../src/SFML/Network/Http.cpp; sourceTree = SOURCE_ROOT; };
A018A27A0EA21866005FFAC3 /* Ftp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Ftp.cpp; path = ../../src/SFML/Network/Ftp.cpp; sourceTree = SOURCE_ROOT; };
@ -406,20 +422,18 @@
A04C59A80EDDBA9C00935061 /* Joystick.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Joystick.hpp; path = ../../src/SFML/Window/Cocoa/Joystick.hpp; sourceTree = SOURCE_ROOT; };
A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = VideoModeSupport.cpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.cpp; sourceTree = SOURCE_ROOT; };
A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = VideoModeSupport.hpp; path = ../../src/SFML/Window/Cocoa/VideoModeSupport.hpp; sourceTree = SOURCE_ROOT; };
A04C59AB0EDDBA9C00935061 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = WindowController.h; path = ../../src/SFML/Window/Cocoa/WindowController.h; sourceTree = SOURCE_ROOT; };
A04C59AC0EDDBA9C00935061 /* WindowController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowController.mm; path = ../../src/SFML/Window/Cocoa/WindowController.mm; sourceTree = SOURCE_ROOT; };
A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = WindowImplCocoa.hpp; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.hpp; sourceTree = SOURCE_ROOT; };
A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = WindowImplCocoa.mm; path = ../../src/SFML/Window/Cocoa/WindowImplCocoa.mm; sourceTree = SOURCE_ROOT; };
A093E3750D8BF86E002236B4 /* SFML.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SFML.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3770D8BF86E002236B4 /* SFML-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SFML-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E37F0D8BF87A002236B4 /* sfml-system.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-system.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-system-d.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3800D8BF87A002236B4 /* sfml-system-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-system-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E3880D8BF885002236B4 /* sfml-network.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-network.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3880D8BF885002236B4 /* sfml-network-d.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-network-d.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3890D8BF885002236B4 /* sfml-network-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-network-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E3920D8BF892002236B4 /* sfml-window-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-window-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E39A0D8BF89B002236B4 /* sfml-audio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-audio.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E39A0D8BF89B002236B4 /* sfml-audio-d.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-audio-d.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E39B0D8BF89B002236B4 /* sfml-audio-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-audio-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-graphics.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3A30D8BF8A2002236B4 /* sfml-graphics-d.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-graphics-d.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A093E3A40D8BF8A2002236B4 /* sfml-graphics-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "sfml-graphics-Info.plist"; sourceTree = SOURCE_ROOT; };
A093E3CF0D8BF918002236B4 /* dummy.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = dummy.cpp; sourceTree = SOURCE_ROOT; };
A09EEBED0D8C19BF00F6C625 /* Platform.hpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Platform.hpp; path = ../../src/SFML/System/Platform.hpp; sourceTree = SOURCE_ROOT; };
@ -431,7 +445,11 @@
A09EEBF40D8C19BF00F6C625 /* Clock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Clock.cpp; path = ../../src/SFML/System/Clock.cpp; sourceTree = SOURCE_ROOT; };
A09EEBF50D8C19BF00F6C625 /* Lock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Lock.cpp; path = ../../src/SFML/System/Lock.cpp; sourceTree = SOURCE_ROOT; };
A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Sleep.cpp; path = ../../src/SFML/System/Sleep.cpp; sourceTree = SOURCE_ROOT; };
A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-window.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A0B617720F66936F005E0970 /* sndfile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = sndfile.framework; path = "../../extlibs/libs-xcode/sndfile.framework"; sourceTree = SOURCE_ROOT; };
A0C93EB40D9A9CA000B9E0C8 /* sfml-window-d.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = "sfml-window-d.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
A0CE9FE50F46F72500FD00CE /* GLKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLKit.h; sourceTree = "<group>"; };
A0CE9FE60F46F72500FD00CE /* GLKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GLKit.mm; sourceTree = "<group>"; };
A0EEDE980F59D49C0023A7F7 /* Initializer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Initializer.cpp; path = ../../src/SFML/System/Initializer.cpp; sourceTree = SOURCE_ROOT; };
A0F1E6800E75440800778F12 /* IPAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = IPAddress.cpp; path = ../../src/SFML/Network/IPAddress.cpp; sourceTree = SOURCE_ROOT; };
A0F1E6820E75440800778F12 /* Packet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Packet.cpp; path = ../../src/SFML/Network/Packet.cpp; sourceTree = SOURCE_ROOT; };
A0F1E6830E75440800778F12 /* SelectorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SelectorBase.cpp; path = ../../src/SFML/Network/SelectorBase.cpp; sourceTree = SOURCE_ROOT; };
@ -600,7 +618,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A093E5480D8BFEAE002236B4 /* sfml-system.framework in Frameworks */,
A093E5480D8BFEAE002236B4 /* sfml-system-d.framework in Frameworks */,
A0B617730F66936F005E0970 /* sndfile.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -608,8 +627,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A0BE1A200D917332007D4CAD /* sfml-system.framework in Frameworks */,
A05EEF700E5CF18F00572B7E /* sfml-window.framework in Frameworks */,
A0BE1A200D917332007D4CAD /* sfml-system-d.framework in Frameworks */,
A05EEF700E5CF18F00572B7E /* sfml-window-d.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -617,7 +636,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A0C93F930D9AA9FA00B9E0C8 /* sfml-system.framework in Frameworks */,
A0C93F930D9AA9FA00B9E0C8 /* sfml-system-d.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -820,10 +839,10 @@
A04C59A70EDDBA9C00935061 /* Joystick.cpp */,
A04C59AA0EDDBA9C00935061 /* VideoModeSupport.hpp */,
A04C59A90EDDBA9C00935061 /* VideoModeSupport.cpp */,
A04C59AB0EDDBA9C00935061 /* WindowController.h */,
A04C59AC0EDDBA9C00935061 /* WindowController.mm */,
A04C59AD0EDDBA9C00935061 /* WindowImplCocoa.hpp */,
A04C59AE0EDDBA9C00935061 /* WindowImplCocoa.mm */,
A0CE9FE50F46F72500FD00CE /* GLKit.h */,
A0CE9FE60F46F72500FD00CE /* GLKit.mm */,
);
name = Cocoa;
path = ../../src/SFML/Window/Cocoa;
@ -846,11 +865,11 @@
isa = PBXGroup;
children = (
A093E3750D8BF86E002236B4 /* SFML.framework */,
A093E37F0D8BF87A002236B4 /* sfml-system.framework */,
A093E3880D8BF885002236B4 /* sfml-network.framework */,
A093E39A0D8BF89B002236B4 /* sfml-audio.framework */,
A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */,
A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */,
A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */,
A093E3880D8BF885002236B4 /* sfml-network-d.framework */,
A093E39A0D8BF89B002236B4 /* sfml-audio-d.framework */,
A093E3A30D8BF8A2002236B4 /* sfml-graphics-d.framework */,
A0C93EB40D9A9CA000B9E0C8 /* sfml-window-d.framework */,
);
name = Products;
sourceTree = "<group>";
@ -895,6 +914,7 @@
A093E3B90D8BF8C2002236B4 /* sfml-audio */ = {
isa = PBXGroup;
children = (
A0B617720F66936F005E0970 /* sndfile.framework */,
A01A3AD70E75181300D0BA9B /* Sources */,
A093E39B0D8BF89B002236B4 /* sfml-audio-Info.plist */,
);
@ -920,6 +940,7 @@
A09EEBF40D8C19BF00F6C625 /* Clock.cpp */,
A09EEBF50D8C19BF00F6C625 /* Lock.cpp */,
A09EEBF60D8C19BF00F6C625 /* Sleep.cpp */,
A0EEDE980F59D49C0023A7F7 /* Initializer.cpp */,
);
name = Sources;
sourceTree = SOURCE_ROOT;
@ -1247,8 +1268,8 @@
A04C59AF0EDDBA9C00935061 /* AppController.h in Headers */,
A04C59B20EDDBA9C00935061 /* Joystick.hpp in Headers */,
A04C59B40EDDBA9C00935061 /* VideoModeSupport.hpp in Headers */,
A04C59B50EDDBA9C00935061 /* WindowController.h in Headers */,
A04C59B70EDDBA9C00935061 /* WindowImplCocoa.hpp in Headers */,
A0CE9FE70F46F72500FD00CE /* GLKit.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1290,7 +1311,7 @@
);
name = "sfml-system";
productName = "sfml-system";
productReference = A093E37F0D8BF87A002236B4 /* sfml-system.framework */;
productReference = A093E37F0D8BF87A002236B4 /* sfml-system-d.framework */;
productType = "com.apple.product-type.framework";
};
A093E3870D8BF885002236B4 /* sfml-network */ = {
@ -1309,7 +1330,7 @@
);
name = "sfml-network";
productName = "sfml-network";
productReference = A093E3880D8BF885002236B4 /* sfml-network.framework */;
productReference = A093E3880D8BF885002236B4 /* sfml-network-d.framework */;
productType = "com.apple.product-type.framework";
};
A093E3990D8BF89B002236B4 /* sfml-audio */ = {
@ -1320,6 +1341,7 @@
A093E3960D8BF89B002236B4 /* Resources */,
A093E3970D8BF89B002236B4 /* Sources */,
A093E3980D8BF89B002236B4 /* Frameworks */,
A0B617500F66926C005E0970 /* CopyFiles */,
);
buildRules = (
);
@ -1328,7 +1350,7 @@
);
name = "sfml-audio";
productName = "sfml-audio";
productReference = A093E39A0D8BF89B002236B4 /* sfml-audio.framework */;
productReference = A093E39A0D8BF89B002236B4 /* sfml-audio-d.framework */;
productType = "com.apple.product-type.framework";
};
A093E3A20D8BF8A2002236B4 /* sfml-graphics */ = {
@ -1348,7 +1370,7 @@
);
name = "sfml-graphics";
productName = "sfml-graphics";
productReference = A093E3A30D8BF8A2002236B4 /* sfml-graphics.framework */;
productReference = A093E3A30D8BF8A2002236B4 /* sfml-graphics-d.framework */;
productType = "com.apple.product-type.framework";
};
A0C93EB30D9A9CA000B9E0C8 /* sfml-window */ = {
@ -1367,7 +1389,7 @@
);
name = "sfml-window";
productName = "sfml-window";
productReference = A0C93EB40D9A9CA000B9E0C8 /* sfml-window.framework */;
productReference = A0C93EB40D9A9CA000B9E0C8 /* sfml-window-d.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
@ -1476,6 +1498,7 @@
A09EEBFE0D8C19BF00F6C625 /* Lock.cpp in Sources */,
A09EEBFF0D8C19BF00F6C625 /* Sleep.cpp in Sources */,
A01C69C90E3E63CE00ED3F04 /* Unicode.cpp in Sources */,
A0EEDE990F59D49C0023A7F7 /* Initializer.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1625,8 +1648,8 @@
A04C59B00EDDBA9C00935061 /* AppController.mm in Sources */,
A04C59B10EDDBA9C00935061 /* Joystick.cpp in Sources */,
A04C59B30EDDBA9C00935061 /* VideoModeSupport.cpp in Sources */,
A04C59B60EDDBA9C00935061 /* WindowController.mm in Sources */,
A04C59B80EDDBA9C00935061 /* WindowImplCocoa.mm in Sources */,
A0CE9FE80F46F72500FD00CE /* GLKit.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1715,7 +1738,7 @@
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
STRIP_INSTALLED_PRODUCT = NO;
SYMROOT = ../../lib/xcode;
SYMROOT = ../../lib;
};
name = Debug;
};
@ -1742,7 +1765,7 @@
);
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;
SYMROOT = ../../lib/xcode;
SYMROOT = ../../lib;
};
name = Release;
};
@ -1800,6 +1823,7 @@
OTHER_REZFLAGS = "";
PRODUCT_NAME = SFML;
SECTORDER_FLAGS = "";
SYMROOT = ../../lib;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
@ -1828,6 +1852,7 @@
OTHER_REZFLAGS = "";
PRODUCT_NAME = SFML;
SECTORDER_FLAGS = "";
SYMROOT = ../../lib;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
@ -1842,6 +1867,11 @@
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/libs-xcode\"";
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
@ -1854,7 +1884,6 @@
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a",
"-framework",
OpenAL,
);
@ -1875,6 +1904,11 @@
COPY_PHASE_STRIP = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/libs-xcode\"";
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
@ -1886,7 +1920,6 @@
INFOPLIST_FILE = "sfml-audio-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_LDFLAGS = (
"$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a",
"-framework",
OpenAL,
);
@ -2041,7 +2074,10 @@
INFOPLIST_FILE = "sfml-system-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_LDFLAGS = (
"-framework",
CoreFoundation,
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = "sfml-system-d";
SECTORDER_FLAGS = "";
@ -2069,7 +2105,10 @@
INFOPLIST_FILE = "sfml-system-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_LDFLAGS = (
"-framework",
CoreFoundation,
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = "sfml-system";
SECTORDER_FLAGS = "";
@ -2157,21 +2196,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
CONFIGURATION_BUILD_DIR = ../../lib;
COPY_PHASE_STRIP = NO;
GCC_DEBUGGING_SYMBOLS = full;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "";
OTHER_CFLAGS = "-g3";
SDKROOT = "";
STRIP_INSTALLED_PRODUCT = NO;
SYMROOT = build;
SYMROOT = ../../lib;
};
name = Development;
};
@ -2226,6 +2273,11 @@
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/../../extlibs/libs-xcode\"";
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
@ -2238,7 +2290,6 @@
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"$(SRCROOT)/../../extlibs/libs-xcode/libsndfile.a",
"-framework",
OpenAL,
);
@ -2324,6 +2375,7 @@
FRAMEWORK_VERSION = A;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
GCC_VERSION = 4.2;
HEADER_SEARCH_PATHS = (
"${SRCROOT}/../../src",
"${SRCROOT}/../../include",
@ -2331,7 +2383,10 @@
INFOPLIST_FILE = "sfml-system-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_LDFLAGS = (
"-framework",
CoreFoundation,
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = "sfml-system-d";
SECTORDER_FLAGS = "";
@ -2385,9 +2440,9 @@
A02679DD0E5CDB03008D4C81 /* Build configuration list for PBXProject "SFML" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDC80E8BE5D10084CFD8 /* Development */,
A02679C20E5CDB03008D4C81 /* Debug */,
A02679C30E5CDB03008D4C81 /* Release */,
A0C9DDC80E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2395,9 +2450,9 @@
A02679DE0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "SFML" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCA0E8BE5D10084CFD8 /* Development */,
A02679C80E5CDB03008D4C81 /* Debug */,
A02679C90E5CDB03008D4C81 /* Release */,
A0C9DDCA0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2405,9 +2460,9 @@
A02679DF0E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-system" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCE0E8BE5D10084CFD8 /* Development */,
A02679D40E5CDB03008D4C81 /* Debug */,
A02679D50E5CDB03008D4C81 /* Release */,
A0C9DDCE0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2415,9 +2470,9 @@
A02679E00E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-network" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCD0E8BE5D10084CFD8 /* Development */,
A02679D10E5CDB03008D4C81 /* Debug */,
A02679D20E5CDB03008D4C81 /* Release */,
A0C9DDCD0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2425,9 +2480,9 @@
A02679E10E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-audio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCB0E8BE5D10084CFD8 /* Development */,
A02679CB0E5CDB03008D4C81 /* Debug */,
A02679CC0E5CDB03008D4C81 /* Release */,
A0C9DDCB0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2435,9 +2490,9 @@
A02679E20E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-window" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCF0E8BE5D10084CFD8 /* Development */,
A02679D70E5CDB03008D4C81 /* Debug */,
A02679D80E5CDB03008D4C81 /* Release */,
A0C9DDCF0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2445,9 +2500,9 @@
A02679E30E5CDB03008D4C81 /* Build configuration list for PBXNativeTarget "sfml-graphics" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDCC0E8BE5D10084CFD8 /* Development */,
A02679CE0E5CDB03008D4C81 /* Debug */,
A02679CF0E5CDB03008D4C81 /* Release */,
A0C9DDCC0E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
@ -2455,9 +2510,9 @@
A02679E40E5CDB03008D4C81 /* Build configuration list for PBXAggregateTarget "All" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A0C9DDC90E8BE5D10084CFD8 /* Development */,
A02679C50E5CDB03008D4C81 /* Debug */,
A02679C60E5CDB03008D4C81 /* Release */,
A0C9DDC90E8BE5D10084CFD8 /* Development */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;

View File

@ -20,7 +20,7 @@ namespace SFML
/// Global volume of all sounds, in range [0 .. 100] (default is 100)
/// </summary>
////////////////////////////////////////////////////////////
static float GlobalVolume
public static float GlobalVolume
{
get {return sfListener_GetGlobalVolume();}
set {sfListener_SetGlobalVolume(value);}
@ -31,7 +31,7 @@ namespace SFML
/// 3D position of the listener (default is (0, 0, 0))
/// </summary>
////////////////////////////////////////////////////////////
static Vector3 Position
public static Vector3 Position
{
get {Vector3 v; sfListener_GetPosition(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetPosition(value.X, value.Y, value.Z);}
@ -43,7 +43,7 @@ namespace SFML
/// (default is (0, 0, -1))
/// </summary>
////////////////////////////////////////////////////////////
static Vector3 Target
public static Vector3 Target
{
get {Vector3 v; sfListener_GetTarget(out v.X, out v.Y, out v.Z); return v;}
set {sfListener_SetTarget(value.X, value.Y, value.Z);}

View File

@ -165,6 +165,19 @@ namespace SFML
set {sfMusic_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the music's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfMusic_IsRelativeToListener(This);}
set {sfMusic_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the music. Closer than this distance,
@ -213,70 +226,76 @@ namespace SFML
}
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfMusic_CreateFromFile(string Filename);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
unsafe static extern IntPtr sfMusic_CreateFromMemory(char* Data, uint SizeInBytes);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Destroy(IntPtr MusicStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Play(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Pause(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_Stop(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern SoundStatus sfMusic_GetStatus(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetDuration(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfMusic_GetChannelsCount(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfMusic_GetSampleRate(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetPitch(IntPtr Music, float Pitch);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetLoop(IntPtr Music, bool Loop);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetVolume(IntPtr Music, float Volume);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetPosition(IntPtr Music, float X, float Y, float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetRelativeToListener(IntPtr Music, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetMinDistance(IntPtr Music, float MinDistance);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_SetAttenuation(IntPtr Music, float Attenuation);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfMusic_GetLoop(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetPitch(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetVolume(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfMusic_GetPosition(IntPtr Music, out float X, out float Y, out float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfMusic_IsRelativeToListener(IntPtr Music);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetMinDistance(IntPtr Music);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfMusic_GetAttenuation(IntPtr Music);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]

View File

@ -159,6 +159,19 @@ namespace SFML
set {sfSound_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the sound's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfSound_IsRelativeToListener(This);}
set {sfSound_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the sound. Closer than this distance,
@ -238,6 +251,9 @@ namespace SFML
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetPosition(IntPtr Sound, float X, float Y, float Z);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetRelativeToListener(IntPtr Sound, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_SetMinDistance(IntPtr Sound, float MinDistance);
@ -256,6 +272,9 @@ namespace SFML
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSound_GetPosition(IntPtr Sound, out float X, out float Y, out float Z);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSound_IsRelativeToListener(IntPtr Sound);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSound_GetMinDistance(IntPtr Sound);

View File

@ -157,22 +157,22 @@ namespace SFML
private StopCallback myStopCallback;
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfSoundRecorder_Create(StartCallback OnStart, ProcessCallback OnProcess, StopCallback OnStop, IntPtr UserData);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Destroy(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Start(IntPtr SoundRecorder, uint SampleRate);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundRecorder_Stop(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundRecorder_GetSampleRate(IntPtr SoundRecorder);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundRecorder_CanCapture();
#endregion
}

View File

@ -130,6 +130,19 @@ namespace SFML
set {sfSoundStream_SetPosition(This, value.X, value.Y, value.Z);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Is the sound stream's position relative to the listener's position,
/// or is it absolute?
/// Default value is false (absolute)
/// </summary>
////////////////////////////////////////////////////////////
public bool RelativeToListener
{
get {return sfSoundStream_IsRelativeToListener(This);}
set {sfSoundStream_SetRelativeToListener(This, value);}
}
////////////////////////////////////////////////////////////
/// <summary>
/// Minimum distance of the sound stream. Closer than this distance,
@ -275,64 +288,70 @@ namespace SFML
private short[] myTempBuffer;
#region Imports
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern IntPtr sfSoundStream_Create(StartCallbackType OnStart, GetDataCallbackType OnGetData, uint ChannelsCount, uint SampleRate, IntPtr UserData);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Destroy(IntPtr SoundStreamStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Play(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Pause(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_Stop(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern SoundStatus sfSoundStream_GetStatus(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundStream_GetChannelsCount(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern uint sfSoundStream_GetSampleRate(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetLoop(IntPtr SoundStream, bool Loop);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetPitch(IntPtr SoundStream, float Pitch);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetVolume(IntPtr SoundStream, float Volume);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetPosition(IntPtr SoundStream, float X, float Y, float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetRelativeToListener(IntPtr SoundStream, bool Relative);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetMinDistance(IntPtr SoundStream, float MinDistance);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_SetAttenuation(IntPtr SoundStream, float Attenuation);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundStream_GetLoop(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetPitch(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetVolume(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern void sfSoundStream_GetPosition(IntPtr SoundStream, out float X, out float Y, out float Z);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern bool sfSoundStream_IsRelativeToListener(IntPtr SoundStream);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetMinDistance(IntPtr SoundStream);
[DllImport("csfml-audio")]
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
static extern float sfSoundStream_GetAttenuation(IntPtr SoundStream);
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]

View File

@ -519,7 +519,7 @@ namespace SFML
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
static extern void sfRenderWindow_EnableKeyRepeat(IntPtr This, bool Enable);
[DllImport("csfml-graphics")]
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
unsafe static extern void sfRenderWindow_SetIcon(IntPtr This, uint Width, uint Height, byte* Pixels);
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]

Binary file not shown.

View File

@ -0,0 +1 @@
Versions/Current/Resources

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>sndfile</string>
<key>CFBundleIdentifier</key>
<string>com.mega-nerd.sndfile</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>

Binary file not shown.

View File

@ -0,0 +1 @@
A

View File

@ -0,0 +1 @@
Versions/Current/sndfile

View File

@ -159,6 +159,16 @@ public :
////////////////////////////////////////////////////////////
void SetPosition(const Vector3f& Position);
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
///
/// \param Relative : True to set the position relative, false to set it absolute
///
////////////////////////////////////////////////////////////
void SetRelativeToListener(bool Relative);
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -227,6 +237,15 @@ public :
////////////////////////////////////////////////////////////
Vector3f GetPosition() const;
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
///
/// \return True if the position is relative, false if it's absolute
///
////////////////////////////////////////////////////////////
bool IsRelativeToListener() const;
////////////////////////////////////////////////////////////
/// Get the minimum distance
///

View File

@ -53,11 +53,13 @@ public :
using Sound::SetPitch;
using Sound::SetVolume;
using Sound::SetPosition;
using Sound::SetRelativeToListener;
using Sound::SetMinDistance;
using Sound::SetAttenuation;
using Sound::GetPitch;
using Sound::GetVolume;
using Sound::GetPosition;
using Sound::IsRelativeToListener;
using Sound::GetMinDistance;
using Sound::GetAttenuation;

View File

@ -1 +1,2 @@
__all__ = ['sf']

View File

@ -24,7 +24,7 @@ class MyCustomStream(sf.SoundStream):
# Check if there is enough data to stream
if self.myOffset > len(self.myBuffer):
# Returning something else than a string means that we want to stop playing the stream
return False
return ""
# Data contains the string of samples we will return
if self.myOffset + self.myBufferSize >= len(self.myBuffer):
print "End of audio data reached"

View File

@ -24,7 +24,7 @@ class MyCustomStream(sf.SoundStream):
# Check if there is enough data to stream
if self.myOffset > len(self.myBuffer):
# Returning something else than a string means that we want to stop playing the stream
return False
return ""
# Data contains the string of samples we will return
if self.myOffset + self.myBufferSize >= len(self.myBuffer):
print("End of audio data reached")

View File

@ -234,14 +234,9 @@ class Main:
while self.win.GetEvent(event): # Event Handler
if event.Type == sf.Event.Closed:
self.win.Close()
elif event.Type == sf.Event.KeyPressed:
for key in self.keys:
if event.Key.Code == key:
self.keys[key](True)
elif event.Type == sf.Event.KeyReleased:
for key in self.keys:
if event.Key.Code == key:
self.keys[key](False)
elif event.Type == sf.Event.KeyPressed or event.Type == sf.Event.KeyReleased:
if event.Key.Code in self.keys:
self.keys[event.Key.Code](event.Type == sf.Event.KeyPressed)
self.win.Display()
self.win.Clear(background_color)
self.next_frame(self.win)

View File

@ -41,21 +41,12 @@ PySfClock_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self = (PySfClock *)type->tp_alloc(type, 0);
if (self != NULL)
{
}
self->obj = new sf::Clock();
return (PyObject *)self;
}
static int
PySfClock_init(PySfClock *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::Clock();
return 0;
}
static PyObject*
PySfClock_GetElapsedTime(PySfClock *self)
{
@ -111,7 +102,7 @@ PyTypeObject PySfClockType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfClock_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfClock_new, /* tp_new */
};

View File

@ -57,52 +57,28 @@ static PyObject *
PySfColor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfColor *self;
self = (PySfColor *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->r = 0;
self->g = 0;
self->b = 0;
self->a = 255;
self->obj = new sf::Color(0, 0, 0, 255);
}
return (PyObject *)self;
}
static int
PySfColor_init(PySfColor *self, PyObject *args, PyObject *kwds)
static int
PySfColor_init(PySfColor *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"r", "g", "b", "a", NULL};
long int rgba=0;
if (PyTuple_Size(args) == 1)
{
if ( !PyArg_ParseTuple(args, "l", &rgba))
return -1;
self->r = rgba & 0xff;
self->g = rgba>>8 & 0xff;
self->b = rgba>>16 & 0xff;
self->a = rgba>>24 & 0xff;
}
else if (PyTuple_Size(args) > 1)
if (! PyArg_ParseTupleAndKeywords(args, kwds, "BBB|B", (char **)kwlist, &(self->r), &(self->g), &(self->b), &(self->a)))
return -1;
self->obj = new sf::Color(self->r, self->g, self->b, self->a);
if (!PyArg_ParseTupleAndKeywords(args, kwds, "BBB|B:Color.__init__", (char **)kwlist, &(self->r), &(self->g), &(self->b), &(self->a)))
return -1;
PySfColorUpdate(self);
return 0;
}
static PyMethodDef PySfColor_methods[] = {
{NULL} /* Sentinel */
};
PyTypeObject PySfColorType = {
head_init
"Color", /*tp_name*/
@ -131,7 +107,7 @@ PyTypeObject PySfColorType = {
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PySfColor_methods, /* tp_methods */
0, /* tp_methods */
PySfColor_members, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
@ -147,7 +123,7 @@ PyTypeObject PySfColorType = {
PySfColor *
GetNewPySfColor()
{
return (PySfColor *)PySfColor_new(&PySfColorType, NULL, NULL);
return PyObject_New(PySfColor, &PySfColorType);
}
void
@ -218,16 +194,5 @@ PySfColor_InitConst()
Cyan->a = sf::Color::Cyan.a;
PyDict_SetItemString(PySfColorType.tp_dict, "Cyan", (PyObject *)Cyan);
Py_DECREF(Cyan);
/*
static const Color Black; ///< Black predefined color
static const Color White; ///< White predefined color
static const Color Red; ///< Red predefined color
static const Color Green; ///< Green predefined color
static const Color Blue; ///< Blue predefined color
static const Color Yellow; ///< Yellow predefined color
static const Color Magenta; ///< Magenta predefined color
static const Color Cyan; ///< Cyan predefined color
*/
}

View File

@ -36,7 +36,10 @@ void CustomDrawable::Render(sf::RenderTarget& Target) const
if (RenderFunction)
PyObject_CallFunction(RenderFunction, (char *)"O", RenderWindow);
else
{
PyErr_SetString(PyExc_RuntimeError, "Custom drawables must have a render method defined");
PyErr_Print();
}
}
static void
@ -51,17 +54,18 @@ PySfDrawable_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfDrawable *self;
self = (PySfDrawable *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->IsCustom = true;
self->obj = new CustomDrawable();
if (PyObject_HasAttrString((PyObject *)self, "Render"))
self->obj->RenderFunction = PyObject_GetAttrString((PyObject *)self, "Render");
else
self->obj->RenderFunction = NULL;
self->obj->RenderWindow = NULL;
}
return (PyObject *)self;
}
static int
PySfDrawable_init(PySfDrawable *self, PyObject *args, PyObject *kwds)
{
self->obj = new CustomDrawable();
self->obj->RenderFunction = NULL;
self->obj->RenderWindow = NULL;
return 0;
}
static PyObject *
PySfDrawable_SetX(PySfDrawable* self, PyObject *args)
@ -123,7 +127,7 @@ static PyObject *
PySfDrawable_SetColor(PySfDrawable* self, PyObject *args)
{
PySfColor *Color = (PySfColor *)args;
if (! PyObject_TypeCheck(args, &PySfColorType))
if (!PyObject_TypeCheck(args, &PySfColorType))
{
PyErr_SetString(PyExc_TypeError, "Drawable.SetColor() Argument is not a sf.Color");
return NULL;
@ -226,6 +230,27 @@ PySfDrawable_TransformToGlobal(PySfDrawable* self, PyObject *args)
return Py_BuildValue("ff", result.x, result.y);
}
int PySfDrawable_SetAttr(PyObject* self, PyObject *attr_name, PyObject *v)
{
#ifdef IS_PY3K
PyObject *string = PyUnicode_AsUTF8String(attr_name);
if (string == NULL) return NULL;
std::string Name(PyBytes_AsString(string));
#else
std::string Name(PyString_AsString(attr_name));
#endif
if (Name == "Render")
{
Py_CLEAR(((PySfDrawable*)self)->obj->RenderFunction);
Py_INCREF(v);
((PySfDrawable*)self)->obj->RenderFunction = v;
}
#ifdef IS_PY3K
Py_DECREF(string);
#endif
return PyObject_GenericSetAttr(self, attr_name, v);
}
static PyMethodDef PySfDrawable_methods[] = {
{"TransformToLocal", (PyCFunction)PySfDrawable_TransformToLocal, METH_VARARGS, "TransformToLocal(X, Y)\n\
Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point). Returns a tuple.\n\
@ -274,7 +299,7 @@ PyTypeObject PySfDrawableType = {
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
PySfDrawable_SetAttr, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"Abstract base class for every object that can be drawn into a render window.", /* tp_doc */
@ -292,15 +317,9 @@ PyTypeObject PySfDrawableType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfDrawable_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfDrawable_new, /* tp_new */
};
PySfDrawable *
GetNewPySfDrawable()
{
return (PySfDrawable *)PySfDrawable_new(&PySfDrawableType, NULL, NULL);
}

View File

@ -44,11 +44,9 @@ public :
typedef struct {
PyObject_HEAD
bool IsCustom;
CustomDrawable *obj;
} PySfDrawable;
PySfDrawable *
GetNewPySfDrawable();
#endif

View File

@ -51,12 +51,6 @@ PySfEventText_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventText_init(PySfEventText *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventText_dealloc(PySfEventText* self)
{
@ -99,7 +93,7 @@ PyTypeObject PySfEventTextType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventText_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventText_new, /* tp_new */
};
@ -129,12 +123,6 @@ PySfEventKey_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventKey_init(PySfEventKey *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventKey_dealloc(PySfEventKey* self)
{
@ -185,7 +173,7 @@ PyTypeObject PySfEventKeyType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventKey_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventKey_new, /* tp_new */
};
@ -210,12 +198,6 @@ PySfEventMouseMove_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventMouseMove_init(PySfEventMouseMove *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventMouseMove_dealloc(PySfEventMouseMove *self)
{
@ -265,7 +247,7 @@ PyTypeObject PySfEventMouseMoveType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventMouseMove_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventMouseMove_new, /* tp_new */
};
@ -291,12 +273,6 @@ PySfEventMouseButton_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventMouseButton_init(PySfEventMouseButton *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventMouseButton_dealloc(PySfEventMouseButton* self)
{
@ -347,7 +323,7 @@ PyTypeObject PySfEventMouseButtonType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventMouseButton_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventMouseButton_new, /* tp_new */
};
@ -371,12 +347,6 @@ PySfEventMouseWheel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventMouseWheel_init(PySfEventMouseWheel *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventMouseWheel_dealloc(PySfEventMouseWheel* self)
{
@ -424,7 +394,7 @@ PyTypeObject PySfEventMouseWheelType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventMouseWheel_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventMouseWheel_new, /* tp_new */
};
@ -450,12 +420,6 @@ PySfEventJoyMove_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventJoyMove_init(PySfEventJoyMove *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventJoyMove_dealloc(PySfEventJoyMove* self)
{
@ -506,7 +470,7 @@ PyTypeObject PySfEventJoyMoveType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventJoyMove_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventJoyMove_new, /* tp_new */
};
@ -531,12 +495,6 @@ PySfEventJoyButton_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventJoyButton_init(PySfEventJoyButton *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventJoyButton_dealloc(PySfEventJoyButton* self)
{
@ -586,7 +544,7 @@ PyTypeObject PySfEventJoyButtonType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventJoyButton_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventJoyButton_new, /* tp_new */
};
@ -611,12 +569,6 @@ PySfEventSize_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return (PyObject *)self;
}
int
PySfEventSize_init(PySfEventSize *self, PyObject *args, PyObject *kwds)
{
return 0;
}
void
PySfEventSize_dealloc(PySfEventSize* self)
{
@ -665,7 +617,7 @@ PyTypeObject PySfEventSizeType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEventSize_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEventSize_new, /* tp_new */
};
@ -680,13 +632,6 @@ PyTypeObject PySfEventSizeType = {
////////////////////////////////////
static int
PySfEvent_init(PySfEvent *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::Event();
return 0;
}
static PyObject *
PySfEvent_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
@ -703,6 +648,7 @@ PySfEvent_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->JoyMove = (PySfEventJoyMove *)PySfEventJoyMove_new(&PySfEventJoyMoveType, NULL, NULL);
self->JoyButton = (PySfEventJoyButton *)PySfEventJoyButton_new(&PySfEventJoyButtonType, NULL, NULL);
self->Size = (PySfEventSize *)PySfEventSize_new(&PySfEventSizeType, NULL, NULL);
self->obj = new sf::Event();
}
return (PyObject *)self;
@ -736,10 +682,6 @@ static PyMemberDef PySfEvent_members[] = {
{NULL} /* Sentinel */
};
static PyMethodDef PySfEvent_methods[] = {
{NULL} /* Sentinel */
};
PyTypeObject PySfEventType = {
head_init
"Event", /*tp_name*/
@ -768,7 +710,7 @@ PyTypeObject PySfEventType = {
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PySfEvent_methods, /* tp_methods */
0, /* tp_methods */
PySfEvent_members, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
@ -776,7 +718,7 @@ PyTypeObject PySfEventType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfEvent_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfEvent_new, /* tp_new */
};

View File

@ -42,17 +42,13 @@ PySfFont_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PySfFont *self;
self = (PySfFont *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->Owner = true;
self->obj = new sf::Font();
}
return (PyObject *)self;
}
static int
PySfFont_init(PySfFont *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::Font();
return 0;
}
static PyObject *
PySfFont_LoadFromFile(PySfFont* self, PyObject *args, PyObject *kwds)
{
@ -63,7 +59,7 @@ PySfFont_LoadFromFile(PySfFont* self, PyObject *args, PyObject *kwds)
int Length;
bool result;
std::string Encoding;
if (PyArg_ParseTupleAndKeywords(args, kwds, "s|I:Font.LoadFromFile", (char **)kwlist, &Filename, &Charsize))
if (PyArg_ParseTuple(args, "s|I:Font.LoadFromFile", &Filename, &Charsize))
result = self->obj->LoadFromFile(Filename, Charsize);
else if (PyArg_ParseTupleAndKeywords(args, kwds, "s|Iu:Font.LoadFromFile", (char **)kwlist, &Filename, &Charsize, &Charset))
{
@ -113,7 +109,7 @@ PySfFont_LoadFromMemory(PySfFont* self, PyObject *args, PyObject *kwds)
int Length;
bool result;
std::string Encoding;
if (PyArg_ParseTupleAndKeywords(args, kwds, "s#|I:Font.LoadFromMemory", (char **)kwlist, &Data, &Size, &Charsize))
if (PyArg_ParseTuple(args, "s#|I:Font.LoadFromMemory", &Data, &Size, &Charsize))
result = self->obj->LoadFromMemory(Data, Size, Charsize);
else if (PyArg_ParseTupleAndKeywords(args, kwds, "s#|Iu:Font.LoadFromMemory", (char **)kwlist, &Data, &Size, &Charsize, &Charset))
{
@ -238,7 +234,7 @@ PyTypeObject PySfFontType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfFont_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfFont_new, /* tp_new */
};
@ -246,7 +242,7 @@ PyTypeObject PySfFontType = {
PySfFont *
GetNewPySfFont()
{
return (PySfFont *)PySfFont_new(&PySfFontType, NULL, NULL);
return PyObject_New(PySfFont, &PySfFontType);
}

View File

@ -91,21 +91,13 @@ PySfGlyph_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->Advance = 0;
self->Rectangle = GetNewPySfIntRect();
self->TexCoords = GetNewPySfFloatRect();
self->obj = new sf::Glyph();
self->Rectangle->obj = &(self->obj->Rectangle);
self->TexCoords->obj = &(self->obj->TexCoords);
}
return (PyObject *)self;
}
static int
PySfGlyph_init(PySfGlyph *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::Glyph();
self->Rectangle->obj = &(self->obj->Rectangle);
self->TexCoords->obj = &(self->obj->TexCoords);
return 0;
}
PyTypeObject PySfGlyphType = {
head_init
"Glyph", /*tp_name*/
@ -142,7 +134,7 @@ PyTypeObject PySfGlyphType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfGlyph_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfGlyph_new, /* tp_new */
};
@ -150,6 +142,6 @@ PyTypeObject PySfGlyphType = {
PySfGlyph *
GetNewPySfGlyph()
{
return (PySfGlyph *)PySfGlyph_new(&PySfGlyphType, NULL, NULL);
return PyObject_New(PySfGlyph, &PySfGlyphType);
}

View File

@ -41,13 +41,7 @@ PySfImage_dealloc(PySfImage* self)
}
static PyObject *
PySfImage_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfImage *self;
self = (PySfImage *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
PySfImage_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *
PySfImage_Create(PySfImage* self, PyObject *args, PyObject *kwds)
@ -57,7 +51,7 @@ PySfImage_Create(PySfImage* self, PyObject *args, PyObject *kwds)
unsigned int Width=0, Height=0;
const char *kwlist[] = {"Width", "Height", "Color", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|IIO!:Image.Create", (char **)kwlist, &Width, &Height, &PySfColorType, &ColorTmp))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|IIO!:Image.Create", (char **)kwlist, &Width, &Height, &PySfColorType, &ColorTmp))
return NULL;
if (ColorTmp)
@ -79,7 +73,7 @@ PySfImage_CopyScreen(PySfImage* self, PyObject *args)
PySfIntRect *SourceRect=NULL;
bool Result;
if (! PyArg_ParseTuple(args, "O!|O!:Image.CopyScreen", &PySfRenderWindowType, &RenderWindow, &PySfIntRectType, &SourceRect))
if (!PyArg_ParseTuple(args, "O!|O!:Image.CopyScreen", &PySfRenderWindowType, &RenderWindow, &PySfIntRectType, &SourceRect))
return NULL;
@ -164,7 +158,7 @@ PySfImage_LoadFromMemory(PySfImage* self, PyObject *args)
unsigned int SizeInBytes;
char *Data;
if (! PyArg_ParseTuple(args, "s#:Image.LoadFromMemory", &Data, &SizeInBytes))
if (!PyArg_ParseTuple(args, "s#:Image.LoadFromMemory", &Data, &SizeInBytes))
return NULL;
return PyBool_FromLong(self->obj->LoadFromMemory(Data, (std::size_t) SizeInBytes));
@ -205,9 +199,6 @@ PySfImage_SaveToFile (PySfImage *self, PyObject *args)
save_to_file(self, args);
}
static int
PySfImage_init(PySfImage *self, PyObject *args, PyObject *kwds);
static PyObject *
PySfImage_Bind(PySfImage *self)
{
@ -248,7 +239,7 @@ PySfImage_GetTexCoords(PySfImage* self, PyObject *args)
bool Adjust = false;
PyObject *AdjustObj = NULL;
if (! PyArg_ParseTuple(args, "O!|O", &PySfIntRectType, &RectArg, &AdjustObj))
if (!PyArg_ParseTuple(args, "O!|O:Image.GetTextCoords", &PySfIntRectType, &RectArg, &AdjustObj))
return NULL;
if (AdjustObj)
@ -258,7 +249,7 @@ PySfImage_GetTexCoords(PySfImage* self, PyObject *args)
PySfFloatRect *Rect;
Rect = GetNewPySfFloatRect();
Rect->obj = new sf::FloatRect ( self->obj->GetTexCoords(*(RectArg->obj), Adjust) );
Rect->obj = new sf::FloatRect(self->obj->GetTexCoords(*(RectArg->obj), Adjust));
Rect->Left = Rect->obj->Left;
Rect->Top = Rect->obj->Top;
Rect->Right = Rect->obj->Right;
@ -267,8 +258,26 @@ PySfImage_GetTexCoords(PySfImage* self, PyObject *args)
return (PyObject *)Rect;
}
static int
PySfImage_init(PySfImage *self, PyObject *args, PyObject *kwds)
{
int size = PyTuple_Size(args);
if (size > 0)
{
if (PySfImage_Create(self, args, kwds) == NULL)
{
if (size != 3)
return -1;
else if (PySfImage_LoadFromPixels(self, args) == NULL)
return -1;
else PyErr_Clear();
}
}
return 0;
}
static PyObject *
PySfImage_Copy(PySfImage* self, PyObject *args);
PySfImage_Copy(PySfImage* self, PyObject *args, PyObject *kwds);
static PyMethodDef PySfImage_methods[] = {
{"Copy", (PyCFunction)PySfImage_Copy, METH_VARARGS, "Copy(Source, DestX, DestY, SourceRect = sf.IntRect(0,0,0,0))\n\
@ -352,44 +361,38 @@ Copy constructor : sf.Image(Copy) where Copy is a sf.Image instance.", /* tp_doc
PySfImage_new, /* tp_new */
};
static int
PySfImage_init(PySfImage *self, PyObject *args, PyObject *kwds)
static PyObject *
PySfImage_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
int size = PyTuple_Size(args);
if (size == 1)
PySfImage *self;
self = (PySfImage *)type->tp_alloc(type, 0);
if (self != NULL)
{
PySfImage *Image;
if (PyArg_ParseTuple(args, "O!", &PySfImageType, &Image))
if (PyTuple_Size(args) == 1)
{
self->obj = new sf::Image(*(Image->obj));
return 0;
}
else PyErr_Clear();
}
self->obj = new sf::Image();
if (PyTuple_Size(args) > 0)
{
if (PySfImage_Create(self, args, kwds) == NULL)
{
if (size != 3)
return -1;
else if (PySfImage_LoadFromPixels(self, args) == NULL)
return -1;
PySfImage *Image;
if (PyArg_ParseTuple(args, "O!", &PySfImageType, &Image))
{
self->obj = new sf::Image(*(Image->obj));
}
else PyErr_Clear();
}
else self->obj = new sf::Image();
}
return 0;
return (PyObject *)self;
}
static PyObject *
PySfImage_Copy(PySfImage* self, PyObject *args)
PySfImage_Copy(PySfImage* self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Source", "DestX", "DestY", "SourceRect", "ApplyAlpha", NULL};
PySfIntRect *SourceRect = NULL;
PySfImage *Source = NULL;
unsigned int DestX, DestY;
PyObject *PyApplyAlpha;
bool ApplyAlpha = false;
if (! PyArg_ParseTuple(args, "O!II|O!O:Image.Copy", &PySfImageType, &Source, &DestX, &DestY, &PySfIntRectType, &SourceRect, &PyApplyAlpha))
PyObject *PyApplyAlpha = NULL;
bool ApplyAlpha = false;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!II|O!O:Image.Copy", (char **)kwlist, &PySfImageType, &Source, &DestX, &DestY, &PySfIntRectType, &SourceRect, &PyApplyAlpha))
return NULL;
if (PyApplyAlpha)
@ -410,6 +413,6 @@ PySfImage_Copy(PySfImage* self, PyObject *args)
PySfImage *
GetNewPySfImage()
{
return (PySfImage *)PySfImage_new(&PySfImageType, NULL, NULL);
return PyObject_New(PySfImage, &PySfImageType);
}

View File

@ -29,17 +29,9 @@
static PyObject *
PySfInput_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfInput *self;
self = (PySfInput *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static int
PySfInput_init(PySfInput *self, PyObject *args, PyObject *kwds)
{
PyErr_SetString(PyExc_RuntimeError, "You can't create an Input object yourself, because an Input object must always be associated to its window.\nThe only way to get an Input is by creating a window and calling : Input = MyWindow.GetInput().");
return -1;
return NULL;
}
static PyObject*
@ -129,7 +121,7 @@ PyTypeObject PySfInputType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfInput_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfInput_new, /* tp_new */
};
@ -137,6 +129,6 @@ PyTypeObject PySfInputType = {
PySfInput *
GetNewPySfInput()
{
return (PySfInput *)PySfInput_new(&PySfInputType, NULL, NULL);
return PyObject_New(PySfInput, &PySfInputType);
}

View File

@ -27,14 +27,6 @@
#include "compat.hpp"
static PyObject *
PySfListener_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfListener *self;
self = (PySfListener *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static PyObject *
PySfListener_SetGlobalVolume(PySfListener* self, PyObject *args)
{
@ -130,7 +122,7 @@ PyTypeObject PySfListenerType = {
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
PySfListener_new, /* tp_new */
0, /* tp_new */
};

View File

@ -40,37 +40,25 @@ PySfMusic_dealloc(PySfMusic *self)
static PyObject *
PySfMusic_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
unsigned int BufferSize=44100;
PySfMusic *self;
self = (PySfMusic *)type->tp_alloc(type, 0);
if (self != NULL)
{
if (!PyArg_ParseTuple(args, "|I:Music.__new__", &BufferSize))
return NULL;
self->obj = new sf::Music(BufferSize);
}
return (PyObject *)self;
}
static int
PySfMusic_init(PySfMusic *self, PyObject *args, PyObject *kwds)
{
unsigned int BufferSize=44100;
int size = PyTuple_Size(args);
if (size == 1)
{
if ( !PyArg_ParseTuple(args, "I:Music.Init", &BufferSize))
return -1;
}
else if (size > 1)
{
PyErr_SetString(PyExc_TypeError, "Music.__init__() takes at most one argument");
}
self->obj = new sf::Music(BufferSize);
return 0;
}
static PyObject*
PySfMusic_OpenFromMemory(PySfMusic *self, PyObject *args)
{
unsigned int SizeInBytes;
char *Data;
if (! PyArg_ParseTuple(args, "s#:Music.OpenFromMemory", &Data, &SizeInBytes))
if (!PyArg_ParseTuple(args, "s#:Music.OpenFromMemory", &Data, &SizeInBytes))
return NULL;
return PyBool_FromLong(self->obj->OpenFromMemory(Data, (std::size_t) SizeInBytes));
@ -148,7 +136,7 @@ BufferSize : Size of the internal buffer, expressed in number of samples (ie. si
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfMusic_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfMusic_new, /* tp_new */
};

View File

@ -41,12 +41,7 @@ PySfPostFX_dealloc(PySfPostFX *self)
}
static PyObject *
PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfPostFX *self;
self = (PySfPostFX *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *
PySfPostFX_LoadFromFile (PySfPostFX *self, PyObject *args)
@ -73,10 +68,6 @@ PySfPostFX_LoadFromMemory (PySfPostFX *self, PyObject *args)
return PyBool_FromLong(result);
}
static int
PySfPostFX_init(PySfPostFX *self, PyObject *args);
static PyObject * PySfPostFX_SetParameter(PySfPostFX* self, PyObject *args) { char *Name; float X, Y, Z, W; int size = PyTuple_Size(args); if (!PyArg_ParseTuple(args, "sf|fff:PostFX.SetParameter", &Name, &X, &Y, &Z, &W)) return NULL;
switch (size)
@ -179,24 +170,25 @@ Copy constructor : sf.PostFX(Copy) where Copy is a sf.PostFX instance.", /* tp_d
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfPostFX_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfPostFX_new, /* tp_new */
};
static int
PySfPostFX_init(PySfPostFX *self, PyObject *args)
{
if (PyTuple_Size(args) == 1)
{
PySfPostFX *Copy;
if (PyArg_ParseTuple(args, "O!", &PySfPostFXType, &Copy))
self->obj = new sf::PostFX(*(Copy->obj));
else
return -1;
}
else
self->obj = new sf::PostFX();
return 0;
}
static PyObject *
PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfPostFX *self;
self = (PySfPostFX *)type->tp_alloc(type, 0);
if (self != NULL)
{
PySfPostFX *Copy = NULL;
self->IsCustom = false;
if (!PyArg_ParseTuple(args, "|O!", &PySfPostFXType, &Copy))
return NULL;
if (Copy) self->obj = new sf::PostFX(*(Copy->obj));
else self->obj = new sf::PostFX();
}
return (PyObject *)self;
}

View File

@ -31,6 +31,7 @@
typedef struct {
PyObject_HEAD
bool IsCustom;
sf::PostFX *obj;
} PySfPostFX;

View File

@ -63,36 +63,33 @@ PySfFloatRect_dealloc(PySfFloatRect* self)
static PyObject *
PySfIntRect_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL};
PySfIntRect *self;
self = (PySfIntRect *)type->tp_alloc(type, 0);
if (self != NULL)
{
if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiii:IntRect.__init__", (char **)kwlist, &(self->Left), &(self->Top), &(self->Right), &(self->Bottom)))
return NULL;
self->obj = new sf::IntRect(self->Left, self->Top, self->Right, self->Bottom);
}
return (PyObject *)self;
}
static PyObject *
PySfFloatRect_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL};
PySfFloatRect *self;
self = (PySfFloatRect *)type->tp_alloc(type, 0);
if (self != NULL)
{
if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffff:FloatRect.__init__", (char **)kwlist, &(self->Left), &(self->Top), &(self->Right), &(self->Bottom)))
return NULL;
self->obj = new sf::FloatRect(self->Left, self->Top, self->Right, self->Bottom);
}
return (PyObject *)self;
}
static int
PySfIntRect_init(PySfIntRect *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL};
int Left, Top, Right, Bottom;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiii:IntRect.__init__", (char **)kwlist, &Left, &Top, &Right, &Bottom))
return -1;
self->Left = Left;
self->Top = Top;
self->Right = Right;
self->Bottom = Bottom;
self->obj = new sf::IntRect(Left, Top, Right, Bottom);
return 0;
}
static PyObject *
PySfIntRect_GetWidth(PySfIntRect *self)
{
@ -133,24 +130,6 @@ PySfFloatRect_Contains(PySfFloatRect* self, PyObject *args);
static PyObject *
PySfFloatRect_Intersects(PySfFloatRect* self, PyObject *args);
static int
PySfFloatRect_init(PySfFloatRect *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Left", "Top", "Right", "Bottom", NULL};
float Left, Top, Right, Bottom;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffff:FloatRect.__init__", (char **)kwlist, &Left, &Top, &Right, &Bottom))
return -1;
self->Left = Left;
self->Top = Top;
self->Right = Right;
self->Bottom = Bottom;
self->obj = new sf::FloatRect(Left, Top, Right, Bottom);
return 0;
}
static PyObject *
PySfIntRect_Offset(PySfIntRect* self, PyObject *args)
{
@ -259,7 +238,7 @@ PyTypeObject PySfIntRectType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfIntRect_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfIntRect_new, /* tp_new */
};
@ -301,7 +280,7 @@ PyTypeObject PySfFloatRectType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfFloatRect_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfFloatRect_new, /* tp_new */
};
@ -406,13 +385,13 @@ PySfFloatRectUpdateSelf(PySfFloatRect *self)
PySfIntRect *
GetNewPySfIntRect()
{
return (PySfIntRect *)PySfIntRect_new(&PySfIntRectType, NULL, NULL);
return PyObject_New(PySfIntRect, &PySfIntRectType);
}
PySfFloatRect *
GetNewPySfFloatRect()
{
return (PySfFloatRect *)PySfFloatRect_new(&PySfFloatRectType, NULL, NULL);
return PyObject_New(PySfFloatRect, &PySfFloatRectType);
}

View File

@ -52,19 +52,11 @@ static PyObject *
PySfRenderWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfRenderWindow *self;
self = (PySfRenderWindow *)type->tp_alloc(type, 0);
self = (PySfRenderWindow *)type->tp_alloc(type, 0);
if (self != NULL)
self->obj = new sf::RenderWindow();
return (PyObject *)self;
}
static int
PySfRenderWindow_init(PySfRenderWindow *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::RenderWindow();
if (PyTuple_Size(args) > 0)
if (PySfWindow_Create((PySfWindow *)self, args, kwds) == NULL)
return -1;
return 0;
}
}
static PyObject *
PySfRenderWindow_Capture(PySfRenderWindow *self)
@ -99,14 +91,13 @@ PySfRenderWindow_DrawObject(PySfRenderWindow *RenderWindow, PySfDrawable *Obj)
{
if (PyObject_TypeCheck((PyObject *)Obj, &PySfDrawableType))
{
if (PyObject_HasAttrString((PyObject *)Obj, "Render"))
if (Obj->IsCustom)
{
Py_XDECREF(Obj->obj->RenderWindow);
Py_CLEAR(Obj->obj->RenderWindow);
Py_INCREF(RenderWindow);
Obj->obj->RenderWindow = RenderWindow;
Py_XDECREF(Obj->obj->RenderFunction);
Obj->obj->RenderFunction = PyObject_GetAttrString((PyObject *)Obj, "Render");
}
RenderWindow->obj->Draw( *(Obj->obj) );
RenderWindow->obj->Draw(*(Obj->obj));
return true;
}
return false;
@ -147,23 +138,14 @@ PySfRenderWindow_Draw(PySfRenderWindow *self, PyObject *args)
static PyObject *
PySfRenderWindow_Clear(PySfRenderWindow *self, PyObject *args)
{
PySfColor *Color;
int size = PyTuple_Size(args);
if (size == 1)
{
if (!PyArg_ParseTuple(args, "O!:RenderWindow.Clear", &PySfColorType, &Color))
return NULL;
PySfColorUpdate(Color);
self->obj->Clear(*(Color->obj));
}
else if (size == 0)
{
self->obj->Clear(sf::Color::Black);
}
PySfColor *Color = NULL;
if (!PyArg_ParseTuple(args, "|O!:RenderWindow.Clear", &PySfColorType, &Color))
return NULL;
if (Color == NULL) self->obj->Clear(sf::Color::Black);
else
{
PyErr_SetString(PyExc_TypeError, "RenderWindow.Clear() takes one or zero argument");
return NULL;
PySfColorUpdate(Color);
self->obj->Clear(*(Color->obj));
}
Py_RETURN_NONE;
}
@ -282,7 +264,7 @@ Parameters:\n\
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfRenderWindow_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfRenderWindow_new, /* tp_new */
};

View File

@ -45,16 +45,14 @@ PySfShape_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfShape *self;
self = (PySfShape *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->obj = new sf::Shape();
self->IsCustom = false;
}
return (PyObject *)self;
}
static int
PySfShape_init(PySfShape *self, PyObject *args)
{
self->obj = new sf::Shape();
return 0;
}
// void AddPoint(float X, float Y, const Color& Col = Color(255, 255, 255), const Color& OutlineCol = Color(0, 0, 0));
static PyObject *
PySfShape_AddPoint(PySfShape* self, PyObject *args, PyObject *kwds)
@ -72,7 +70,7 @@ PySfShape_AddPoint(PySfShape* self, PyObject *args, PyObject *kwds)
Col = ColTmp->obj;
}
else
Col = (sf::Color *)&sf::Color::Black;
Col = (sf::Color *)&sf::Color::White;
if (OutlineColTmp)
{
@ -231,7 +229,7 @@ PySfShape_SetPointOutlineColor(PySfShape* self, PyObject *args)
{
unsigned int Index;
PySfColor *Color;
if (!PyArg_ParseTuple(args, "IO!:Shape:SetPointOutlineColor", &Index, &PySfColorType, &Color))
if (!PyArg_ParseTuple(args, "IO!:Shape.SetPointOutlineColor", &Index, &PySfColorType, &Color))
return NULL;
PySfColorUpdate(Color);
self->obj->SetPointOutlineColor(Index, *(Color->obj));
@ -365,7 +363,7 @@ PyTypeObject PySfShapeType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfShape_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfShape_new, /* tp_new */
};
@ -374,6 +372,8 @@ PyTypeObject PySfShapeType = {
PySfShape *
GetNewPySfShape()
{
return (PySfShape *)PySfShape_new(&PySfShapeType, NULL, NULL);
PySfShape *Shape = PyObject_New(PySfShape, &PySfShapeType);
Shape->IsCustom = false;
return Shape;
}

View File

@ -32,6 +32,7 @@
typedef struct {
PyObject_HEAD
bool IsCustom;
sf::Shape *obj;
} PySfShape;

View File

@ -39,23 +39,38 @@ PySfSound_dealloc(PySfSound *self)
}
static PyObject *
PySfSound_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSound *self;
self = (PySfSound *)type->tp_alloc(type, 0);
return (PyObject *)self;
PySfSound_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static int
PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Buffer", "Loop", "Pitch", "Volume", "X", "Y", "Z", NULL};
PySfSoundBuffer *Buffer=NULL;
PyObject *Loop=NULL;
float Pitch=1.f, Volume=100.f, X=0.f, Y=0.f, Z=0.f;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!Offfff:Sound.__new__", (char **)kwlist, &PySfSoundBufferType, &Buffer, &Loop, &Pitch, &Volume, &X, &Y, &Z))
return -1;
{
if (Loop)
self->obj->SetLoop(PyBool_AsBool(Loop));
if (Buffer)
self->obj->SetBuffer(*(Buffer->obj));
self->obj->SetPitch(Pitch);
self->obj->SetVolume(Volume);
self->obj->SetPosition(X, Y, Z);
}
return 0;
}
static int
PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds);
static PyObject*
PySfSound_SetBuffer(PySfSound *self, PyObject *args)
{
PySfSoundBuffer *Buffer = (PySfSoundBuffer *)args;
if (!PyObject_TypeCheck(args, &PySfSoundBufferType))
{
PyErr_SetString(PyExc_TypeError, "Sound.SetBuffer() The argument must be a sf.SoundBuffer.");
return NULL;
}
self->obj->SetBuffer(*(Buffer->obj));
Py_RETURN_NONE;
@ -68,6 +83,19 @@ PySfSound_SetLoop(PySfSound *self, PyObject *args)
Py_RETURN_NONE;
}
static PyObject*
PySfSound_SetRelativeToListener(PySfSound *self, PyObject *args)
{
self->obj->SetRelativeToListener(PyBool_AsBool(args));
Py_RETURN_NONE;
}
static PyObject*
PySfSound_IsRelativeToListener(PySfSound *self)
{
return PyBool_FromLong(self->obj->IsRelativeToListener());
}
static PyObject*
PySfSound_SetPitch(PySfSound *self, PyObject *args)
{
@ -195,6 +223,8 @@ PySfSound_SetPlayingOffset(PySfSound *self, PyObject *args)
}
static PyMethodDef PySfSound_methods[] = {
{"SetRelativeToListener", (PyCFunction)PySfSound_SetRelativeToListener, METH_O, "SetRelativeToListener(Relative)\nMake the sound's position relative to the listener's position, or absolute. The default value is false (absolute)\n Relative : True to set the position relative, false to set it absolute"},
{"IsRelativeToListener", (PyCFunction)PySfSound_IsRelativeToListener, METH_NOARGS, "IsRelativeToListener()\nTell if the sound's position is relative to the listener's position, or if it's absolute."},
{"SetPlayingOffset", (PyCFunction)PySfSound_SetPlayingOffset, METH_O, "SetPlayingOffset(TimeOffset)\nSet the current playing position of the sound.\n TimeOffset : New playing position, expressed in seconds"},
{"SetLoop", (PyCFunction)PySfSound_SetLoop, METH_O, "SetLoop(Loop)\nSet the Sound loop state.\n Loop : True to play in loop, false to play once"},
{"SetBuffer", (PyCFunction)PySfSound_SetBuffer, METH_O, "SetBuffer(Buffer)\nSet the source buffer.\n Buffer : New sound buffer to bind to the sound "},
@ -269,38 +299,26 @@ Copy constructor : Sound(Copy) where Copy is a sf.Sound instance.", /* tp_doc */
PySfSound_new, /* tp_new */
};
static int
PySfSound_init(PySfSound *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Buffer", "Loop", "Pitch", "Volume", "X", "Y", "Z", NULL};
PySfSoundBuffer *Buffer=NULL;
bool Loop=false;
PyObject *LoopObj=Py_False;
float Pitch=1.f, Volume=100.f, X=0.f, Y=0.f, Z=0.f;
if (PyTuple_Size(args) == 1)
static PyObject *
PySfSound_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSound *self;
self = (PySfSound *)type->tp_alloc(type, 0);
if (self != NULL)
{
PySfSound *Copy;
if (PyArg_ParseTuple(args, "O!:Sound.__init__", &PySfSoundType, &Copy))
if (PyTuple_Size(args) == 1)
{
self->obj = new sf::Sound(*(Copy->obj));
return 0;
PySfSound *Copy;
if (PyArg_ParseTuple(args, "O!:Sound.__new__", &PySfSoundType, &Copy))
{
self->obj = new sf::Sound(*(Copy->obj));
return (PyObject *)self;
}
else PyErr_Clear();
}
else PyErr_Clear();
}
if (PyTuple_Size(args) > 0)
{
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|Offfff:Sound.__init__", (char **)kwlist, &PySfSoundBufferType, &Buffer, &LoopObj, &Pitch, &Volume, &X, &Y, &Z))
return -1;
if (PyObject_IsTrue(LoopObj))
Loop = true;
self->obj = new sf::Sound(*(Buffer->obj), Loop, Pitch, Volume, sf::Vector3f(X, Y, Z));
}
else
self->obj = new sf::Sound();
return 0;
}
return (PyObject *)self;
}
void

View File

@ -35,15 +35,7 @@ PySfSoundBuffer_dealloc(PySfSoundBuffer *self)
}
static PyObject *
PySfSoundBuffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSoundBuffer *self;
self = (PySfSoundBuffer *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static int
PySfSoundBuffer_init(PySfSoundBuffer *self, PyObject *args, PyObject *kwds);
PySfSoundBuffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject*
PySfSoundBuffer_LoadFromFile(PySfSoundBuffer *self, PyObject *args)
@ -170,32 +162,33 @@ Copy constructor : SoundBuffer(Copy) where Copy is a sf.SoundBuffer instance.",
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfSoundBuffer_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfSoundBuffer_new, /* tp_new */
};
static int
PySfSoundBuffer_init(PySfSoundBuffer *self, PyObject *args, PyObject *kwds)
static PyObject *
PySfSoundBuffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
int size = PyTuple_Size(args);
if (size == 1)
PySfSoundBuffer *self;
self = (PySfSoundBuffer *)type->tp_alloc(type, 0);
if (self != NULL)
{
PySfSoundBuffer *Copy;
if (!PyArg_ParseTuple(args, "O!:SoundBuffer.__init__", &PySfSoundBufferType, &Copy))
return -1;
self->obj = new sf::SoundBuffer(*(Copy->obj));
}
else if (size == 0)
PySfSoundBuffer *Copy=NULL;
if (PyArg_ParseTuple(args, "O!:SoundBuffer.__init__", &PySfSoundBufferType, &Copy))
{
self->obj = new sf::SoundBuffer(*(Copy->obj));
return (PyObject *)self;
}
PyErr_Clear();
self->obj = new sf::SoundBuffer();
else
PyErr_SetString(PyExc_TypeError, "SoundBuffer.__init__() takes 0 or 1 argument");
return 0;
}
return (PyObject *)self;
}
PySfSoundBuffer *
GetNewPySfSoundBuffer()
{
return (PySfSoundBuffer *)PySfSoundBuffer_new(&PySfSoundBufferType, NULL, NULL);
return PyObject_New(PySfSoundBuffer, &PySfSoundBufferType);
}

View File

@ -43,16 +43,11 @@ PySfSoundBufferRecorder_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSoundBufferRecorder *self;
self = (PySfSoundBufferRecorder *)type->tp_alloc(type, 0);
if (self != NULL)
self->obj = new sf::SoundBufferRecorder();
return (PyObject *)self;
}
static int
PySfSoundBufferRecorder_init(PySfSoundBufferRecorder *self, PyObject *args)
{
self->obj = new sf::SoundBufferRecorder();
return 0;
}
static PyObject *
PySfSoundBufferRecorder_GetBuffer(PySfSoundBufferRecorder* self)
{
@ -103,7 +98,7 @@ PyTypeObject PySfSoundBufferRecorderType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfSoundBufferRecorder_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfSoundBufferRecorder_new, /* tp_new */
};

View File

@ -76,17 +76,14 @@ PySfSoundRecorder_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSoundRecorder *self;
self = (PySfSoundRecorder *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->obj = new CustomSoundRecorder();
self->obj->SoundRecorder = (PyObject *)self;
}
return (PyObject *)self;
}
static int
PySfSoundRecorder_init(PySfSoundRecorder *self, PyObject *args)
{
self->obj = new CustomSoundRecorder();
self->obj->SoundRecorder = (PyObject *)self;
return 0;
}
static PyObject *
PySfSoundRecorder_Start(PySfSoundRecorder* self, PyObject *args)
{
@ -162,7 +159,7 @@ Construct the sound recorder with a callback function for processing captured sa
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfSoundRecorder_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfSoundRecorder_new, /* tp_new */
};

View File

@ -38,19 +38,21 @@ bool CustomSoundStream::OnStart()
Py_DECREF(OnStart);
Py_DECREF(Result);
}
if (PyErr_Occurred())
{
PyErr_Print();
return false;
}
return result;
}
bool CustomSoundStream::OnGetData(Chunk& Data)
{
bool result = false;
if (PyData != NULL) {
Py_DECREF(PyData);
}
if (PyObject_HasAttrString(SoundStream, "OnGetData"))
Py_CLEAR(PyData);
PyObject *Function = PyObject_GetAttrString(SoundStream, "OnGetData");
if (Function != NULL)
{
PyObject *Function = PyObject_GetAttrString(SoundStream, "OnGetData");
Data.NbSamples = 0;
PyData = PyObject_CallFunction(Function, NULL);
if (PyData != NULL)
{
@ -63,6 +65,12 @@ bool CustomSoundStream::OnGetData(Chunk& Data)
}
Py_DECREF(Function);
}
if (PyErr_Occurred())
{
PyErr_Print();
Py_CLEAR(PyData);
return false;
}
return result;
}
@ -71,15 +79,6 @@ void CustomSoundStream::Init(unsigned int ChannelsCount, unsigned int SampleRate
Initialize(ChannelsCount, SampleRate);
}
static int
PySfSoundStream_init(PySfSoundStream *self, PyObject *args, PyObject *kwds)
{
self->obj = new CustomSoundStream();
self->obj->PyData = NULL;
self->obj->SoundStream = (PyObject *)self;
return 0;
}
static void
PySfSoundStream_dealloc(PySfSoundStream *self)
{
@ -92,6 +91,12 @@ PySfSoundStream_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfSoundStream *self;
self = (PySfSoundStream *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->obj = new CustomSoundStream();
self->obj->PyData = NULL;
self->obj->SoundStream = (PyObject *)self;
}
return (PyObject *)self;
}
@ -232,7 +237,22 @@ PySfSoundStream_GetPlayingOffset(PySfSoundStream *self)
return PyFloat_FromDouble(self->obj->GetPlayingOffset());
}
static PyObject*
PySfSoundStream_SetRelativeToListener(PySfSoundStream *self, PyObject *args)
{
self->obj->SetRelativeToListener(PyBool_AsBool(args));
Py_RETURN_NONE;
}
static PyObject*
PySfSoundStream_IsRelativeToListener(PySfSoundStream *self)
{
return PyBool_FromLong(self->obj->IsRelativeToListener());
}
static PyMethodDef PySfSoundStream_methods[] = {
{"SetRelativeToListener", (PyCFunction)PySfSoundStream_SetRelativeToListener, METH_O, "SetRelativeToListener(Relative)\nMake the sound's position relative to the listener's position, or absolute. The default value is false (absolute)\n Relative : True to set the position relative, false to set it absolute"},
{"IsRelativeToListener", (PyCFunction)PySfSoundStream_IsRelativeToListener, METH_NOARGS, "IsRelativeToListener()\nTell if the sound's position is relative to the listener's position, or if it's absolute."},
{"Initialize", (PyCFunction)PySfSoundStream_Initialize, METH_VARARGS, "Initialize(ChannelsCount, SampleRate)\n\
Set the audio stream parameters, you must call it before Play()\n\
ChannelsCount : Number of channels\n\
@ -300,7 +320,7 @@ or for streaming sound from the network", /* tp_doc */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfSoundStream_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfSoundStream_new, /* tp_new */
};

View File

@ -56,7 +56,8 @@ PySfSprite_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (self != NULL)
{
self->Image = NULL;
self->Image = NULL;
self->IsCustom = false;
}
return (PyObject *)self;

View File

@ -33,6 +33,7 @@
typedef struct {
PyObject_HEAD
bool IsCustom;
sf::Sprite *obj;
PySfImage *Image;
} PySfSprite;

View File

@ -30,8 +30,6 @@
#include "compat.hpp"
extern PyTypeObject PySfColorType;
extern PyTypeObject PySfImageType;
extern PyTypeObject PySfDrawableType;
extern PyTypeObject PySfFontType;
@ -39,6 +37,7 @@ extern PyTypeObject PySfFontType;
static void
PySfString_dealloc(PySfString *self)
{
Py_CLEAR(self->font);
delete self->obj;
free_object(self);
}
@ -48,52 +47,13 @@ PySfString_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfString *self;
self = (PySfString *)type->tp_alloc(type, 0);
return (PyObject *)self;
}
static int
PySfString_init(PySfString *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Text", "Font", "Size", NULL};
float Size = 30.f;
PyObject *Text=NULL;
PySfFont *FontTmp = NULL;
sf::Font *Font;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO!f:String.__init__", (char **)kwlist, &Text, &PySfFontType, &FontTmp, &Size))
return -1;
if (FontTmp)
Font = (FontTmp->obj);
else
Font = (sf::Font *)&(sf::Font::GetDefaultFont());
if (Text != NULL)
if (self != NULL)
{
if (PyUnicode_Check(Text))
{
#if Py_UNICODE_SIZE == 4
self->obj = new sf::String((sf::Uint32 *)PyUnicode_AS_UNICODE(Text), *Font, Size);
#else
self->obj = new sf::String((sf::Uint16 *)PyUnicode_AS_UNICODE(Text), *Font, Size);
#endif
}
#ifdef IS_PY3K
else if (PyBytes_Check(Text))
self->obj = new sf::String(sf::Unicode::UTF8String((sf::Uint8 *)PyBytes_AsString(Text)), *Font, Size);
#else
else if (PyString_Check(Text))
self->obj = new sf::String(sf::Unicode::UTF8String((sf::Uint8 *)PyString_AsString(Text)), *Font, Size);
#endif
else
{
PyErr_SetString(PyExc_TypeError, "String.__init__() first argument must be str");
return -1;
}
self->font = NULL;
self->IsCustom = false;
self->obj = new sf::String();
}
else
self->obj = new sf::String("", *Font, Size);
return 0;
return (PyObject *)self;
}
static PyObject *
@ -144,7 +104,13 @@ PySfString_SetFont(PySfString* self, PyObject *args)
{
PySfFont *Font = (PySfFont *)args;
if (!PyObject_TypeCheck(Font, &PySfFontType))
{
PyErr_SetString(PyExc_ValueError, "String.SetFont() Argument must be a sf.Font");
return NULL;
}
Py_CLEAR(self->font);
Py_INCREF(args);
self->font = Font;
self->obj->SetFont(*(Font->obj));
Py_RETURN_NONE;
}
@ -189,9 +155,18 @@ PySfString_GetText(PySfString* self)
static PyObject *
PySfString_GetFont(PySfString* self)
{
PySfFont *Font = GetNewPySfFont();
Font->obj = new sf::Font(self->obj->GetFont());
return (PyObject *)Font;
if (self->font == NULL)
{
PySfFont *Font = GetNewPySfFont();
Font->obj = (sf::Font *)&(sf::Font::GetDefaultFont());
Font->Owner = false;
return (PyObject *)Font;
}
else
{
Py_INCREF(self->font);
return (PyObject *)(self->font);
}
}
static PyObject *
@ -216,6 +191,44 @@ PySfString_GetCharacterPos(PySfString* self, PyObject *args)
return Py_BuildValue("ff", Pos.x, Pos.y);
}
static int
PySfString_init(PySfString *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Text", "Font", "Size", NULL};
float Size = 30.f;
PyObject *Text=NULL;
PySfFont *Font = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO!f:String.__new__", (char **)kwlist, &Text, &PySfFontType, &Font, &Size))
return -1;
if (Text != NULL)
{
if (PyUnicode_Check(Text))
{
#if Py_UNICODE_SIZE == 4
self->obj->SetText((sf::Uint32 *)PyUnicode_AS_UNICODE(Text));
#else
self->obj->SetText((sf::Uint16 *)PyUnicode_AS_UNICODE(Text));
#endif
}
#ifdef IS_PY3K
else if (PyBytes_Check(Text))
self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)PyBytes_AsString(Text)));
#else
else if (PyString_Check(Text))
self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)PyString_AsString(Text)));
#endif
else
{
PyErr_SetString(PyExc_TypeError, "String.__init__() first argument must be str");
return -1;
}
}
if (Font) PySfString_SetFont(self, (PyObject *)Font);
self->obj->SetSize(Size);
return 0;
}
static PyMethodDef PySfString_methods[] = {
{"GetCharacterPos", (PyCFunction)PySfString_GetCharacterPos, METH_O, "GetCharacterPos(Index)\n\

View File

@ -29,9 +29,13 @@
#include <SFML/Graphics/String.hpp>
#include "Font.hpp"
typedef struct {
PyObject_HEAD
bool IsCustom;
sf::String *obj;
PySfFont *font;
} PySfString;
void PySfString_InitConst();

View File

@ -48,17 +48,16 @@ PySfVideoMode_dealloc(PySfVideoMode* self)
static PyObject *
PySfVideoMode_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Width", "Height", "BitsPerPixel", NULL};
PySfVideoMode *self;
self = (PySfVideoMode *)type->tp_alloc(type, 0);
if (self != NULL)
{
self->Width = 0;
self->Height = 0;
self->BitsPerPixel = 32;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "II|I:VideoMode.__init__", (char **)kwlist, &self->Width, &self->Height, &self->BitsPerPixel))
return NULL;
self->obj = new sf::VideoMode(self->Width, self->Height, self->BitsPerPixel);
}
return (PyObject *)self;
}
@ -70,27 +69,10 @@ PySfVideoModeUpdate(PySfVideoMode *self)
self->obj->BitsPerPixel = self->BitsPerPixel;
}
static int
PySfVideoMode_init(PySfVideoMode *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"Width", "Height", "BitsPerPixel", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "II|I:VideoMode.__init__", (char **)kwlist, &self->Width, &self->Height, &self->BitsPerPixel))
return -1;
self->obj = new sf::VideoMode(self->Width, self->Height, self->BitsPerPixel);
return 0;
}
static PyObject *
PySfVideoMode_IsValid(PySfVideoMode* self)
{
self->obj->Width = self->Width;
self->obj->Height = self->Height;
self->obj->BitsPerPixel = self->BitsPerPixel;
PySfVideoModeUpdate(self);
return PyBool_FromLong(self->obj->IsValid());
}
@ -100,7 +82,7 @@ PySfVideoMode_GetDesktopMode(PySfVideoMode* self)
PySfVideoMode *VideoMode;
VideoMode = GetNewPySfVideoMode();
VideoMode->obj = new sf::VideoMode ( sf::VideoMode::GetDesktopMode() );
VideoMode->obj = new sf::VideoMode(sf::VideoMode::GetDesktopMode());
VideoMode->Width = VideoMode->obj->Width;
VideoMode->Height = VideoMode->obj->Height;
VideoMode->BitsPerPixel = VideoMode->obj->BitsPerPixel;
@ -117,7 +99,7 @@ PySfVideoMode_GetMode(PySfVideoMode* self, PyObject *args)
index = (std::size_t)PyLong_AsLong(args);
VideoMode = GetNewPySfVideoMode();
VideoMode->obj = new sf::VideoMode ( sf::VideoMode::GetMode(index) );
VideoMode->obj = new sf::VideoMode(sf::VideoMode::GetMode(index));
VideoMode->Width = VideoMode->obj->Width;
VideoMode->Height = VideoMode->obj->Height;
VideoMode->BitsPerPixel = VideoMode->obj->BitsPerPixel;
@ -132,7 +114,6 @@ PySfVideoMode_GetModesCount(PySfVideoMode* self)
}
static PyMethodDef PySfVideoMode_methods[] = {
{"IsValid", (PyCFunction)PySfVideoMode_IsValid, METH_NOARGS, "IsValid()\nTell whether or not the video mode is supported."},
{"GetDesktopMode", (PyCFunction)PySfVideoMode_GetDesktopMode, METH_STATIC | METH_NOARGS, "GetDesktopMode()\nGet the current desktop video mode."},
@ -190,7 +171,7 @@ Construct the video mode with its attributes : VideoMode(ModeWidth, ModeHeight,
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfVideoMode_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfVideoMode_new, /* tp_new */
};
@ -199,6 +180,6 @@ Construct the video mode with its attributes : VideoMode(ModeWidth, ModeHeight,
PySfVideoMode *
GetNewPySfVideoMode()
{
return (PySfVideoMode *)PySfVideoMode_new(&PySfVideoModeType, NULL, NULL);
return PyObject_New(PySfVideoMode, &PySfVideoModeType);
}

View File

@ -50,7 +50,9 @@ static PyObject *
PySfWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PySfWindow *self;
self = (PySfWindow *)type->tp_alloc(type, 0);
self = (PySfWindow *)type->tp_alloc(type, 0);
if (self != NULL)
self->obj = new sf::Window();
return (PyObject *)self;
}
@ -128,9 +130,8 @@ PySfWindow_Create(PySfWindow* self, PyObject *args, PyObject *kwds)
static int
PySfWindow_init(PySfWindow *self, PyObject *args, PyObject *kwds)
{
self->obj = new sf::Window();
if (PyTuple_Size(args) > 0)
{
if (args != NULL)
if (PySfWindow_Create(self, args, kwds) == NULL)
return -1;
return 0;

View File

@ -55,6 +55,7 @@ PySfWindowSettingsUpdate(PySfWindowSettings *self)
static PyObject *
PySfWindowSettings_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"DepthBits", "StencilBits", "AntialiasingLevel", NULL};
PySfWindowSettings *self;
self = (PySfWindowSettings *)type->tp_alloc(type, 0);
if (self != NULL)
@ -62,23 +63,13 @@ PySfWindowSettings_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self->DepthBits = 24;
self->StencilBits = 8;
self->AntialiasingLevel = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|III:WindowSettings.__init__", (char **)kwlist, &(self->DepthBits), &(self->StencilBits), &(self->AntialiasingLevel)))
return NULL;
self->obj = new sf::WindowSettings(self->DepthBits, self->StencilBits, self->AntialiasingLevel);
}
return (PyObject *)self;
}
static int
PySfWindowSettings_init(PySfWindowSettings *self, PyObject *args, PyObject *kwds)
{
const char *kwlist[] = {"DepthBits", "StencilBits", "AntialiasingLevel", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|III:WindowSettings.__init__", (char **)kwlist, &(self->DepthBits), &(self->StencilBits), &(self->AntialiasingLevel)))
return -1;
self->obj = new sf::WindowSettings(self->DepthBits, self->StencilBits, self->AntialiasingLevel);
return 0;
}
PyTypeObject PySfWindowSettingsType = {
head_init
"WindowSettings", /*tp_name*/
@ -115,7 +106,7 @@ PyTypeObject PySfWindowSettingsType = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)PySfWindowSettings_init, /* tp_init */
0, /* tp_init */
0, /* tp_alloc */
PySfWindowSettings_new, /* tp_new */
};
@ -123,6 +114,6 @@ PyTypeObject PySfWindowSettingsType = {
PySfWindowSettings *
GetNewPySfWindowSettings()
{
return (PySfWindowSettings *)PySfWindowSettings_new(&PySfWindowSettingsType, NULL, NULL);
return PyObject_New(PySfWindowSettings, &PySfWindowSettingsType);
}

View File

@ -27,7 +27,6 @@
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include <Python.h>
#include <structmember.h>

View File

@ -175,6 +175,17 @@ void Sound::SetPosition(const Vector3f& Position)
}
////////////////////////////////////////////////////////////
/// Make the sound's position relative to the listener's
/// position, or absolute.
/// The default value is false (absolute)
////////////////////////////////////////////////////////////
void Sound::SetRelativeToListener(bool Relative)
{
ALCheck(alSourcei(mySource, AL_SOURCE_RELATIVE, Relative));
}
////////////////////////////////////////////////////////////
/// Set the minimum distance - closer than this distance,
/// the listener will hear the sound at its maximum volume.
@ -263,6 +274,19 @@ Vector3f Sound::GetPosition() const
}
////////////////////////////////////////////////////////////
/// Tell if the sound's position is relative to the listener's
/// position, or if it's absolute
////////////////////////////////////////////////////////////
bool Sound::IsRelativeToListener() const
{
ALint Relative;
ALCheck(alGetSourcei(mySource, AL_SOURCE_RELATIVE, &Relative));
return Relative != 0;
}
////////////////////////////////////////////////////////////
/// Get the minimum distance
////////////////////////////////////////////////////////////

View File

@ -2037,7 +2037,6 @@ void dct_iv_slow(float *buffer, int n)
//acc += x[j] * cos(M_PI / n * (i + 0.5) * (j + 0.5));
buffer[i] = acc;
}
free(x);
}
void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype)
@ -3504,8 +3503,8 @@ static int start_decoder(vorb *f)
#else
for (j=0; j < (int) c->lookup_values; ++j)
c->multiplicands[j] = mults[j] * c->delta_value + c->minimum_value;
setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values);
#endif
setup_temp_free(f, mults,sizeof(mults[0])*c->lookup_values);
}
skip:;
@ -3812,6 +3811,7 @@ static void vorbis_deinit(stb_vorbis *p)
setup_free(p, p->B[i]);
setup_free(p, p->C[i]);
setup_free(p, p->window[i]);
setup_free(p, p->bit_reverse[i]);
}
#ifndef STB_VORBIS_NO_STDIO
if (p->close_on_free) fclose(p->f);

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2009 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@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.

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@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.
@ -26,12 +26,8 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#import <SFML/Window/Cocoa/WindowImplCocoa.hpp>
#import <SFML/Window/VideoMode.hpp>
#import <SFML/System/Clock.hpp>
#import <Cocoa/Cocoa.h>
#import <vector>
#import <iostream>
#define SharedAppController [AppController sharedController]
@ -42,80 +38,50 @@ enum {
CleanScreen
};
@class WindowWrapper;
@interface AppController : NSObject {
// Note: objc allocation doesn't call C++ constructor
std::vector <sf::priv::WindowImplCocoa *> *windows;
NSAutoreleasePool *mainPool;
sf::Clock *cleaner;
sf::VideoMode desktopMode;
sf::VideoMode prevMode;
BOOL myOwningEventLoop;
WindowWrapper *myFullscreenWrapper;
NSAutoreleasePool *myMainPool;
sf::VideoMode myDesktopMode;
sf::VideoMode myPrevMode;
}
////////////////////////////////////////////////////////////
/// Return the shared AppController object. Makes one if needed
/// Return the shared AppController instance. Make 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
/// Make the menu bar
////////////////////////////////////////////////////////////
- (void)makeMenuBar;
////////////////////////////////////////////////////////////
/// Get the events and put them into an array for each window
/// Process all the events and send them to the application
/// No event is processed if the AppController instance is
/// not the owner of the event loop (ie: user made his own loop)
////////////////////////////////////////////////////////////
- (void)processEvents;
////////////////////////////////////////////////////////////
/// Add the 'windowImplObj' object to the list of known windows
/// Set @window as the current fullscreen window
/// Change the screen resolution if needed according to @window and @fullscreenMode
////////////////////////////////////////////////////////////
- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj;
////////////////////////////////////////////////////////////
/// Remove the 'windowImplObj' object from the list of known windows
////////////////////////////////////////////////////////////
- (void)unregisterWindow:(sf::priv::WindowImplCocoa *)windowImplObj;
////////////////////////////////////////////////////////////
/// Return true is one of the registered window is a full screen one
////////////////////////////////////////////////////////////
- (bool)isUsingFullscreen;
- (void)setFullscreenWindow:(WindowWrapper *)window mode:(sf::VideoMode *)fullscreenMode;
////////////////////////////////////////////////////////////
/// Perform fade operation where 'operation' is one of { FillScreen, CleanScreen}
/// and 'time' is the time during which you wish the operation to be performed.
/// Set 'sync' to true if you do not want the method to end before the end
/// of the fade operation. Pass the last used token or a new one if you are
/// using this method for the first time. This lets the method release some
/// resources when doing CleanScreen operation.
/// of the fade operation.
////////////////////////////////////////////////////////////
- (void)doFadeOperation:(int)operation time:(float)time sync:(bool)sync token:(CGDisplayFadeReservationToken *)prevToken;
- (void)doFadeOperation:(int)operation time:(float)time sync:(bool)sync;
////////////////////////////////////////////////////////////
/// Return the desktop video mode (made at the instance initialization)
////////////////////////////////////////////////////////////
- (const sf::VideoMode&)desktopMode;
@end
////////////////////////////////////////////////////////////
/// check that ptr is valid, otherwise print msg in
/// std::cerr and throw std::bad_alloc.
/// Must be used to check alloc results
////////////////////////////////////////////////////////////
template <typename T>
T *massert(T *ptr);

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@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.
@ -27,14 +27,13 @@
// Headers
////////////////////////////////////////////////////////////
#import <SFML/Window/Cocoa/AppController.h>
#import <SFML/Window/Cocoa/WindowController.h>
#import <SFML/Window/Cocoa/WindowImplCocoa.hpp>
#import <SFML/Window/Cocoa/GLKit.h>
#import <SFML/System.hpp>
#import <ApplicationServices/ApplicationServices.h>
#import <iostream>
// AppController singleton
// AppController singleton object
static AppController *shared = nil;
@ -61,160 +60,120 @@ static AppController *shared = nil;
@implementation AppController
////////////////////////////////////////////////////////////
/// Return an initialized AppController instance
/// Save the desktop mode
/// Make the main autorelease pool
/// Set the application observer
////////////////////////////////////////////////////////////
- (id)init
{
self = [super init];
if (self != nil) {
windows = new std::vector <sf::priv::WindowImplCocoa *>;
cleaner = new sf::Clock;
myOwningEventLoop = NO;
// Save the desktop mode
myDesktopMode = sf::VideoMode::GetDesktopMode();
myPrevMode = myDesktopMode;
// Make the app autorelease pool
myMainPool = [[NSAutoreleasePool alloc] init];
// Don't go on if the user handles the app
if (![NSApp isRunning])
{
// Force our application to appear in the Dock and make it able
// to get focus (even when it's a raw executable)
ProcessSerialNumber psn;
if (!GetCurrentProcess(&psn)) {
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
SetFrontProcess(&psn);
}
// Make the app
[NSApplication sharedApplication];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
// I want to go back to the desktop mode
// if we've a fullscreen window when hiding
[nc addObserver:self
selector:@selector(applicationWillHide:)
name:NSApplicationWillHideNotification
object:NSApp];
// And restore de fullscreen mode when unhiding
[nc addObserver:self
selector:@selector(applicationWillUnhide:)
name:NSApplicationWillUnhideNotification
object:NSApp];
// Go back to desktop mode before exit
[nc addObserver:self
selector:@selector(applicationWillTerminate:)
name:NSApplicationWillTerminateNotification
object:NSApp];
if ([NSApp mainMenu] == nil) {
[self makeMenuBar];
}
}
}
return self;
}
////////////////////////////////////////////////////////////
/// Clean the controller
////////////////////////////////////////////////////////////
- (void)dealloc
{
delete windows;
delete cleaner;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[myFullscreenWrapper release];
[super dealloc];
}
////////////////////////////////////////////////////////////
/// Return the shared AppController object. Makes one if needed
/// Return the shared AppController instance. Make one if needed.
////////////////////////////////////////////////////////////
+ (AppController *)sharedController
{
if (nil == shared) {
shared = [massert([AppController alloc]) init];
}
if (nil == shared)
shared = [[AppController alloc] init];
return shared;
}
////////////////////////////////////////////////////////////
/// Reallocate main pool to release autoreleased objects
////////////////////////////////////////////////////////////
- (void)resetPool
{
[mainPool release];
mainPool = [massert([NSAutoreleasePool alloc]) init];
}
////////////////////////////////////////////////////////////
/// 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) {
massert([NSApplication sharedApplication]);
}
if ([NSApp mainMenu] == nil) {
[self makeMenuBar];
}
[NSApp finishLaunching];
[NSApp setRunning:YES];
[NSApp setDelegate:self];
desktopMode = sf::VideoMode::GetDesktopMode();
}
////////////////////////////////////////////////////////////
/// 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());
}
}
////////////////////////////////////////////////////////////
/// Returns the first full screen window found or nil
////////////////////////////////////////////////////////////
- (SFWindow *)fullscreenWindow
{
SFWindow *window = nil;
std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size();
std::vector<sf::priv::WindowImplCocoa *>::size_type idx;
for (idx = 0; idx < sz; idx++) {
sf::priv::WindowImplCocoa *win = windows->at(idx);
if (win && win->IsFullscreen()) {
window = static_cast <SFWindow *> (win->CocoaWindow());
break;
}
}
return window;
}
////////////////////////////////////////////////////////////
/// Hide all the fullscreen windows and switch to desktop display mode
/// Hide all the fullscreen windows and switch back to the desktop display mode
////////////////////////////////////////////////////////////
- (void)applicationWillHide:(NSNotification *)aNotification
{
if ([self isUsingFullscreen]) {
prevMode = sf::VideoMode::GetDesktopMode();
if (myFullscreenWrapper) {
myPrevMode = sf::VideoMode::GetDesktopMode();
CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay,
desktopMode.BitsPerPixel,
desktopMode.Width,
desktopMode.Height,
myDesktopMode.BitsPerPixel,
myDesktopMode.Width,
myDesktopMode.Height,
NULL);
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
// Fade to black screen
[SharedAppController doFadeOperation:FillScreen time:0.2f sync:true token:&token];
[self doFadeOperation:FillScreen time:0.2f sync:true];
// Make all the full screen SFML windows unvisible
std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size();
std::vector<sf::priv::WindowImplCocoa *>::size_type idx;
for (idx = 0; idx < sz; idx++) {
sf::priv::WindowImplCocoa *win = windows->at(idx);
if (win->IsFullscreen()) {
[static_cast <SFWindow *> (win->CocoaWindow()) setAlphaValue:0.0f];
}
}
// Make the full screen window unvisible
[[myFullscreenWrapper window] setAlphaValue:0.0f];
// Switch to the wished display mode
CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode);
// Fade to normal screen
[SharedAppController doFadeOperation:CleanScreen time:0.5f sync:false token:&token];
[self doFadeOperation:CleanScreen time:0.5f sync:false];
}
}
@ -224,41 +183,43 @@ static AppController *shared = nil;
////////////////////////////////////////////////////////////
- (void)applicationWillUnhide:(NSNotification *)aNotification
{
if ([self isUsingFullscreen]) {
if (myFullscreenWrapper) {
CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay,
prevMode.BitsPerPixel,
prevMode.Width,
prevMode.Height,
myPrevMode.BitsPerPixel,
myPrevMode.Width,
myPrevMode.Height,
NULL);
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
// Fade to a black screen
[SharedAppController doFadeOperation:FillScreen time:0.5f sync:true token:&token];
[self doFadeOperation:FillScreen time:0.5f sync:true];
[NSMenu setMenuBarVisible:NO];
// Switch to the wished display mode
CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode);
// Make all the SFML windows visible
std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size();
std::vector<sf::priv::WindowImplCocoa *>::size_type idx;
for (idx = 0; idx < sz; idx++) {
sf::priv::WindowImplCocoa *win = windows->at(idx);
if (win->IsFullscreen()) {
[static_cast <SFWindow *> (win->CocoaWindow()) setAlphaValue:1.0f];
[static_cast <SFWindow *> (win->CocoaWindow()) center];
}
// Show the fullscreen window if existing
if (myFullscreenWrapper)
{
[[myFullscreenWrapper window] setAlphaValue:1.0f];
[[myFullscreenWrapper window] center];
}
// Fade to normal screen
[SharedAppController doFadeOperation:CleanScreen time:0.5f sync:false token:&token];
[self doFadeOperation:CleanScreen time:0.5f sync:false];
}
}
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
if (myFullscreenWrapper)
[self setFullscreenWindow:nil mode:NULL];
// FIXME: should I really do this ? what about the user owned windows ?
// And is this really useful as the application is about to exit ?
[NSApp makeWindowsPerform:@selector(close) inOrder:NO];
}
////////////////////////////////////////////////////////////
/// Make menu bar
////////////////////////////////////////////////////////////
@ -282,10 +243,10 @@ static AppController *shared = nil;
// Create the main menu bar
[NSApp setMainMenu:[massert([NSMenu alloc]) init]];
[NSApp setMainMenu:[[NSMenu alloc] init]];
// Create the application menu
appleMenu = [massert([NSMenu alloc]) initWithTitle:@""];
appleMenu = [[NSMenu alloc] initWithTitle:@""];
// Put menu items
// + 'About' menu item
@ -303,7 +264,7 @@ static AppController *shared = nil;
keyEquivalent:@"h"];
// + 'Hide other' menu item
menuItem = static_cast <NSMenuItem *> ([appleMenu addItemWithTitle:@"Hide Others"
menuItem = reinterpret_cast <NSMenuItem *> ([appleMenu addItemWithTitle:@"Hide Others"
action:@selector(hideOtherApplications:)
keyEquivalent:@"h"]);
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
@ -317,15 +278,15 @@ static AppController *shared = nil;
// + 'Quit' menu item
title = [@"Quit " stringByAppendingString:appName];
quitMenuItem = [[massert([NSMenuItem alloc])
quitMenuItem = [[[NSMenuItem alloc]
initWithTitle:title
action:@selector(quitApplication:)
action:@selector(terminate:)
keyEquivalent:@"q"] autorelease];
[quitMenuItem setTarget:self];
//[quitMenuItem setTarget:self];
[appleMenu addItem:quitMenuItem];
// Put the menu into the menubar
menuItem = [massert([NSMenuItem alloc])
menuItem = [[NSMenuItem alloc]
initWithTitle:@""
action:nil
keyEquivalent:@""];
@ -338,11 +299,11 @@ static AppController *shared = nil;
[appleMenu release];
// 'File' menu
fileMenu = [massert([NSMenu alloc])
fileMenu = [[NSMenu alloc]
initWithTitle:@"File"];
// + 'Close' menu item
menuItem = [massert([NSMenuItem alloc])
menuItem = [[NSMenuItem alloc]
initWithTitle:@"Close"
action:@selector(performClose:)
keyEquivalent:@"w"];
@ -350,7 +311,7 @@ static AppController *shared = nil;
[menuItem release];
// + 'File' menu item (head)
menuItem = [massert([NSMenuItem alloc])
menuItem = [[NSMenuItem alloc]
initWithTitle:@"File"
action:nil
keyEquivalent:@""];
@ -359,11 +320,11 @@ static AppController *shared = nil;
[menuItem release];
// 'Window' menu
windowMenu = [massert([NSMenu alloc])
windowMenu = [[NSMenu alloc]
initWithTitle:@"Window"];
// + 'Minimize' menu item
menuItem = [massert([NSMenuItem alloc])
menuItem = [[NSMenuItem alloc]
initWithTitle:@"Minimize"
action:@selector(performMiniaturize:)
keyEquivalent:@"m"];
@ -371,7 +332,7 @@ static AppController *shared = nil;
[menuItem release];
// + 'Window' menu item (head)
menuItem = [massert([NSMenuItem alloc])
menuItem = [[NSMenuItem alloc]
initWithTitle:@"Window"
action:nil keyEquivalent:@""];
[menuItem setSubmenu:windowMenu];
@ -385,127 +346,109 @@ static AppController *shared = nil;
////////////////////////////////////////////////////////////
/// 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
/// Process all the events and send them to the application
/// No event is processed if the AppController instance is
/// not the owner of the event loop (ie: user made his own loop)
////////////////////////////////////////////////////////////
- (void)processEvents
{
// Release the main autorelease pool every second
if (cleaner->GetElapsedTime() > 1.0f) {
cleaner->Reset();
[self resetPool];
// Check there is a run loop
if (![NSApp isRunning])
{
// Get the ownershipt of event handling if not and run
[NSApp finishLaunching];
[NSApp setRunning:YES];
myOwningEventLoop = YES;
}
// Clean the autorelease pool
[myMainPool release];
myMainPool = [[NSAutoreleasePool alloc] init];
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 ?
if (myOwningEventLoop)
{
// Minimal event loop
while (nil != (event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue:YES]))
{
[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
/// Set @window as the current fullscreen window
/// Change the screen resolution if needed according to @window and @fullscreenMode
////////////////////////////////////////////////////////////
- (void)registerWindow:(sf::priv::WindowImplCocoa *)windowImplObj
- (void)setFullscreenWindow:(WindowWrapper *)aWrapper mode:(sf::VideoMode *)fullscreenMode
{
if (windowImplObj != NULL) {
std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size();
std::vector<sf::priv::WindowImplCocoa *>::size_type idx;
// If we have a fullscreen window and want to remove it
if (myFullscreenWrapper && aWrapper == nil)
{
// Get the CoreGraphics display mode according to the desktop mode
CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay,
myDesktopMode.BitsPerPixel,
myDesktopMode.Width,
myDesktopMode.Height,
NULL);
for (idx = 0; idx < sz; idx++) {
if (windows->at(idx) == windowImplObj) {
break;
}
}
// Fade to black screen
[self doFadeOperation:FillScreen time:0.2f sync:true];
// Switch to the desktop display mode
CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode);
// Register window only if not already registered
if (sz == idx) {
windows->push_back(windowImplObj);
}
// Close the window
[[myFullscreenWrapper window] close];
// Show the menu bar
[NSMenu setMenuBarVisible:YES];
// Fade to normal screen
[self doFadeOperation:CleanScreen time:0.5f sync:true];
// Release the saved window wrapper
[myFullscreenWrapper release], myFullscreenWrapper = nil;
}
}
////////////////////////////////////////////////////////////
/// 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;
else if (myFullscreenWrapper == nil && aWrapper)
{
assert(fullscreenMode != NULL);
for (idx = 0; idx < sz; idx++) {
if (windows->at(idx) == windowImplObj) {
break;
}
}
// Get the CoreGraphics display mode according to the given sf mode
CFDictionaryRef displayMode = CGDisplayBestModeForParameters (kCGDirectMainDisplay,
fullscreenMode->BitsPerPixel,
fullscreenMode->Width,
fullscreenMode->Height,
NULL);
if (idx < sz) {
windows->erase(windows->begin() + idx);
}
// Fade to a black screen
[self doFadeOperation:FillScreen time:0.5f sync:true];
// Hide to the main menu bar
[NSMenu setMenuBarVisible:NO];
// Switch to the wished display mode
CGDisplaySwitchToMode(kCGDirectMainDisplay, displayMode);
// Open and center the window
[[aWrapper window] makeKeyAndOrderFront:nil];
[[aWrapper window] center];
// Fade to normal screen
[self doFadeOperation:CleanScreen time:0.2f sync:false];
// Save the fullscreen wrapper
myFullscreenWrapper = [aWrapper retain];
}
}
////////////////////////////////////////////////////////////
/// Return true is one of the registered window is a full screen one
////////////////////////////////////////////////////////////
- (bool)isUsingFullscreen
{
bool isUsing = false;
std::vector<sf::priv::WindowImplCocoa *>::size_type sz = windows->size();
std::vector<sf::priv::WindowImplCocoa *>::size_type idx;
for (idx = 0; idx < sz; idx++) {
sf::priv::WindowImplCocoa *win = windows->at(idx);
if (win && win->IsFullscreen()) {
isUsing = true;
break;
}
else
{
std::cerr << "Inconcistency error for arguments given to -[AppController setFullscreenWindow:mode:]" << std::endl;
}
return isUsing;
}
@ -517,11 +460,10 @@ static AppController *shared = nil;
/// using this method for the first time. This lets the method release some
/// resources when doing CleanScreen operation.
////////////////////////////////////////////////////////////
- (void) doFadeOperation:(int)operation time:(float)time sync:(bool)sync token:(CGDisplayFadeReservationToken *)prevToken
- (void) doFadeOperation:(int)operation time:(float)time sync:(bool)sync
{
CGDisplayFadeReservationToken token = kCGDisplayFadeReservationInvalidToken;
if (prevToken)
token = *prevToken;
static CGDisplayFadeReservationToken prevToken = kCGDisplayFadeReservationInvalidToken;
CGDisplayFadeReservationToken token = prevToken;
CGError result = 0, capture = 0;
@ -539,7 +481,7 @@ static AppController *shared = nil;
CGDisplayFade(token, time,
kCGDisplayBlendNormal,
kCGDisplayBlendSolidColor,
0.0, 0.0, 0.0, sync);
0.0f, 0.0f, 0.0f, sync);
// Now, release the non black-filling capture
CGDisplayRelease(kCGDirectMainDisplay);
@ -549,8 +491,7 @@ static AppController *shared = nil;
CGDisplayCaptureWithOptions(kCGDirectMainDisplay, kCGCaptureNoOptions);
}
if (prevToken)
*prevToken = token;
prevToken = token;
}
} else if (operation == CleanScreen) {
// Get access for the fade operation
@ -569,14 +510,13 @@ static AppController *shared = nil;
CGDisplayFade(token, time,
kCGDisplayBlendSolidColor,
kCGDisplayBlendNormal,
0.0, 0.0, 0.0, sync);
0.0f, 0.0f, 0.0f, sync);
// Release the fade operation token
CGReleaseDisplayFadeReservation(token);
// Invalidate the given token
if (prevToken)
*prevToken = kCGDisplayFadeReservationInvalidToken;
prevToken = kCGDisplayFadeReservationInvalidToken;
}
// Release the captured display
@ -585,15 +525,14 @@ static AppController *shared = nil;
}
}
////////////////////////////////////////////////////////////
/// Return the desktop video mode (made at the instance initialization)
////////////////////////////////////////////////////////////
- (const sf::VideoMode&)desktopMode
{
return myDesktopMode;
}
@end
template <typename T>
T *massert(T *ptr)
{
if (NULL == ptr) {
throw std::bad_alloc();
}
return ptr;
}

View File

@ -0,0 +1,216 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@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/Cocoa/WindowImplCocoa.hpp>
////////////////////////////////////////////////////////////
/// Window independant OpenGL context class
////////////////////////////////////////////////////////////
@interface GLContext : NSOpenGLContext
{
GLContext *mySharedContext;
}
////////////////////////////////////////////////////////////
/// Return the shared OpenGL context instance (making one if needed)
////////////////////////////////////////////////////////////
+ (id)sharedContext;
////////////////////////////////////////////////////////////
/// Make a new OpenGL context according to the @attribs settings
/// and the shared context @context
////////////////////////////////////////////////////////////
- (id)initWithAttributes:(sf::WindowSettings&)attribs
sharedContext:(GLContext *)context;
@end
////////////////////////////////////////////////////////////
/// Customized Cocoa OpenGL view
////////////////////////////////////////////////////////////
@interface GLView : NSOpenGLView
{
sf::priv::WindowImplCocoa *myDelegate;
GLContext *myGLContext;
}
////////////////////////////////////////////////////////////
/// Make a new view according the the rect @frame,
/// the video mode @mode, the window settings @settings
/// and the sf window delegate @delegate
/// @delegate must not be null
////////////////////////////////////////////////////////////
- (id)initWithFrame:(NSRect)frame
mode:(const sf::VideoMode&)mode
settings:(sf::WindowSettings&)settings
delegate:(sf::priv::WindowImplCocoa *)delegate;
////////////////////////////////////////////////////////////
/// Finish view setting (after having added it to the window)
////////////////////////////////////////////////////////////
- (void)finishInitialization;
////////////////////////////////////////////////////////////
/// Forward call to en/disable vertical synchronization
////////////////////////////////////////////////////////////
- (void)enableVerticalSync:(bool)flag;
////////////////////////////////////////////////////////////
/// Forward call to set the OpenGL context as active according to @flag
////////////////////////////////////////////////////////////
- (void)setActive:(bool)flag;
////////////////////////////////////////////////////////////
/// Forward call to flush the OpenGL context
////////////////////////////////////////////////////////////
- (void)flushBuffer;
@end
////////////////////////////////////////////////////////////
/// Cocoa window implementation to let fullscreen windows
/// catch key events
////////////////////////////////////////////////////////////
@interface GLWindow : NSWindow
////////////////////////////////////////////////////////////
/// Technical note: this class must neither contain new members
/// nor methods. It is used transparently as a NSWindow object
/// by WindowWrapper. Not following this rule could result
/// in a segmentation fault or data corruption.
////////////////////////////////////////////////////////////
@end
////////////////////////////////////////////////////////////
/// WindowWrapper class : handles both imported and self-built windows
////////////////////////////////////////////////////////////
@interface WindowWrapper : NSObject
{
GLWindow *myWindow;
GLView *myView;
sf::VideoMode myFullscreenMode;
bool myIsFullscreen;
}
////////////////////////////////////////////////////////////
/// Make a new window wrapper according to the window settings @attribs,
/// the video mode @mode, the window style @style, the window title @title
/// and the sf window implementation delegate @delegate
////////////////////////////////////////////////////////////
- (id)initWithSettings:(sf::WindowSettings&)attribs
videoMode:(sf::VideoMode&)mode
style:(unsigned long)style
title:(NSString *)title
delegate:(sf::priv::WindowImplCocoa *)delegate;
////////////////////////////////////////////////////////////
/// Make a new window wrapper by importing @window and according to
/// the window settings @params and the sf window implementation delegate
/// @delegate
/// @window and @delegate must not be null
////////////////////////////////////////////////////////////
- (id)initWithWindow:(NSWindow *)window
settings:(sf::WindowSettings&)params
delegate:(sf::priv::WindowImplCocoa *)delegate;
////////////////////////////////////////////////////////////
/// Make a new window wrapper by importing @window if it's not null and according to
/// the window settings @params and the sf window implementation delegate
/// @delegate; or by creating a new window if @window is null. In this case @title
/// must therefore not be null and @params must be valid.
/// @delegate must never be null
////////////////////////////////////////////////////////////
- (id)initWithWindow:(NSWindow *)window
settings:(sf::WindowSettings&)params
videoMode:(sf::VideoMode&)mode
style:(unsigned long)style
title:(NSString *)title
delegate:(sf::priv::WindowImplCocoa *)delegate;
////////////////////////////////////////////////////////////
/// Finish the window setup (without knowing whether it's a imported
/// window)
////////////////////////////////////////////////////////////
/* - (void)setupGLViewAndWindow; */
////////////////////////////////////////////////////////////
/// Return a reference to the internal Cocoa window
////////////////////////////////////////////////////////////
- (NSWindow *)window;
////////////////////////////////////////////////////////////
/// Return a reference to the internal Cocoa OpenGL view
////////////////////////////////////////////////////////////
- (GLView *)glView;
////////////////////////////////////////////////////////////
/// Forward call to set the window position on screen
////////////////////////////////////////////////////////////
- (void)setPosition:(NSPoint)pos;
////////////////////////////////////////////////////////////
/// Forward call to set the window size
////////////////////////////////////////////////////////////
- (void)setSize:(NSSize)size;
////////////////////////////////////////////////////////////
/// Return the mouse location relative to the internal window
////////////////////////////////////////////////////////////
- (NSPoint)mouseLocation;
////////////////////////////////////////////////////////////
/// Return whether the mouse is on our window
////////////////////////////////////////////////////////////
- (BOOL)mouseInside;
////////////////////////////////////////////////////////////
/// Close or open the window
////////////////////////////////////////////////////////////
- (void)show:(bool)flag;
////////////////////////////////////////////////////////////
/// Forward call to en/disable the OpenGL view vertical synchronization
////////////////////////////////////////////////////////////
- (void)enableVerticalSync:(bool)flag;
////////////////////////////////////////////////////////////
/// Forward 'setActive' call the the OpenGL view
////////////////////////////////////////////////////////////
- (void)setActive:(bool)flag;
////////////////////////////////////////////////////////////
/// Forward call to flush the OpenGL view
////////////////////////////////////////////////////////////
- (void)flushBuffer;
@end

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 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.

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 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.

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 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.

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 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.

View File

@ -1,73 +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/Cocoa/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
// NSWindow subclass used to allow full screen windows to receive events
@interface SFWindow : NSWindow
@end

View File

@ -1,157 +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/Cocoa/WindowController.h>
#import <SFML/Window/Cocoa/WindowImplCocoa.hpp>
#import <SFML/Window/Cocoa/AppController.h>
#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::cerr << "-[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 =
massert([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
@implementation SFWindow
- (BOOL)canBecomeKeyWindow
{
return YES;
}
- (BOOL)canBecomeMainWindow
{
return YES;
}
@end

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2008 Lucas Soltic (elmerod@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@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.
@ -32,13 +32,16 @@
#include <SFML/Window/WindowImpl.hpp>
#include <string>
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
@class WindowWrapper;
#endif
namespace sf
{
namespace priv
{
typedef struct objc_members objc_members;
////////////////////////////////////////////////////////////
/// WindowImplCocoa is the Cocoa implementation of WindowImpl
////////////////////////////////////////////////////////////
@ -88,25 +91,23 @@ public :
////////////////////////////////////////////////////////////
static bool IsContextActive();
////////////////////////////////////////////////////////////
/// Handle Cocoa NSEvent
////////////////////////////////////////////////////////////
void HandleEvent(void *eventRef);
////////////////////////////////////////////////////////////
/// Handle an event sent by the default NSNotificationCenter
////////////////////////////////////////////////////////////
void HandleNotifiedEvent(Event& eventRef);
////////////////////////////////////////////////////////////
/// Return a pointer to the NSWindow (objc->windowHandle) object
/// Event handling for every event type.
/// 'eventRef' is a NSEvent.
////////////////////////////////////////////////////////////
void *CocoaWindow(void);
void HandleKeyDown(void *eventRef);
void HandleKeyUp(void *eventRef);
void HandleModifierKey(void *eventRef);
void HandleMouseDown(void *eventRef);
void HandleMouseUp(void *eventRef);
void HandleMouseMove(void *eventRef);
void HandleMouseWheel(void *eventRef);
////////////////////////////////////////////////////////////
/// Return whether the window is in full screen mode
////////////////////////////////////////////////////////////
bool IsFullscreen(void);
private :
////////////////////////////////////////////////////////////
@ -182,38 +183,19 @@ private :
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// Event handling for every event type.
/// 'eventRef' is a NSEvent.
////////////////////////////////////////////////////////////
int HandleKeyDown(void *eventRef);
int HandleKeyUp(void *eventRef);
int HandleModifierKey(void *eventRef);
int HandleMouseDown(void *eventRef);
int HandleMouseUp(void *eventRef);
int HandleMouseMove(void *eventRef);
int HandleMouseWheel(void *eventRef);
////////////////////////////////////////////////////////////
/// Make some allocations and initializations
////////////////////////////////////////////////////////////
void Initialize(void);
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
// An opaque structure that contains all obj-C objects
objc_members *members;
#ifdef __OBJC__
WindowWrapper *myWrapper;
#else
void *myWrapper;
#endif
bool useKeyRepeat;
bool mouseIn;
float wheelStatus;
bool fullscreen;
VideoMode fullscreenMode;
VideoMode desktopMode;
bool myUseKeyRepeat;
bool myMouseIn;
float myWheelStatus;
};
} // namespace priv

File diff suppressed because it is too large Load Diff

View File

@ -61,15 +61,24 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& Modes)
XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes);
if (Sizes && (NbSizes > 0))
{
// Add them to the video modes array
for (int i = 0; i < NbSizes; ++i)
// Get the list of supported depths
int NbDepths = 0;
int* Depths = XListDepths(Disp, Screen, &NbDepths);
if (Depths && (NbDepths > 0))
{
// Convert to sfVideoMode
VideoMode Mode(Sizes[i].width, Sizes[i].height, 32);
// 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);
// Combine depths and sizes to fill the array of supported modes
for (int i = 0; i < NbDepths; ++i)
{
for (int j = 0; j < NbSizes; ++j)
{
// Convert to VideoMode
VideoMode Mode(Sizes[j].width, Sizes[j].height, Depths[i]);
// 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);
}
}
}
}
@ -116,7 +125,7 @@ VideoMode VideoModeSupport::GetDesktopVideoMode()
int NbSizes;
XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes);
if (Sizes && (NbSizes > 0))
DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, 32);
DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, DefaultDepth(Disp, Screen));
// Free the configuration instance
XRRFreeScreenConfigInfo(Config);

View File

@ -44,6 +44,16 @@ namespace
unsigned long EventMask = FocusChangeMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
PointerMotionMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask |
EnterWindowMask | LeaveWindowMask;
////////////////////////////////////////////////////////////
/// Filter the events received by windows
/// (only allow those matching a specific window)
////////////////////////////////////////////////////////////
Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData)
{
// Just check if the event matches the window
return Event->xany.window == reinterpret_cast< ::Window >(UserData);
}
}
@ -255,30 +265,53 @@ WindowImplX11::~WindowImplX11()
////////////////////////////////////////////////////////////
void WindowImplX11::ProcessEvents()
{
// This function implements a workaround to properly discard
// repeated key events when necessary. The problem is that the
// system's key events policy doesn't match SFML's one: X server will generate
// both repeated KeyPress and KeyRelease events when maintaining a key down, while
// SFML only wants repeated KeyPress events. Thus, we have to:
// - Discard duplicated KeyRelease events when EnableKeyRepeat is true
// - Discard both duplicated KeyPress and KeyRelease events when EnableKeyRepeat is false
// Process any event in the queue matching our window
XEvent Event;
while (XCheckIfEvent(myDisplay, &Event, &WindowImplX11::CheckEvent, reinterpret_cast<XPointer>(myWindow)))
while (XCheckIfEvent(myDisplay, &Event, &CheckEvent, reinterpret_cast<XPointer>(myWindow)))
{
// Filter repeated key events
if (Event.type == KeyRelease)
// Detect repeated key events
if ((Event.type == KeyPress) || (Event.type == KeyRelease))
{
if (XPending(myDisplay))
if (Event.xkey.keycode < 256)
{
XEvent NextEvent;
XPeekEvent(myDisplay, &NextEvent);
if ((NextEvent.type == KeyPress) &&
(NextEvent.xkey.keycode == Event.xkey.keycode) &&
(NextEvent.xkey.time == Event.xkey.time))
// To detect if it is a repeated key event, we check the current state of the key.
// - If the state is "down", KeyReleased events must obviously be discarded.
// - KeyPress events are a little bit harder to handle: they depend on the EnableKeyRepeat state,
// and we need to properly forward the first one.
char Keys[32];
XQueryKeymap(myDisplay, Keys);
if (Keys[Event.xkey.keycode >> 3] & (1 << (Event.xkey.keycode % 8)))
{
if (!myKeyRepeat)
XNextEvent(myDisplay, &NextEvent);
continue;
// KeyRelease event + key down = repeated event --> discard
if (Event.type == KeyRelease)
{
myLastKeyReleaseEvent = Event;
continue;
}
// KeyPress event + key repeat disabled + matching KeyRelease event = repeated event --> discard
if ((Event.type == KeyPress) && !myKeyRepeat &&
(myLastKeyReleaseEvent.xkey.keycode == Event.xkey.keycode) &&
(myLastKeyReleaseEvent.xkey.time == Event.xkey.time))
{
continue;
}
}
}
}
// Process the event
ProcessEvent(Event);
}
}
}
@ -467,6 +500,9 @@ void WindowImplX11::SwitchToFullscreen(const VideoMode& Mode)
////////////////////////////////////////////////////////////
void WindowImplX11::Initialize()
{
// Make sure the "last key release" is initialized with invalid values
myLastKeyReleaseEvent.type = -1;
// Get the atom defining the close event
myAtomClose = XInternAtom(myDisplay, "WM_DELETE_WINDOW", false);
XSetWMProtocols(myDisplay, myWindow, &myAtomClose, 1);
@ -551,17 +587,6 @@ void WindowImplX11::CleanUp()
}
////////////////////////////////////////////////////////////
/// Filter the received events
/// (only allow those matching a specific window)
////////////////////////////////////////////////////////////
Bool WindowImplX11::CheckEvent(::Display*, XEvent* Event, XPointer UserData)
{
// Just check if the event matches our window
return Event->xany.window == reinterpret_cast< ::Window >(UserData);
}
////////////////////////////////////////////////////////////
/// Process an incoming event from the window
////////////////////////////////////////////////////////////

View File

@ -155,18 +155,6 @@ private :
////////////////////////////////////////////////////////////
void CleanUp();
////////////////////////////////////////////////////////////
/// Filter the received events
/// (only allow those matching a specific window)
///
/// \param Event : Event to filter
/// \param UserData : Data passed to the function (here : the window to compare)
///
/// \return True if the event belongs to the specified window
///
////////////////////////////////////////////////////////////
static Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData);
////////////////////////////////////////////////////////////
/// Process an incoming event from the window
///
@ -188,16 +176,17 @@ private :
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
DisplayRef myDisplayRef; ///< Connection to the X server
::Window myWindow; ///< X11 structure defining our window
::Display* myDisplay; ///< Pointer to the display
int myScreen; ///< Screen identifier
bool myIsExternal; ///< Tell whether the window has been created externally or by SFML
Atom myAtomClose; ///< Atom used to identify the close event
int myOldVideoMode; ///< Video mode in use before we switch to fullscreen
Cursor myHiddenCursor; ///< As X11 doesn't provide cursor hidding, we must create a transparent one
XIC myInputContext; ///< Input context used to get unicode input in our window
bool myKeyRepeat; ///< Is the KeyRepeat feature enabled ?
DisplayRef myDisplayRef; ///< Connection to the X server
::Window myWindow; ///< X11 structure defining our window
::Display* myDisplay; ///< Pointer to the display
int myScreen; ///< Screen identifier
bool myIsExternal; ///< Tell whether the window has been created externally or by SFML
Atom myAtomClose; ///< Atom used to identify the close event
int myOldVideoMode; ///< Video mode in use before we switch to fullscreen
Cursor myHiddenCursor; ///< As X11 doesn't provide cursor hidding, we must create a transparent one
XIC myInputContext; ///< Input context used to get unicode input in our window
bool myKeyRepeat; ///< Is the KeyRepeat feature enabled ?
XEvent myLastKeyReleaseEvent; ///< Last key release event we received (needed for discarding repeated key events)
};
} // namespace priv

View File

@ -32,11 +32,19 @@
#include <iostream>
////////////////////////////////////////////////////////////
// Private data
////////////////////////////////////////////////////////////
namespace
{
const sf::Window* FullscreenWindow = NULL;
}
namespace sf
{
////////////////////////////////////////////////////////////
/// Default constructor
///
////////////////////////////////////////////////////////////
Window::Window() :
myWindow (NULL),
@ -97,11 +105,30 @@ Window::~Window()
////////////////////////////////////////////////////////////
void Window::Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const ContextSettings& Settings)
{
// Check validity of video mode
if ((WindowStyle & Style::Fullscreen) && !Mode.IsValid())
// Destroy the previous window implementation
Close();
// Fullscreen style requires some tests
if (WindowStyle & Style::Fullscreen)
{
std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl;
Mode = VideoMode::GetMode(0);
// Make sure there's not already a fullscreen window (only one is allowed)
if (FullscreenWindow)
{
std::cerr << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
WindowStyle &= ~Style::Fullscreen;
}
else
{
// Make sure the chosen video mode is compatible
if (!Mode.IsValid())
{
std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl;
Mode = VideoMode::GetMode(0);
}
// Update the fullscreen window
FullscreenWindow = this;
}
}
// Check validity of style
@ -131,7 +158,7 @@ void Window::Create(VideoMode Mode, const std::string& Title, unsigned long Wind
void Window::Create(WindowHandle Handle, const ContextSettings& Settings)
{
// Recreate the window implementation
delete myWindow;
Close();
myWindow = priv::WindowImpl::New(Handle);
// Make sure another context is bound, so that:
@ -170,6 +197,10 @@ void Window::Close()
delete myWindow;
myWindow = NULL;
}
// Update the fullscreen window
if (this == FullscreenWindow)
FullscreenWindow = NULL;
}