From: Lukel495 Date: Thu, 9 Nov 2023 12:35:47 +0000 (+0100) Subject: Bilderna till spelet X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=0c772c8f2ec10d8faf96bf8e26f67bd76caf022b;p=TDDC76_proj.git Bilderna till spelet --- diff --git a/SFML-2.1-osx-clang-universal/.DS_Store b/SFML-2.1-osx-clang-universal/.DS_Store new file mode 100644 index 0000000..e44b783 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/.DS_Store differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Headers b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/SFML b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/SFML new file mode 120000 index 0000000..4db0e98 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/SFML @@ -0,0 +1 @@ +Versions/Current/SFML \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio.hpp new file mode 100644 index 0000000..1129863 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio.hpp @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_HPP +#define SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup audio Audio module +/// +/// Sounds, streaming (musics or custom sources), recording, +/// spatialization. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Export.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Export.hpp new file mode 100644 index 0000000..7c4b6ca --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_EXPORT_HPP +#define SFML_AUDIO_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_AUDIO_EXPORTS) + + #define SFML_AUDIO_API SFML_API_EXPORT + +#else + + #define SFML_AUDIO_API SFML_API_IMPORT + +#endif + + +#endif // SFML_AUDIO_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Listener.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Listener.hpp new file mode 100644 index 0000000..213d96a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Listener.hpp @@ -0,0 +1,184 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LISTENER_HPP +#define SFML_LISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief The audio listener is the point in the scene +/// from where all the sounds are heard +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Listener +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Change the global volume of all the sounds and musics + /// + /// The volume is a number between 0 and 100; it is combined with + /// the individual volume of each sound / music. + /// The default value for the volume is 100 (maximum). + /// + /// \param volume New global volume, in the range [0, 100] + /// + /// \see getGlobalVolume + /// + //////////////////////////////////////////////////////////// + static void setGlobalVolume(float volume); + + //////////////////////////////////////////////////////////// + /// \brief Get the current value of the global volume + /// + /// \return Current global volume, in the range [0, 100] + /// + /// \see setGlobalVolume + /// + //////////////////////////////////////////////////////////// + static float getGlobalVolume(); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param x X coordinate of the listener's position + /// \param y Y coordinate of the listener's position + /// \param z Z coordinate of the listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param position New listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector3f& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the listener in the scene + /// + /// \return Listener's position + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + static Vector3f getPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the listener in the scene + /// + /// The orientation defines the 3D axes of the listener + /// (left, up, front) in the scene. The orientation vector + /// doesn't have to be normalized. + /// The default listener's orientation is (0, 0, -1). + /// + /// \param x X coordinate of the listener's orientation + /// \param y Y coordinate of the listener's orientation + /// \param z Z coordinate of the listener's orientation + /// + /// \see getDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the listener in the scene + /// + /// The orientation defines the 3D axes of the listener + /// (left, up, front) in the scene. The orientation vector + /// doesn't have to be normalized. + /// The default listener's orientation is (0, 0, -1). + /// + /// \param direction New listener's orientation + /// + /// \see getDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(const Vector3f& direction); + + //////////////////////////////////////////////////////////// + /// \brief Get the current orientation of the listener in the scene + /// + /// \return Listener's orientation + /// + /// \see setDirection + /// + //////////////////////////////////////////////////////////// + static Vector3f getDirection(); +}; + +} // namespace sf + + +#endif // SFML_LISTENER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Listener +/// \ingroup audio +/// +/// The audio listener defines the global properties of the +/// audio environment, it defines where and how sounds and musics +/// are heard. If sf::View is the eyes of the user, then sf::Listener +/// is his ears (by the way, they are often linked together -- +/// same position, orientation, etc.). +/// +/// sf::Listener is a simple interface, which allows to setup the +/// listener in the 3D audio environment (position and direction), +/// and to adjust the global volume. +/// +/// Because the listener is unique in the scene, sf::Listener only +/// contains static functions and doesn't have to be instanciated. +/// +/// Usage example: +/// \code +/// // Move the listener to the position (1, 0, -5) +/// sf::Listener::setPosition(1, 0, -5); +/// +/// // Make it face the right axis (1, 0, 0) +/// sf::Listener::setDirection(1, 0, 0); +/// +/// // Reduce the global volume +/// sf::Listener::setGlobalVolume(50); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Music.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Music.hpp new file mode 100644 index 0000000..ba922e9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Music.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUSIC_HPP +#define SFML_MUSIC_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class SoundFile; +} + +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Streamed music played from an audio file +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Music : public SoundStream +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Music(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Music(); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the music file to open + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromMemory, openFromStream + /// + //////////////////////////////////////////////////////////// + bool openFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file in memory + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// Since the music is not loaded completely but rather streamed + /// continuously, the \a data must remain available as long as the + /// music is playing (ie. you can't deallocate it right after calling + /// this function). + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromFile, openFromStream + /// + //////////////////////////////////////////////////////////// + bool openFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file in a custom stream + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// Since the music is not loaded completely but rather streamed + /// continuously, the \a stream must remain alive as long as the + /// music is playing (ie. you can't destroy it right after calling + /// this function). + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromFile, openFromMemory + /// + //////////////////////////////////////////////////////////// + bool openFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Get the total duration of the music + /// + /// \return Music duration + /// + //////////////////////////////////////////////////////////// + Time getDuration() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Request a new chunk of audio samples from the stream source + /// + /// This function fills the chunk from the next samples + /// to read from the audio file. + /// + /// \param data Chunk of data to fill + /// + /// \return True to continue playback, false to stop + /// + //////////////////////////////////////////////////////////// + virtual bool onGetData(Chunk& data); + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position in the stream source + /// + /// \param timeOffset New playing position, from the beginning of the music + /// + //////////////////////////////////////////////////////////// + virtual void onSeek(Time timeOffset); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Initialize the internal state after loading a new music + /// + //////////////////////////////////////////////////////////// + void initialize(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::SoundFile* m_file; ///< Sound file + Time m_duration; ///< Music duration + std::vector m_samples; ///< Temporary buffer of samples + Mutex m_mutex; ///< Mutex protecting the data +}; + +} // namespace sf + + +#endif // SFML_MUSIC_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Music +/// \ingroup audio +/// +/// Musics are sounds that are streamed rather than completely +/// loaded in memory. This is especially useful for compressed +/// musics that usually take hundreds of MB when they are +/// uncompressed: by streaming it instead of loading it entirely, +/// you avoid saturating the memory and have almost no loading delay. +/// +/// Apart from that, a sf::Music has almost the same features as +/// the sf::SoundBuffer / sf::Sound pair: you can play/pause/stop +/// it, request its parameters (channels, sample rate), change +/// the way it is played (pitch, volume, 3D position, ...), etc. +/// +/// As a sound stream, a music is played in its own thread in order +/// not to block the rest of the program. This means that you can +/// leave the music alone after calling play(), it will manage itself +/// very well. +/// +/// Usage example: +/// \code +/// // Declare a new music +/// sf::Music music; +/// +/// // Open it from an audio file +/// if (!music.openFromFile("music.ogg")) +/// { +/// // error... +/// } +/// +/// // Change some parameters +/// music.setPosition(0, 1, 10); // change its 3D position +/// music.setPitch(2); // increase the pitch +/// music.setVolume(50); // reduce the volume +/// music.setLoop(true); // make it loop +/// +/// // Play it +/// music.play(); +/// \endcode +/// +/// \see sf::Sound, sf::SoundStream +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Sound.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Sound.hpp new file mode 100644 index 0000000..1250f42 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/Sound.hpp @@ -0,0 +1,262 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUND_HPP +#define SFML_SOUND_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class SoundBuffer; + +//////////////////////////////////////////////////////////// +/// \brief Regular sound that can be played in the audio environment +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Sound : public SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Sound(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sound with a buffer + /// + /// \param buffer Sound buffer containing the audio data to play with the sound + /// + //////////////////////////////////////////////////////////// + explicit Sound(const SoundBuffer& buffer); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + Sound(const Sound& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Sound(); + + //////////////////////////////////////////////////////////// + /// \brief Start or resume playing the sound + /// + /// This function starts the stream if it was stopped, resumes + /// it if it was paused, and restarts it from beginning if it + /// was it already playing. + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the sound is played. + /// + /// \see pause, stop + /// + //////////////////////////////////////////////////////////// + void play(); + + //////////////////////////////////////////////////////////// + /// \brief Pause the sound + /// + /// This function pauses the sound if it was playing, + /// otherwise (sound already paused or stopped) it has no effect. + /// + /// \see play, stop + /// + //////////////////////////////////////////////////////////// + void pause(); + + //////////////////////////////////////////////////////////// + /// \brief stop playing the sound + /// + /// This function stops the sound if it was playing or paused, + /// and does nothing if it was already stopped. + /// It also resets the playing position (unlike pause()). + /// + /// \see play, pause + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Set the source buffer containing the audio data to play + /// + /// It is important to note that the sound buffer is not copied, + /// thus the sf::SoundBuffer instance must remain alive as long + /// as it is attached to the sound. + /// + /// \param buffer Sound buffer to attach to the sound + /// + /// \see getBuffer + /// + //////////////////////////////////////////////////////////// + void setBuffer(const SoundBuffer& buffer); + + //////////////////////////////////////////////////////////// + /// \brief Set whether or not the sound should loop after reaching the end + /// + /// If set, the sound will restart from beginning after + /// reaching the end and so on, until it is stopped or + /// setLoop(false) is called. + /// The default looping state for sound is false. + /// + /// \param loop True to play in loop, false to play once + /// + /// \see getLoop + /// + //////////////////////////////////////////////////////////// + void setLoop(bool loop); + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position of the sound + /// + /// The playing position can be changed when the sound is + /// either paused or playing. + /// + /// \param timeOffset New playing position, from the beginning of the sound + /// + /// \see getPlayingOffset + /// + //////////////////////////////////////////////////////////// + void setPlayingOffset(Time timeOffset); + + //////////////////////////////////////////////////////////// + /// \brief Get the audio buffer attached to the sound + /// + /// \return Sound buffer attached to the sound (can be NULL) + /// + //////////////////////////////////////////////////////////// + const SoundBuffer* getBuffer() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the sound is in loop mode + /// + /// \return True if the sound is looping, false otherwise + /// + /// \see setLoop + /// + //////////////////////////////////////////////////////////// + bool getLoop() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current playing position of the sound + /// + /// \return Current playing position, from the beginning of the sound + /// + /// \see setPlayingOffset + /// + //////////////////////////////////////////////////////////// + Time getPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the sound (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Sound& operator =(const Sound& right); + + //////////////////////////////////////////////////////////// + /// \brief Reset the internal buffer of the sound + /// + /// This function is for internal use only, you don't have + /// to use it. It is called by the sf::SoundBuffer that + /// this sound uses, when it is destroyed in order to prevent + /// the sound from using a dead buffer. + /// + //////////////////////////////////////////////////////////// + void resetBuffer(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + const SoundBuffer* m_buffer; ///< Sound buffer bound to the source +}; + +} // namespace sf + + +#endif // SFML_SOUND_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Sound +/// \ingroup audio +/// +/// sf::Sound is the class to use to play sounds. +/// It provides: +/// \li Control (play, pause, stop) +/// \li Ability to modify output parameters in real-time (pitch, volume, ...) +/// \li 3D spatial features (position, attenuation, ...). +/// +/// sf::Sound is perfect for playing short sounds that can +/// fit in memory and require no latency, like foot steps or +/// gun shots. For longer sounds, like background musics +/// or long speeches, rather see sf::Music (which is based +/// on streaming). +/// +/// In order to work, a sound must be given a buffer of audio +/// data to play. Audio data (samples) is stored in sf::SoundBuffer, +/// and attached to a sound with the setBuffer() function. +/// The buffer object attached to a sound must remain alive +/// as long as the sound uses it. Note that multiple sounds +/// can use the same sound buffer at the same time. +/// +/// Usage example: +/// \code +/// sf::SoundBuffer buffer; +/// buffer.loadFromFile("sound.wav"); +/// +/// sf::Sound sound; +/// sound.setBuffer(buffer); +/// sound.play(); +/// \endcode +/// +/// \see sf::SoundBuffer, sf::Music +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBuffer.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBuffer.hpp new file mode 100644 index 0000000..23fed88 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBuffer.hpp @@ -0,0 +1,359 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFER_HPP +#define SFML_SOUNDBUFFER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class SoundFile; +} + +class Sound; +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Storage for audio samples defining a sound +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundBuffer +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SoundBuffer(const SoundBuffer& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a file + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the sound file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream, loadFromSamples, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a file in memory + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a custom stream + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from an array of audio samples + /// + /// The assumed format of the audio samples is 16 bits signed integer + /// (sf::Int16). + /// + /// \param samples Pointer to the array of samples in memory + /// \param sampleCount Number of samples in the array + /// \param channelCount Number of channels (1 = mono, 2 = stereo, ...) + /// \param sampleRate Sample rate (number of samples to play per second) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Save the sound buffer to an audio file + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the sound file to write + /// + /// \return True if saving succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool saveToFile(const std::string& filename) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the array of audio samples stored in the buffer + /// + /// The format of the returned samples is 16 bits signed integer + /// (sf::Int16). The total number of samples in this array + /// is given by the getSampleCount() function. + /// + /// \return Read-only pointer to the array of sound samples + /// + /// \see getSampleCount + /// + //////////////////////////////////////////////////////////// + const Int16* getSamples() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of samples stored in the buffer + /// + /// The array of samples can be accessed with the getSamples() + /// function. + /// + /// \return Number of samples + /// + /// \see getSamples + /// + //////////////////////////////////////////////////////////// + std::size_t getSampleCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sample rate of the sound + /// + /// The sample rate is the number of samples played per second. + /// The higher, the better the quality (for example, 44100 + /// samples/s is CD quality). + /// + /// \return Sample rate (number of samples per second) + /// + /// \see getChannelCount, getDuration + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of channels used by the sound + /// + /// If the sound is mono then the number of channels will + /// be 1, 2 for stereo, etc. + /// + /// \return Number of channels + /// + /// \see getSampleRate, getDuration + /// + //////////////////////////////////////////////////////////// + unsigned int getChannelCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the total duration of the sound + /// + /// \return Sound duration + /// + /// \see getSampleRate, getChannelCount + /// + //////////////////////////////////////////////////////////// + Time getDuration() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + SoundBuffer& operator =(const SoundBuffer& right); + +private : + + friend class Sound; + + //////////////////////////////////////////////////////////// + /// \brief Initialize the internal state after loading a new sound + /// + /// \param file Sound file providing access to the new loaded sound + /// + /// \return True on succesful initialization, false on failure + /// + //////////////////////////////////////////////////////////// + bool initialize(priv::SoundFile& file); + + //////////////////////////////////////////////////////////// + /// \brief Update the internal buffer with the cached audio samples + /// + /// \param channelCount Number of channels + /// \param sampleRate Sample rate (number of samples per second) + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool update(unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Add a sound to the list of sounds that use this buffer + /// + /// \param sound Sound instance to attach + /// + //////////////////////////////////////////////////////////// + void attachSound(Sound* sound) const; + + //////////////////////////////////////////////////////////// + /// \brief Remove a sound from the list of sounds that use this buffer + /// + /// \param sound Sound instance to detach + /// + //////////////////////////////////////////////////////////// + void detachSound(Sound* sound) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::set SoundList; ///< Set of unique sound instances + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_buffer; ///< OpenAL buffer identifier + std::vector m_samples; ///< Samples buffer + Time m_duration; ///< Sound duration + mutable SoundList m_sounds; ///< List of sounds that are using this buffer +}; + +} // namespace sf + + +#endif // SFML_SOUNDBUFFER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundBuffer +/// \ingroup audio +/// +/// A sound buffer holds the data of a sound, which is +/// an array of audio samples. A sample is a 16 bits signed integer +/// that defines the amplitude of the sound at a given time. +/// The sound is then restituted by playing these samples at +/// a high rate (for example, 44100 samples per second is the +/// standard rate used for playing CDs). In short, audio samples +/// are like texture pixels, and a sf::SoundBuffer is similar to +/// a sf::Texture. +/// +/// A sound buffer can be loaded from a file (see loadFromFile() +/// for the complete list of supported formats), from memory, from +/// a custom stream (see sf::InputStream) or directly from an array +/// of samples. It can also be saved back to a file. +/// +/// Sound buffers alone are not very useful: they hold the audio data +/// but cannot be played. To do so, you need to use the sf::Sound class, +/// which provides functions to play/pause/stop the sound as well as +/// changing the way it is outputted (volume, pitch, 3D position, ...). +/// This separation allows more flexibility and better performances: +/// indeed a sf::SoundBuffer is a heavy resource, and any operation on it +/// is slow (often too slow for real-time applications). On the other +/// side, a sf::Sound is a lightweight object, which can use the audio data +/// of a sound buffer and change the way it is played without actually +/// modifying that data. Note that it is also possible to bind +/// several sf::Sound instances to the same sf::SoundBuffer. +/// +/// It is important to note that the sf::Sound instance doesn't +/// copy the buffer that it uses, it only keeps a reference to it. +/// Thus, a sf::SoundBuffer must not be destructed while it is +/// used by a sf::Sound (i.e. never write a function that +/// uses a local sf::SoundBuffer instance for loading a sound). +/// +/// Usage example: +/// \code +/// // Declare a new sound buffer +/// sf::SoundBuffer buffer; +/// +/// // Load it from a file +/// if (!buffer.loadFromFile("sound.wav")) +/// { +/// // error... +/// } +/// +/// // Create a sound source and bind it to the buffer +/// sf::Sound sound1; +/// sound1.setBuffer(buffer); +/// +/// // Play the sound +/// sound1.play(); +/// +/// // Create another sound source bound to the same buffer +/// sf::Sound sound2; +/// sound2.setBuffer(buffer); +/// +/// // Play it with a higher pitch -- the first sound remains unchanged +/// sound2.setPitch(2); +/// sound2.play(); +/// \endcode +/// +/// \see sf::Sound, sf::SoundBufferRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBufferRecorder.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBufferRecorder.hpp new file mode 100644 index 0000000..fa4ac4c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundBufferRecorder.hpp @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFERRECORDER_HPP +#define SFML_SOUNDBUFFERRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized SoundRecorder which stores the captured +/// audio data into a sound buffer +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundBufferRecorder : public SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Get the sound buffer containing the captured audio data + /// + /// The sound buffer is valid only after the capture has ended. + /// This function provides a read-only access to the internal + /// sound buffer, but it can be copied if you need to + /// make any modification to it. + /// + /// \return Read-only access to the sound buffer + /// + //////////////////////////////////////////////////////////// + const SoundBuffer& getBuffer() const; + +protected: + + //////////////////////////////////////////////////////////// + /// \brief Start capturing audio data + /// + /// \return True to start the capture, or false to abort it + /// + //////////////////////////////////////////////////////////// + virtual bool onStart(); + + //////////////////////////////////////////////////////////// + /// \brief Process a new chunk of recorded samples + /// + /// \param samples Pointer to the new chunk of recorded samples + /// \param sampleCount Number of samples pointed by \a samples + /// + /// \return True to continue the capture, or false to stop it + /// + //////////////////////////////////////////////////////////// + virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount); + + //////////////////////////////////////////////////////////// + /// \brief Stop capturing audio data + /// + //////////////////////////////////////////////////////////// + virtual void onStop(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_samples; ///< Temporary sample buffer to hold the recorded data + SoundBuffer m_buffer; ///< Sound buffer that will contain the recorded data +}; + +} // namespace sf + +#endif // SFML_SOUNDBUFFERRECORDER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundBufferRecorder +/// \ingroup audio +/// +/// sf::SoundBufferRecorder allows to access a recorded sound +/// through a sf::SoundBuffer, so that it can be played, saved +/// to a file, etc. +/// +/// It has the same simple interface as its base class (start(), stop()) +/// and adds a function to retrieve the recorded sound buffer +/// (getBuffer()). +/// +/// As usual, don't forget to call the isAvailable() function +/// before using this class (see sf::SoundRecorder for more details +/// about this). +/// +/// Usage example: +/// \code +/// if (sf::SoundBufferRecorder::isAvailable()) +/// { +/// // Record some audio data +/// sf::SoundBufferRecorder recorder; +/// recorder.start(); +/// ... +/// recorder.stop(); +/// +/// // Get the buffer containing the captured audio data +/// const sf::SoundBuffer& buffer = recorder.getBuffer(); +/// +/// // Save it to a file (for example...) +/// buffer.saveToFile("my_record.ogg"); +/// } +/// \endcode +/// +/// \see sf::SoundRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundRecorder.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundRecorder.hpp new file mode 100644 index 0000000..eddf48e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundRecorder.hpp @@ -0,0 +1,270 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDRECORDER_HPP +#define SFML_SOUNDRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for capturing sound data +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundRecorder(); + + //////////////////////////////////////////////////////////// + /// \brief Start the capture + /// + /// The \a sampleRate parameter defines the number of audio samples + /// captured per second. The higher, the better the quality + /// (for example, 44100 samples/sec is CD quality). + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the capture runs. + /// Please note that only one capture can happen at the same time. + /// + /// \param sampleRate Desired capture rate, in number of samples per second + /// + /// \see stop + /// + //////////////////////////////////////////////////////////// + void start(unsigned int sampleRate = 44100); + + //////////////////////////////////////////////////////////// + /// \brief Stop the capture + /// + /// \see start + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Get the sample rate + /// + /// The sample rate defines the number of audio samples + /// captured per second. The higher, the better the quality + /// (for example, 44100 samples/sec is CD quality). + /// + /// \return Sample rate, in samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the system supports audio capture + /// + /// This function should always be called before using + /// the audio capture features. If it returns false, then + /// any attempt to use sf::SoundRecorder or one of its derived + /// classes will fail. + /// + /// \return True if audio capture is supported, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isAvailable(); + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is only meant to be called by derived classes. + /// + //////////////////////////////////////////////////////////// + SoundRecorder(); + + //////////////////////////////////////////////////////////// + /// \brief Start capturing audio data + /// + /// This virtual function may be overriden by a derived class + /// if something has to be done every time a new capture + /// starts. If not, this function can be ignored; the default + /// implementation does nothing. + /// + /// \return True to start the capture, or false to abort it + /// + //////////////////////////////////////////////////////////// + virtual bool onStart(); + + //////////////////////////////////////////////////////////// + /// \brief Process a new chunk of recorded samples + /// + /// This virtual function is called every time a new chunk of + /// recorded data is available. The derived class can then do + /// whatever it wants with it (storing it, playing it, sending + /// it over the network, etc.). + /// + /// \param samples Pointer to the new chunk of recorded samples + /// \param sampleCount Number of samples pointed by \a samples + /// + /// \return True to continue the capture, or false to stop it + /// + //////////////////////////////////////////////////////////// + virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Stop capturing audio data + /// + /// This virtual function may be overriden by a derived class + /// if something has to be done every time the capture + /// ends. If not, this function can be ignored; the default + /// implementation does nothing. + /// + //////////////////////////////////////////////////////////// + virtual void onStop(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Function called as the entry point of the thread + /// + /// This function starts the recording loop, and returns + /// only when the capture is stopped. + /// + //////////////////////////////////////////////////////////// + void record(); + + //////////////////////////////////////////////////////////// + /// \brief Get the new available audio samples and process them + /// + /// This function is called continuously during the + /// capture loop. It retrieves the captured samples and + /// forwards them to the derived class. + /// + //////////////////////////////////////////////////////////// + void processCapturedSamples(); + + //////////////////////////////////////////////////////////// + /// \brief Clean up the recorder's internal resources + /// + /// This function is called when the capture stops. + /// + //////////////////////////////////////////////////////////// + void cleanup(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Thread m_thread; ///< Thread running the background recording task + std::vector m_samples; ///< Buffer to store captured samples + unsigned int m_sampleRate; ///< Sample rate + bool m_isCapturing; ///< Capturing state +}; + +} // namespace sf + + +#endif // SFML_SOUNDRECORDER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundRecorder +/// \ingroup audio +/// +/// sf::SoundBuffer provides a simple interface to access +/// the audio recording capabilities of the computer +/// (the microphone). As an abstract base class, it only cares +/// about capturing sound samples, the task of making something +/// useful with them is left to the derived class. Note that +/// SFML provides a built-in specialization for saving the +/// captured data to a sound buffer (see sf::SoundBufferRecorder). +/// +/// A derived class has only one virtual function to override: +/// \li onProcessSamples provides the new chunks of audio samples while the capture happens +/// +/// Moreover, two additionnal virtual functions can be overriden +/// as well if necessary: +/// \li onStart is called before the capture happens, to perform custom initializations +/// \li onStop is called after the capture ends, to perform custom cleanup +/// +/// The audio capture feature may not be supported or activated +/// on every platform, thus it is recommended to check its +/// availability with the isAvailable() function. If it returns +/// false, then any attempt to use an audio recorder will fail. +/// +/// It is important to note that the audio capture happens in a +/// separate thread, so that it doesn't block the rest of the +/// program. In particular, the onProcessSamples and onStop +/// virtual functions (but not onStart) will be called +/// from this separate thread. It is important to keep this in +/// mind, because you may have to take care of synchronization +/// issues if you share data between threads. +/// +/// Usage example: +/// \code +/// class CustomRecorder : public sf::SoundRecorder +/// { +/// virtual bool onStart() // optional +/// { +/// // Initialize whatever has to be done before the capture starts +/// ... +/// +/// // Return true to start playing +/// return true; +/// } +/// +/// virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) +/// { +/// // Do something with the new chunk of samples (store them, send them, ...) +/// ... +/// +/// // Return true to continue playing +/// return true; +/// } +/// +/// virtual void onStop() // optional +/// { +/// // Clean up whatever has to be done after the capture ends +/// ... +/// } +/// } +/// +/// // Usage +/// if (CustomRecorder::isAvailable()) +/// { +/// CustomRecorder recorder; +/// recorder.start(); +/// ... +/// recorder.stop(); +/// } +/// \endcode +/// +/// \see sf::SoundBufferRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundSource.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundSource.hpp new file mode 100644 index 0000000..8ccc0b7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundSource.hpp @@ -0,0 +1,286 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSOURCE_HPP +#define SFML_SOUNDSOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class defining a sound's properties +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the sound source states + /// + //////////////////////////////////////////////////////////// + enum Status + { + Stopped, ///< Sound is not playing + Paused, ///< Sound is paused + Playing ///< Sound is playing + }; + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SoundSource(const SoundSource& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundSource(); + + //////////////////////////////////////////////////////////// + /// \brief Set the pitch of the sound + /// + /// The pitch represents the perceived fundamental frequency + /// of a sound; thus you can make a sound more acute or grave + /// by changing its pitch. A side effect of changing the pitch + /// is to modify the playing speed of the sound as well. + /// The default value for the pitch is 1. + /// + /// \param pitch New pitch to apply to the sound + /// + /// \see getPitch + /// + //////////////////////////////////////////////////////////// + void setPitch(float pitch); + + //////////////////////////////////////////////////////////// + /// \brief Set the volume of the sound + /// + /// The volume is a value between 0 (mute) and 100 (full volume). + /// The default value for the volume is 100. + /// + /// \param volume Volume of the sound + /// + /// \see getVolume + /// + //////////////////////////////////////////////////////////// + void setVolume(float volume); + + //////////////////////////////////////////////////////////// + /// \brief Set the 3D position of the sound in the audio scene + /// + /// Only sounds with one channel (mono sounds) can be + /// spatialized. + /// The default position of a sound is (0, 0, 0). + /// + /// \param x X coordinate of the position of the sound in the scene + /// \param y Y coordinate of the position of the sound in the scene + /// \param z Z coordinate of the position of the sound in the scene + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the 3D position of the sound in the audio scene + /// + /// Only sounds with one channel (mono sounds) can be + /// spatialized. + /// The default position of a sound is (0, 0, 0). + /// + /// \param position Position of the sound in the scene + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector3f& position); + + //////////////////////////////////////////////////////////// + /// \brief Make the sound's position relative to the listener or absolute + /// + /// Making a sound relative to the listener will ensure that it will always + /// be played the same way regardless the position of the listener. + /// This can be useful for non-spatialized sounds, sounds that are + /// produced by the listener, or sounds attached to it. + /// The default value is false (position is absolute). + /// + /// \param relative True to set the position relative, false to set it absolute + /// + /// \see isRelativeToListener + /// + //////////////////////////////////////////////////////////// + void setRelativeToListener(bool relative); + + //////////////////////////////////////////////////////////// + /// \brief Set the minimum distance of the sound + /// + /// The "minimum distance" of a sound is the maximum + /// distance at which it is heard at its maximum volume. Further + /// than the minimum distance, it will start to fade out according + /// to its attenuation factor. A value of 0 ("inside the head + /// of the listener") is an invalid value and is forbidden. + /// The default value of the minimum distance is 1. + /// + /// \param distance New minimum distance of the sound + /// + /// \see getMinDistance, setAttenuation + /// + //////////////////////////////////////////////////////////// + void setMinDistance(float distance); + + //////////////////////////////////////////////////////////// + /// \brief Set the attenuation factor of the sound + /// + /// The attenuation is a multiplicative factor which makes + /// the sound more or less loud according to its distance + /// from the listener. An attenuation of 0 will produce a + /// non-attenuated sound, i.e. its volume will always be the same + /// whether it is heard from near or from far. On the other hand, + /// an attenuation value such as 100 will make the sound fade out + /// very quickly as it gets further from the listener. + /// The default value of the attenuation is 1. + /// + /// \param attenuation New attenuation factor of the sound + /// + /// \see getAttenuation, setMinDistance + /// + //////////////////////////////////////////////////////////// + void setAttenuation(float attenuation); + + //////////////////////////////////////////////////////////// + /// \brief Get the pitch of the sound + /// + /// \return Pitch of the sound + /// + /// \see setPitch + /// + //////////////////////////////////////////////////////////// + float getPitch() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the volume of the sound + /// + /// \return Volume of the sound, in the range [0, 100] + /// + /// \see setVolume + /// + //////////////////////////////////////////////////////////// + float getVolume() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the 3D position of the sound in the audio scene + /// + /// \return Position of the sound + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + Vector3f getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the sound's position is relative to the + /// listener or is absolute + /// + /// \return True if the position is relative, false if it's absolute + /// + /// \see setRelativeToListener + /// + //////////////////////////////////////////////////////////// + bool isRelativeToListener() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the minimum distance of the sound + /// + /// \return Minimum distance of the sound + /// + /// \see setMinDistance, getAttenuation + /// + //////////////////////////////////////////////////////////// + float getMinDistance() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the attenuation factor of the sound + /// + /// \return Attenuation factor of the sound + /// + /// \see setAttenuation, getMinDistance + /// + //////////////////////////////////////////////////////////// + float getAttenuation() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is meant ot be called by derived classes only. + /// + //////////////////////////////////////////////////////////// + SoundSource(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the sound (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_source; ///< OpenAL source identifier +}; + +} // namespace sf + + +#endif // SFML_SOUNDSOURCE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundSource +/// \ingroup audio +/// +/// sf::SoundSource is not meant to be used directly, it +/// only serves as a common base for all audio objects +/// that can live in the audio environment. +/// +/// It defines several properties for the sound: pitch, +/// volume, position, attenuation, etc. All of them can be +/// changed at any time with no impact on performances. +/// +/// \see sf::Sound, sf::SoundStream +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundStream.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundStream.hpp new file mode 100644 index 0000000..461dd92 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Audio/SoundStream.hpp @@ -0,0 +1,377 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSTREAM_HPP +#define SFML_SOUNDSTREAM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for streamed audio sources +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundStream : public SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a chunk of audio data to stream + /// + //////////////////////////////////////////////////////////// + struct Chunk + { + const Int16* samples; ///< Pointer to the audio samples + std::size_t sampleCount; ///< Number of samples pointed by Samples + }; + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundStream(); + + //////////////////////////////////////////////////////////// + /// \brief Start or resume playing the audio stream + /// + /// This function starts the stream if it was stopped, resumes + /// it if it was paused, and restarts it from beginning if it + /// was it already playing. + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the stream is played. + /// + /// \see pause, stop + /// + //////////////////////////////////////////////////////////// + void play(); + + //////////////////////////////////////////////////////////// + /// \brief Pause the audio stream + /// + /// This function pauses the stream if it was playing, + /// otherwise (stream already paused or stopped) it has no effect. + /// + /// \see play, stop + /// + //////////////////////////////////////////////////////////// + void pause(); + + //////////////////////////////////////////////////////////// + /// \brief Stop playing the audio stream + /// + /// This function stops the stream if it was playing or paused, + /// and does nothing if it was already stopped. + /// It also resets the playing position (unlike pause()). + /// + /// \see play, pause + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Return the number of channels of the stream + /// + /// 1 channel means a mono sound, 2 means stereo, etc. + /// + /// \return Number of channels + /// + //////////////////////////////////////////////////////////// + unsigned int getChannelCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the stream sample rate of the stream + /// + /// The sample rate is the number of audio samples played per + /// second. The higher, the better the quality. + /// + /// \return Sample rate, in number of samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the stream (stopped, paused, playing) + /// + /// \return Current status + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position of the stream + /// + /// The playing position can be changed when the stream is + /// either paused or playing. + /// + /// \param timeOffset New playing position, from the beginning of the stream + /// + /// \see getPlayingOffset + /// + //////////////////////////////////////////////////////////// + void setPlayingOffset(Time timeOffset); + + //////////////////////////////////////////////////////////// + /// \brief Get the current playing position of the stream + /// + /// \return Current playing position, from the beginning of the stream + /// + /// \see setPlayingOffset + /// + //////////////////////////////////////////////////////////// + Time getPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Set whether or not the stream should loop after reaching the end + /// + /// If set, the stream will restart from beginning after + /// reaching the end and so on, until it is stopped or + /// setLoop(false) is called. + /// The default looping state for streams is false. + /// + /// \param loop True to play in loop, false to play once + /// + /// \see getLoop + /// + //////////////////////////////////////////////////////////// + void setLoop(bool loop); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the stream is in loop mode + /// + /// \return True if the stream is looping, false otherwise + /// + /// \see setLoop + /// + //////////////////////////////////////////////////////////// + bool getLoop() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is only meant to be called by derived classes. + /// + //////////////////////////////////////////////////////////// + SoundStream(); + + //////////////////////////////////////////////////////////// + /// \brief Define the audio stream parameters + /// + /// This function must be called by derived classes as soon + /// as they know the audio settings of the stream to play. + /// Any attempt to manipulate the stream (play(), ...) before + /// calling this function will fail. + /// It can be called multiple times if the settings of the + /// audio stream change, but only when the stream is stopped. + /// + /// \param channelCount Number of channels of the stream + /// \param sampleRate Sample rate, in samples per second + /// + //////////////////////////////////////////////////////////// + void initialize(unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Request a new chunk of audio samples from the stream source + /// + /// This function must be overriden by derived classes to provide + /// the audio samples to play. It is called continuously by the + /// streaming loop, in a separate thread. + /// The source can choose to stop the streaming loop at any time, by + /// returning false to the caller. + /// + /// \param data Chunk of data to fill + /// + /// \return True to continue playback, false to stop + /// + //////////////////////////////////////////////////////////// + virtual bool onGetData(Chunk& data) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position in the stream source + /// + /// This function must be overriden by derived classes to + /// allow random seeking into the stream source. + /// + /// \param timeOffset New playing position, relative to the beginning of the stream + /// + //////////////////////////////////////////////////////////// + virtual void onSeek(Time timeOffset) = 0; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Function called as the entry point of the thread + /// + /// This function starts the streaming loop, and returns + /// only when the sound is stopped. + /// + //////////////////////////////////////////////////////////// + void streamData(); + + //////////////////////////////////////////////////////////// + /// \brief Fill a new buffer with audio samples, and append + /// it to the playing queue + /// + /// This function is called as soon as a buffer has been fully + /// consumed; it fills it again and inserts it back into the + /// playing queue. + /// + /// \param buffer Number of the buffer to fill (in [0, BufferCount]) + /// + /// \return True if the stream source has requested to stop, false otherwise + /// + //////////////////////////////////////////////////////////// + bool fillAndPushBuffer(unsigned int bufferNum); + + //////////////////////////////////////////////////////////// + /// \brief Fill the audio buffers and put them all into the playing queue + /// + /// This function is called when playing starts and the + /// playing queue is empty. + /// + /// \return True if the derived class has requested to stop, false otherwise + /// + //////////////////////////////////////////////////////////// + bool fillQueue(); + + //////////////////////////////////////////////////////////// + /// \brief Clear all the audio buffers and empty the playing queue + /// + /// This function is called when the stream is stopped. + /// + //////////////////////////////////////////////////////////// + void clearQueue(); + + enum + { + BufferCount = 3 ///< Number of audio buffers used by the streaming loop + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Thread m_thread; ///< Thread running the background tasks + bool m_isStreaming; ///< Streaming state (true = playing, false = stopped) + unsigned int m_buffers[BufferCount]; ///< Sound buffers used to store temporary audio data + unsigned int m_channelCount; ///< Number of channels (1 = mono, 2 = stereo, ...) + unsigned int m_sampleRate; ///< Frequency (samples / second) + Uint32 m_format; ///< Format of the internal sound buffers + bool m_loop; ///< Loop flag (true to loop, false to play once) + Uint64 m_samplesProcessed; ///< Number of buffers processed since beginning of the stream + bool m_endBuffers[BufferCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation +}; + +} // namespace sf + + +#endif // SFML_SOUNDSTREAM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundStream +/// \ingroup audio +/// +/// Unlike audio buffers (see sf::SoundBuffer), audio streams +/// are never completely loaded in memory. Instead, the audio +/// data is acquired continuously while the stream is playing. +/// This behaviour allows to play a sound with no loading delay, +/// and keeps the memory consumption very low. +/// +/// Sound sources that need to be streamed are usually big files +/// (compressed audio musics that would eat hundreds of MB in memory) +/// or files that would take a lot of time to be received +/// (sounds played over the network). +/// +/// sf::SoundStream is a base class that doesn't care about the +/// stream source, which is left to the derived class. SFML provides +/// a built-in specialization for big files (see sf::Music). +/// No network stream source is provided, but you can write your own +/// by combining this class with the network module. +/// +/// A derived class has to override two virtual functions: +/// \li onGetData fills a new chunk of audio data to be played +/// \li onSeek changes the current playing position in the source +/// +/// It is important to note that each SoundStream is played in its +/// own separate thread, so that the streaming loop doesn't block the +/// rest of the program. In particular, the OnGetData and OnSeek +/// virtual functions may sometimes be called from this separate thread. +/// It is important to keep this in mind, because you may have to take +/// care of synchronization issues if you share data between threads. +/// +/// Usage example: +/// \code +/// class CustomStream : public sf::SoundStream +/// { +/// public : +/// +/// bool open(const std::string& location) +/// { +/// // Open the source and get audio settings +/// ... +/// unsigned int channelCount = ...; +/// unsigned int sampleRate = ...; +/// +/// // Initialize the stream -- important! +/// initialize(channelCount, sampleRate); +/// } +/// +/// private : +/// +/// virtual bool onGetData(Chunk& data) +/// { +/// // Fill the chunk with audio data from the stream source +/// data.samples = ...; +/// data.sampleCount = ...; +/// +/// // Return true to continue playing +/// return true; +/// } +/// +/// virtual void onSeek(Uint32 timeOffset) +/// { +/// // Change the current position in the stream source +/// ... +/// } +/// } +/// +/// // Usage +/// CustomStream stream; +/// stream.open("path/to/stream"); +/// stream.play(); +/// \endcode +/// +/// \see sf::Music +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Config.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Config.hpp new file mode 100644 index 0000000..933cd11 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Config.hpp @@ -0,0 +1,159 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONFIG_HPP +#define SFML_CONFIG_HPP + + +//////////////////////////////////////////////////////////// +// Define the SFML version +//////////////////////////////////////////////////////////// +#define SFML_VERSION_MAJOR 2 +#define SFML_VERSION_MINOR 1 + + +//////////////////////////////////////////////////////////// +// Identify the operating system +//////////////////////////////////////////////////////////// +#if defined(_WIN32) || defined(__WIN32__) + + // Windows + #define SFML_SYSTEM_WINDOWS + #ifndef NOMINMAX + #define NOMINMAX + #endif + +#elif defined(linux) || defined(__linux) + + // Linux + #define SFML_SYSTEM_LINUX + +#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) + + // MacOS + #define SFML_SYSTEM_MACOS + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + + // FreeBSD + #define SFML_SYSTEM_FREEBSD + +#else + + // Unsupported system + #error This operating system is not supported by SFML library + +#endif + + +//////////////////////////////////////////////////////////// +// Define a portable debug macro +//////////////////////////////////////////////////////////// +#if !defined(NDEBUG) + + #define SFML_DEBUG + +#endif + + +//////////////////////////////////////////////////////////// +// Define helpers to create portable import / export macros for each module +//////////////////////////////////////////////////////////// +#if !defined(SFML_STATIC) + + #if defined(SFML_SYSTEM_WINDOWS) + + // Windows compilers need specific (and different) keywords for export and import + #define SFML_API_EXPORT __declspec(dllexport) + #define SFML_API_IMPORT __declspec(dllimport) + + // For Visual C++ compilers, we also need to turn off this annoying C4251 warning + #ifdef _MSC_VER + + #pragma warning(disable : 4251) + + #endif + + #else // Linux, FreeBSD, Mac OS X + + #if __GNUC__ >= 4 + + // GCC 4 has special keywords for showing/hidding symbols, + // the same keyword is used for both importing and exporting + #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default"))) + #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default"))) + + #else + + // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported + #define SFML_API_EXPORT + #define SFML_API_IMPORT + + #endif + + #endif + +#else + + // Static build doesn't need import/export macros + #define SFML_API_EXPORT + #define SFML_API_IMPORT + +#endif + + +//////////////////////////////////////////////////////////// +// Define portable fixed-size types +//////////////////////////////////////////////////////////// +namespace sf +{ + // All "common" platforms use the same size for char, short and int + // (basically there are 3 types for 3 sizes, so no other match is possible), + // we can use them without doing any kind of check + + // 8 bits integer types + typedef signed char Int8; + typedef unsigned char Uint8; + + // 16 bits integer types + typedef signed short Int16; + typedef unsigned short Uint16; + + // 32 bits integer types + typedef signed int Int32; + typedef unsigned int Uint32; + + // 64 bits integer types + #if defined(_MSC_VER) + typedef signed __int64 Int64; + typedef unsigned __int64 Uint64; + #else + typedef signed long long Int64; + typedef unsigned long long Uint64; + #endif + +} // namespace sf + + +#endif // SFML_CONFIG_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics.hpp new file mode 100644 index 0000000..0dc6534 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics.hpp @@ -0,0 +1,62 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_HPP +#define SFML_GRAPHICS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_GRAPHICS_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup graphics Graphics module +/// +/// 2D graphics module: sprites, text, shapes, ... +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/BlendMode.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/BlendMode.hpp new file mode 100644 index 0000000..4b12e11 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/BlendMode.hpp @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_BLENDMODE_HPP +#define SFML_BLENDMODE_HPP + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup graphics +/// \brief Available blending modes for drawing +/// +//////////////////////////////////////////////////////////// +enum BlendMode +{ + BlendAlpha, ///< Pixel = Source * Source.a + Dest * (1 - Source.a) + BlendAdd, ///< Pixel = Source + Dest + BlendMultiply, ///< Pixel = Source * Dest + BlendNone ///< Pixel = Source +}; + +} // namespace sf + + +#endif // SFML_BLENDMODE_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/CircleShape.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/CircleShape.hpp new file mode 100644 index 0000000..b82539e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/CircleShape.hpp @@ -0,0 +1,151 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CIRCLESHAPE_HPP +#define SFML_CIRCLESHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a circle +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API CircleShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param radius Radius of the circle + /// \param pointCount Number of points composing the circle + /// + //////////////////////////////////////////////////////////// + explicit CircleShape(float radius = 0, unsigned int pointCount = 30); + + //////////////////////////////////////////////////////////// + /// \brief Set the radius of the circle + /// + /// \param radius New radius of the circle + /// + /// \see getRadius + /// + //////////////////////////////////////////////////////////// + void setRadius(float radius); + + //////////////////////////////////////////////////////////// + /// \brief Get the radius of the circle + /// + /// \return Radius of the circle + /// + /// \see setRadius + /// + //////////////////////////////////////////////////////////// + float getRadius() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the number of points of the circle + /// + /// \param count New number of points of the circle + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + void setPointCount(unsigned int count); + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points of the shape + /// + /// \return Number of points of the shape + /// + /// \see setPointCount + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + float m_radius; ///< Radius of the circle + unsigned int m_pointCount; ///< Number of points composing the circle +}; + +} // namespace sf + + +#endif // SFML_CIRCLESHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::CircleShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// Usage example: +/// \code +/// sf::CircleShape circle; +/// circle.setRadius(150); +/// circle.setOutlineColor(sf::Color::Red); +/// circle.setOutlineThickness(5); +/// circle.setPosition(10, 20); +/// ... +/// window.draw(circle); +/// \endcode +/// +/// Since the graphics card can't draw perfect circles, we have to +/// fake them with multiple triangles connected to each other. The +/// "points count" property of sf::CircleShape defines how many of these +/// triangles to use, and therefore defines the quality of the circle. +/// +/// The number of points can also be used for another purpose; with +/// small numbers you can create any regular polygon shape: +/// equilateral triangle, square, pentagon, hexagon, ... +/// +/// \see sf::Shape, sf::RectangleShape, sf::ConvexShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Color.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Color.hpp new file mode 100644 index 0000000..fb2aa2d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Color.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_COLOR_HPP +#define SFML_COLOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class for manpulating RGBA colors +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Color +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an opaque black color. It is equivalent to + /// sf::Color(0, 0, 0, 255). + /// + //////////////////////////////////////////////////////////// + Color(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the color from its 4 RGBA components + /// + /// \param red Red component (in the range [0, 255]) + /// \param green Green component (in the range [0, 255]) + /// \param blue Blue component (in the range [0, 255]) + /// \param alpha Alpha (opacity) component (in the range [0, 255]) + /// + //////////////////////////////////////////////////////////// + Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + 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 + static const Color Transparent; ///< Transparent (black) predefined color + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint8 r; ///< Red component + Uint8 g; ///< Green component + Uint8 b; ///< Blue component + Uint8 a; ///< Alpha (opacity) component +}; + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the == operator +/// +/// This operator compares two colors and check if they are equal. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return True if colors are equal, false if they are different +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API bool operator ==(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the != operator +/// +/// This operator compares two colors and check if they are different. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return True if colors are different, false if they are equal +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API bool operator !=(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary + operator +/// +/// This operator returns the component-wise sum of two colors. +/// Components that exceed 255 are clamped to 255. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Result of \a left + \a right +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color operator +(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary * operator +/// +/// This operator returns the component-wise multiplication +/// (also called "modulation") of two colors. +/// Components are then divided by 255 so that the result is +/// still in the range [0, 255]. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Result of \a left * \a right +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color operator *(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary += operator +/// +/// This operator computes the component-wise sum of two colors, +/// and assigns the result to the left operand. +/// Components that exceed 255 are clamped to 255. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color& operator +=(Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary *= operator +/// +/// This operator returns the component-wise multiplication +/// (also called "modulation") of two colors, and assigns +/// the result to the left operand. +/// Components are then divided by 255 so that the result is +/// still in the range [0, 255]. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color& operator *=(Color& left, const Color& right); + +} // namespace sf + + +#endif // SFML_COLOR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Color +/// \ingroup graphics +/// +/// sf::Color is a simple color class composed of 4 components: +/// \li Red +/// \li Green +/// \li Blue +/// \li Alpha (opacity) +/// +/// Each component is a public member, an unsigned integer in +/// the range [0, 255]. Thus, colors can be constructed and +/// manipulated very easily: +/// +/// \code +/// sf::Color color(255, 0, 0); // red +/// color.r = 0; // make it black +/// color.b = 128; // make it dark blue +/// \endcode +/// +/// The fourth component of colors, named "alpha", represents +/// the opacity of the color. A color with an alpha value of +/// 255 will be fully opaque, while an alpha value of 0 will +/// make a color fully transparent, whatever the value of the +/// other components is. +/// +/// The most common colors are already defined as static variables: +/// \code +/// sf::Color black = sf::Color::Black; +/// sf::Color white = sf::Color::White; +/// sf::Color red = sf::Color::Red; +/// sf::Color green = sf::Color::Green; +/// sf::Color blue = sf::Color::Blue; +/// sf::Color yellow = sf::Color::Yellow; +/// sf::Color magenta = sf::Color::Magenta; +/// sf::Color cyan = sf::Color::Cyan; +/// sf::Color transparent = sf::Color::Transparent; +/// \endcode +/// +/// Colors can also be added and modulated (multiplied) using the +/// overloaded operators + and *. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/ConvexShape.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/ConvexShape.hpp new file mode 100644 index 0000000..03af57f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/ConvexShape.hpp @@ -0,0 +1,150 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONVEXSHAPE_HPP +#define SFML_CONVEXSHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a convex polygon +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API ConvexShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param pointCount Number of points of the polygon + /// + //////////////////////////////////////////////////////////// + explicit ConvexShape(unsigned int pointCount = 0); + + //////////////////////////////////////////////////////////// + /// \brief Set the number of points of the polygon + /// + /// \a count must be greater than 2 to define a valid shape. + /// + /// \param count New number of points of the polygon + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + void setPointCount(unsigned int count); + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points of the polygon + /// + /// \return Number of points of the polygon + /// + /// \see setPointCount + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the position of a point + /// + /// Don't forget that the polygon must remain convex, and + /// the points need to stay ordered! + /// setPointCount must be called first in order to set the total + /// number of points. The result is undefined if \a index is out + /// of the valid range. + /// + /// \param index Index of the point to change, in range [0 .. getPointCount() - 1] + /// \param point New position of the point + /// + /// \see getPoint + /// + //////////////////////////////////////////////////////////// + void setPoint(unsigned int index, const Vector2f& point); + + //////////////////////////////////////////////////////////// + /// \brief Get the position of a point + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Position of the index-th point of the polygon + /// + /// \see setPoint + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_points; ///< Points composing the convex polygon +}; + +} // namespace sf + + +#endif // SFML_CONVEXSHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ConvexShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// It is important to keep in mind that a convex shape must +/// always be... convex, otherwise it may not be drawn correctly. +/// Moreover, the points must be defined in order; using a random +/// order would result in an incorrect shape. +/// +/// Usage example: +/// \code +/// sf::ConvexShape polygon; +/// polygon.setPointCount(3); +/// polygon.setPoint(0, sf::Vector2f(0, 0)); +/// polygon.setPoint(1, sf::Vector2f(0, 10)); +/// polygon.setPoint(2, sf::Vector2f(25, 5)); +/// polygon.setOutlineColor(sf::Color::Red); +/// polygon.setOutlineThickness(5); +/// polygon.setPosition(10, 20); +/// ... +/// window.draw(polygon); +/// \endcode +/// +/// \see sf::Shape, sf::RectangleShape, sf::CircleShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Drawable.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Drawable.hpp new file mode 100644 index 0000000..accebfc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Drawable.hpp @@ -0,0 +1,126 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_DRAWABLE_HPP +#define SFML_DRAWABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class RenderTarget; + +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for objects that can be drawn +/// to a render target +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Drawable() {} + +protected : + + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// \brief Draw the object to a render target + /// + /// This is a pure virtual function that has to be implemented + /// by the derived class to define how the drawable should be + /// drawn. + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const = 0; +}; + +} // namespace sf + + +#endif // SFML_DRAWABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Drawable +/// \ingroup graphics +/// +/// sf::Drawable is a very simple base class that allows objects +/// of derived classes to be drawn to a sf::RenderTarget. +/// +/// All you have to do in your derived class is to override the +/// draw virtual function. +/// +/// Note that inheriting from sf::Drawable is not mandatory, +/// but it allows this nice syntax "window.draw(object)" rather +/// than "object.draw(window)", which is more consistent with other +/// SFML classes. +/// +/// Example: +/// \code +/// class MyDrawable : public sf::Drawable +/// { +/// public : +/// +/// ... +/// +/// private : +/// +/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const +/// { +/// // You can draw other high-level objects +/// target.draw(m_sprite, states); +/// +/// // ... or use the low-level API +/// states.texture = &m_texture; +/// target.draw(m_vertices, states); +/// +/// // ... or draw with OpenGL directly +/// glBegin(GL_QUADS); +/// ... +/// glEnd(); +/// } +/// +/// sf::Sprite m_sprite; +/// sf::Texture m_texture; +/// sf::VertexArray m_vertices; +/// }; +/// \endcode +/// +/// \see sf::RenderTarget +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Export.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Export.hpp new file mode 100644 index 0000000..eb76ae8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_EXPORT_HPP +#define SFML_GRAPHICS_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_GRAPHICS_EXPORTS) + + #define SFML_GRAPHICS_API SFML_API_EXPORT + +#else + + #define SFML_GRAPHICS_API SFML_API_IMPORT + +#endif + + +#endif // SFML_GRAPHICS_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Font.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Font.hpp new file mode 100644 index 0000000..d3b1955 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Font.hpp @@ -0,0 +1,361 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FONT_HPP +#define SFML_FONT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Class for loading and manipulating character fonts +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Font +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor defines an empty font + /// + //////////////////////////////////////////////////////////// + Font(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + Font(const Font& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Cleans up all the internal resources used by the font + /// + //////////////////////////////////////////////////////////// + ~Font(); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a file + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Note that this function know nothing about the standard + /// fonts installed on the user's system, thus you can't + /// load them directly. + /// + /// \param filename Path of the font file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a file in memory + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Warning: SFML cannot preload all the font data in this + /// function, so the buffer pointed by \a data has to remain + /// valid as long as the font is used. + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a custom stream + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Warning: SFML cannot preload all the font data in this + /// function, so the contents of \a stream have to remain + /// valid as long as the font is used. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve a glyph of the font + /// + /// \param codePoint Unicode code point of the character to get + /// \param characterSize Reference character size + /// \param bold Retrieve the bold version or the regular one? + /// + /// \return The glyph corresponding to \a codePoint and \a characterSize + /// + //////////////////////////////////////////////////////////// + const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the kerning offset of two glyphs + /// + /// The kerning is an extra offset (negative) to apply between two + /// glyphs when rendering them, to make the pair look more "natural". + /// For example, the pair "AV" have a special kerning to make them + /// closer than other characters. Most of the glyphs pairs have a + /// kerning offset of zero, though. + /// + /// \param first Unicode code point of the first character + /// \param second Unicode code point of the second character + /// \param characterSize Reference character size + /// + /// \return Kerning value for \a first and \a second, in pixels + /// + //////////////////////////////////////////////////////////// + int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the line spacing + /// + /// Line spacing is the vertical offset to apply between two + /// consecutive lines of text. + /// + /// \param characterSize Reference character size + /// + /// \return Line spacing, in pixels + /// + //////////////////////////////////////////////////////////// + int getLineSpacing(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Retrieve the texture containing the loaded glyphs of a certain size + /// + /// The contents of the returned texture changes as more glyphs + /// are requested, thus it is not very relevant. It is mainly + /// used internally by sf::Text. + /// + /// \param characterSize Reference character size + /// + /// \return Texture containing the glyphs of the requested size + /// + //////////////////////////////////////////////////////////// + const Texture& getTexture(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Font& operator =(const Font& right); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a row of glyphs + /// + //////////////////////////////////////////////////////////// + struct Row + { + Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight) {} + + unsigned int width; ///< Current width of the row + unsigned int top; ///< Y position of the row into the texture + unsigned int height; ///< Height of the row + }; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map GlyphTable; ///< Table mapping a codepoint to its glyph + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a page of glyphs + /// + //////////////////////////////////////////////////////////// + struct Page + { + Page(); + + GlyphTable glyphs; ///< Table mapping code points to their corresponding glyph + sf::Texture texture; ///< Texture containing the pixels of the glyphs + unsigned int nextRow; ///< Y position of the next new row in the texture + std::vector rows; ///< List containing the position of all the existing rows + }; + + //////////////////////////////////////////////////////////// + /// \brief Free all the internal resources + /// + //////////////////////////////////////////////////////////// + void cleanup(); + + //////////////////////////////////////////////////////////// + /// \brief Load a new glyph and store it in the cache + /// + /// \param codePoint Unicode code point of the character to load + /// \param characterSize Reference character size + /// \param bold Retrieve the bold version or the regular one? + /// + /// \return The glyph corresponding to \a codePoint and \a characterSize + /// + //////////////////////////////////////////////////////////// + Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const; + + //////////////////////////////////////////////////////////// + /// \brief Find a suitable rectangle within the texture for a glyph + /// + /// \param page Page of glyphs to search in + /// \param width Width of the rectangle + /// \param height Height of the rectangle + /// + /// \return Found rectangle within the texture + /// + //////////////////////////////////////////////////////////// + IntRect findGlyphRect(Page& page, unsigned int width, unsigned int height) const; + + //////////////////////////////////////////////////////////// + /// \brief Make sure that the given size is the current one + /// + /// \param characterSize Reference character size + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool setCurrentSize(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map PageTable; ///< Table mapping a character size to its page (texture) + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + void* m_library; ///< Pointer to the internal library interface (it is typeless to avoid exposing implementation details) + void* m_face; ///< Pointer to the internal font face (it is typeless to avoid exposing implementation details) + void* m_streamRec; ///< Pointer to the stream rec instance (it is typeless to avoid exposing implementation details) + int* m_refCount; ///< Reference counter used by implicit sharing + mutable PageTable m_pages; ///< Table containing the glyphs pages by character size + mutable std::vector m_pixelBuffer; ///< Pixel buffer holding a glyph's pixels before being written to the texture +}; + +} // namespace sf + + +#endif // SFML_FONT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Font +/// \ingroup graphics +/// +/// Fonts can be loaded from a file, from memory or from a custom +/// stream, and supports the most common types of fonts. See +/// the loadFromFile function for the complete list of supported formats. +/// +/// Once it is loaded, a sf::Font instance provides three +/// types of information about the font: +/// \li Global metrics, such as the line spacing +/// \li Per-glyph metrics, such as bounding box or kerning +/// \li Pixel representation of glyphs +/// +/// Fonts alone are not very useful: they hold the font data +/// but cannot make anything useful of it. To do so you need to +/// use the sf::Text class, which is able to properly output text +/// with several options such as character size, style, color, +/// position, rotation, etc. +/// This separation allows more flexibility and better performances: +/// indeed a sf::Font is a heavy resource, and any operation on it +/// is slow (often too slow for real-time applications). On the other +/// side, a sf::Text is a lightweight object which can combine the +/// glyphs data and metrics of a sf::Font to display any text on a +/// render target. +/// Note that it is also possible to bind several sf::Text instances +/// to the same sf::Font. +/// +/// It is important to note that the sf::Text instance doesn't +/// copy the font that it uses, it only keeps a reference to it. +/// Thus, a sf::Font must not be destructed while it is +/// used by a sf::Text (i.e. never write a function that +/// uses a local sf::Font instance for creating a text). +/// +/// Usage example: +/// \code +/// // Declare a new font +/// sf::Font font; +/// +/// // Load it from a file +/// if (!font.loadFromFile("arial.ttf")) +/// { +/// // error... +/// } +/// +/// // Create a text which uses our font +/// sf::Text text1; +/// text1.setFont(font); +/// text1.setCharacterSize(30); +/// text1.setStyle(sf::Text::Regular); +/// +/// // Create another text using the same font, but with different parameters +/// sf::Text text2; +/// text2.setFont(font); +/// text2.setCharacterSize(50); +/// text1.setStyle(sf::Text::Italic); +/// \endcode +/// +/// Apart from loading font files, and passing them to instances +/// of sf::Text, you should normally not have to deal directly +/// with this class. However, it may be useful to access the +/// font metrics or rasterized glyphs for advanced usage. +/// +/// \see sf::Text +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Glyph.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Glyph.hpp new file mode 100644 index 0000000..d97616f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Glyph.hpp @@ -0,0 +1,79 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLYPH_HPP +#define SFML_GLYPH_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Structure describing a glyph +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Glyph +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Glyph() : advance(0) {} + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + int advance; ///< Offset to move horizontically to the next character + IntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline + IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture +}; + +} // namespace sf + + +#endif // SFML_GLYPH_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Glyph +/// \ingroup graphics +/// +/// A glyph is the visual representation of a character. +/// +/// The sf::Glyph structure provides the information needed +/// to handle the glyph: +/// \li its coordinates in the font's texture +/// \li its bounding rectangle +/// \li the offset to apply to get the starting position of the next glyph +/// +/// \see sf::Font +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Image.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Image.hpp new file mode 100644 index 0000000..0b61d6c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Image.hpp @@ -0,0 +1,318 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IMAGE_HPP +#define SFML_IMAGE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Class for loading, manipulating and saving images +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Image +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty image. + /// + //////////////////////////////////////////////////////////// + Image(); + + //////////////////////////////////////////////////////////// + /// \brief Create the image and fill it with a unique color + /// + /// \param width Width of the image + /// \param height Height of the image + /// \param color Fill color + /// + //////////////////////////////////////////////////////////// + void create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// \brief Create the image from an array of pixels + /// + /// The \a pixel array is assumed to contain 32-bits RGBA pixels, + /// and have the given \a width and \a height. If not, this is + /// an undefined behaviour. + /// If \a pixels is null, an empty image is created. + /// + /// \param width Width of the image + /// \param height Height of the image + /// \param pixels Array of pixels to copy to the image + /// + //////////////////////////////////////////////////////////// + void create(unsigned int width, unsigned int height, const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a file on disk + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param filename Path of the image file to load + /// + /// \return True if loading was successful + /// + /// \see loadFromMemory, loadFromStream, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a file in memory + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param data Pointer to the file data in memory + /// \param size Size of the data to load, in bytes + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t size); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a custom stream + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Save the image to a file on disk + /// + /// The format of the image is automatically deduced from + /// the extension. The supported image formats are bmp, png, + /// tga and jpg. The destination file is overwritten + /// if it already exists. This function fails if the image is empty. + /// + /// \param filename Path of the file to save + /// + /// \return True if saving was successful + /// + /// \see create, loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool saveToFile(const std::string& filename) const; + + //////////////////////////////////////////////////////////// + /// \brief Return the size (width and height) of the image + /// + /// \return Size of the image, in pixels + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Create a transparency mask from a specified color-key + /// + /// This function sets the alpha value of every pixel matching + /// the given color to \a alpha (0 by default), so that they + /// become transparent. + /// + /// \param color Color to make transparent + /// \param alpha Alpha value to assign to transparent pixels + /// + //////////////////////////////////////////////////////////// + void createMaskFromColor(const Color& color, Uint8 alpha = 0); + + //////////////////////////////////////////////////////////// + /// \brief Copy pixels from another image onto this one + /// + /// This function does a slow pixel copy and should not be + /// used intensively. It can be used to prepare a complex + /// static image from several others, but if you need this + /// kind of feature in real-time you'd better use sf::RenderTexture. + /// + /// If \a sourceRect is empty, the whole image is copied. + /// If \a applyAlpha is set to true, the transparency of + /// source pixels is applied. If it is false, the pixels are + /// copied unchanged with their alpha value. + /// + /// \param source Source image to copy + /// \param destX X coordinate of the destination position + /// \param destY Y coordinate of the destination position + /// \param sourceRect Sub-rectangle of the source image to copy + /// \param applyAlpha Should the copy take in account the source transparency? + /// + //////////////////////////////////////////////////////////// + void copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false); + + //////////////////////////////////////////////////////////// + /// \brief Change the color of a pixel + /// + /// This function doesn't check the validity of the pixel + /// coordinates, using out-of-range values will result in + /// an undefined behaviour. + /// + /// \param x X coordinate of pixel to change + /// \param y Y coordinate of pixel to change + /// \param color New color of the pixel + /// + /// \see getPixel + /// + //////////////////////////////////////////////////////////// + void setPixel(unsigned int x, unsigned int y, const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the color of a pixel + /// + /// This function doesn't check the validity of the pixel + /// coordinates, using out-of-range values will result in + /// an undefined behaviour. + /// + /// \param x X coordinate of pixel to get + /// \param y Y coordinate of pixel to get + /// + /// \return Color of the pixel at coordinates (x, y) + /// + /// \see setPixel + /// + //////////////////////////////////////////////////////////// + Color getPixel(unsigned int x, unsigned int y) const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only pointer to the array of pixels + /// + /// The returned value points to an array of RGBA pixels made of + /// 8 bits integers components. The size of the array is + /// width * height * 4 (getSize().x * getSize().y * 4). + /// Warning: the returned pointer may become invalid if you + /// modify the image, so you should never store it for too long. + /// If the image is empty, a null pointer is returned. + /// + /// \return Read-only pointer to the array of pixels + /// + //////////////////////////////////////////////////////////// + const Uint8* getPixelsPtr() const; + + //////////////////////////////////////////////////////////// + /// \brief Flip the image horizontally (left <-> right) + /// + //////////////////////////////////////////////////////////// + void flipHorizontally(); + + //////////////////////////////////////////////////////////// + /// \brief Flip the image vertically (top <-> bottom) + /// + //////////////////////////////////////////////////////////// + void flipVertically(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2u m_size; ///< Image size + std::vector m_pixels; ///< Pixels of the image +}; + +} // namespace sf + + +#endif // SFML_IMAGE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Image +/// \ingroup graphics +/// +/// sf::Image is an abstraction to manipulate images +/// as bidimensional arrays of pixels. The class provides +/// functions to load, read, write and save pixels, as well +/// as many other useful functions. +/// +/// sf::Image can handle a unique internal representation of +/// pixels, which is RGBA 32 bits. This means that a pixel +/// must be composed of 8 bits red, green, blue and alpha +/// channels -- just like a sf::Color. +/// All the functions that return an array of pixels follow +/// this rule, and all parameters that you pass to sf::Image +/// functions (such as loadFromPixels) must use this +/// representation as well. +/// +/// A sf::Image can be copied, but it is a heavy resource and +/// if possible you should always use [const] references to +/// pass or return them to avoid useless copies. +/// +/// Usage example: +/// \code +/// // Load an image file from a file +/// sf::Image background; +/// if (!background.loadFromFile("background.jpg")) +/// return -1; +/// +/// // Create a 20x20 image filled with black color +/// sf::Image image; +/// image.create(20, 20, sf::Color::Black); +/// +/// // Copy image1 on image2 at position (10, 10) +/// image.copy(background, 10, 10); +/// +/// // Make the top-left pixel transparent +/// sf::Color color = image.getPixel(0, 0); +/// color.a = 0; +/// image.setPixel(0, 0, color); +/// +/// // Save the image to a file +/// if (!image.saveToFile("result.png")) +/// return -1; +/// \endcode +/// +/// \see sf::Texture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/PrimitiveType.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/PrimitiveType.hpp new file mode 100644 index 0000000..8f3cfb2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/PrimitiveType.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PRIMITIVETYPE_HPP +#define SFML_PRIMITIVETYPE_HPP + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup graphics +/// \brief Types of primitives that a sf::VertexArray can render +/// +/// Points and lines have no area, therefore their thickness +/// will always be 1 pixel, regarldess the current transform +/// and view. +/// +//////////////////////////////////////////////////////////// +enum PrimitiveType +{ + Points, ///< List of individual points + Lines, ///< List of individual lines + LinesStrip, ///< List of connected lines, a point uses the previous point to form a line + Triangles, ///< List of individual triangles + TrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle + TrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle + Quads ///< List of individual quads +}; + +} // namespace sf + + +#endif // SFML_PRIMITIVETYPE_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.hpp new file mode 100644 index 0000000..3a3acc7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.hpp @@ -0,0 +1,248 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECT_HPP +#define SFML_RECT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class for manipulating 2D axis aligned rectangles +/// +//////////////////////////////////////////////////////////// +template +class Rect +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty rectangle (it is equivalent to calling + /// Rect(0, 0, 0, 0)). + /// + //////////////////////////////////////////////////////////// + Rect(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from its coordinates + /// + /// Be careful, the last two parameters are the width + /// and height, not the right and bottom coordinates! + /// + /// \param rectLeft Left coordinate of the rectangle + /// \param rectTop Top coordinate of the rectangle + /// \param rectWidth Width of the rectangle + /// \param rectHeight Height of the rectangle + /// + //////////////////////////////////////////////////////////// + Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from position and size + /// + /// Be careful, the last parameter is the size, + /// not the bottom-right corner! + /// + /// \param position Position of the top-left corner of the rectangle + /// \param size Size of the rectangle + /// + //////////////////////////////////////////////////////////// + Rect(const Vector2& position, const Vector2& size); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from another type of rectangle + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param rectangle Rectangle to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Rect(const Rect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Check if a point is inside the rectangle's area + /// + /// \param x X coordinate of the point to test + /// \param y Y coordinate of the point to test + /// + /// \return True if the point is inside, false otherwise + /// + /// \see intersects + /// + //////////////////////////////////////////////////////////// + bool contains(T x, T y) const; + + //////////////////////////////////////////////////////////// + /// \brief Check if a point is inside the rectangle's area + /// + /// \param point Point to test + /// + /// \return True if the point is inside, false otherwise + /// + /// \see intersects + /// + //////////////////////////////////////////////////////////// + bool contains(const Vector2& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Check the intersection between two rectangles + /// + /// \param rectangle Rectangle to test + /// + /// \return True if rectangles overlap, false otherwise + /// + /// \see contains + /// + //////////////////////////////////////////////////////////// + bool intersects(const Rect& rectangle) const; + + //////////////////////////////////////////////////////////// + /// \brief Check the intersection between two rectangles + /// + /// This overload returns the overlapped rectangle in the + /// \a intersection parameter. + /// + /// \param rectangle Rectangle to test + /// \param intersection Rectangle to be filled with the intersection + /// + /// \return True if rectangles overlap, false otherwise + /// + /// \see contains + /// + //////////////////////////////////////////////////////////// + bool intersects(const Rect& rectangle, Rect& intersection) const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T left; ///< Left coordinate of the rectangle + T top; ///< Top coordinate of the rectangle + T width; ///< Width of the rectangle + T height; ///< Height of the rectangle +}; + +//////////////////////////////////////////////////////////// +/// \relates Rect +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two rectangles. +/// +/// \param left Left operand (a rectangle) +/// \param right Right operand (a rectangle) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Rect& left, const Rect& right); + +//////////////////////////////////////////////////////////// +/// \relates Rect +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two rectangles. +/// +/// \param left Left operand (a rectangle) +/// \param right Right operand (a rectangle) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Rect& left, const Rect& right); + +#include + +// Create typedefs for the most common types +typedef Rect IntRect; +typedef Rect FloatRect; + +} // namespace sf + + +#endif // SFML_RECT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Rect +/// \ingroup graphics +/// +/// A rectangle is defined by its top-left corner and its size. +/// It is a very simple class defined for convenience, so +/// its member variables (left, top, width and height) are public +/// and can be accessed directly, just like the vector classes +/// (Vector2 and Vector3). +/// +/// To keep things simple, sf::Rect doesn't define +/// functions to emulate the properties that are not directly +/// members (such as right, bottom, center, etc.), it rather +/// only provides intersection functions. +/// +/// sf::Rect uses the usual rules for its boundaries: +/// \li The left and top edges are included in the rectangle's area +/// \li The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area +/// +/// This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1) +/// don't intersect. +/// +/// sf::Rect is a template and may be used with any numeric type, but +/// for simplicity the instanciations used by SFML are typedefed: +/// \li sf::Rect is sf::IntRect +/// \li sf::Rect is sf::FloatRect +/// +/// So that you don't have to care about the template syntax. +/// +/// Usage example: +/// \code +/// // Define a rectangle, located at (0, 0) with a size of 20x5 +/// sf::IntRect r1(0, 0, 20, 5); +/// +/// // Define another rectangle, located at (4, 2) with a size of 18x10 +/// sf::Vector2i position(4, 2); +/// sf::Vector2i size(18, 10); +/// sf::IntRect r2(position, size); +/// +/// // Test intersections with the point (3, 1) +/// bool b1 = r1.contains(3, 1); // true +/// bool b2 = r2.contains(3, 1); // false +/// +/// // Test the intersection between r1 and r2 +/// sf::IntRect result; +/// bool b3 = r1.intersects(r2, result); // true +/// // result == (4, 2, 16, 3) +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.inl new file mode 100644 index 0000000..0a97b99 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Rect.inl @@ -0,0 +1,159 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +Rect::Rect() : +left (0), +top (0), +width (0), +height(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +Rect::Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) : +left (rectLeft), +top (rectTop), +width (rectWidth), +height(rectHeight) +{ + +} + + +//////////////////////////////////////////////////////////// +template +Rect::Rect(const Vector2& position, const Vector2& size) : +left (position.x), +top (position.y), +width (size.x), +height(size.y) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +Rect::Rect(const Rect& rectangle) : +left (static_cast(rectangle.left)), +top (static_cast(rectangle.top)), +width (static_cast(rectangle.width)), +height(static_cast(rectangle.height)) +{ +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::contains(T x, T y) const +{ + // Rectangles with negative dimensions are allowed, so we must handle them correctly + + // Compute the real min and max of the rectangle on both axes + T minX = std::min(left, left + width); + T maxX = std::max(left, left + width); + T minY = std::min(top, top + height); + T maxY = std::max(top, top + height); + + return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::contains(const Vector2& point) const +{ + return contains(point.x, point.y); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::intersects(const Rect& rectangle) const +{ + Rect intersection; + return intersects(rectangle, intersection); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::intersects(const Rect& rectangle, Rect& intersection) const +{ + // Rectangles with negative dimensions are allowed, so we must handle them correctly + + // Compute the min and max of the first rectangle on both axes + T r1MinX = std::min(left, left + width); + T r1MaxX = std::max(left, left + width); + T r1MinY = std::min(top, top + height); + T r1MaxY = std::max(top, top + height); + + // Compute the min and max of the second rectangle on both axes + T r2MinX = std::min(rectangle.left, rectangle.left + rectangle.width); + T r2MaxX = std::max(rectangle.left, rectangle.left + rectangle.width); + T r2MinY = std::min(rectangle.top, rectangle.top + rectangle.height); + T r2MaxY = std::max(rectangle.top, rectangle.top + rectangle.height); + + // Compute the intersection boundaries + T interLeft = std::max(r1MinX, r2MinX); + T interTop = std::max(r1MinY, r2MinY); + T interRight = std::min(r1MaxX, r2MaxX); + T interBottom = std::min(r1MaxY, r2MaxY); + + // If the intersection is valid (positive non zero area), then there is an intersection + if ((interLeft < interRight) && (interTop < interBottom)) + { + intersection = Rect(interLeft, interTop, interRight - interLeft, interBottom - interTop); + return true; + } + else + { + intersection = Rect(0, 0, 0, 0); + return false; + } +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Rect& left, const Rect& right) +{ + return (left.left == right.left) && (left.width == right.width) && + (left.top == right.top) && (left.height == right.height); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Rect& left, const Rect& right) +{ + return !(left == right); +} diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RectangleShape.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RectangleShape.hpp new file mode 100644 index 0000000..2140e91 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RectangleShape.hpp @@ -0,0 +1,128 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECTANGLESHAPE_HPP +#define SFML_RECTANGLESHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a rectangle +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RectangleShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param size Size of the rectangle + /// + //////////////////////////////////////////////////////////// + explicit RectangleShape(const Vector2f& size = Vector2f(0, 0)); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the rectangle + /// + /// \param size New size of the rectangle + /// + /// \see getSize + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rectangle + /// + /// \return Size of the rectangle + /// + /// \see setSize + /// + //////////////////////////////////////////////////////////// + const Vector2f& getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points defining the shape + /// + /// \return Number of points of the shape + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_size; ///< Size of the rectangle +}; + +} // namespace sf + + +#endif // SFML_RECTANGLESHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RectangleShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// Usage example: +/// \code +/// sf::RectangleShape rectangle; +/// rectangle.setSize(sf::Vector2f(100, 50)); +/// rectangle.setOutlineColor(sf::Color::Red); +/// rectangle.setOutlineThickness(5); +/// rectangle.setPosition(10, 20); +/// ... +/// window.draw(rectangle); +/// \endcode +/// +/// \see sf::Shape, sf::CircleShape, sf::ConvexShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderStates.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderStates.hpp new file mode 100644 index 0000000..bf4183c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderStates.hpp @@ -0,0 +1,174 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERSTATES_HPP +#define SFML_RENDERSTATES_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Shader; +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Define the states used for drawing to a RenderTarget +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderStates +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructing a default set of render states is equivalent + /// to using sf::RenderStates::Default. + /// The default set defines: + /// \li the BlendAlpha blend mode + /// \li the identity transform + /// \li a null texture + /// \li a null shader + /// + //////////////////////////////////////////////////////////// + RenderStates(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom blend mode + /// + /// \param theBlendMode Blend mode to use + /// + //////////////////////////////////////////////////////////// + RenderStates(BlendMode theBlendMode); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom transform + /// + /// \param theTransform Transform to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Transform& theTransform); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom texture + /// + /// \param theTexture Texture to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Texture* theTexture); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom shader + /// + /// \param theShader Shader to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Shader* theShader); + + //////////////////////////////////////////////////////////// + /// \brief Construct a set of render states with all its attributes + /// + /// \param theBlendMode Blend mode to use + /// \param theTransform Transform to use + /// \param theTexture Texture to use + /// \param theShader Shader to use + /// + //////////////////////////////////////////////////////////// + RenderStates(BlendMode theBlendMode, const Transform& theTransform, + const Texture* theTexture, const Shader* theShader); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const RenderStates Default; ///< Special instance holding the default render states + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + BlendMode blendMode; ///< Blending mode + Transform transform; ///< Transform + const Texture* texture; ///< Texture + const Shader* shader; ///< Shader +}; + +} // namespace sf + + +#endif // SFML_RENDERSTATES_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderStates +/// \ingroup graphics +/// +/// There are four global states that can be applied to +/// the drawn objects: +/// \li the blend mode: how pixels of the object are blended with the background +/// \li the transform: how the object is positioned/rotated/scaled +/// \li the texture: what image is mapped to the object +/// \li the shader: what custom effect is applied to the object +/// +/// High-level objects such as sprites or text force some of +/// these states when they are drawn. For example, a sprite +/// will set its own texture, so that you don't have to care +/// about it when drawing the sprite. +/// +/// The transform is a special case: sprites, texts and shapes +/// (and it's a good idea to do it with your own drawable classes +/// too) combine their transform with the one that is passed in the +/// RenderStates structure. So that you can use a "global" transform +/// on top of each object's transform. +/// +/// Most objects, especially high-level drawables, can be drawn +/// directly without defining render states explicitely -- the +/// default set of states is ok in most cases. +/// \code +/// window.Draw(sprite); +/// \endcode +/// +/// If you want to use a single specific render state, +/// for example a shader, you can pass it directly to the Draw +/// function: sf::RenderStates has an implicit one-argument +/// constructor for each state. +/// \code +/// window.draw(sprite, shader); +/// \endcode +/// +/// When you're inside the Draw function of a drawable +/// object (inherited from sf::Drawable), you can +/// either pass the render states unmodified, or change +/// some of them. +/// For example, a transformable object will combine the +/// current transform with its own transform. A sprite will +/// set its texture. Etc. +/// +/// \see sf::RenderTarget, sf::Drawable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTarget.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTarget.hpp new file mode 100644 index 0000000..5f69e7f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTarget.hpp @@ -0,0 +1,451 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERTARGET_HPP +#define SFML_RENDERTARGET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class Drawable; + +//////////////////////////////////////////////////////////// +/// \brief Base class for all render targets (window, texture, ...) +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderTarget : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderTarget(); + + //////////////////////////////////////////////////////////// + /// \brief Clear the entire target with a single color + /// + /// This function is usually called once every frame, + /// to clear the previous contents of the target. + /// + /// \param color Fill color to use to clear the render target + /// + //////////////////////////////////////////////////////////// + void clear(const Color& color = Color(0, 0, 0, 255)); + + //////////////////////////////////////////////////////////// + /// \brief Change the current active view + /// + /// The view is like a 2D camera, it controls which part of + /// the 2D scene is visible, and how it is viewed in the + /// render-target. + /// The new view will affect everything that is drawn, until + /// another view is set. + /// The render target keeps its own copy of the view object, + /// so it is not necessary to keep the original one alive + /// after calling this function. + /// To restore the original view of the target, you can pass + /// the result of getDefaultView() to this function. + /// + /// \param view New view to use + /// + /// \see getView, getDefaultView + /// + //////////////////////////////////////////////////////////// + void setView(const View& view); + + //////////////////////////////////////////////////////////// + /// \brief Get the view currently in use in the render target + /// + /// \return The view object that is currently used + /// + /// \see setView, getDefaultView + /// + //////////////////////////////////////////////////////////// + const View& getView() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the default view of the render target + /// + /// The default view has the initial size of the render target, + /// and never changes after the target has been created. + /// + /// \return The default view of the render target + /// + /// \see setView, getView + /// + //////////////////////////////////////////////////////////// + const View& getDefaultView() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the viewport of a view, applied to this render target + /// + /// The viewport is defined in the view as a ratio, this function + /// simply applies this ratio to the current dimensions of the + /// render target to calculate the pixels rectangle that the viewport + /// actually covers in the target. + /// + /// \param view The view for which we want to compute the viewport + /// + /// \return Viewport rectangle, expressed in pixels + /// + //////////////////////////////////////////////////////////// + IntRect getViewport(const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from target coordinates to world + /// coordinates, using the current view + /// + /// This function is an overload of the mapPixelToCoords + /// function that implicitely uses the current view. + /// It is equivalent to: + /// \code + /// target.mapPixelToCoords(point, target.getView()); + /// \endcode + /// + /// \param point Pixel to convert + /// + /// \return The converted point, in "world" coordinates + /// + /// \see mapCoordsToPixel + /// + //////////////////////////////////////////////////////////// + Vector2f mapPixelToCoords(const Vector2i& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from target coordinates to world coordinates + /// + /// This function finds the 2D position that matches the + /// given pixel of the render-target. In other words, it does + /// the inverse of what the graphics card does, to find the + /// initial position of a rendered pixel. + /// + /// Initially, both coordinate systems (world units and target pixels) + /// match perfectly. But if you define a custom view or resize your + /// render-target, this assertion is not true anymore, ie. a point + /// located at (10, 50) in your render-target may map to the point + /// (150, 75) in your 2D world -- if the view is translated by (140, 25). + /// + /// For render-windows, this function is typically used to find + /// which point (or object) is located below the mouse cursor. + /// + /// This version uses a custom view for calculations, see the other + /// overload of the function if you want to use the current view of the + /// render-target. + /// + /// \param point Pixel to convert + /// \param view The view to use for converting the point + /// + /// \return The converted point, in "world" units + /// + /// \see mapCoordsToPixel + /// + //////////////////////////////////////////////////////////// + Vector2f mapPixelToCoords(const Vector2i& point, const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from world coordinates to target + /// coordinates, using the current view + /// + /// This function is an overload of the mapCoordsToPixel + /// function that implicitely uses the current view. + /// It is equivalent to: + /// \code + /// target.mapCoordsToPixel(point, target.getView()); + /// \endcode + /// + /// \param point Point to convert + /// + /// \return The converted point, in target coordinates (pixels) + /// + /// \see mapPixelToCoords + /// + //////////////////////////////////////////////////////////// + Vector2i mapCoordsToPixel(const Vector2f& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from world coordinates to target coordinates + /// + /// This function finds the pixel of the render-target that matches + /// the given 2D point. In other words, it goes through the same process + /// as the graphics card, to compute the final position of a rendered point. + /// + /// Initially, both coordinate systems (world units and target pixels) + /// match perfectly. But if you define a custom view or resize your + /// render-target, this assertion is not true anymore, ie. a point + /// located at (150, 75) in your 2D world may map to the pixel + /// (10, 50) of your render-target -- if the view is translated by (140, 25). + /// + /// This version uses a custom view for calculations, see the other + /// overload of the function if you want to use the current view of the + /// render-target. + /// + /// \param point Point to convert + /// \param view The view to use for converting the point + /// + /// \return The converted point, in target coordinates (pixels) + /// + /// \see mapPixelToCoords + /// + //////////////////////////////////////////////////////////// + Vector2i mapCoordsToPixel(const Vector2f& point, const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Draw a drawable object to the render-target + /// + /// \param drawable Object to draw + /// \param states Render states to use for drawing + /// + //////////////////////////////////////////////////////////// + void draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default); + + //////////////////////////////////////////////////////////// + /// \brief Draw primitives defined by an array of vertices + /// + /// \param vertices Pointer to the vertices + /// \param vertexCount Number of vertices in the array + /// \param type Type of primitives to draw + /// \param states Render states to use for drawing + /// + //////////////////////////////////////////////////////////// + void draw(const Vertex* vertices, unsigned int vertexCount, + PrimitiveType type, const RenderStates& states = RenderStates::Default); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the rendering region of the target + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Save the current OpenGL render states and matrices + /// + /// This function can be used when you mix SFML drawing + /// and direct OpenGL rendering. Combined with PopGLStates, + /// it ensures that: + /// \li SFML's internal states are not messed up by your OpenGL code + /// \li your OpenGL states are not modified by a call to a SFML function + /// + /// More specifically, it must be used around code that + /// calls Draw functions. Example: + /// \code + /// // OpenGL code here... + /// window.pushGLStates(); + /// window.draw(...); + /// window.draw(...); + /// window.popGLStates(); + /// // OpenGL code here... + /// \endcode + /// + /// Note that this function is quite expensive: it saves all the + /// possible OpenGL states and matrices, even the ones you + /// don't care about. Therefore it should be used wisely. + /// It is provided for convenience, but the best results will + /// be achieved if you handle OpenGL states yourself (because + /// you know which states have really changed, and need to be + /// saved and restored). Take a look at the ResetGLStates + /// function if you do so. + /// + /// \see popGLStates + /// + //////////////////////////////////////////////////////////// + void pushGLStates(); + + //////////////////////////////////////////////////////////// + /// \brief Restore the previously saved OpenGL render states and matrices + /// + /// See the description of pushGLStates to get a detailed + /// description of these functions. + /// + /// \see pushGLStates + /// + //////////////////////////////////////////////////////////// + void popGLStates(); + + //////////////////////////////////////////////////////////// + /// \brief Reset the internal OpenGL states so that the target is ready for drawing + /// + /// This function can be used when you mix SFML drawing + /// and direct OpenGL rendering, if you choose not to use + /// pushGLStates/popGLStates. It makes sure that all OpenGL + /// states needed by SFML are set, so that subsequent draw() + /// calls will work as expected. + /// + /// Example: + /// \code + /// // OpenGL code here... + /// glPushAttrib(...); + /// window.resetGLStates(); + /// window.draw(...); + /// window.draw(...); + /// glPopAttrib(...); + /// // OpenGL code here... + /// \endcode + /// + //////////////////////////////////////////////////////////// + void resetGLStates(); + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + RenderTarget(); + + //////////////////////////////////////////////////////////// + /// \brief Performs the common initialization step after creation + /// + /// The derived classes must call this function after the + /// target is created and ready for drawing. + /// + //////////////////////////////////////////////////////////// + void initialize(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Apply the current view + /// + //////////////////////////////////////////////////////////// + void applyCurrentView(); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new blending mode + /// + /// \param mode Blending mode to apply + /// + //////////////////////////////////////////////////////////// + void applyBlendMode(BlendMode mode); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new transform + /// + /// \param transform Transform to apply + /// + //////////////////////////////////////////////////////////// + void applyTransform(const Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new texture + /// + /// \param texture Texture to apply + /// + //////////////////////////////////////////////////////////// + void applyTexture(const Texture* texture); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new shader + /// + /// \param shader Shader to apply + /// + //////////////////////////////////////////////////////////// + void applyShader(const Shader* shader); + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// This function must be implemented by derived classes to make + /// their OpenGL context current; it is called by the base class + /// everytime it's going to use OpenGL calls. + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Render states cache + /// + //////////////////////////////////////////////////////////// + struct StatesCache + { + enum {VertexCacheSize = 4}; + + bool glStatesSet; ///< Are our internal GL states set yet? + bool viewChanged; ///< Has the current view changed since last draw? + BlendMode lastBlendMode; ///< Cached blending mode + Uint64 lastTextureId; ///< Cached texture + bool useVertexCache; ///< Did we previously use the vertex cache? + Vertex vertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + View m_defaultView; ///< Default view + View m_view; ///< Current view + StatesCache m_cache; ///< Render states cache +}; + +} // namespace sf + + +#endif // SFML_RENDERTARGET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderTarget +/// \ingroup graphics +/// +/// sf::RenderTarget defines the common behaviour of all the +/// 2D render targets usable in the graphics module. It makes +/// it possible to draw 2D entities like sprites, shapes, text +/// without using any OpenGL command directly. +/// +/// A sf::RenderTarget is also able to use views (sf::View), +/// which are a kind of 2D cameras. With views you can globally +/// scroll, rotate or zoom everything that is drawn, +/// without having to transform every single entity. See the +/// documentation of sf::View for more details and sample pieces of +/// code about this class. +/// +/// On top of that, render targets are still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. When doing so, make sure that +/// OpenGL states are not messed up by calling the +/// pushGLStates/popGLStates functions. +/// +/// \see sf::RenderWindow, sf::RenderTexture, sf::View +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTexture.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTexture.hpp new file mode 100644 index 0000000..384e459 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderTexture.hpp @@ -0,0 +1,280 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERTEXTURE_HPP +#define SFML_RENDERTEXTURE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class RenderTextureImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Target for off-screen 2D rendering into a texture +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderTexture : public RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an empty, invalid render-texture. You must + /// call create to have a valid render-texture. + /// + /// \see create + /// + //////////////////////////////////////////////////////////// + RenderTexture(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderTexture(); + + //////////////////////////////////////////////////////////// + /// \brief Create the render-texture + /// + /// Before calling this function, the render-texture is in + /// an invalid state, thus it is mandatory to call it before + /// doing anything with the render-texture. + /// The last parameter, \a depthBuffer, is useful if you want + /// to use the render-texture for 3D OpenGL rendering that requires + /// a depth-buffer. Otherwise it is unnecessary, and you should + /// leave this parameter to false (which is its default value). + /// + /// \param width Width of the render-texture + /// \param height Height of the render-texture + /// \param depthBuffer Do you want this render-texture to have a depth buffer? + /// + /// \return True if creation has been successful + /// + //////////////////////////////////////////////////////////// + bool create(unsigned int width, unsigned int height, bool depthBuffer = false); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable texture smoothing + /// + /// This function is similar to Texture::setSmooth. + /// This parameter is disabled by default. + /// + /// \param smooth True to enable smoothing, false to disable it + /// + /// \see isSmooth + /// + //////////////////////////////////////////////////////////// + void setSmooth(bool smooth); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the smooth filtering is enabled or not + /// + /// \return True if texture smoothing is enabled + /// + /// \see setSmooth + /// + //////////////////////////////////////////////////////////// + bool isSmooth() const; + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable texture repeating + /// + /// This function is similar to Texture::setRepeated. + /// This parameter is disabled by default. + /// + /// \param repeated True to enable repeating, false to disable it + /// + /// \see isRepeated + /// + //////////////////////////////////////////////////////////// + void setRepeated(bool repeated); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the texture is repeated or not + /// + /// \return True if texture is repeated + /// + /// \see setRepeated + /// + //////////////////////////////////////////////////////////// + bool isRepeated() const; + + //////////////////////////////////////////////////////////// + /// \brief Activate of deactivate the render-texture for rendering + /// + /// This function makes the render-texture's context current for + /// future OpenGL rendering operations (so you shouldn't care + /// about it if you're not doing direct OpenGL stuff). + /// Only one context can be current in a thread, so if you + /// want to draw OpenGL geometry to another render target + /// (like a RenderWindow) don't forget to activate it again. + /// + /// \param active True to activate, false to deactivate + /// + /// \return True if operation was successful, false otherwise + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active = true); + + //////////////////////////////////////////////////////////// + /// \brief Update the contents of the target texture + /// + /// This function updates the target texture with what + /// has been drawn so far. Like for windows, calling this + /// function is mandatory at the end of rendering. Not calling + /// it may leave the texture in an undefined state. + /// + //////////////////////////////////////////////////////////// + void display(); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the rendering region of the texture + /// + /// The returned value is the size that you passed to + /// the create function. + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only reference to the target texture + /// + /// After drawing to the render-texture and calling Display, + /// you can retrieve the updated texture using this function, + /// and draw it using a sprite (for example). + /// The internal sf::Texture of a render-texture is always the + /// same instance, so that it is possible to call this function + /// once and keep a reference to the texture even after it is + /// modified. + /// + /// \return Const reference to the texture + /// + //////////////////////////////////////////////////////////// + const Texture& getTexture() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// This function is called by the base class + /// everytime it's going to use OpenGL calls. + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::RenderTextureImpl* m_impl; ///< Platform/hardware specific implementation + Texture m_texture; ///< Target texture to draw on +}; + +} // namespace sf + + +#endif // SFML_RENDERTEXTURE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderTexture +/// \ingroup graphics +/// +/// sf::RenderTexture is the little brother of sf::RenderWindow. +/// It implements the same 2D drawing and OpenGL-related functions +/// (see their base class sf::RenderTarget for more details), +/// the difference is that the result is stored in an off-screen +/// texture rather than being show in a window. +/// +/// Rendering to a texture can be useful in a variety of situations: +/// \li precomputing a complex static texture (like a level's background from multiple tiles) +/// \li applying post-effects to the whole scene with shaders +/// \li creating a sprite from a 3D object rendered with OpenGL +/// \li etc. +/// +/// Usage example: +/// +/// \code +/// // Create a new render-window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Create a new render-texture +/// sf::RenderTexture texture; +/// if (!texture.create(500, 500)) +/// return -1; +/// +/// // The main loop +/// while (window.isOpen()) +/// { +/// // Event processing +/// // ... +/// +/// // Clear the whole texture with red color +/// texture.clear(sf::Color::Red); +/// +/// // Draw stuff to the texture +/// texture.draw(sprite); // sprite is a sf::Sprite +/// texture.draw(shape); // shape is a sf::Shape +/// texture.draw(text); // text is a sf::Text +/// +/// // We're done drawing to the texture +/// texture.display(); +/// +/// // Now we start rendering to the window, clear it first +/// window.clear(); +/// +/// // Draw the texture +/// sf::Sprite sprite(texture.getTexture()); +/// window.draw(sprite); +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +/// Like sf::RenderWindow, sf::RenderTexture is still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. If you need a depth buffer for +/// 3D rendering, don't forget to request it when calling RenderTexture::create. +/// +/// \see sf::RenderTarget, sf::RenderWindow, sf::View, sf::Texture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderWindow.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderWindow.hpp new file mode 100644 index 0000000..b069347 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/RenderWindow.hpp @@ -0,0 +1,266 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERWINDOW_HPP +#define SFML_RENDERWINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Window that can serve as a target for 2D drawing +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderWindow : public Window, public RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor doesn't actually create the window, + /// use the other constructors or call "create" to do so. + /// + //////////////////////////////////////////////////////////// + RenderWindow(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a new window + /// + /// This constructor creates the window with the size and pixel + /// depth defined in \a mode. An optional style can be passed to + /// customize the look and behaviour of the window (borders, + /// title bar, resizable, closable, ...). + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. You shouldn't care about these + /// parameters for a regular usage of the graphics module. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + RenderWindow(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Construct the window from an existing control + /// + /// Use this constructor if you want to create an SFML + /// rendering area into an already existing control. + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. You shouldn't care about these + /// parameters for a regular usage of the graphics module. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + explicit RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Closes the window and free all the resources attached to it. + /// + //////////////////////////////////////////////////////////// + virtual ~RenderWindow(); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rendering region of the window + /// + /// The size doesn't include the titlebar and borders + /// of the window. + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Copy the current contents of the window to an image + /// + /// This is a slow operation, whose main purpose is to make + /// screenshots of the application. If you want to update an + /// image with the contents of the window and then use it for + /// drawing, you should rather use a sf::Texture and its + /// update(Window&) function. + /// You can also draw things directly to a texture with the + /// sf::RenderTexture class. + /// + /// \return Image containing the captured contents + /// + //////////////////////////////////////////////////////////// + Image capture() const; + +protected: + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been created + /// + /// This function is called so that derived classes can + /// perform their own specific initialization as soon as + /// the window is created. + /// + //////////////////////////////////////////////////////////// + virtual void onCreate(); + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been resized + /// + /// This function is called so that derived classes can + /// perform custom actions when the size of the window changes. + /// + //////////////////////////////////////////////////////////// + virtual void onResize(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active); +}; + +} // namespace sf + + +#endif // SFML_RENDERWINDOW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderWindow +/// \ingroup graphics +/// +/// sf::RenderWindow is the main class of the Graphics module. +/// It defines an OS window that can be painted using the other +/// classes of the graphics module. +/// +/// sf::RenderWindow is derived from sf::Window, thus it inherits +/// all its features: events, window management, OpenGL rendering, +/// etc. See the documentation of sf::Window for a more complete +/// description of all these features, as well as code examples. +/// +/// On top of that, sf::RenderWindow adds more features related to +/// 2D drawing with the graphics module (see its base class +/// sf::RenderTarget for more details). +/// Here is a typical rendering and event loop with a sf::RenderWindow: +/// +/// \code +/// // Declare and create a new render-window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Limit the framerate to 60 frames per second (this step is optional) +/// window.setFramerateLimit(60); +/// +/// // The main loop - ends as soon as the window is closed +/// while (window.isOpen()) +/// { +/// // Event processing +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// } +/// +/// // Clear the whole window before rendering a new frame +/// window.clear(); +/// +/// // Draw some graphical entities +/// window.draw(sprite); +/// window.draw(circle); +/// window.draw(text); +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +/// Like sf::Window, sf::RenderWindow is still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. +/// +/// \code +/// // Create the render window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL"); +/// +/// // Create a sprite and a text to display +/// sf::Sprite sprite; +/// sf::Text text; +/// ... +/// +/// // Perform OpenGL initializations +/// glMatrixMode(GL_PROJECTION); +/// ... +/// +/// // Start the rendering loop +/// while (window.isOpen()) +/// { +/// // Process events +/// ... +/// +/// // Draw a background sprite +/// window.pushGLStates(); +/// window.draw(sprite); +/// window.popGLStates(); +/// +/// // Draw a 3D object using OpenGL +/// glBegin(GL_QUADS); +/// glVertex3f(...); +/// ... +/// glEnd(); +/// +/// // Draw text on top of the 3D object +/// window.pushGLStates(); +/// window.draw(text); +/// window.popGLStates(); +/// +/// // Finally, display the rendered frame on screen +/// window.display(); +/// } +/// \endcode +/// +/// \see sf::Window, sf::RenderTarget, sf::RenderTexture, sf::View +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shader.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shader.hpp new file mode 100644 index 0000000..2fbbf6e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shader.hpp @@ -0,0 +1,635 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SHADER_HPP +#define SFML_SHADER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Shader class (vertex and fragment) +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Shader : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Types of shaders + /// + //////////////////////////////////////////////////////////// + enum Type + { + Vertex, ///< Vertex shader + Fragment ///< Fragment (pixel) shader + }; + + //////////////////////////////////////////////////////////// + /// \brief Special type/value that can be passed to setParameter, + /// and that represents the texture of the object being drawn + /// + //////////////////////////////////////////////////////////// + struct CurrentTextureType {}; + static CurrentTextureType CurrentTexture; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an invalid shader. + /// + //////////////////////////////////////////////////////////// + Shader(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Shader(); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a file + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source must be a text file containing a valid + /// shader in GLSL language. GLSL is a C-like language + /// dedicated to OpenGL shaders; you'll probably need to + /// read a good documentation for it before writing your + /// own shaders. + /// + /// \param filename Path of the vertex or fragment shader file to load + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from files + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The sources must be text files containing valid shaders + /// in GLSL language. GLSL is a C-like language dedicated to + /// OpenGL shaders; you'll probably need to read a good documentation + /// for it before writing your own shaders. + /// + /// \param vertexShaderFilename Path of the vertex shader file to load + /// \param fragmentShaderFilename Path of the fragment shader file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a source code in memory + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source code must be a valid shader in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for + /// it before writing your own shaders. + /// + /// \param shader String containing the source code of the shader + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const std::string& shader, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from source codes in memory + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The sources must be valid shaders in GLSL language. GLSL is + /// a C-like language dedicated to OpenGL shaders; you'll + /// probably need to read a good documentation for it before + /// writing your own shaders. + /// + /// \param vertexShader String containing the source code of the vertex shader + /// \param fragmentShader String containing the source code of the fragment shader + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a custom stream + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source code must be a valid shader in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for it + /// before writing your own shaders. + /// + /// \param stream Source stream to read from + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from custom streams + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The source codes must be valid shaders in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for + /// it before writing your own shaders. + /// + /// \param vertexShaderStream Source stream to read the vertex shader from + /// \param fragmentShaderStream Source stream to read the fragment shader from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream); + + //////////////////////////////////////////////////////////// + /// \brief Change a float parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a float + /// (float GLSL type). + /// + /// Example: + /// \code + /// uniform float myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x Value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x); + + //////////////////////////////////////////////////////////// + /// \brief Change a 2-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2x1 vector + /// (vec2 GLSL type). + /// + /// Example: + /// \code + /// uniform vec2 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Change a 3-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 3x1 vector + /// (vec3 GLSL type). + /// + /// Example: + /// \code + /// uniform vec3 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// \param z Third component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Change a 4-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x1 vector + /// (vec4 GLSL type). + /// + /// Example: + /// \code + /// uniform vec4 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// \param z Third component of the value to assign + /// \param w Fourth component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y, float z, float w); + + //////////////////////////////////////////////////////////// + /// \brief Change a 2-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2x1 vector + /// (vec2 GLSL type). + /// + /// Example: + /// \code + /// uniform vec2 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", sf::Vector2f(5.2f, 6.0f)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param vector Vector to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Vector2f& vector); + + //////////////////////////////////////////////////////////// + /// \brief Change a 3-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 3x1 vector + /// (vec3 GLSL type). + /// + /// Example: + /// \code + /// uniform vec3 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param vector Vector to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Vector3f& vector); + + //////////////////////////////////////////////////////////// + /// \brief Change a color parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x1 vector + /// (vec4 GLSL type). + /// + /// It is important to note that the components of the color are + /// normalized before being passed to the shader. Therefore, + /// they are converted from range [0 .. 255] to range [0 .. 1]. + /// For example, a sf::Color(255, 125, 0, 255) will be transformed + /// to a vec4(1.0, 0.5, 0.0, 1.0) in the shader. + /// + /// Example: + /// \code + /// uniform vec4 color; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("color", sf::Color(255, 128, 0, 255)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param color Color to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Change a matrix parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x4 matrix + /// (mat4 GLSL type). + /// + /// Example: + /// \code + /// uniform mat4 matrix; // this is the variable in the shader + /// \endcode + /// \code + /// sf::Transform transform; + /// transform.translate(5, 10); + /// shader.setParameter("matrix", transform); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param transform Transform to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const sf::Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Change a texture parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2D texture + /// (sampler2D GLSL type). + /// + /// Example: + /// \code + /// uniform sampler2D the_texture; // this is the variable in the shader + /// \endcode + /// \code + /// sf::Texture texture; + /// ... + /// shader.setParameter("the_texture", texture); + /// \endcode + /// It is important to note that \a texture must remain alive as long + /// as the shader uses it, no copy is made internally. + /// + /// To use the texture of the object being draw, which cannot be + /// known in advance, you can pass the special value + /// sf::Shader::CurrentTexture: + /// \code + /// shader.setParameter("the_texture", sf::Shader::CurrentTexture). + /// \endcode + /// + /// \param name Name of the texture in the shader + /// \param texture Texture to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Texture& texture); + + //////////////////////////////////////////////////////////// + /// \brief Change a texture parameter of the shader + /// + /// This overload maps a shader texture variable to the + /// texture of the object being drawn, which cannot be + /// known in advance. The second argument must be + /// sf::Shader::CurrentTexture. + /// The corresponding parameter in the shader must be a 2D texture + /// (sampler2D GLSL type). + /// + /// Example: + /// \code + /// uniform sampler2D current; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("current", sf::Shader::CurrentTexture); + /// \endcode + /// + /// \param name Name of the texture in the shader + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, CurrentTextureType); + + //////////////////////////////////////////////////////////// + /// \brief Bind a shader for rendering + /// + /// This function is not part of the graphics API, it mustn't be + /// used when drawing SFML entities. It must be used only if you + /// mix sf::Shader with OpenGL code. + /// + /// \code + /// sf::Shader s1, s2; + /// ... + /// sf::Shader::bind(&s1); + /// // draw OpenGL stuff that use s1... + /// sf::Shader::bind(&s2); + /// // draw OpenGL stuff that use s2... + /// sf::Shader::bind(NULL); + /// // draw OpenGL stuff that use no shader... + /// \endcode + /// + /// \param shader Shader to bind, can be null to use no shader + /// + //////////////////////////////////////////////////////////// + static void bind(const Shader* shader); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the system supports shaders + /// + /// This function should always be called before using + /// the shader features. If it returns false, then + /// any attempt to use sf::Shader will fail. + /// + /// \return True if shaders are supported, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isAvailable(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Compile the shader(s) and create the program + /// + /// If one of the arguments is NULL, the corresponding shader + /// is not created. + /// + /// \param vertexShaderCode Source code of the vertex shader + /// \param fragmentShaderCode Source code of the fragment shader + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool compile(const char* vertexShaderCode, const char* fragmentShaderCode); + + //////////////////////////////////////////////////////////// + /// \brief Bind all the textures used by the shader + /// + /// This function each texture to a different unit, and + /// updates the corresponding variables in the shader accordingly. + /// + //////////////////////////////////////////////////////////// + void bindTextures() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the location ID of a shader parameter + /// + /// \param name Name of the parameter to search + /// + /// \return Location ID of the parameter, or -1 if not found + /// + //////////////////////////////////////////////////////////// + int getParamLocation(const std::string& name); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map TextureTable; + typedef std::map ParamTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_shaderProgram; ///< OpenGL identifier for the program + int m_currentTexture; ///< Location of the current texture in the shader + TextureTable m_textures; ///< Texture variables in the shader, mapped to their location + ParamTable m_params; ///< Parameters location cache +}; + +} // namespace sf + + +#endif // SFML_SHADER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Shader +/// \ingroup graphics +/// +/// Shaders are programs written using a specific language, +/// executed directly by the graphics card and allowing +/// to apply real-time operations to the rendered entities. +/// +/// There are two kinds of shaders: +/// \li Vertex shaders, that process vertices +/// \li Fragment (pixel) shaders, that process pixels +/// +/// A sf::Shader can be composed of either a vertex shader +/// alone, a fragment shader alone, or both combined +/// (see the variants of the load functions). +/// +/// Shaders are written in GLSL, which is a C-like +/// language dedicated to OpenGL shaders. You'll probably +/// need to learn its basics before writing your own shaders +/// for SFML. +/// +/// Like any C/C++ program, a shader has its own variables +/// that you can set from your C++ application. sf::Shader +/// handles 5 different types of variables: +/// \li floats +/// \li vectors (2, 3 or 4 components) +/// \li colors +/// \li textures +/// \li transforms (matrices) +/// +/// The value of the variables can be changed at any time +/// with the various overloads of the setParameter function: +/// \code +/// shader.setParameter("offset", 2.f); +/// shader.setParameter("point", 0.5f, 0.8f, 0.3f); +/// shader.setParameter("color", sf::Color(128, 50, 255)); +/// shader.setParameter("matrix", transform); // transform is a sf::Transform +/// shader.setParameter("overlay", texture); // texture is a sf::Texture +/// shader.setParameter("texture", sf::Shader::CurrentTexture); +/// \endcode +/// +/// The special Shader::CurrentTexture argument maps the +/// given texture variable to the current texture of the +/// object being drawn (which cannot be known in advance). +/// +/// To apply a shader to a drawable, you must pass it as an +/// additional parameter to the Draw function: +/// \code +/// window.draw(sprite, &shader); +/// \endcode +/// +/// ... which is in fact just a shortcut for this: +/// \code +/// sf::RenderStates states; +/// states.shader = &shader; +/// window.draw(sprite, states); +/// \endcode +/// +/// In the code above we pass a pointer to the shader, because it may +/// be null (which means "no shader"). +/// +/// Shaders can be used on any drawable, but some combinations are +/// not interesting. For example, using a vertex shader on a sf::Sprite +/// is limited because there are only 4 vertices, the sprite would +/// have to be subdivided in order to apply wave effects. +/// Another bad example is a fragment shader with sf::Text: the texture +/// of the text is not the actual text that you see on screen, it is +/// a big texture containing all the characters of the font in an +/// arbitrary order; thus, texture lookups on pixels other than the +/// current one may not give you the expected result. +/// +/// Shaders can also be used to apply global post-effects to the +/// current contents of the target (like the old sf::PostFx class +/// in SFML 1). This can be done in two different ways: +/// \li draw everything to a sf::RenderTexture, then draw it to +/// the main target using the shader +/// \li draw everything directly to the main target, then use +/// sf::Texture::update(Window&) to copy its contents to a texture +/// and draw it to the main target using the shader +/// +/// The first technique is more optimized because it doesn't involve +/// retrieving the target's pixels to system memory, but the +/// second one doesn't impact the rendering process and can be +/// easily inserted anywhere without impacting all the code. +/// +/// Like sf::Texture that can be used as a raw OpenGL texture, +/// sf::Shader can also be used directly as a raw shader for +/// custom OpenGL geometry. +/// \code +/// sf::Shader::bind(&shader); +/// ... render OpenGL geometry ... +/// sf::Shader::bind(NULL); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shape.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shape.hpp new file mode 100644 index 0000000..bc38775 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Shape.hpp @@ -0,0 +1,345 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SHAPE_HPP +#define SFML_SHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class for textured shapes with outline +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Shape : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Shape(); + + //////////////////////////////////////////////////////////// + /// \brief Change the source texture of the shape + /// + /// The \a texture argument refers to a texture that must + /// exist as long as the shape uses it. Indeed, the shape + /// doesn't store its own copy of the texture, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the source texture is destroyed and the shape tries to + /// use it, the behaviour is undefined. + /// \a texture can be NULL to disable texturing. + /// If \a resetRect is true, the TextureRect property of + /// the shape is automatically adjusted to the size of the new + /// texture. If it is false, the texture rect is left unchanged. + /// + /// \param texture New texture + /// \param resetRect Should the texture rect be reset to the size of the new texture? + /// + /// \see getTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + void setTexture(const Texture* texture, bool resetRect = false); + + //////////////////////////////////////////////////////////// + /// \brief Set the sub-rectangle of the texture that the shape will display + /// + /// The texture rect is useful when you don't want to display + /// the whole texture, but rather a part of it. + /// By default, the texture rect covers the entire texture. + /// + /// \param rect Rectangle defining the region of the texture to display + /// + /// \see getTextureRect, setTexture + /// + //////////////////////////////////////////////////////////// + void setTextureRect(const IntRect& rect); + + //////////////////////////////////////////////////////////// + /// \brief Set the fill color of the shape + /// + /// This color is modulated (multiplied) with the shape's + /// texture if any. It can be used to colorize the shape, + /// or change its global opacity. + /// You can use sf::Color::Transparent to make the inside of + /// the shape transparent, and have the outline alone. + /// By default, the shape's fill color is opaque white. + /// + /// \param color New color of the shape + /// + /// \see getFillColor, setOutlineColor + /// + //////////////////////////////////////////////////////////// + void setFillColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Set the outline color of the shape + /// + /// By default, the shape's outline color is opaque white. + /// + /// \param color New outline color of the shape + /// + /// \see getOutlineColor, setFillColor + /// + //////////////////////////////////////////////////////////// + void setOutlineColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Set the thickness of the shape's outline + /// + /// Note that negative values are allowed (so that the outline + /// expands towards the center of the shape), and using zero + /// disables the outline. + /// By default, the outline thickness is 0. + /// + /// \param thickness New outline thickness + /// + /// \see getOutlineThickness + /// + //////////////////////////////////////////////////////////// + void setOutlineThickness(float thickness); + + //////////////////////////////////////////////////////////// + /// \brief Get the source texture of the shape + /// + /// If the shape has no source texture, a NULL pointer is returned. + /// The returned pointer is const, which means that you can't + /// modify the texture when you retrieve it with this function. + /// + /// \return Pointer to the shape's texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + const Texture* getTexture() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sub-rectangle of the texture displayed by the shape + /// + /// \return Texture rectangle of the shape + /// + /// \see setTextureRect + /// + //////////////////////////////////////////////////////////// + const IntRect& getTextureRect() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the fill color of the shape + /// + /// \return Fill color of the shape + /// + /// \see setFillColor + /// + //////////////////////////////////////////////////////////// + const Color& getFillColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the outline color of the shape + /// + /// \return Outline color of the shape + /// + /// \see setOutlineColor + /// + //////////////////////////////////////////////////////////// + const Color& getOutlineColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the outline thickness of the shape + /// + /// \return Outline thickness of the shape + /// + /// \see setOutlineThickness + /// + //////////////////////////////////////////////////////////// + float getOutlineThickness() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the total number of points of the shape + /// + /// \return Number of points of the shape + /// + /// \see getPoint + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Shape(); + + //////////////////////////////////////////////////////////// + /// \brief Recompute the internal geometry of the shape + /// + /// This function must be called by the derived class everytime + /// the shape's points change (ie. the result of either + /// getPointCount or getPoint is different). + /// + //////////////////////////////////////////////////////////// + void update(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the shape to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the fill vertices' color + /// + //////////////////////////////////////////////////////////// + void updateFillColors(); + + //////////////////////////////////////////////////////////// + /// \brief Update the fill vertices' texture coordinates + /// + //////////////////////////////////////////////////////////// + void updateTexCoords(); + + //////////////////////////////////////////////////////////// + /// \brief Update the outline vertices' position + /// + //////////////////////////////////////////////////////////// + void updateOutline(); + + //////////////////////////////////////////////////////////// + /// \brief Update the outline vertices' color + /// + //////////////////////////////////////////////////////////// + void updateOutlineColors(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + const Texture* m_texture; ///< Texture of the shape + IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display + Color m_fillColor; ///< Fill color + Color m_outlineColor; ///< Outline color + float m_outlineThickness; ///< Thickness of the shape's outline + VertexArray m_vertices; ///< Vertex array containing the fill geometry + VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry + FloatRect m_insideBounds; ///< Bounding rectangle of the inside (fill) + FloatRect m_bounds; ///< Bounding rectangle of the whole shape (outline + fill) +}; + +} // namespace sf + + +#endif // SFML_SHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Shape +/// \ingroup graphics +/// +/// sf::Shape is a drawable class that allows to define and +/// display a custom convex shape on a render target. +/// It's only an abstract base, it needs to be specialized for +/// concrete types of shapes (circle, rectangle, convex polygon, +/// star, ...). +/// +/// In addition to the attributes provided by the specialized +/// shape classes, a shape always has the following attributes: +/// \li a texture +/// \li a texture rectangle +/// \li a fill color +/// \li an outline color +/// \li an outline thickness +/// +/// Each feature is optional, and can be disabled easily: +/// \li the texture can be null +/// \li the fill/outline colors can be sf::Color::Transparent +/// \li the outline thickness can be zero +/// +/// You can write your own derived shape class, there are only +/// two virtual functions to override: +/// \li getPointCount must return the number of points of the shape +/// \li getPoint must return the points of the shape +/// +/// \see sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Sprite.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Sprite.hpp new file mode 100644 index 0000000..954881d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Sprite.hpp @@ -0,0 +1,277 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SPRITE_HPP +#define SFML_SPRITE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Drawable representation of a texture, with its +/// own transformations, color, etc. +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Sprite : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty sprite with no source texture. + /// + //////////////////////////////////////////////////////////// + Sprite(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sprite from a source texture + /// + /// \param texture Source texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + explicit Sprite(const Texture& texture); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sprite from a sub-rectangle of a source texture + /// + /// \param texture Source texture + /// \param rectangle Sub-rectangle of the texture to assign to the sprite + /// + /// \see setTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + Sprite(const Texture& texture, const IntRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Change the source texture of the sprite + /// + /// The \a texture argument refers to a texture that must + /// exist as long as the sprite uses it. Indeed, the sprite + /// doesn't store its own copy of the texture, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the source texture is destroyed and the sprite tries to + /// use it, the behaviour is undefined. + /// If \a resetRect is true, the TextureRect property of + /// the sprite is automatically adjusted to the size of the new + /// texture. If it is false, the texture rect is left unchanged. + /// + /// \param texture New texture + /// \param resetRect Should the texture rect be reset to the size of the new texture? + /// + /// \see getTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + void setTexture(const Texture& texture, bool resetRect = false); + + //////////////////////////////////////////////////////////// + /// \brief Set the sub-rectangle of the texture that the sprite will display + /// + /// The texture rect is useful when you don't want to display + /// the whole texture, but rather a part of it. + /// By default, the texture rect covers the entire texture. + /// + /// \param rectangle Rectangle defining the region of the texture to display + /// + /// \see getTextureRect, setTexture + /// + //////////////////////////////////////////////////////////// + void setTextureRect(const IntRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Set the global color of the sprite + /// + /// This color is modulated (multiplied) with the sprite's + /// texture. It can be used to colorize the sprite, or change + /// its global opacity. + /// By default, the sprite's color is opaque white. + /// + /// \param color New color of the sprite + /// + /// \see getColor + /// + //////////////////////////////////////////////////////////// + void setColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the source texture of the sprite + /// + /// If the sprite has no source texture, a NULL pointer is returned. + /// The returned pointer is const, which means that you can't + /// modify the texture when you retrieve it with this function. + /// + /// \return Pointer to the sprite's texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + const Texture* getTexture() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sub-rectangle of the texture displayed by the sprite + /// + /// \return Texture rectangle of the sprite + /// + /// \see setTextureRect + /// + //////////////////////////////////////////////////////////// + const IntRect& getTextureRect() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global color of the sprite + /// + /// \return Global color of the sprite + /// + /// \see setColor + /// + //////////////////////////////////////////////////////////// + const Color& getColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the sprite to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the vertices' positions + /// + //////////////////////////////////////////////////////////// + void updatePositions(); + + //////////////////////////////////////////////////////////// + /// \brief Update the vertices' texture coordinates + /// + //////////////////////////////////////////////////////////// + void updateTexCoords(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vertex m_vertices[4]; ///< Vertices defining the sprite's geometry + const Texture* m_texture; ///< Texture of the sprite + IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display +}; + +} // namespace sf + + +#endif // SFML_SPRITE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Sprite +/// \ingroup graphics +/// +/// sf::Sprite is a drawable class that allows to easily display +/// a texture (or a part of it) on a render target. +/// +/// It inherits all the functions from sf::Transformable: +/// position, rotation, scale, origin. It also adds sprite-specific +/// properties such as the texture to use, the part of it to display, +/// and some convenience functions to change the overall color of the +/// sprite, or to get its bounding rectangle. +/// +/// sf::Sprite works in combination with the sf::Texture class, which +/// loads and provides the pixel data of a given texture. +/// +/// The separation of sf::Sprite and sf::Texture allows more flexibility +/// and better performances: indeed a sf::Texture is a heavy resource, +/// and any operation on it is slow (often too slow for real-time +/// applications). On the other side, a sf::Sprite is a lightweight +/// object which can use the pixel data of a sf::Texture and draw +/// it with its own transformation/color/blending attributes. +/// +/// It is important to note that the sf::Sprite instance doesn't +/// copy the texture that it uses, it only keeps a reference to it. +/// Thus, a sf::Texture must not be destroyed while it is +/// used by a sf::Sprite (i.e. never write a function that +/// uses a local sf::Texture instance for creating a sprite). +/// +/// Usage example: +/// \code +/// // Declare and load a texture +/// sf::Texture texture; +/// texture.loadFromFile("texture.png"); +/// +/// // Create a sprite +/// sf::Sprite sprite; +/// sprite.setTexture(texture); +/// sprite.setTextureRect(sf::IntRect(10, 10, 50, 30)); +/// sprite.setColor(sf::Color(255, 255, 255, 200)); +/// sprite.setPosition(100, 25); +/// +/// // Draw it +/// window.draw(sprite); +/// \endcode +/// +/// \see sf::Texture, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Text.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Text.hpp new file mode 100644 index 0000000..04abd24 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Text.hpp @@ -0,0 +1,351 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TEXT_HPP +#define SFML_TEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Graphical text that can be drawn to a render target +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Text : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the string drawing styles + /// + //////////////////////////////////////////////////////////// + enum Style + { + Regular = 0, ///< Regular characters, no style + Bold = 1 << 0, ///< Bold characters + Italic = 1 << 1, ///< Italic characters + Underlined = 1 << 2 ///< Underlined characters + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty text. + /// + //////////////////////////////////////////////////////////// + Text(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the text from a string, font and size + /// + /// \param string Text assigned to the string + /// \param font Font used to draw the string + /// \param characterSize Base size of characters, in pixels + /// + //////////////////////////////////////////////////////////// + Text(const String& string, const Font& font, unsigned int characterSize = 30); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's string + /// + /// The \a string argument is a sf::String, which can + /// automatically be constructed from standard string types. + /// So, the following calls are all valid: + /// \code + /// text.setString("hello"); + /// text.setString(L"hello"); + /// text.setString(std::string("hello")); + /// text.setString(std::wstring(L"hello")); + /// \endcode + /// A text's string is empty by default. + /// + /// \param string New string + /// + /// \see getString + /// + //////////////////////////////////////////////////////////// + void setString(const String& string); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's font + /// + /// The \a font argument refers to a font that must + /// exist as long as the text uses it. Indeed, the text + /// doesn't store its own copy of the font, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the font is destroyed and the text tries to + /// use it, the behaviour is undefined. + /// + /// \param font New font + /// + /// \see getFont + /// + //////////////////////////////////////////////////////////// + void setFont(const Font& font); + + //////////////////////////////////////////////////////////// + /// \brief Set the character size + /// + /// The default size is 30. + /// + /// \param size New character size, in pixels + /// + /// \see getCharacterSize + /// + //////////////////////////////////////////////////////////// + void setCharacterSize(unsigned int size); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's style + /// + /// You can pass a combination of one or more styles, for + /// example sf::Text::Bold | sf::Text::Italic. + /// The default style is sf::Text::Regular. + /// + /// \param style New style + /// + /// \see getStyle + /// + //////////////////////////////////////////////////////////// + void setStyle(Uint32 style); + + //////////////////////////////////////////////////////////// + /// \brief Set the global color of the text + /// + /// By default, the text's color is opaque white. + /// + /// \param color New color of the text + /// + /// \see getColor + /// + //////////////////////////////////////////////////////////// + void setColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the text's string + /// + /// The returned string is a sf::String, which can automatically + /// be converted to standard string types. So, the following + /// lines of code are all valid: + /// \code + /// sf::String s1 = text.getString(); + /// std::string s2 = text.getString(); + /// std::wstring s3 = text.getString(); + /// \endcode + /// + /// \return Text's string + /// + /// \see setString + /// + //////////////////////////////////////////////////////////// + const String& getString() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the text's font + /// + /// If the text has no font attached, a NULL pointer is returned. + /// The returned reference is const, which means that you + /// cannot modify the font when you get it from this function. + /// + /// \return Pointer to the text's font + /// + /// \see setFont + /// + //////////////////////////////////////////////////////////// + const Font* getFont() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the character size + /// + /// \return Size of the characters, in pixels + /// + /// \see setCharacterSize + /// + //////////////////////////////////////////////////////////// + unsigned int getCharacterSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the text's style + /// + /// \return Text's style + /// + /// \see setStyle + /// + //////////////////////////////////////////////////////////// + Uint32 getStyle() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global color of the text + /// + /// \return Global color of the text + /// + /// \see setColor + /// + //////////////////////////////////////////////////////////// + const Color& getColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the position of the \a index-th character + /// + /// This function computes the visual position of a character + /// from its index in the string. The returned position is + /// in global coordinates (translation, rotation, scale and + /// origin are applied). + /// If \a index is out of range, the position of the end of + /// the string is returned. + /// + /// \param index Index of the character + /// + /// \return Position of the character + /// + //////////////////////////////////////////////////////////// + Vector2f findCharacterPos(std::size_t index) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the text to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the text's geometry + /// + //////////////////////////////////////////////////////////// + void updateGeometry(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + String m_string; ///< String to display + const Font* m_font; ///< Font used to display the string + unsigned int m_characterSize; ///< Base size of characters, in pixels + Uint32 m_style; ///< Text style (see Style enum) + Color m_color; ///< Text color + VertexArray m_vertices; ///< Vertex array containing the text's geometry + FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates) +}; + +} // namespace sf + + +#endif // SFML_TEXT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Text +/// \ingroup graphics +/// +/// sf::Text is a drawable class that allows to easily display +/// some text with custom style and color on a render target. +/// +/// It inherits all the functions from sf::Transformable: +/// position, rotation, scale, origin. It also adds text-specific +/// properties such as the font to use, the character size, +/// the font style (bold, italic, underlined), the global color +/// and the text to display of course. +/// It also provides convenience functions to calculate the +/// graphical size of the text, or to get the global position +/// of a given character. +/// +/// sf::Text works in combination with the sf::Font class, which +/// loads and provides the glyphs (visual characters) of a given font. +/// +/// The separation of sf::Font and sf::Text allows more flexibility +/// and better performances: indeed a sf::Font is a heavy resource, +/// and any operation on it is slow (often too slow for real-time +/// applications). On the other side, a sf::Text is a lightweight +/// object which can combine the glyphs data and metrics of a sf::Font +/// to display any text on a render target. +/// +/// It is important to note that the sf::Text instance doesn't +/// copy the font that it uses, it only keeps a reference to it. +/// Thus, a sf::Font must not be destructed while it is +/// used by a sf::Text (i.e. never write a function that +/// uses a local sf::Font instance for creating a text). +/// +/// Usage example: +/// \code +/// // Declare and load a font +/// sf::Font font; +/// font.loadFromFile("arial.ttf"); +/// +/// // Create a text +/// sf::Text text("hello", font); +/// text.setCharacterSize(30); +/// text.setStyle(sf::Text::Bold); +/// text.setColor(sf::Color::Red); +/// +/// // Draw it +/// window.draw(text); +/// \endcode +/// +/// \see sf::Font, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Texture.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Texture.hpp new file mode 100644 index 0000000..ba61f54 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Texture.hpp @@ -0,0 +1,602 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TEXTURE_HPP +#define SFML_TEXTURE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Window; +class RenderTarget; +class RenderTexture; +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Image living on the graphics card that can be used for drawing +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Texture : GlResource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Types of texture coordinates that can be used for rendering + /// + //////////////////////////////////////////////////////////// + enum CoordinateType + { + Normalized, ///< Texture coordinates in range [0 .. 1] + Pixels ///< Texture coordinates in range [0 .. size] + }; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty texture. + /// + //////////////////////////////////////////////////////////// + Texture(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy instance to copy + /// + //////////////////////////////////////////////////////////// + Texture(const Texture& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Texture(); + + //////////////////////////////////////////////////////////// + /// \brief Create the texture + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param width Width of the texture + /// \param height Height of the texture + /// + /// \return True if creation was successful + /// + //////////////////////////////////////////////////////////// + bool create(unsigned int width, unsigned int height); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a file on disk + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromFile(filename); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param filename Path of the image file to load + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromMemory, loadFromStream, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a file in memory + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromMemory(data, size); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param data Pointer to the file data in memory + /// \param size Size of the data to load, in bytes + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromStream, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a custom stream + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromStream(stream); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param stream Source stream to read from + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(sf::InputStream& stream, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from an image + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param image Image to load into the texture + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromImage(const Image& image, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the texture + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Copy the texture pixels to an image + /// + /// This function performs a slow operation that downloads + /// the texture's pixels from the graphics card and copies + /// them to a new image, potentially applying transformations + /// to pixels if necessary (texture may be padded or flipped). + /// + /// \return Image containing the texture's pixels + /// + /// \see loadFromImage + /// + //////////////////////////////////////////////////////////// + Image copyToImage() const; + + //////////////////////////////////////////////////////////// + /// \brief Update the whole texture from an array of pixels + /// + /// The \a pixel array is assumed to have the same size as + /// the \a area rectangle, and to contain 32-bits RGBA pixels. + /// + /// No additional check is performed on the size of the pixel + /// array, passing invalid arguments will lead to an undefined + /// behaviour. + /// + /// This function does nothing if \a pixels is null or if the + /// texture was not previously created. + /// + /// \param pixels Array of pixels to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from an array of pixels + /// + /// The size of the \a pixel array must match the \a width and + /// \a height arguments, and it must contain 32-bits RGBA pixels. + /// + /// No additional check is performed on the size of the pixel + /// array or the bounds of the area to update, passing invalid + /// arguments will lead to an undefined behaviour. + /// + /// This function does nothing if \a pixels is null or if the + /// texture was not previously created. + /// + /// \param pixels Array of pixels to copy to the texture + /// \param width Width of the pixel region contained in \a pixels + /// \param height Height of the pixel region contained in \a pixels + /// \param x X offset in the texture where to copy the source pixels + /// \param y Y offset in the texture where to copy the source pixels + /// + //////////////////////////////////////////////////////////// + void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Update the texture from an image + /// + /// Although the source image can be smaller than the texture, + /// this function is usually used for updating the whole texture. + /// The other overload, which has (x, y) additional arguments, + /// is more convenient for updating a sub-area of the texture. + /// + /// No additional check is performed on the size of the image, + /// passing an image bigger than the texture will lead to an + /// undefined behaviour. + /// + /// This function does nothing if the texture was not + /// previously created. + /// + /// \param image Image to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Image& image); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from an image + /// + /// No additional check is performed on the size of the image, + /// passing an invalid combination of image size and offset + /// will lead to an undefined behaviour. + /// + /// This function does nothing if the texture was not + /// previously created. + /// + /// \param image Image to copy to the texture + /// \param x X offset in the texture where to copy the source image + /// \param y Y offset in the texture where to copy the source image + /// + //////////////////////////////////////////////////////////// + void update(const Image& image, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Update the texture from the contents of a window + /// + /// Although the source window can be smaller than the texture, + /// this function is usually used for updating the whole texture. + /// The other overload, which has (x, y) additional arguments, + /// is more convenient for updating a sub-area of the texture. + /// + /// No additional check is performed on the size of the window, + /// passing a window bigger than the texture will lead to an + /// undefined behaviour. + /// + /// This function does nothing if either the texture or the window + /// was not previously created. + /// + /// \param window Window to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Window& window); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from the contents of a window + /// + /// No additional check is performed on the size of the window, + /// passing an invalid combination of window size and offset + /// will lead to an undefined behaviour. + /// + /// This function does nothing if either the texture or the window + /// was not previously created. + /// + /// \param window Window to copy to the texture + /// \param x X offset in the texture where to copy the source window + /// \param y Y offset in the texture where to copy the source window + /// + //////////////////////////////////////////////////////////// + void update(const Window& window, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable the smooth filter + /// + /// When the filter is activated, the texture appears smoother + /// so that pixels are less noticeable. However if you want + /// the texture to look exactly the same as its source file, + /// you should leave it disabled. + /// The smooth filter is disabled by default. + /// + /// \param smooth True to enable smoothing, false to disable it + /// + /// \see isSmooth + /// + //////////////////////////////////////////////////////////// + void setSmooth(bool smooth); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the smooth filter is enabled or not + /// + /// \return True if smoothing is enabled, false if it is disabled + /// + /// \see setSmooth + /// + //////////////////////////////////////////////////////////// + bool isSmooth() const; + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable repeating + /// + /// Repeating is involved when using texture coordinates + /// outside the texture rectangle [0, 0, width, height]. + /// In this case, if repeat mode is enabled, the whole texture + /// will be repeated as many times as needed to reach the + /// coordinate (for example, if the X texture coordinate is + /// 3 * width, the texture will be repeated 3 times). + /// If repeat mode is disabled, the "extra space" will instead + /// be filled with border pixels. + /// Warning: on very old graphics cards, white pixels may appear + /// when the texture is repeated. With such cards, repeat mode + /// can be used reliably only if the texture has power-of-two + /// dimensions (such as 256x128). + /// Repeating is disabled by default. + /// + /// \param repeated True to repeat the texture, false to disable repeating + /// + /// \see isRepeated + /// + //////////////////////////////////////////////////////////// + void setRepeated(bool repeated); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the texture is repeated or not + /// + /// \return True if repeat mode is enabled, false if it is disabled + /// + /// \see setRepeated + /// + //////////////////////////////////////////////////////////// + bool isRepeated() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Texture& operator =(const Texture& right); + + //////////////////////////////////////////////////////////// + /// \brief Bind a texture for rendering + /// + /// This function is not part of the graphics API, it mustn't be + /// used when drawing SFML entities. It must be used only if you + /// mix sf::Texture with OpenGL code. + /// + /// \code + /// sf::Texture t1, t2; + /// ... + /// sf::Texture::bind(&t1); + /// // draw OpenGL stuff that use t1... + /// sf::Texture::bind(&t2); + /// // draw OpenGL stuff that use t2... + /// sf::Texture::bind(NULL); + /// // draw OpenGL stuff that use no texture... + /// \endcode + /// + /// The \a coordinateType argument controls how texture + /// coordinates will be interpreted. If Normalized (the default), they + /// must be in range [0 .. 1], which is the default way of handling + /// texture coordinates with OpenGL. If Pixels, they must be given + /// in pixels (range [0 .. size]). This mode is used internally by + /// the graphics classes of SFML, it makes the definition of texture + /// coordinates more intuitive for the high-level API, users don't need + /// to compute normalized values. + /// + /// \param texture Pointer to the texture to bind, can be null to use no texture + /// \param coordinateType Type of texture coordinates to use + /// + //////////////////////////////////////////////////////////// + static void bind(const Texture* texture, CoordinateType coordinateType = Normalized); + + //////////////////////////////////////////////////////////// + /// \brief Get the maximum texture size allowed + /// + /// This maximum size is defined by the graphics driver. + /// You can expect a value of 512 pixels for low-end graphics + /// card, and up to 8192 pixels or more for newer hardware. + /// + /// \return Maximum size allowed for textures, in pixels + /// + //////////////////////////////////////////////////////////// + static unsigned int getMaximumSize(); + +private : + + friend class RenderTexture; + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// \brief Get a valid image size according to hardware support + /// + /// This function checks whether the graphics driver supports + /// non power of two sizes or not, and adjusts the size + /// accordingly. + /// The returned size is greater than or equal to the original size. + /// + /// \param Size size to convert + /// + /// \return Valid nearest size (greater than or equal to specified size) + /// + //////////////////////////////////////////////////////////// + static unsigned int getValidSize(unsigned int size); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2u m_size; ///< Public texture size + Vector2u m_actualSize; ///< Actual texture size (can be greater than public size because of padding) + unsigned int m_texture; ///< Internal texture identifier + bool m_isSmooth; ///< Status of the smooth filter + bool m_isRepeated; ///< Is the texture in repeat mode? + mutable bool m_pixelsFlipped; ///< To work around the inconsistency in Y orientation + Uint64 m_cacheId; ///< Unique number that identifies the texture to the render target's cache +}; + +} // namespace sf + + +#endif // SFML_TEXTURE_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::Texture +/// \ingroup graphics +/// +/// sf::Texture stores pixels that can be drawn, with a sprite +/// for example. A texture lives in the graphics card memory, +/// therefore it is very fast to draw a texture to a render target, +/// or copy a render target to a texture (the graphics card can +/// access both directly). +/// +/// Being stored in the graphics card memory has some drawbacks. +/// A texture cannot be manipulated as freely as a sf::Image, +/// you need to prepare the pixels first and then upload them +/// to the texture in a single operation (see Texture::update). +/// +/// sf::Texture makes it easy to convert from/to sf::Image, but +/// keep in mind that these calls require transfers between +/// the graphics card and the central memory, therefore they are +/// slow operations. +/// +/// A texture can be loaded from an image, but also directly +/// from a file/memory/stream. The necessary shortcuts are defined +/// so that you don't need an image first for the most common cases. +/// However, if you want to perform some modifications on the pixels +/// before creating the final texture, you can load your file to a +/// sf::Image, do whatever you need with the pixels, and then call +/// Texture::loadFromImage. +/// +/// Since they live in the graphics card memory, the pixels of a texture +/// cannot be accessed without a slow copy first. And they cannot be +/// accessed individually. Therefore, if you need to read the texture's +/// pixels (like for pixel-perfect collisions), it is recommended to +/// store the collision information separately, for example in an array +/// of booleans. +/// +/// Like sf::Image, sf::Texture can handle a unique internal +/// representation of pixels, which is RGBA 32 bits. This means +/// that a pixel must be composed of 8 bits red, green, blue and +/// alpha channels -- just like a sf::Color. +/// +/// Usage example: +/// \code +/// // This example shows the most common use of sf::Texture: +/// // drawing a sprite +/// +/// // Load a texture from a file +/// sf::Texture texture; +/// if (!texture.loadFromFile("texture.png")) +/// return -1; +/// +/// // Assign it to a sprite +/// sf::Sprite sprite; +/// sprite.setTexture(texture); +/// +/// // Draw the textured sprite +/// window.draw(sprite); +/// \endcode +/// +/// \code +/// // This example shows another common use of sf::Texture: +/// // streaming real-time data, like video frames +/// +/// // Create an empty texture +/// sf::Texture texture; +/// if (!texture.create(640, 480)) +/// return -1; +/// +/// // Create a sprite that will display the texture +/// sf::Sprite sprite(texture); +/// +/// while (...) // the main loop +/// { +/// ... +/// +/// // update the texture +/// sf::Uint8* pixels = ...; // get a fresh chunk of pixels (the next frame of a movie, for example) +/// texture.update(pixels); +/// +/// // draw it +/// window.draw(sprite); +/// +/// ... +/// } +/// +/// \endcode +/// +/// Like sf::Shader that can be used as a raw OpenGL shader, +/// sf::Texture can also be used directly as a raw texture for +/// custom OpenGL geometry. +/// \code +/// sf::Texture::bind(&texture); +/// ... render OpenGL geometry ... +/// sf::Texture::bind(NULL); +/// \endcode +/// +/// \see sf::Sprite, sf::Image, sf::RenderTexture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transform.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transform.hpp new file mode 100644 index 0000000..3b91a8a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transform.hpp @@ -0,0 +1,450 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TRANSFORM_HPP +#define SFML_TRANSFORM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a 3x3 transform matrix +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Transform +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an identity transform (a transform that does nothing). + /// + //////////////////////////////////////////////////////////// + Transform(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a transform from a 3x3 matrix + /// + /// \param a00 Element (0, 0) of the matrix + /// \param a01 Element (0, 1) of the matrix + /// \param a02 Element (0, 2) of the matrix + /// \param a10 Element (1, 0) of the matrix + /// \param a11 Element (1, 1) of the matrix + /// \param a12 Element (1, 2) of the matrix + /// \param a20 Element (2, 0) of the matrix + /// \param a21 Element (2, 1) of the matrix + /// \param a22 Element (2, 2) of the matrix + /// + //////////////////////////////////////////////////////////// + Transform(float a00, float a01, float a02, + float a10, float a11, float a12, + float a20, float a21, float a22); + + //////////////////////////////////////////////////////////// + /// \brief Return the transform as a 4x4 matrix + /// + /// This function returns a pointer to an array of 16 floats + /// containing the transform elements as a 4x4 matrix, which + /// is directly compatible with OpenGL functions. + /// + /// \code + /// sf::Transform transform = ...; + /// glLoadMatrixf(transform.getMatrix()); + /// \endcode + /// + /// \return Pointer to a 4x4 matrix + /// + //////////////////////////////////////////////////////////// + const float* getMatrix() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the inverse of the transform + /// + /// If the inverse cannot be computed, an identity transform + /// is returned. + /// + /// \return A new transform which is the inverse of self + /// + //////////////////////////////////////////////////////////// + Transform getInverse() const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a 2D point + /// + /// \param x X coordinate of the point to transform + /// \param y Y coordinate of the point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + Vector2f transformPoint(float x, float y) const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a 2D point + /// + /// \param point Point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + Vector2f transformPoint(const Vector2f& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a rectangle + /// + /// Since SFML doesn't provide support for oriented rectangles, + /// the result of this function is always an axis-aligned + /// rectangle. Which means that if the transform contains a + /// rotation, the bounding rectangle of the transformed rectangle + /// is returned. + /// + /// \param rectangle Rectangle to transform + /// + /// \return Transformed rectangle + /// + //////////////////////////////////////////////////////////// + FloatRect transformRect(const FloatRect& rectangle) const; + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with another one + /// + /// The result is a transform that is equivalent to applying + /// *this followed by \a transform. Mathematically, it is + /// equivalent to a matrix multiplication. + /// + /// \param transform Transform to combine with this transform + /// + /// \return Reference to *this + /// + //////////////////////////////////////////////////////////// + Transform& combine(const Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a translation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.translate(100, 200).rotate(45); + /// \endcode + /// + /// \param x Offset to apply on X axis + /// \param y Offset to apply on Y axis + /// + /// \return Reference to *this + /// + /// \see rotate, scale + /// + //////////////////////////////////////////////////////////// + Transform& translate(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a translation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.translate(sf::Vector2f(100, 200)).rotate(45); + /// \endcode + /// + /// \param offset Translation offset to apply + /// + /// \return Reference to *this + /// + /// \see rotate, scale + /// + //////////////////////////////////////////////////////////// + Transform& translate(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90).translate(50, 20); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// The center of rotation is provided for convenience as a second + /// argument, so that you can build rotations around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).rotate(angle).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90, 8, 3).translate(50, 20); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// \param centerX X coordinate of the center of rotation + /// \param centerY Y coordinate of the center of rotation + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle, float centerX, float centerY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// The center of rotation is provided for convenience as a second + /// argument, so that you can build rotations around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).rotate(angle).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90, sf::Vector2f(8, 3)).translate(sf::Vector2f(50, 20)); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// \param center Center of rotation + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle, const Vector2f& center); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(2, 1).rotate(45); + /// \endcode + /// + /// \param scaleX Scaling factor on the X axis + /// \param scaleY Scaling factor on the Y axis + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(float scaleX, float scaleY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// The center of scaling is provided for convenience as a second + /// argument, so that you can build scaling around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).scale(factors).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(2, 1, 8, 3).rotate(45); + /// \endcode + /// + /// \param scaleX Scaling factor on X axis + /// \param scaleY Scaling factor on Y axis + /// \param centerX X coordinate of the center of scaling + /// \param centerY Y coordinate of the center of scaling + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(float scaleX, float scaleY, float centerX, float centerY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(sf::Vector2f(2, 1)).rotate(45); + /// \endcode + /// + /// \param factors Scaling factors + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(const Vector2f& factors); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// The center of scaling is provided for convenience as a second + /// argument, so that you can build scaling around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).scale(factors).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).rotate(45); + /// \endcode + /// + /// \param factors Scaling factors + /// \param center Center of scaling + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(const Vector2f& factors, const Vector2f& center); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Transform Identity; ///< The identity transform (does nothing) + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + float m_matrix[16]; ///< 4x4 matrix defining the transformation +}; + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator * to combine two transforms +/// +/// This call is equivalent to calling Transform(left).combine(right). +/// +/// \param left Left operand (the first transform) +/// \param right Right operand (the second transform) +/// +/// \return New combined transform +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right); + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator *= to combine two transforms +/// +/// This call is equivalent to calling left.combine(right). +/// +/// \param left Left operand (the first transform) +/// \param right Right operand (the second transform) +/// +/// \return The combined transform +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right); + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator * to transform a point +/// +/// This call is equivalent to calling left.transformPoint(right). +/// +/// \param left Left operand (the transform) +/// \param right Right operand (the point to transform) +/// +/// \return New transformed point +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right); + +} // namespace sf + + +#endif // SFML_TRANSFORM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Transform +/// \ingroup graphics +/// +/// A sf::Transform specifies how to translate, rotate, scale, +/// shear, project, whatever things. In mathematical terms, it defines +/// how to transform a coordinate system into another. +/// +/// For example, if you apply a rotation transform to a sprite, the +/// result will be a rotated sprite. And anything that is transformed +/// by this rotation transform will be rotated the same way, according +/// to its initial position. +/// +/// Transforms are typically used for drawing. But they can also be +/// used for any computation that requires to transform points between +/// the local and global coordinate systems of an entity (like collision +/// detection). +/// +/// Example: +/// \code +/// // define a translation transform +/// sf::Transform translation; +/// translation.translate(20, 50); +/// +/// // define a rotation transform +/// sf::Transform rotation; +/// rotation.rotate(45); +/// +/// // combine them +/// sf::Transform transform = translation * rotation; +/// +/// // use the result to transform stuff... +/// sf::Vector2f point = transform.transformPoint(10, 20); +/// sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100)); +/// \endcode +/// +/// \see sf::Transformable, sf::RenderStates +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transformable.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transformable.hpp new file mode 100644 index 0000000..28fb386 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Transformable.hpp @@ -0,0 +1,417 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TRANSFORMABLE_HPP +#define SFML_TRANSFORMABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Decomposed transform defined by a position, a rotation and a scale +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Transformable(); + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Transformable(); + + //////////////////////////////////////////////////////////// + /// \brief set the position of the object + /// + /// This function completely overwrites the previous position. + /// See the move function to apply an offset based on the previous position instead. + /// The default position of a transformable object is (0, 0). + /// + /// \param x X coordinate of the new position + /// \param y Y coordinate of the new position + /// + /// \see move, getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief set the position of the object + /// + /// This function completely overwrites the previous position. + /// See the move function to apply an offset based on the previous position instead. + /// The default position of a transformable object is (0, 0). + /// + /// \param position New position + /// + /// \see move, getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector2f& position); + + //////////////////////////////////////////////////////////// + /// \brief set the orientation of the object + /// + /// This function completely overwrites the previous rotation. + /// See the rotate function to add an angle based on the previous rotation instead. + /// The default rotation of a transformable object is 0. + /// + /// \param angle New rotation, in degrees + /// + /// \see rotate, getRotation + /// + //////////////////////////////////////////////////////////// + void setRotation(float angle); + + //////////////////////////////////////////////////////////// + /// \brief set the scale factors of the object + /// + /// This function completely overwrites the previous scale. + /// See the scale function to add a factor based on the previous scale instead. + /// The default scale of a transformable object is (1, 1). + /// + /// \param factorX New horizontal scale factor + /// \param factorY New vertical scale factor + /// + /// \see scale, getScale + /// + //////////////////////////////////////////////////////////// + void setScale(float factorX, float factorY); + + //////////////////////////////////////////////////////////// + /// \brief set the scale factors of the object + /// + /// This function completely overwrites the previous scale. + /// See the scale function to add a factor based on the previous scale instead. + /// The default scale of a transformable object is (1, 1). + /// + /// \param factors New scale factors + /// + /// \see scale, getScale + /// + //////////////////////////////////////////////////////////// + void setScale(const Vector2f& factors); + + //////////////////////////////////////////////////////////// + /// \brief set the local origin of the object + /// + /// The origin of an object defines the center point for + /// all transformations (position, scale, rotation). + /// The coordinates of this point must be relative to the + /// top-left corner of the object, and ignore all + /// transformations (position, scale, rotation). + /// The default origin of a transformable object is (0, 0). + /// + /// \param x X coordinate of the new origin + /// \param y Y coordinate of the new origin + /// + /// \see getOrigin + /// + //////////////////////////////////////////////////////////// + void setOrigin(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief set the local origin of the object + /// + /// The origin of an object defines the center point for + /// all transformations (position, scale, rotation). + /// The coordinates of this point must be relative to the + /// top-left corner of the object, and ignore all + /// transformations (position, scale, rotation). + /// The default origin of a transformable object is (0, 0). + /// + /// \param origin New origin + /// + /// \see getOrigin + /// + //////////////////////////////////////////////////////////// + void setOrigin(const Vector2f& origin); + + //////////////////////////////////////////////////////////// + /// \brief get the position of the object + /// + /// \return Current position + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + const Vector2f& getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief get the orientation of the object + /// + /// The rotation is always in the range [0, 360]. + /// + /// \return Current rotation, in degrees + /// + /// \see setRotation + /// + //////////////////////////////////////////////////////////// + float getRotation() const; + + //////////////////////////////////////////////////////////// + /// \brief get the current scale of the object + /// + /// \return Current scale factors + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + const Vector2f& getScale() const; + + //////////////////////////////////////////////////////////// + /// \brief get the local origin of the object + /// + /// \return Current origin + /// + /// \see setOrigin + /// + //////////////////////////////////////////////////////////// + const Vector2f& getOrigin() const; + + //////////////////////////////////////////////////////////// + /// \brief Move the object by a given offset + /// + /// This function adds to the current position of the object, + /// unlike setPosition which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f pos = object.getPosition(); + /// object.setPosition(pos.x + offsetX, pos.y + offsetY); + /// \endcode + /// + /// \param offsetX X offset + /// \param offsetY Y offset + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + void move(float offsetX, float offsetY); + + //////////////////////////////////////////////////////////// + /// \brief Move the object by a given offset + /// + /// This function adds to the current position of the object, + /// unlike setPosition which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// object.setPosition(object.getPosition() + offset); + /// \endcode + /// + /// \param offset Offset + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + void move(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Rotate the object + /// + /// This function adds to the current rotation of the object, + /// unlike setRotation which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// object.setRotation(object.getRotation() + angle); + /// \endcode + /// + /// \param angle Angle of rotation, in degrees + /// + //////////////////////////////////////////////////////////// + void rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Scale the object + /// + /// This function multiplies the current scale of the object, + /// unlike setScale which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f scale = object.getScale(); + /// object.setScale(scale.x * factorX, scale.y * factorY); + /// \endcode + /// + /// \param factorX Horizontal scale factor + /// \param factorY Vertical scale factor + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + void scale(float factorX, float factorY); + + //////////////////////////////////////////////////////////// + /// \brief Scale the object + /// + /// This function multiplies the current scale of the object, + /// unlike setScale which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f scale = object.getScale(); + /// object.setScale(scale.x * factor.x, scale.y * factor.y); + /// \endcode + /// + /// \param factor Scale factors + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + void scale(const Vector2f& factor); + + //////////////////////////////////////////////////////////// + /// \brief get the combined transform of the object + /// + /// \return Transform combining the position/rotation/scale/origin of the object + /// + /// \see getInverseTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getTransform() const; + + //////////////////////////////////////////////////////////// + /// \brief get the inverse of the combined transform of the object + /// + /// \return Inverse of the combined transformations applied to the object + /// + /// \see getTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getInverseTransform() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_origin; ///< Origin of translation/rotation/scaling of the object + Vector2f m_position; ///< Position of the object in the 2D world + float m_rotation; ///< Orientation of the object, in degrees + Vector2f m_scale; ///< Scale of the object + mutable Transform m_transform; ///< Combined transformation of the object + mutable bool m_transformNeedUpdate; ///< Does the transform need to be recomputed? + mutable Transform m_inverseTransform; ///< Combined transformation of the object + mutable bool m_inverseTransformNeedUpdate; ///< Does the transform need to be recomputed? +}; + +} // namespace sf + + +#endif // SFML_TRANSFORMABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Transformable +/// \ingroup graphics +/// +/// This class is provided for convenience, on top of sf::Transform. +/// +/// sf::Transform, as a low-level class, offers a great level of +/// flexibility but it is not always convenient to manage. Indeed, +/// one can easily combine any kind of operation, such as a translation +/// followed by a rotation followed by a scaling, but once the result +/// transform is built, there's no way to go backward and, let's say, +/// change only the rotation without modifying the translation and scaling. +/// The entire transform must be recomputed, which means that you +/// need to retrieve the initial translation and scale factors as +/// well, and combine them the same way you did before updating the +/// rotation. This is a tedious operation, and it requires to store +/// all the individual components of the final transform. +/// +/// That's exactly what sf::Transformable was written for: it hides +/// these variables and the composed transform behind an easy to use +/// interface. You can set or get any of the individual components +/// without worrying about the others. It also provides the composed +/// transform (as a sf::Transform), and keeps it up-to-date. +/// +/// In addition to the position, rotation and scale, sf::Transformable +/// provides an "origin" component, which represents the local origin +/// of the three other components. Let's take an example with a 10x10 +/// pixels sprite. By default, the sprite is positioned/rotated/scaled +/// relatively to its top-left corner, because it is the local point +/// (0, 0). But if we change the origin to be (5, 5), the sprite will +/// be positioned/rotated/scaled around its center instead. And if +/// we set the origin to (10, 10), it will be transformed around its +/// bottom-right corner. +/// +/// To keep the sf::Transformable class simple, there's only one +/// origin for all the components. You cannot position the sprite +/// relatively to its top-left corner while rotating it around its +/// center, for example. To do such things, use sf::Transform directly. +/// +/// sf::Transformable can be used as a base class. It is often +/// combined with sf::Drawable -- that's what SFML's sprites, +/// texts and shapes do. +/// \code +/// class MyEntity : public sf::Transformable, public sf::Drawable +/// { +/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const +/// { +/// states.transform *= getTransform(); +/// target.draw(..., states); +/// } +/// }; +/// +/// MyEntity entity; +/// entity.setPosition(10, 20); +/// entity.setRotation(45); +/// window.draw(entity); +/// \endcode +/// +/// It can also be used as a member, if you don't want to use +/// its API directly (because you don't need all its functions, +/// or you have different naming conventions for example). +/// \code +/// class MyEntity +/// { +/// public : +/// void SetPosition(const MyVector& v) +/// { +/// myTransform.setPosition(v.x(), v.y()); +/// } +/// +/// void Draw(sf::RenderTarget& target) const +/// { +/// target.draw(..., myTransform.getTransform()); +/// } +/// +/// private : +/// sf::Transformable myTransform; +/// }; +/// \endcode +/// +/// \see sf::Transform +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Vertex.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Vertex.hpp new file mode 100644 index 0000000..b983ef2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/Vertex.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VERTEX_HPP +#define SFML_VERTEX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a point with color and texture coordinates +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Vertex +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Vertex(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position + /// + /// The vertex color is white and texture coordinates are (0, 0). + /// + /// \param thePosition Vertex position + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position and color + /// + /// The texture coordinates are (0, 0). + /// + /// \param thePosition Vertex position + /// \param theColor Vertex color + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Color& theColor); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position and texture coordinates + /// + /// The vertex color is white. + /// + /// \param thePosition Vertex position + /// \param theTexCoords Vertex texture coordinates + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position, color and texture coordinates + /// + /// \param thePosition Vertex position + /// \param theColor Vertex color + /// \param theTexCoords Vertex texture coordinates + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Color& theColor, const Vector2f& theTexCoords); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f position; ///< 2D position of the vertex + Color color; ///< Color of the vertex + Vector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex +}; + +} // namespace sf + + +#endif // SFML_VERTEX_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vertex +/// \ingroup graphics +/// +/// A vertex is an improved point. It has a position and other +/// extra attributes that will be used for drawing: in SFML, +/// vertices also have a color and a pair of texture coordinates. +/// +/// The vertex is the building block of drawing. Everything which +/// is visible on screen is made of vertices. They are grouped +/// as 2D primitives (triangles, quads, ...), and these primitives +/// are grouped to create even more complex 2D entities such as +/// sprites, texts, etc. +/// +/// If you use the graphical entities of SFML (sprite, text, shape) +/// you won't have to deal with vertices directly. But if you want +/// to define your own 2D entities, such as tiled maps or particle +/// systems, using vertices will allow you to get maximum performances. +/// +/// Example: +/// \code +/// // define a 100x100 square, red, with a 10x10 texture mapped on it +/// sf::Vertex vertices[] = +/// { +/// sf::Vertex(sf::Vector2f( 0, 0), sf::Color::Red, sf::Vector2f( 0, 0)), +/// sf::Vertex(sf::Vector2f( 0, 100), sf::Color::Red, sf::Vector2f( 0, 10)), +/// sf::Vertex(sf::Vector2f(100, 100), sf::Color::Red, sf::Vector2f(10, 10)), +/// sf::Vertex(sf::Vector2f(100, 0), sf::Color::Red, sf::Vector2f(10, 0)) +/// }; +/// +/// // draw it +/// window.draw(vertices, 4, sf::Quads); +/// \endcode +/// +/// Note: although texture coordinates are supposed to be an integer +/// amount of pixels, their type is float because of some buggy graphics +/// drivers that are not able to process integer coordinates correctly. +/// +/// \see sf::VertexArray +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/VertexArray.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/VertexArray.hpp new file mode 100644 index 0000000..fc67845 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/VertexArray.hpp @@ -0,0 +1,223 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VERTEXARRAY_HPP +#define SFML_VERTEXARRAY_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a set of one or more 2D primitives +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API VertexArray : public Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty vertex array. + /// + //////////////////////////////////////////////////////////// + VertexArray(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex array with a type and an initial number of vertices + /// + /// \param type Type of primitives + /// \param vertexCount Initial number of vertices in the array + /// + //////////////////////////////////////////////////////////// + explicit VertexArray(PrimitiveType type, unsigned int vertexCount = 0); + + //////////////////////////////////////////////////////////// + /// \brief Return the vertex count + /// + /// \return Number of vertices in the array + /// + //////////////////////////////////////////////////////////// + unsigned int getVertexCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-write access to a vertex by its index + /// + /// This function doesn't check \a index, it must be in range + /// [0, getVertexCount() - 1]. The behaviour is undefined + /// otherwise. + /// + /// \param index Index of the vertex to get + /// + /// \return Reference to the index-th vertex + /// + /// \see getVertexCount + /// + //////////////////////////////////////////////////////////// + Vertex& operator [](unsigned int index); + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only access to a vertex by its index + /// + /// This function doesn't check \a index, it must be in range + /// [0, getVertexCount() - 1]. The behaviour is undefined + /// otherwise. + /// + /// \param index Index of the vertex to get + /// + /// \return Const reference to the index-th vertex + /// + /// \see getVertexCount + /// + //////////////////////////////////////////////////////////// + const Vertex& operator [](unsigned int index) const; + + //////////////////////////////////////////////////////////// + /// \brief Clear the vertex array + /// + /// This function removes all the vertices from the array. + /// It doesn't deallocate the corresponding memory, so that + /// adding new vertices after clearing doesn't involve + /// reallocating all the memory. + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Resize the vertex array + /// + /// If \a vertexCount is greater than the current size, the previous + /// vertices are kept and new (default-constructed) vertices are + /// added. + /// If \a vertexCount is less than the current size, existing vertices + /// are removed from the array. + /// + /// \param vertexCount New size of the array (number of vertices) + /// + //////////////////////////////////////////////////////////// + void resize(unsigned int vertexCount); + + //////////////////////////////////////////////////////////// + /// \brief Add a vertex to the array + /// + /// \param vertex Vertex to add + /// + //////////////////////////////////////////////////////////// + void append(const Vertex& vertex); + + //////////////////////////////////////////////////////////// + /// \brief Set the type of primitives to draw + /// + /// This function defines how the vertices must be interpreted + /// when it's time to draw them: + /// \li As points + /// \li As lines + /// \li As triangles + /// \li As quads + /// The default primitive type is sf::Points. + /// + /// \param type Type of primitive + /// + //////////////////////////////////////////////////////////// + void setPrimitiveType(PrimitiveType type); + + //////////////////////////////////////////////////////////// + /// \brief Get the type of primitives drawn by the vertex array + /// + /// \return Primitive type + /// + //////////////////////////////////////////////////////////// + PrimitiveType getPrimitiveType() const; + + //////////////////////////////////////////////////////////// + /// \brief Compute the bounding rectangle of the vertex array + /// + /// This function returns the axis-aligned rectangle that + /// contains all the vertices of the array. + /// + /// \return Bounding rectangle of the vertex array + /// + //////////////////////////////////////////////////////////// + FloatRect getBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the vertex array to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_vertices; ///< Vertices contained in the array + PrimitiveType m_primitiveType; ///< Type of primitives to draw +}; + +} // namespace sf + + +#endif // SFML_VERTEXARRAY_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::VertexArray +/// \ingroup graphics +/// +/// sf::VertexArray is a very simple wrapper around a dynamic +/// array of vertices and a primitives type. +/// +/// It inherits sf::Drawable, but unlike other drawables it +/// is not transformable. +/// +/// Example: +/// \code +/// sf::VertexArray lines(sf::LinesStrip, 4); +/// lines[0].position = sf::Vector2f(10, 0); +/// lines[1].position = sf::Vector2f(20, 0); +/// lines[2].position = sf::Vector2f(30, 5); +/// lines[3].position = sf::Vector2f(40, 2); +/// +/// window.draw(lines); +/// \endcode +/// +/// \see sf::Vertex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/View.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/View.hpp new file mode 100644 index 0000000..7713aef --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Graphics/View.hpp @@ -0,0 +1,341 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIEW_HPP +#define SFML_VIEW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief 2D camera that defines what region is shown on screen +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API View +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates a default view of (0, 0, 1000, 1000) + /// + //////////////////////////////////////////////////////////// + View(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the view from a rectangle + /// + /// \param rectangle Rectangle defining the zone to display + /// + //////////////////////////////////////////////////////////// + explicit View(const FloatRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Construct the view from its center and size + /// + /// \param center Center of the zone to display + /// \param size Size of zone to display + /// + //////////////////////////////////////////////////////////// + View(const Vector2f& center, const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Set the center of the view + /// + /// \param x X coordinate of the new center + /// \param y Y coordinate of the new center + /// + /// \see setSize, getCenter + /// + //////////////////////////////////////////////////////////// + void setCenter(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Set the center of the view + /// + /// \param center New center + /// + /// \see setSize, getCenter + /// + //////////////////////////////////////////////////////////// + void setCenter(const Vector2f& center); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the view + /// + /// \param width New width of the view + /// \param height New height of the view + /// + /// \see setCenter, getCenter + /// + //////////////////////////////////////////////////////////// + void setSize(float width, float height); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the view + /// + /// \param size New size + /// + /// \see setCenter, getCenter + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the view + /// + /// The default rotation of a view is 0 degree. + /// + /// \param angle New angle, in degrees + /// + /// \see getRotation + /// + //////////////////////////////////////////////////////////// + void setRotation(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Set the target viewport + /// + /// The viewport is the rectangle into which the contents of the + /// view are displayed, expressed as a factor (between 0 and 1) + /// of the size of the RenderTarget to which the view is applied. + /// For example, a view which takes the left side of the target would + /// be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)). + /// By default, a view has a viewport which covers the entire target. + /// + /// \param viewport New viewport rectangle + /// + /// \see getViewport + /// + //////////////////////////////////////////////////////////// + void setViewport(const FloatRect& viewport); + + //////////////////////////////////////////////////////////// + /// \brief Reset the view to the given rectangle + /// + /// Note that this function resets the rotation angle to 0. + /// + /// \param rectangle Rectangle defining the zone to display + /// + /// \see setCenter, setSize, setRotation + /// + //////////////////////////////////////////////////////////// + void reset(const FloatRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Get the center of the view + /// + /// \return Center of the view + /// + /// \see getSize, setCenter + /// + //////////////////////////////////////////////////////////// + const Vector2f& getCenter() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the view + /// + /// \return Size of the view + /// + /// \see getCenter, setSize + /// + //////////////////////////////////////////////////////////// + const Vector2f& getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current orientation of the view + /// + /// \return Rotation angle of the view, in degrees + /// + /// \see setRotation + /// + //////////////////////////////////////////////////////////// + float getRotation() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the target viewport rectangle of the view + /// + /// \return Viewport rectangle, expressed as a factor of the target size + /// + /// \see setViewport + /// + //////////////////////////////////////////////////////////// + const FloatRect& getViewport() const; + + //////////////////////////////////////////////////////////// + /// \brief Move the view relatively to its current position + /// + /// \param offsetX X coordinate of the move offset + /// \param offsetY Y coordinate of the move offset + /// + /// \see setCenter, rotate, zoom + /// + //////////////////////////////////////////////////////////// + void move(float offsetX, float offsetY); + + //////////////////////////////////////////////////////////// + /// \brief Move the view relatively to its current position + /// + /// \param offset Move offset + /// + /// \see setCenter, rotate, zoom + /// + //////////////////////////////////////////////////////////// + void move(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Rotate the view relatively to its current orientation + /// + /// \param angle Angle to rotate, in degrees + /// + /// \see setRotation, move, zoom + /// + //////////////////////////////////////////////////////////// + void rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Resize the view rectangle relatively to its current size + /// + /// Resizing the view simulates a zoom, as the zone displayed on + /// screen grows or shrinks. + /// \a factor is a multiplier: + /// \li 1 keeps the size unchanged + /// \li > 1 makes the view bigger (objects appear smaller) + /// \li < 1 makes the view smaller (objects appear bigger) + /// + /// \param factor Zoom factor to apply + /// + /// \see setSize, move, rotate + /// + //////////////////////////////////////////////////////////// + void zoom(float factor); + + //////////////////////////////////////////////////////////// + /// \brief Get the projection transform of the view + /// + /// This function is meant for internal use only. + /// + /// \return Projection transform defining the view + /// + /// \see getInverseTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getTransform() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the inverse projection transform of the view + /// + /// This function is meant for internal use only. + /// + /// \return Inverse of the projection transform defining the view + /// + /// \see getTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getInverseTransform() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_center; ///< Center of the view, in scene coordinates + Vector2f m_size; ///< Size of the view, in scene coordinates + float m_rotation; ///< Angle of rotation of the view rectangle, in degrees + FloatRect m_viewport; ///< Viewport rectangle, expressed as a factor of the render-target's size + mutable Transform m_transform; ///< Precomputed projection transform corresponding to the view + mutable Transform m_inverseTransform; ///< Precomputed inverse projection transform corresponding to the view + mutable bool m_transformUpdated; ///< Internal state telling if the transform needs to be updated + mutable bool m_invTransformUpdated; ///< Internal state telling if the inverse transform needs to be updated +}; + +} // namespace sf + + +#endif // SFML_VIEW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::View +/// \ingroup graphics +/// +/// sf::View defines a camera in the 2D scene. This is a +/// very powerful concept: you can scroll, rotate or zoom +/// the entire scene without altering the way that your +/// drawable objects are drawn. +/// +/// A view is composed of a source rectangle, which defines +/// what part of the 2D scene is shown, and a target viewport, +/// which defines where the contents of the source rectangle +/// will be displayed on the render target (window or texture). +/// +/// The viewport allows to map the scene to a custom part +/// of the render target, and can be used for split-screen +/// or for displaying a minimap, for example. If the source +/// rectangle has not the same size as the viewport, its +/// contents will be stretched to fit in. +/// +/// To apply a view, you have to assign it to the render target. +/// Then, every objects drawn in this render target will be +/// affected by the view until you use another view. +/// +/// Usage example: +/// \code +/// sf::RenderWindow window; +/// sf::View view; +/// +/// // Initialize the view to a rectangle located at (100, 100) and with a size of 400x200 +/// view.reset(sf::FloatRect(100, 100, 400, 200)); +/// +/// // Rotate it by 45 degrees +/// view.rotate(45); +/// +/// // Set its target viewport to be half of the window +/// view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f)); +/// +/// // Apply it +/// window.setView(view); +/// +/// // Render stuff +/// window.draw(someSprite); +/// +/// // Set the default view back +/// window.setView(window.getDefaultView()); +/// +/// // Render stuff not affected by the view +/// window.draw(someText); +/// \endcode +/// +/// \see sf::RenderWindow, sf::RenderTexture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network.hpp new file mode 100644 index 0000000..66b3b85 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network.hpp @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_HPP +#define SFML_NETWORK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_NETWORK_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup network Network module +/// +/// Socket-based communication, utilities and higher-level +/// network protocols (HTTP, FTP). +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Export.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Export.hpp new file mode 100644 index 0000000..7dcd1d0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_EXPORT_HPP +#define SFML_NETWORK_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_NETWORK_EXPORTS) + + #define SFML_NETWORK_API SFML_API_EXPORT + +#else + + #define SFML_NETWORK_API SFML_API_IMPORT + +#endif + + +#endif // SFML_NETWORK_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Ftp.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Ftp.hpp new file mode 100644 index 0000000..9b8ed9b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Ftp.hpp @@ -0,0 +1,591 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FTP_HPP +#define SFML_FTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class IpAddress; + +//////////////////////////////////////////////////////////// +/// \brief A FTP client +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Ftp : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of transfer modes + /// + //////////////////////////////////////////////////////////// + enum TransferMode + { + Binary, ///< Binary mode (file is transfered as a sequence of bytes) + Ascii, ///< Text mode using ASCII encoding + Ebcdic ///< Text mode using EBCDIC encoding + }; + + //////////////////////////////////////////////////////////// + /// \brief Define a FTP response + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Status codes possibly returned by a FTP response + /// + //////////////////////////////////////////////////////////// + enum Status + { + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + RestartMarkerReply = 110, ///< Restart marker reply + ServiceReadySoon = 120, ///< Service ready in N minutes + DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting + OpeningDataConnection = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + Ok = 200, ///< Command ok + PointlessCommand = 202, ///< Command not implemented + SystemStatus = 211, ///< System status, or system help reply + DirectoryStatus = 212, ///< Directory status + FileStatus = 213, ///< File status + HelpMessage = 214, ///< Help message + SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + ServiceReady = 220, ///< Service ready for new user + ClosingConnection = 221, ///< Service closing control connection + DataConnectionOpened = 225, ///< Data connection open, no transfer in progress + ClosingDataConnection = 226, ///< Closing data connection, requested file action successful + EnteringPassiveMode = 227, ///< Entering passive mode + LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate + FileActionOk = 250, ///< Requested file action ok + DirectoryOk = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + NeedPassword = 331, ///< User name ok, need password + NeedAccountToLogIn = 332, ///< Need account for login + NeedInformation = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + ServiceUnavailable = 421, ///< Service not available, closing control connection + DataConnectionUnavailable = 425, ///< Can't open data connection + TransferAborted = 426, ///< Connection closed, transfer aborted + FileActionAborted = 450, ///< Requested file action not taken + LocalError = 451, ///< Requested action aborted, local error in processing + InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + CommandUnknown = 500, ///< Syntax error, command unrecognized + ParametersUnknown = 501, ///< Syntax error in parameters or arguments + CommandNotImplemented = 502, ///< Command not implemented + BadCommandSequence = 503, ///< Bad sequence of commands + ParameterNotImplemented = 504, ///< Command not implemented for that parameter + NotLoggedIn = 530, ///< Not logged in + NeedAccountToStore = 532, ///< Need account for storing files + FileUnavailable = 550, ///< Requested action not taken, file unavailable + PageTypeUnknown = 551, ///< Requested action aborted, page type unknown + NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation + FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid FTP one + ConnectionFailed = 1001, ///< Connection with server failed + ConnectionClosed = 1002, ///< Connection with server closed + InvalidFile = 1003 ///< Invalid file to upload / download + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is used by the FTP client to build + /// the response. + /// + /// \param code Response status code + /// \param message Response message + /// + //////////////////////////////////////////////////////////// + explicit Response(Status code = InvalidResponse, const std::string& message = ""); + + //////////////////////////////////////////////////////////// + /// \brief Check if the status code means a success + /// + /// This function is defined for convenience, it is + /// equivalent to testing if the status code is < 400. + /// + /// \return True if the status is a success, false if it is a failure + /// + //////////////////////////////////////////////////////////// + bool isOk() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the status code of the response + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the full message contained in the response + /// + /// \return The response message + /// + //////////////////////////////////////////////////////////// + const std::string& getMessage() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Status m_status; ///< Status code returned from the server + std::string m_message; ///< Last message received from the server + }; + + //////////////////////////////////////////////////////////// + /// \brief Specialization of FTP response returning a directory + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API DirectoryResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param response Source response + /// + //////////////////////////////////////////////////////////// + DirectoryResponse(const Response& response); + + //////////////////////////////////////////////////////////// + /// \brief Get the directory returned in the response + /// + /// \return Directory name + /// + //////////////////////////////////////////////////////////// + const std::string& getDirectory() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::string m_directory; ///< Directory extracted from the response message + }; + + + //////////////////////////////////////////////////////////// + /// \brief Specialization of FTP response returning a + /// filename lisiting + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API ListingResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param response Source response + /// \param data Data containing the raw listing + /// + //////////////////////////////////////////////////////////// + ListingResponse(const Response& response, const std::vector& data); + + //////////////////////////////////////////////////////////// + /// \brief Return the array of directory/file names + /// + /// \return Array containing the requested listing + /// + //////////////////////////////////////////////////////////// + const std::vector& getListing() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_listing; ///< Directory/file names extracted from the data + }; + + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Automatically closes the connection with the server if + /// it is still opened. + /// + //////////////////////////////////////////////////////////// + ~Ftp(); + + //////////////////////////////////////////////////////////// + /// \brief Connect to the specified FTP server + /// + /// The port has a default value of 21, which is the standard + /// port used by the FTP protocol. You shouldn't use a different + /// value, unless you really know what you do. + /// This function tries to connect to the server so it may take + /// a while to complete, especially if the server is not + /// reachable. To avoid blocking your application for too long, + /// you can use a timeout. The default value, Time::Zero, means that the + /// system timeout will be used (which is usually pretty long). + /// + /// \param server Name or address of the FTP server to connect to + /// \param port Port used for the connection + /// \param timeout Maximum time to wait + /// + /// \return Server response to the request + /// + /// \see disconnect + /// + //////////////////////////////////////////////////////////// + Response connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Close the connection with the server + /// + /// \return Server response to the request + /// + /// \see connect + /// + //////////////////////////////////////////////////////////// + Response disconnect(); + + //////////////////////////////////////////////////////////// + /// \brief Log in using an anonymous account + /// + /// Logging in is mandatory after connecting to the server. + /// Users that are not logged in cannot perform any operation. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response login(); + + //////////////////////////////////////////////////////////// + /// \brief Log in using a username and a password + /// + /// Logging in is mandatory after connecting to the server. + /// Users that are not logged in cannot perform any operation. + /// + /// \param name User name + /// \param password Password + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response login(const std::string& name, const std::string& password); + + //////////////////////////////////////////////////////////// + /// \brief Send a null command to keep the connection alive + /// + /// This command is useful because the server may close the + /// connection automatically if no command is sent. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response keepAlive(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current working directory + /// + /// The working directory is the root path for subsequent + /// operations involving directories and/or filenames. + /// + /// \return Server response to the request + /// + /// \see getDirectoryListing, changeDirectory, parentDirectory + /// + //////////////////////////////////////////////////////////// + DirectoryResponse getWorkingDirectory(); + + //////////////////////////////////////////////////////////// + /// \brief Get the contents of the given directory + /// + /// This function retrieves the sub-directories and files + /// contained in the given directory. It is not recursive. + /// The \a directory parameter is relative to the current + /// working directory. + /// + /// \param directory Directory to list + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, changeDirectory, parentDirectory + /// + //////////////////////////////////////////////////////////// + ListingResponse getDirectoryListing(const std::string& directory = ""); + + //////////////////////////////////////////////////////////// + /// \brief Change the current working directory + /// + /// The new directory must be relative to the current one. + /// + /// \param directory New working directory + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, getDirectoryListing, parentDirectory + /// + //////////////////////////////////////////////////////////// + Response changeDirectory(const std::string& directory); + + //////////////////////////////////////////////////////////// + /// \brief Go to the parent directory of the current one + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, getDirectoryListing, changeDirectory + /// + //////////////////////////////////////////////////////////// + Response parentDirectory(); + + //////////////////////////////////////////////////////////// + /// \brief Create a new directory + /// + /// The new directory is created as a child of the current + /// working directory. + /// + /// \param name Name of the directory to create + /// + /// \return Server response to the request + /// + /// \see deleteDirectory + /// + //////////////////////////////////////////////////////////// + Response createDirectory(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Remove an existing directory + /// + /// The directory to remove must be relative to the + /// current working directory. + /// Use this function with caution, the directory will + /// be removed permanently! + /// + /// \param name Name of the directory to remove + /// + /// \return Server response to the request + /// + /// \see createDirectory + /// + //////////////////////////////////////////////////////////// + Response deleteDirectory(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Rename an existing file + /// + /// The filenames must be relative to the current working + /// directory. + /// + /// \param file File to rename + /// \param newName New name of the file + /// + /// \return Server response to the request + /// + /// \see deleteFile + /// + //////////////////////////////////////////////////////////// + Response renameFile(const std::string& file, const std::string& newName); + + //////////////////////////////////////////////////////////// + /// \brief Remove an existing file + /// + /// The file name must be relative to the current working + /// directory. + /// Use this function with caution, the file will be + /// removed permanently! + /// + /// \param name File to remove + /// + /// \return Server response to the request + /// + /// \see renameFile + /// + //////////////////////////////////////////////////////////// + Response deleteFile(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Download a file from the server + /// + /// The filename of the distant file is relative to the + /// current working directory of the server, and the local + /// destination path is relative to the current directory + /// of your application. + /// + /// \param remoteFile Filename of the distant file to download + /// \param localPath Where to put to file on the local computer + /// \param mode Transfer mode + /// + /// \return Server response to the request + /// + /// \see upload + /// + //////////////////////////////////////////////////////////// + Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary); + + //////////////////////////////////////////////////////////// + /// \brief Upload a file to the server + /// + /// The name of the local file is relative to the current + /// working directory of your application, and the + /// remote path is relative to the current directory of the + /// FTP server. + /// + /// \param localFile Path of the local file to upload + /// \param remotePath Where to put to file on the server + /// \param mode Transfer mode + /// + /// \return Server response to the request + /// + /// \see download + /// + //////////////////////////////////////////////////////////// + Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Send a command to the FTP server + /// + /// \param command Command to send + /// \param parameter Command parameter + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response sendCommand(const std::string& command, const std::string& parameter = ""); + + //////////////////////////////////////////////////////////// + /// \brief Receive a response from the server + /// + /// This function must be called after each call to + /// SendCommand that expects a response. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response getResponse(); + + //////////////////////////////////////////////////////////// + /// \brief Utility class for exchanging datas with the server + /// on the data channel + /// + //////////////////////////////////////////////////////////// + class DataChannel; + + friend class DataChannel; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + TcpSocket m_commandSocket; ///< Socket holding the control connection with the server +}; + +} // namespace sf + + +#endif // SFML_FTP_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Ftp +/// \ingroup network +/// +/// sf::Ftp is a very simple FTP client that allows you +/// to communicate with a FTP server. The FTP protocol allows +/// you to manipulate a remote file system (list files, +/// upload, download, create, remove, ...). +/// +/// Using the FTP client consists of 4 parts: +/// \li Connecting to the FTP server +/// \li Logging in (either as a registered user or anonymously) +/// \li Sending commands to the server +/// \li Disconnecting (this part can be done implicitely by the destructor) +/// +/// Every command returns a FTP response, which contains the +/// status code as well as a message from the server. Some +/// commands such as getWorkingDirectory and getDirectoryListing +/// return additional data, and use a class derived from +/// sf::Ftp::Response to provide this data. +/// +/// All commands, especially upload and download, may take some +/// time to complete. This is important to know if you don't want +/// to block your application while the server is completing +/// the task. +/// +/// Usage example: +/// \code +/// // Create a new FTP client +/// sf::Ftp ftp; +/// +/// // Connect to the server +/// sf::Ftp::Response response = ftp.connect("ftp://ftp.myserver.com"); +/// if (response.isOk()) +/// std::cout << "Connected" << std::endl; +/// +/// // Log in +/// response = ftp.login("laurent", "dF6Zm89D"); +/// if (response.isOk()) +/// std::cout << "Logged in" << std::endl; +/// +/// // Print the working directory +/// sf::Ftp::DirectoryResponse directory = ftp.getWorkingDirectory(); +/// if (directory.isOk()) +/// std::cout << "Working directory: " << directory.getDirectory() << std::endl; +/// +/// // Create a new directory +/// response = ftp.createDirectory("files"); +/// if (response.isOk()) +/// std::cout << "Created new directory" << std::endl; +/// +/// // Upload a file to this new directory +/// response = ftp.upload("local-path/file.txt", "files", sf::Ftp::Ascii); +/// if (response.isOk()) +/// std::cout << "File uploaded" << std::endl; +/// +/// // Disconnect from the server (optional) +/// ftp.disconnect(); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Http.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Http.hpp new file mode 100644 index 0000000..7338f5a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Http.hpp @@ -0,0 +1,467 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HTTP_HPP +#define SFML_HTTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief A HTTP client +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Http : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Define a HTTP request + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Request + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Enumerate the available HTTP methods for a request + /// + //////////////////////////////////////////////////////////// + enum Method + { + Get, ///< Request in get mode, standard method to retrieve a page + Post, ///< Request in post mode, usually to send data to a page + Head ///< Request a page's header only + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates a GET request, with the root + /// URI ("/") and an empty body. + /// + /// \param uri Target URI + /// \param method Method to use for the request + /// \param body Content of the request's body + /// + //////////////////////////////////////////////////////////// + Request(const std::string& uri = "/", Method method = Get, const std::string& body = ""); + + //////////////////////////////////////////////////////////// + /// \brief Set the value of a field + /// + /// The field is created if it doesn't exist. The name of + /// the field is case insensitive. + /// By default, a request doesn't contain any field (but the + /// mandatory fields are added later by the HTTP client when + /// sending the request). + /// + /// \param field Name of the field to set + /// \param value Value of the field + /// + //////////////////////////////////////////////////////////// + void setField(const std::string& field, const std::string& value); + + //////////////////////////////////////////////////////////// + /// \brief Set the request method + /// + /// See the Method enumeration for a complete list of all + /// the availale methods. + /// The method is Http::Request::Get by default. + /// + /// \param method Method to use for the request + /// + //////////////////////////////////////////////////////////// + void setMethod(Method method); + + //////////////////////////////////////////////////////////// + /// \brief Set the requested URI + /// + /// The URI is the resource (usually a web page or a file) + /// that you want to get or post. + /// The URI is "/" (the root page) by default. + /// + /// \param uri URI to request, relative to the host + /// + //////////////////////////////////////////////////////////// + void setUri(const std::string& uri); + + //////////////////////////////////////////////////////////// + /// \brief Set the HTTP version for the request + /// + /// The HTTP version is 1.0 by default. + /// + /// \param major Major HTTP version number + /// \param minor Minor HTTP version number + /// + //////////////////////////////////////////////////////////// + void setHttpVersion(unsigned int major, unsigned int minor); + + //////////////////////////////////////////////////////////// + /// \brief Set the body of the request + /// + /// The body of a request is optional and only makes sense + /// for POST requests. It is ignored for all other methods. + /// The body is empty by default. + /// + /// \param body Content of the body + /// + //////////////////////////////////////////////////////////// + void setBody(const std::string& body); + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// \brief Prepare the final request to send to the server + /// + /// This is used internally by Http before sending the + /// request to the web server. + /// + /// \return String containing the request, ready to be sent + /// + //////////////////////////////////////////////////////////// + std::string prepare() const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the request defines a field + /// + /// This function uses case-insensitive comparisons. + /// + /// \param field Name of the field to test + /// + /// \return True if the field exists, false otherwise + /// + //////////////////////////////////////////////////////////// + bool hasField(const std::string& field) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable m_fields; ///< Fields of the header associated to their value + Method m_method; ///< Method to use for the request + std::string m_uri; ///< Target URI of the request + unsigned int m_majorVersion; ///< Major HTTP version + unsigned int m_minorVersion; ///< Minor HTTP version + std::string m_body; ///< Body of the request + }; + + //////////////////////////////////////////////////////////// + /// \brief Define a HTTP response + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Enumerate all the valid status codes for a response + /// + //////////////////////////////////////////////////////////// + enum Status + { + // 2xx: success + Ok = 200, ///< Most common code returned when operation was successful + Created = 201, ///< The resource has successfully been created + Accepted = 202, ///< The request has been accepted, but will be processed later by the server + NoContent = 204, ///< The server didn't send any data in return + ResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent + PartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request + + // 3xx: redirection + MultipleChoices = 300, ///< The requested page can be accessed from several locations + MovedPermanently = 301, ///< The requested page has permanently moved to a new location + MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location + NotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + BadRequest = 400, ///< The server couldn't understand the request (syntax error) + Unauthorized = 401, ///< The requested page needs an authentification to be accessed + Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentification + NotFound = 404, ///< The requested page doesn't exist + RangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field) + + // 5xx: server error + InternalServerError = 500, ///< The server encountered an unexpected error + NotImplemented = 501, ///< The server doesn't implement a requested feature + BadGateway = 502, ///< The gateway server has received an error from the source server + ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + GatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server + VersionNotSupported = 505, ///< The server doesn't support the requested HTTP version + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid HTTP one + ConnectionFailed = 1001 ///< Connection with server failed + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an empty response. + /// + //////////////////////////////////////////////////////////// + Response(); + + //////////////////////////////////////////////////////////// + /// \brief Get the value of a field + /// + /// If the field \a field is not found in the response header, + /// the empty string is returned. This function uses + /// case-insensitive comparisons. + /// + /// \param field Name of the field to get + /// + /// \return Value of the field, or empty string if not found + /// + //////////////////////////////////////////////////////////// + const std::string& getField(const std::string& field) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the response status code + /// + /// The status code should be the first thing to be checked + /// after receiving a response, it defines whether it is a + /// success, a failure or anything else (see the Status + /// enumeration). + /// + /// \return Status code of the response + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the major HTTP version number of the response + /// + /// \return Major HTTP version number + /// + /// \see getMinorHttpVersion + /// + //////////////////////////////////////////////////////////// + unsigned int getMajorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the minor HTTP version number of the response + /// + /// \return Minor HTTP version number + /// + /// \see getMajorHttpVersion + /// + //////////////////////////////////////////////////////////// + unsigned int getMinorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the body of the response + /// + /// The body of a response may contain: + /// \li the requested page (for GET requests) + /// \li a response from the server (for POST requests) + /// \li nothing (for HEAD requests) + /// \li an error message (in case of an error) + /// + /// \return The response body + /// + //////////////////////////////////////////////////////////// + const std::string& getBody() const; + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// \brief Construct the header from a response string + /// + /// This function is used by Http to build the response + /// of a request. + /// + /// \param data Content of the response to parse + /// + //////////////////////////////////////////////////////////// + void parse(const std::string& data); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable m_fields; ///< Fields of the header + Status m_status; ///< Status code + unsigned int m_majorVersion; ///< Major HTTP version + unsigned int m_minorVersion; ///< Minor HTTP version + std::string m_body; ///< Body of the response + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Http(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the HTTP client with the target host + /// + /// This is equivalent to calling setHost(host, port). + /// The port has a default value of 0, which means that the + /// HTTP client will use the right port according to the + /// protocol used (80 for HTTP, 443 for HTTPS). You should + /// leave it like this unless you really need a port other + /// than the standard one, or use an unknown protocol. + /// + /// \param host Web server to connect to + /// \param port Port to use for connection + /// + //////////////////////////////////////////////////////////// + Http(const std::string& host, unsigned short port = 0); + + //////////////////////////////////////////////////////////// + /// \brief Set the target host + /// + /// This function just stores the host address and port, it + /// doesn't actually connect to it until you send a request. + /// The port has a default value of 0, which means that the + /// HTTP client will use the right port according to the + /// protocol used (80 for HTTP, 443 for HTTPS). You should + /// leave it like this unless you really need a port other + /// than the standard one, or use an unknown protocol. + /// + /// \param host Web server to connect to + /// \param port Port to use for connection + /// + //////////////////////////////////////////////////////////// + void setHost(const std::string& host, unsigned short port = 0); + + //////////////////////////////////////////////////////////// + /// \brief Send a HTTP request and return the server's response. + /// + /// You must have a valid host before sending a request (see setHost). + /// Any missing mandatory header field in the request will be added + /// with an appropriate value. + /// Warning: this function waits for the server's response and may + /// not return instantly; use a thread if you don't want to block your + /// application, or use a timeout to limit the time to wait. A value + /// of Time::Zero means that the client will use the system defaut timeout + /// (which is usually pretty long). + /// + /// \param request Request to send + /// \param timeout Maximum time to wait + /// + /// \return Server's response + /// + //////////////////////////////////////////////////////////// + Response sendRequest(const Request& request, Time timeout = Time::Zero); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + TcpSocket m_connection; ///< Connection to the host + IpAddress m_host; ///< Web host address + std::string m_hostName; ///< Web host name + unsigned short m_port; ///< Port used for connection with host +}; + +} // namespace sf + + +#endif // SFML_HTTP_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Http +/// \ingroup network +/// +/// sf::Http is a very simple HTTP client that allows you +/// to communicate with a web server. You can retrieve +/// web pages, send data to an interactive resource, +/// download a remote file, etc. +/// +/// The HTTP client is split into 3 classes: +/// \li sf::Http::Request +/// \li sf::Http::Response +/// \li sf::Http +/// +/// sf::Http::Request builds the request that will be +/// sent to the server. A request is made of: +/// \li a method (what you want to do) +/// \li a target URI (usually the name of the web page or file) +/// \li one or more header fields (options that you can pass to the server) +/// \li an optional body (for POST requests) +/// +/// sf::Http::Response parse the response from the web server +/// and provides getters to read them. The response contains: +/// \li a status code +/// \li header fields (that may be answers to the ones that you requested) +/// \li a body, which contains the contents of the requested resource +/// +/// sf::Http provides a simple function, SendRequest, to send a +/// sf::Http::Request and return the corresponding sf::Http::Response +/// from the server. +/// +/// Usage example: +/// \code +/// // Create a new HTTP client +/// sf::Http http; +/// +/// // We'll work on http://www.sfml-dev.org +/// http.setHost("http://www.sfml-dev.org"); +/// +/// // Prepare a request to get the 'features.php' page +/// sf::Http::Request request("features.php"); +/// +/// // Send the request +/// sf::Http::Response response = http.sendRequest(request); +/// +/// // Check the status code and display the result +/// sf::Http::Response::Status status = response.getStatus(); +/// if (status == sf::Http::Response::Ok) +/// { +/// std::cout << response.getBody() << std::endl; +/// } +/// else +/// { +/// std::cout << "Error " << status << std::endl; +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/IpAddress.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/IpAddress.hpp new file mode 100644 index 0000000..15c4ac3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/IpAddress.hpp @@ -0,0 +1,316 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IPADDRESS_HPP +#define SFML_IPADDRESS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Encapsulate an IPv4 network address +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API IpAddress +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an empty (invalid) address + /// + //////////////////////////////////////////////////////////// + IpAddress(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a string + /// + /// Here \a address can be either a decimal address + /// (ex: "192.168.1.56") or a network name (ex: "localhost"). + /// + /// \param address IP address or network name + /// + //////////////////////////////////////////////////////////// + IpAddress(const std::string& address); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a string + /// + /// Here \a address can be either a decimal address + /// (ex: "192.168.1.56") or a network name (ex: "localhost"). + /// This is equivalent to the constructor taking a std::string + /// parameter, it is defined for convenience so that the + /// implicit conversions from literal strings to IpAddress work. + /// + /// \param address IP address or network name + /// + //////////////////////////////////////////////////////////// + IpAddress(const char* address); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from 4 bytes + /// + /// Calling IpAddress(a, b, c, d) is equivalent to calling + /// IpAddress("a.b.c.d"), but safer as it doesn't have to + /// parse a string to get the address components. + /// + /// \param byte0 First byte of the address + /// \param byte1 Second byte of the address + /// \param byte2 Third byte of the address + /// \param byte3 Fourth byte of the address + /// + //////////////////////////////////////////////////////////// + IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a 32-bits integer + /// + /// This constructor uses the internal representation of + /// the address directly. It should be used for optimization + /// purposes, and only if you got that representation from + /// IpAddress::ToInteger(). + /// + /// \param address 4 bytes of the address packed into a 32-bits integer + /// + /// \see toInteger + /// + //////////////////////////////////////////////////////////// + explicit IpAddress(Uint32 address); + + //////////////////////////////////////////////////////////// + /// \brief Get a string representation of the address + /// + /// The returned string is the decimal representation of the + /// IP address (like "192.168.1.56"), even if it was constructed + /// from a host name. + /// + /// \return String representation of the address + /// + /// \see toInteger + /// + //////////////////////////////////////////////////////////// + std::string toString() const; + + //////////////////////////////////////////////////////////// + /// \brief Get an integer representation of the address + /// + /// The returned number is the internal representation of the + /// address, and should be used for optimization purposes only + /// (like sending the address through a socket). + /// The integer produced by this function can then be converted + /// back to a sf::IpAddress with the proper constructor. + /// + /// \return 32-bits unsigned integer representation of the address + /// + /// \see toString + /// + //////////////////////////////////////////////////////////// + Uint32 toInteger() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the computer's local address + /// + /// The local address is the address of the computer from the + /// LAN point of view, i.e. something like 192.168.1.56. It is + /// meaningful only for communications over the local network. + /// Unlike getPublicAddress, this function is fast and may be + /// used safely anywhere. + /// + /// \return Local IP address of the computer + /// + /// \see getPublicAddress + /// + //////////////////////////////////////////////////////////// + static IpAddress getLocalAddress(); + + //////////////////////////////////////////////////////////// + /// \brief Get the computer's public address + /// + /// The public address is the address of the computer from the + /// internet point of view, i.e. something like 89.54.1.169. + /// It is necessary for communications over the world wide web. + /// The only way to get a public address is to ask it to a + /// distant website; as a consequence, this function depends on + /// both your network connection and the server, and may be + /// very slow. You should use it as few as possible. Because + /// this function depends on the network connection and on a distant + /// server, you may use a time limit if you don't want your program + /// to be possibly stuck waiting in case there is a problem; this + /// limit is deactivated by default. + /// + /// \param timeout Maximum time to wait + /// + /// \return Public IP address of the computer + /// + /// \see getLocalAddress + /// + //////////////////////////////////////////////////////////// + static IpAddress getPublicAddress(Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const IpAddress None; ///< Value representing an empty/invalid address + static const IpAddress LocalHost; ///< The "localhost" address (for connecting a computer to itself locally) + static const IpAddress Broadcast; ///< The "broadcast" address (for sending UDP messages to everyone on a local network) + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint32 m_address; ///< Address stored as an unsigned 32 bits integer +}; + +//////////////////////////////////////////////////////////// +/// \brief Overload of == operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if both addresses are equal +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator ==(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of != operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if both addresses are different +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator !=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of < operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of > operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator >(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of <= operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator <=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of >= operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator >=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of >> operator to extract an IP address from an input stream +/// +/// \param stream Input stream +/// \param address IP address to extract +/// +/// \return Reference to the input stream +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API std::istream& operator >>(std::istream& stream, IpAddress& address); + +//////////////////////////////////////////////////////////// +/// \brief Overload of << operator to print an IP address to an output stream +/// +/// \param stream Output stream +/// \param address IP address to print +/// +/// \return Reference to the output stream +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address); + +} // namespace sf + + +#endif // SFML_IPADDRESS_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::IpAddress +/// \ingroup network +/// +/// sf::IpAddress is a utility class for manipulating network +/// addresses. It provides a set a implicit constructors and +/// conversion functions to easily build or transform an IP +/// address from/to various representations. +/// +/// Usage example: +/// \code +/// sf::IpAddress a0; // an invalid address +/// sf::IpAddress a1 = sf::IpAddress::None; // an invalid address (same as a0) +/// sf::IpAddress a2("127.0.0.1"); // the local host address +/// sf::IpAddress a3 = sf::IpAddress::Broadcast; // the broadcast address +/// sf::IpAddress a4(192, 168, 1, 56); // a local address +/// sf::IpAddress a5("my_computer"); // a local address created from a network name +/// sf::IpAddress a6("89.54.1.169"); // a distant address +/// sf::IpAddress a7("www.google.com"); // a distant address created from a network name +/// sf::IpAddress a8 = sf::IpAddress::getLocalAddress(); // my address on the local network +/// sf::IpAddress a9 = sf::IpAddress::getPublicAddress(); // my address on the internet +/// \endcode +/// +/// Note that sf::IpAddress currently doesn't support IPv6 +/// nor other types of network addresses. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Packet.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Packet.hpp new file mode 100644 index 0000000..2d3e201 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Packet.hpp @@ -0,0 +1,407 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PACKET_HPP +#define SFML_PACKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class String; +class TcpSocket; +class UdpSocket; + +//////////////////////////////////////////////////////////// +/// \brief Utility class to build blocks of data to transfer +/// over the network +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Packet +{ + // A bool-like type that cannot be converted to integer or pointer types + typedef bool (Packet::*BoolType)(std::size_t); + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty packet. + /// + //////////////////////////////////////////////////////////// + Packet(); + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Packet(); + + //////////////////////////////////////////////////////////// + /// \brief Append data to the end of the packet + /// + /// \param data Pointer to the sequence of bytes to append + /// \param sizeInBytes Number of bytes to append + /// + /// \see clear + /// + //////////////////////////////////////////////////////////// + void append(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Clear the packet + /// + /// After calling Clear, the packet is empty. + /// + /// \see append + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Get a pointer to the data contained in the packet + /// + /// Warning: the returned pointer may become invalid after + /// you append data to the packet, therefore it should never + /// be stored. + /// The return pointer is NULL if the packet is empty. + /// + /// \return Pointer to the data + /// + /// \see getDataSize + /// + //////////////////////////////////////////////////////////// + const void* getData() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the data contained in the packet + /// + /// This function returns the number of bytes pointed to by + /// what getData returns. + /// + /// \return Data size, in bytes + /// + /// \see getData + /// + //////////////////////////////////////////////////////////// + std::size_t getDataSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell if the reading position has reached the + /// end of the packet + /// + /// This function is useful to know if there is some data + /// left to be read, without actually reading it. + /// + /// \return True if all data was read, false otherwise + /// + /// \see operator bool + /// + //////////////////////////////////////////////////////////// + bool endOfPacket() const; + +public: + + //////////////////////////////////////////////////////////// + /// \brief Test the validity of the packet, for reading + /// + /// This operator allows to test the packet as a boolean + /// variable, to check if a reading operation was successful. + /// + /// A packet will be in an invalid state if it has no more + /// data to read. + /// + /// This behaviour is the same as standard C++ streams. + /// + /// Usage example: + /// \code + /// float x; + /// packet >> x; + /// if (packet) + /// { + /// // ok, x was extracted successfully + /// } + /// + /// // -- or -- + /// + /// float x; + /// if (packet >> x) + /// { + /// // ok, x was extracted successfully + /// } + /// \endcode + /// + /// Don't focus on the return type, it's equivalent to bool but + /// it disallows unwanted implicit conversions to integer or + /// pointer types. + /// + /// \return True if last data extraction from packet was successful + /// + /// \see endOfPacket + /// + //////////////////////////////////////////////////////////// + operator BoolType() const; + + //////////////////////////////////////////////////////////// + /// Overloads of operator >> to read data from the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator >>(bool& data); + Packet& operator >>(Int8& data); + Packet& operator >>(Uint8& data); + Packet& operator >>(Int16& data); + Packet& operator >>(Uint16& data); + Packet& operator >>(Int32& data); + Packet& operator >>(Uint32& data); + Packet& operator >>(float& data); + Packet& operator >>(double& data); + Packet& operator >>(char* data); + Packet& operator >>(std::string& data); + Packet& operator >>(wchar_t* data); + Packet& operator >>(std::wstring& data); + Packet& operator >>(String& data); + + //////////////////////////////////////////////////////////// + /// Overloads of operator << to write data into the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator <<(bool data); + Packet& operator <<(Int8 data); + Packet& operator <<(Uint8 data); + Packet& operator <<(Int16 data); + Packet& operator <<(Uint16 data); + Packet& operator <<(Int32 data); + Packet& operator <<(Uint32 data); + Packet& operator <<(float data); + Packet& operator <<(double data); + Packet& operator <<(const char* data); + Packet& operator <<(const std::string& data); + Packet& operator <<(const wchar_t* data); + Packet& operator <<(const std::wstring& data); + Packet& operator <<(const String& data); + +protected: + + friend class TcpSocket; + friend class UdpSocket; + + //////////////////////////////////////////////////////////// + /// \brief Called before the packet is sent over the network + /// + /// This function can be defined by derived classes to + /// transform the data before it is sent; this can be + /// used for compression, encryption, etc. + /// The function must return a pointer to the modified data, + /// as well as the number of bytes pointed. + /// The default implementation provides the packet's data + /// without transforming it. + /// + /// \param size Variable to fill with the size of data to send + /// + /// \return Pointer to the array of bytes to send + /// + /// \see onReceive + /// + //////////////////////////////////////////////////////////// + virtual const void* onSend(std::size_t& size); + + //////////////////////////////////////////////////////////// + /// \brief Called after the packet is received over the network + /// + /// This function can be defined by derived classes to + /// transform the data after it is received; this can be + /// used for uncompression, decryption, etc. + /// The function receives a pointer to the received data, + /// and must fill the packet with the transformed bytes. + /// The default implementation fills the packet directly + /// without transforming the data. + /// + /// \param data Pointer to the received bytes + /// \param size Number of bytes + /// + /// \see onSend + /// + //////////////////////////////////////////////////////////// + virtual void onReceive(const void* data, std::size_t size); + +private : + + //////////////////////////////////////////////////////////// + /// Disallow comparisons between packets + /// + //////////////////////////////////////////////////////////// + bool operator ==(const Packet& right) const; + bool operator !=(const Packet& right) const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the packet can extract a given number of bytes + /// + /// This function updates accordingly the state of the packet. + /// + /// \param size Size to check + /// + /// \return True if \a size bytes can be read from the packet + /// + //////////////////////////////////////////////////////////// + bool checkSize(std::size_t size); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_data; ///< Data stored in the packet + std::size_t m_readPos; ///< Current reading position in the packet + bool m_isValid; ///< Reading state of the packet +}; + +} // namespace sf + + +#endif // SFML_PACKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Packet +/// \ingroup network +/// +/// Packets provide a safe and easy way to serialize data, +/// in order to send it over the network using sockets +/// (sf::TcpSocket, sf::UdpSocket). +/// +/// Packets solve 2 fundamental problems that arise when +/// transfering data over the network: +/// \li data is interpreted correctly according to the endianness +/// \li the bounds of the packet are preserved (one send == one receive) +/// +/// The sf::Packet class provides both input and output modes. +/// It is designed to follow the behaviour of standard C++ streams, +/// using operators >> and << to extract and insert data. +/// +/// It is recommended to use only fixed-size types (like sf::Int32, etc.), +/// to avoid possible differences between the sender and the receiver. +/// Indeed, the native C++ types may have different sizes on two platforms +/// and your data may be corrupted if that happens. +/// +/// Usage example: +/// \code +/// sf::Uint32 x = 24; +/// std::string s = "hello"; +/// double d = 5.89; +/// +/// // Group the variables to send into a packet +/// sf::Packet packet; +/// packet << x << s << d; +/// +/// // Send it over the network (socket is a valid sf::TcpSocket) +/// socket.send(packet); +/// +/// ----------------------------------------------------------------- +/// +/// // Receive the packet at the other end +/// sf::Packet packet; +/// socket.receive(packet); +/// +/// // Extract the variables contained in the packet +/// sf::Uint32 x; +/// std::string s; +/// double d; +/// if (packet >> x >> s >> d) +/// { +/// // Data extracted successfully... +/// } +/// \endcode +/// +/// Packets have built-in operator >> and << overloads for +/// standard types: +/// \li bool +/// \li fixed-size integer types (sf::Int8/16/32, sf::Uint8/16/32) +/// \li floating point numbers (float, double) +/// \li string types (char*, wchar_t*, std::string, std::wstring, sf::String) +/// +/// Like standard streams, it is also possible to define your own +/// overloads of operators >> and << in order to handle your +/// custom types. +/// +/// \code +/// struct MyStruct +/// { +/// float number; +/// sf::Int8 integer; +/// std::string str; +/// }; +/// +/// sf::Packet& operator <<(sf::Packet& packet, const MyStruct& m) +/// { +/// return packet << m.number << m.integer << m.str; +/// } +/// +/// sf::Packet& operator >>(sf::Packet& packet, MyStruct& m) +/// { +/// return packet >> m.number >> m.integer >> m.str; +/// } +/// \endcode +/// +/// Packets also provide an extra feature that allows to apply +/// custom transformations to the data before it is sent, +/// and after it is received. This is typically used to +/// handle automatic compression or encryption of the data. +/// This is achieved by inheriting from sf::Packet, and overriding +/// the onSend and onReceive functions. +/// +/// Here is an example: +/// \code +/// class ZipPacket : public sf::Packet +/// { +/// virtual const void* onSend(std::size_t& size) +/// { +/// const void* srcData = getData(); +/// std::size_t srcSize = getDataSize(); +/// +/// return MySuperZipFunction(srcData, srcSize, &size); +/// } +/// +/// virtual void onReceive(const void* data, std::size_t size) +/// { +/// std::size_t dstSize; +/// const void* dstData = MySuperUnzipFunction(data, size, &dstSize); +/// +/// append(dstData, dstSize); +/// } +/// }; +/// +/// // Use like regular packets: +/// ZipPacket packet; +/// packet << x << s << d; +/// ... +/// \endcode +/// +/// \see sf::TcpSocket, sf::UdpSocket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Socket.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Socket.hpp new file mode 100644 index 0000000..4b30307 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/Socket.hpp @@ -0,0 +1,218 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKET_HPP +#define SFML_SOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class SocketSelector; + +//////////////////////////////////////////////////////////// +/// \brief Base class for all the socket types +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Socket : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Status codes that may be returned by socket functions + /// + //////////////////////////////////////////////////////////// + enum Status + { + Done, ///< The socket has sent / received the data + NotReady, ///< The socket is not ready to send / receive data yet + Disconnected, ///< The TCP socket has been disconnected + Error ///< An unexpected error happened + }; + + //////////////////////////////////////////////////////////// + /// \brief Some special values used by sockets + /// + //////////////////////////////////////////////////////////// + enum + { + AnyPort = 0 ///< Special value that tells the system to pick any available port + }; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Socket(); + + //////////////////////////////////////////////////////////// + /// \brief Set the blocking state of the socket + /// + /// In blocking mode, calls will not return until they have + /// completed their task. For example, a call to Receive in + /// blocking mode won't return until some data was actually + /// received. + /// In non-blocking mode, calls will always return immediately, + /// using the return code to signal whether there was data + /// available or not. + /// By default, all sockets are blocking. + /// + /// \param blocking True to set the socket as blocking, false for non-blocking + /// + /// \see isBlocking + /// + //////////////////////////////////////////////////////////// + void setBlocking(bool blocking); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the socket is in blocking or non-blocking mode + /// + /// \return True if the socket is blocking, false otherwise + /// + /// \see setBlocking + /// + //////////////////////////////////////////////////////////// + bool isBlocking() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Types of protocols that the socket can use + /// + //////////////////////////////////////////////////////////// + enum Type + { + Tcp, ///< TCP protocol + Udp ///< UDP protocol + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor can only be accessed by derived classes. + /// + /// \param type Type of the socket (TCP or UDP) + /// + //////////////////////////////////////////////////////////// + Socket(Type type); + + //////////////////////////////////////////////////////////// + /// \brief Return the internal handle of the socket + /// + /// The returned handle may be invalid if the socket + /// was not created yet (or already destroyed). + /// This function can only be accessed by derived classes. + /// + /// \return The internal (OS-specific) handle of the socket + /// + //////////////////////////////////////////////////////////// + SocketHandle getHandle() const; + + //////////////////////////////////////////////////////////// + /// \brief Create the internal representation of the socket + /// + /// This function can only be accessed by derived classes. + /// + //////////////////////////////////////////////////////////// + void create(); + + //////////////////////////////////////////////////////////// + /// \brief Create the internal representation of the socket + /// from a socket handle + /// + /// This function can only be accessed by derived classes. + /// + /// \param handle OS-specific handle of the socket to wrap + /// + //////////////////////////////////////////////////////////// + void create(SocketHandle handle); + + //////////////////////////////////////////////////////////// + /// \brief Close the socket gracefully + /// + /// This function can only be accessed by derived classes. + /// + //////////////////////////////////////////////////////////// + void close(); + +private : + + friend class SocketSelector; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Type m_type; ///< Type of the socket (TCP or UDP) + SocketHandle m_socket; ///< Socket descriptor + bool m_isBlocking; ///< Current blocking mode of the socket +}; + +} // namespace sf + + +#endif // SFML_SOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Socket +/// \ingroup network +/// +/// This class mainly defines internal stuff to be used by +/// derived classes. +/// +/// The only public features that it defines, and which +/// is therefore common to all the socket classes, is the +/// blocking state. All sockets can be set as blocking or +/// non-blocking. +/// +/// In blocking mode, socket functions will hang until +/// the operation completes, which means that the entire +/// program (well, in fact the current thread if you use +/// multiple ones) will be stuck waiting for your socket +/// operation to complete. +/// +/// In non-blocking mode, all the socket functions will +/// return immediately. If the socket is not ready to complete +/// the requested operation, the function simply returns +/// the proper status code (Socket::NotReady). +/// +/// The default mode, which is blocking, is the one that is +/// generally used, in combination with threads or selectors. +/// The non-blocking mode is rather used in real-time +/// applications that run an endless loop that can poll +/// the socket often enough, and cannot afford blocking +/// this loop. +/// +/// \see sf::TcpListener, sf::TcpSocket, sf::UdpSocket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketHandle.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketHandle.hpp new file mode 100644 index 0000000..8edd46a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketHandle.hpp @@ -0,0 +1,57 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETHANDLE_HPP +#define SFML_SOCKETHANDLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +#if defined(SFML_SYSTEM_WINDOWS) + #include +#endif + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Define the low-level socket handle type, specific to +// each platform +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + typedef UINT_PTR SocketHandle; + +#else + + typedef int SocketHandle; + +#endif + +} // namespace sf + + +#endif // SFML_SOCKETHANDLE_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketSelector.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketSelector.hpp new file mode 100644 index 0000000..414a941 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/SocketSelector.hpp @@ -0,0 +1,263 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETSELECTOR_HPP +#define SFML_SOCKETSELECTOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Socket; + +//////////////////////////////////////////////////////////// +/// \brief Multiplexer that allows to read from multiple sockets +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API SocketSelector +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + SocketSelector(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SocketSelector(const SocketSelector& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~SocketSelector(); + + //////////////////////////////////////////////////////////// + /// \brief Add a new socket to the selector + /// + /// This function keeps a weak reference to the socket, + /// so you have to make sure that the socket is not destroyed + /// while it is stored in the selector. + /// This function does nothing if the socket is not valid. + /// + /// \param socket Reference to the socket to add + /// + /// \see remove, clear + /// + //////////////////////////////////////////////////////////// + void add(Socket& socket); + + //////////////////////////////////////////////////////////// + /// \brief Remove a socket from the selector + /// + /// This function doesn't destroy the socket, it simply + /// removes the reference that the selector has to it. + /// + /// \param socket Reference to the socket to remove + /// + /// \see add, clear + /// + //////////////////////////////////////////////////////////// + void remove(Socket& socket); + + //////////////////////////////////////////////////////////// + /// \brief Remove all the sockets stored in the selector + /// + /// This function doesn't destroy any instance, it simply + /// removes all the references that the selector has to + /// external sockets. + /// + /// \see add, remove + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Wait until one or more sockets are ready to receive + /// + /// This function returns as soon as at least one socket has + /// some data available to be received. To know which sockets are + /// ready, use the isReady function. + /// If you use a timeout and no socket is ready before the timeout + /// is over, the function returns false. + /// + /// \param timeout Maximum time to wait, (use Time::Zero for infinity) + /// + /// \return True if there are sockets ready, false otherwise + /// + /// \see isReady + /// + //////////////////////////////////////////////////////////// + bool wait(Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Test a socket to know if it is ready to receive data + /// + /// This function must be used after a call to Wait, to know + /// which sockets are ready to receive data. If a socket is + /// ready, a call to receive will never block because we know + /// that there is data available to read. + /// Note that if this function returns true for a TcpListener, + /// this means that it is ready to accept a new connection. + /// + /// \param socket Socket to test + /// + /// \return True if the socket is ready to read, false otherwise + /// + /// \see isReady + /// + //////////////////////////////////////////////////////////// + bool isReady(Socket& socket) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + SocketSelector& operator =(const SocketSelector& right); + +private : + + struct SocketSelectorImpl; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketSelectorImpl* m_impl; ///< Opaque pointer to the implementation (which requires OS-specific types) +}; + +} // namespace sf + + +#endif // SFML_SOCKETSELECTOR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SocketSelector +/// \ingroup network +/// +/// Socket selectors provide a way to wait until some data is +/// available on a set of sockets, instead of just one. This +/// is convenient when you have multiple sockets that may +/// possibly receive data, but you don't know which one will +/// be ready first. In particular, it avoids to use a thread +/// for each socket; with selectors, a single thread can handle +/// all the sockets. +/// +/// All types of sockets can be used in a selector: +/// \li sf::TcpListener +/// \li sf::TcpSocket +/// \li sf::UdpSocket +/// +/// A selector doesn't store its own copies of the sockets +/// (socket classes are not copyable anyway), it simply keeps +/// a reference to the original sockets that you pass to the +/// "add" function. Therefore, you can't use the selector as a +/// socket container, you must store them oustide and make sure +/// that they are alive as long as they are used in the selector. +/// +/// Using a selector is simple: +/// \li populate the selector with all the sockets that you want to observe +/// \li make it wait until there is data available on any of the sockets +/// \li test each socket to find out which ones are ready +/// +/// Usage example: +/// \code +/// // Create a socket to listen to new connections +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Create a list to store the future clients +/// std::list clients; +/// +/// // Create a selector +/// sf::SocketSelector selector; +/// +/// // Add the listener to the selector +/// selector.add(listener); +/// +/// // Endless loop that waits for new connections +/// while (running) +/// { +/// // Make the selector wait for data on any socket +/// if (selector.wait()) +/// { +/// // Test the listener +/// if (selector.isReady(listener)) +/// { +/// // The listener is ready: there is a pending connection +/// sf::TcpSocket* client = new sf::TcpSocket; +/// if (listener.accept(*client) == sf::Socket::Done) +/// { +/// // Add the new client to the clients list +/// clients.push_back(client); +/// +/// // Add the new client to the selector so that we will +/// // be notified when he sends something +/// selector.add(*client); +/// } +/// else +/// { +/// // Error, we won't get a new connection, delete the socket +/// delete client; +/// } +/// } +/// else +/// { +/// // The listener socket is not ready, test all other sockets (the clients) +/// for (std::list::iterator it = clients.begin(); it != clients.end(); ++it) +/// { +/// sf::TcpSocket& client = **it; +/// if (selector.isReady(client)) +/// { +/// // The client has sent some data, we can receive it +/// sf::Packet packet; +/// if (client.receive(packet) == sf::Socket::Done) +/// { +/// ... +/// } +/// } +/// } +/// } +/// } +/// } +/// \endcode +/// +/// \see sf::Socket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpListener.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpListener.hpp new file mode 100644 index 0000000..5a5bdb3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpListener.hpp @@ -0,0 +1,162 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPLISTENER_HPP +#define SFML_TCPLISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class TcpSocket; + +//////////////////////////////////////////////////////////// +/// \brief Socket that listens to new TCP connections +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API TcpListener : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + TcpListener(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not listening to a port, this function + /// returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Start listening for connections + /// + /// This functions makes the socket listen to the specified + /// port, waiting for new connections. + /// If the socket was previously listening to another port, + /// it will be stopped first and bound to the new port. + /// + /// \param port Port to listen for new connections + /// + /// \return Status code + /// + /// \see accept, close + /// + //////////////////////////////////////////////////////////// + Status listen(unsigned short port); + + //////////////////////////////////////////////////////////// + /// \brief Stop listening and close the socket + /// + /// This function gracefully stops the listener. If the + /// socket is not listening, this function has no effect. + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + void close(); + + //////////////////////////////////////////////////////////// + /// \brief Accept a new connection + /// + /// If the socket is in blocking mode, this function will + /// not return until a connection is actually received. + /// + /// \param socket Socket that will hold the new connection + /// + /// \return Status code + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + Status accept(TcpSocket& socket); +}; + + +} // namespace sf + + +#endif // SFML_TCPLISTENER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::TcpListener +/// \ingroup network +/// +/// A listener socket is a special type of socket that listens to +/// a given port and waits for connections on that port. +/// This is all it can do. +/// +/// When a new connection is received, you must call accept and +/// the listener returns a new instance of sf::TcpSocket that +/// is properly initialized and can be used to communicate with +/// the new client. +/// +/// Listener sockets are specific to the TCP protocol, +/// UDP sockets are connectionless and can therefore communicate +/// directly. As a consequence, a listener socket will always +/// return the new connections as sf::TcpSocket instances. +/// +/// A listener is automatically closed on destruction, like all +/// other types of socket. However if you want to stop listening +/// before the socket is destroyed, you can call its close() +/// function. +/// +/// Usage example: +/// \code +/// // Create a listener socket and make it wait for new +/// // connections on port 55001 +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Endless loop that waits for new connections +/// while (running) +/// { +/// sf::TcpSocket client; +/// if (listener.accept(client) == sf::Socket::Done) +/// { +/// // A new client just connected! +/// std::cout << "New connection received from " << client.getRemoteAddress() << std::endl; +/// doSomethingWith(client); +/// } +/// } +/// \endcode +/// +/// \see sf::TcpSocket, sf::Socket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpSocket.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpSocket.hpp new file mode 100644 index 0000000..2db2b72 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/TcpSocket.hpp @@ -0,0 +1,292 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPSOCKET_HPP +#define SFML_TCPSOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class TcpListener; +class IpAddress; +class Packet; + +//////////////////////////////////////////////////////////// +/// \brief Specialized socket using the TCP protocol +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API TcpSocket : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + TcpSocket(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not connected, this function returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see connect, getRemotePort + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the address of the connected peer + /// + /// It the socket is not connected, this function returns + /// sf::IpAddress::None. + /// + /// \return Address of the remote peer + /// + /// \see getRemotePort + /// + //////////////////////////////////////////////////////////// + IpAddress getRemoteAddress() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the port of the connected peer to which + /// the socket is connected + /// + /// If the socket is not connected, this function returns 0. + /// + /// \return Remote port to which the socket is connected + /// + /// \see getRemoteAddress + /// + //////////////////////////////////////////////////////////// + unsigned short getRemotePort() const; + + //////////////////////////////////////////////////////////// + /// \brief Connect the socket to a remote peer + /// + /// In blocking mode, this function may take a while, especially + /// if the remote peer is not reachable. The last parameter allows + /// you to stop trying to connect after a given timeout. + /// If the socket was previously connected, it is first disconnected. + /// + /// \param remoteAddress Address of the remote peer + /// \param remotePort Port of the remote peer + /// \param timeout Optional maximum time to wait + /// + /// \return Status code + /// + /// \see disconnect + /// + //////////////////////////////////////////////////////////// + Status connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Disconnect the socket from its remote peer + /// + /// This function gracefully closes the connection. If the + /// socket is not connected, this function has no effect. + /// + /// \see connect + /// + //////////////////////////////////////////////////////////// + void disconnect(); + + //////////////////////////////////////////////////////////// + /// \brief Send raw data to the remote peer + /// + /// This function will fail if the socket is not connected. + /// + /// \param data Pointer to the sequence of bytes to send + /// \param size Number of bytes to send + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(const void* data, std::size_t size); + + //////////////////////////////////////////////////////////// + /// \brief Receive raw data from the remote peer + /// + /// In blocking mode, this function will wait until some + /// bytes are actually received. + /// This function will fail if the socket is not connected. + /// + /// \param data Pointer to the array to fill with the received bytes + /// \param size Maximum number of bytes that can be received + /// \param received This variable is filled with the actual number of bytes received + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(void* data, std::size_t size, std::size_t& received); + + //////////////////////////////////////////////////////////// + /// \brief Send a formatted packet of data to the remote peer + /// + /// This function will fail if the socket is not connected. + /// + /// \param packet Packet to send + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(Packet& packet); + + //////////////////////////////////////////////////////////// + /// \brief Receive a formatted packet of data from the remote peer + /// + /// In blocking mode, this function will wait until the whole packet + /// has been received. + /// This function will fail if the socket is not connected. + /// + /// \param packet Packet to fill with the received data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(Packet& packet); + +private: + + friend class TcpListener; + + //////////////////////////////////////////////////////////// + /// \brief Structure holding the data of a pending packet + /// + //////////////////////////////////////////////////////////// + struct PendingPacket + { + PendingPacket(); + + Uint32 Size; ///< Data of packet size + std::size_t SizeReceived; ///< Number of size bytes received so far + std::vector Data; ///< Data of the packet + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + PendingPacket m_pendingPacket; ///< Temporary data of the packet currently being received +}; + +} // namespace sf + + +#endif // SFML_TCPSOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::TcpSocket +/// \ingroup network +/// +/// TCP is a connected protocol, which means that a TCP +/// socket can only communicate with the host it is connected +/// to. It can't send or receive anything if it is not connected. +/// +/// The TCP protocol is reliable but adds a slight overhead. +/// It ensures that your data will always be received in order +/// and without errors (no data corrupted, lost or duplicated). +/// +/// When a socket is connected to a remote host, you can +/// retrieve informations about this host with the +/// getRemoteAddress and getRemotePort functions. You can +/// also get the local port to which the socket is bound +/// (which is automatically chosen when the socket is connected), +/// with the getLocalPort function. +/// +/// Sending and receiving data can use either the low-level +/// or the high-level functions. The low-level functions +/// process a raw sequence of bytes, and cannot ensure that +/// one call to Send will exactly match one call to Receive +/// at the other end of the socket. +/// +/// The high-level interface uses packets (see sf::Packet), +/// which are easier to use and provide more safety regarding +/// the data that is exchanged. You can look at the sf::Packet +/// class to get more details about how they work. +/// +/// The socket is automatically disconnected when it is destroyed, +/// but if you want to explicitely close the connection while +/// the socket instance is still alive, you can call disconnect. +/// +/// Usage example: +/// \code +/// // ----- The client ----- +/// +/// // Create a socket and connect it to 192.168.1.50 on port 55001 +/// sf::TcpSocket socket; +/// socket.connect("192.168.1.50", 55001); +/// +/// // Send a message to the connected host +/// std::string message = "Hi, I am a client"; +/// socket.send(message.c_str(), message.size() + 1); +/// +/// // Receive an answer from the server +/// char buffer[1024]; +/// std::size_t received = 0; +/// socket.receive(buffer, sizeof(buffer), received); +/// std::cout << "The server said: " << buffer << std::endl; +/// +/// // ----- The server ----- +/// +/// // Create a listener to wait for incoming connections on port 55001 +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Wait for a connection +/// sf::TcpSocket socket; +/// listener.accept(socket); +/// std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl; +/// +/// // Receive a message from the client +/// char buffer[1024]; +/// std::size_t received = 0; +/// socket.receive(buffer, sizeof(buffer), received); +/// std::cout << "The client said: " << buffer << std::endl; +/// +/// // Send an answer +/// std::string message = "Welcome, client"; +/// socket.send(message.c_str(), message.size() + 1); +/// \endcode +/// +/// \see sf::Socket, sf::UdpSocket, sf::Packet +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/UdpSocket.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/UdpSocket.hpp new file mode 100644 index 0000000..e5fa3b0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Network/UdpSocket.hpp @@ -0,0 +1,283 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UDPSOCKET_HPP +#define SFML_UDPSOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class IpAddress; +class Packet; + +//////////////////////////////////////////////////////////// +/// \brief Specialized socket using the UDP protocol +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API UdpSocket : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + // Constants + //////////////////////////////////////////////////////////// + enum + { + MaxDatagramSize = 65507 ///< The maximum number of bytes that can be sent in a single UDP datagram + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + UdpSocket(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not bound to a port, this function + /// returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see bind + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Bind the socket to a specific port + /// + /// Binding the socket to a port is necessary for being + /// able to receive data on that port. + /// You can use the special value Socket::AnyPort to tell the + /// system to automatically pick an available port, and then + /// call getLocalPort to retrieve the chosen port. + /// + /// \param port Port to bind the socket to + /// + /// \return Status code + /// + /// \see unbind, getLocalPort + /// + //////////////////////////////////////////////////////////// + Status bind(unsigned short port); + + //////////////////////////////////////////////////////////// + /// \brief Unbind the socket from the local port to which it is bound + /// + /// The port that the socket was previously using is immediately + /// available after this function is called. If the + /// socket is not bound to a port, this function has no effect. + /// + /// \see bind + /// + //////////////////////////////////////////////////////////// + void unbind(); + + //////////////////////////////////////////////////////////// + /// \brief Send raw data to a remote peer + /// + /// Make sure that \a size is not greater than + /// UdpSocket::MaxDatagramSize, otherwise this function will + /// fail and no data will be sent. + /// + /// \param data Pointer to the sequence of bytes to send + /// \param size Number of bytes to send + /// \param remoteAddress Address of the receiver + /// \param remotePort Port of the receiver to send the data to + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(const void* data, std::size_t size, const IpAddress& remoteAddress, unsigned short remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Receive raw data from a remote peer + /// + /// In blocking mode, this function will wait until some + /// bytes are actually received. + /// Be careful to use a buffer which is large enough for + /// the data that you intend to receive, if it is too small + /// then an error will be returned and *all* the data will + /// be lost. + /// + /// \param data Pointer to the array to fill with the received bytes + /// \param size Maximum number of bytes that can be received + /// \param received This variable is filled with the actual number of bytes received + /// \param remoteAddress Address of the peer that sent the data + /// \param remotePort Port of the peer that sent the data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(void* data, std::size_t size, std::size_t& received, IpAddress& remoteAddress, unsigned short& remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Send a formatted packet of data to a remote peer + /// + /// Make sure that the packet size is not greater than + /// UdpSocket::MaxDatagramSize, otherwise this function will + /// fail and no data will be sent. + /// + /// \param packet Packet to send + /// \param remoteAddress Address of the receiver + /// \param remotePort Port of the receiver to send the data to + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(Packet& packet, const IpAddress& remoteAddress, unsigned short remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Receive a formatted packet of data from a remote peer + /// + /// In blocking mode, this function will wait until the whole packet + /// has been received. + /// + /// \param packet Packet to fill with the received data + /// \param remoteAddress Address of the peer that sent the data + /// \param remotePort Port of the peer that sent the data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort); + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_buffer; ///< Temporary buffer holding the received data in Receive(Packet) +}; + +} // namespace sf + + +#endif // SFML_UDPSOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::UdpSocket +/// \ingroup network +/// +/// A UDP socket is a connectionless socket. Instead of +/// connecting once to a remote host, like TCP sockets, +/// it can send to and receive from any host at any time. +/// +/// It is a datagram protocol: bounded blocks of data (datagrams) +/// are transfered over the network rather than a continuous +/// stream of data (TCP). Therefore, one call to send will always +/// match one call to receive (if the datagram is not lost), +/// with the same data that was sent. +/// +/// The UDP protocol is lightweight but unreliable. Unreliable +/// means that datagrams may be duplicated, be lost or +/// arrive reordered. However, if a datagram arrives, its +/// data is guaranteed to be valid. +/// +/// UDP is generally used for real-time communication +/// (audio or video streaming, real-time games, etc.) where +/// speed is crucial and lost data doesn't matter much. +/// +/// Sending and receiving data can use either the low-level +/// or the high-level functions. The low-level functions +/// process a raw sequence of bytes, whereas the high-level +/// interface uses packets (see sf::Packet), which are easier +/// to use and provide more safety regarding the data that is +/// exchanged. You can look at the sf::Packet class to get +/// more details about how they work. +/// +/// It is important to note that UdpSocket is unable to send +/// datagrams bigger than MaxDatagramSize. In this case, it +/// returns an error and doesn't send anything. This applies +/// to both raw data and packets. Indeed, even packets are +/// unable to split and recompose data, due to the unreliability +/// of the protocol (dropped, mixed or duplicated datagrams may +/// lead to a big mess when trying to recompose a packet). +/// +/// If the socket is bound to a port, it is automatically +/// unbound from it when the socket is destroyed. However, +/// you can unbind the socket explicitely with the Unbind +/// function if necessary, to stop receiving messages or +/// make the port available for other sockets. +/// +/// Usage example: +/// \code +/// // ----- The client ----- +/// +/// // Create a socket and bind it to the port 55001 +/// sf::UdpSocket socket; +/// socket.bind(55001); +/// +/// // Send a message to 192.168.1.50 on port 55002 +/// std::string message = "Hi, I am " + sf::IpAddress::getLocalAddress().toString(); +/// socket.send(message.c_str(), message.size() + 1, "192.168.1.50", 55002); +/// +/// // Receive an answer (most likely from 192.168.1.50, but could be anyone else) +/// char buffer[1024]; +/// std::size_t received = 0; +/// sf::IpAddress sender; +/// unsigned short port; +/// socket.receive(buffer, sizeof(buffer), received, sender, port); +/// std::cout << sender.ToString() << " said: " << buffer << std::endl; +/// +/// // ----- The server ----- +/// +/// // Create a socket and bind it to the port 55002 +/// sf::UdpSocket socket; +/// socket.bind(55002); +/// +/// // Receive a message from anyone +/// char buffer[1024]; +/// std::size_t received = 0; +/// sf::IpAddress sender; +/// unsigned short port; +/// socket.receive(buffer, sizeof(buffer), received, sender, port); +/// std::cout << sender.ToString() << " said: " << buffer << std::endl; +/// +/// // Send an answer +/// std::string message = "Welcome " + sender.toString(); +/// socket.send(message.c_str(), message.size() + 1, sender, port); +/// \endcode +/// +/// \see sf::Socket, sf::TcpSocket, sf::Packet +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/OpenGL.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/OpenGL.hpp new file mode 100644 index 0000000..3d04603 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/OpenGL.hpp @@ -0,0 +1,62 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_OPENGL_HPP +#define SFML_OPENGL_HPP + + +//////////////////////////////////////////////////////////// +/// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// This file just includes the OpenGL (GL and GLU) headers, +/// which have actually different paths on each system +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + // The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them + #ifdef _MSC_VER + #include + #endif + + #include + #include + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + #include + +#elif defined(SFML_SYSTEM_MACOS) + + #include + #include + +#endif + + +#endif // SFML_OPENGL_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System.hpp new file mode 100644 index 0000000..9d2166b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System.hpp @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_HPP +#define SFML_SYSTEM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // SFML_SYSTEM_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup system System module +/// +/// Base module of SFML, defining various utilities. It provides +/// vector classes, unicode strings and conversion functions, +/// threads and mutexes, timing classes. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Clock.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Clock.hpp new file mode 100644 index 0000000..4ae0f2d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Clock.hpp @@ -0,0 +1,117 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CLOCK_HPP +#define SFML_CLOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class that measures the elapsed time +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Clock +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// The clock starts automatically after being constructed. + /// + //////////////////////////////////////////////////////////// + Clock(); + + //////////////////////////////////////////////////////////// + /// \brief Get the elapsed time + /// + /// This function returns the time elapsed since the last call + /// to restart() (or the construction of the instance if restart() + /// has not been called). + /// + /// \return Time elapsed + /// + //////////////////////////////////////////////////////////// + Time getElapsedTime() const; + + //////////////////////////////////////////////////////////// + /// \brief Restart the clock + /// + /// This function puts the time counter back to zero. + /// It also returns the time elapsed since the clock was started. + /// + /// \return Time elapsed + /// + //////////////////////////////////////////////////////////// + Time restart(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Time m_startTime; ///< Time of last reset, in microseconds +}; + +} // namespace sf + + +#endif // SFML_CLOCK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Clock +/// \ingroup system +/// +/// sf::Clock is a lightweight class for measuring time. +/// +/// Its provides the most precise time that the underlying +/// OS can achieve (generally microseconds or nanoseconds). +/// It also ensures monotonicity, which means that the returned +/// time can never go backward, even if the system time is +/// changed. +/// +/// Usage example: +/// \code +/// sf::Clock clock; +/// ... +/// Time time1 = clock.getElapsedTime(); +/// ... +/// Time time2 = clock.restart(); +/// \endcode +/// +/// The sf::Time value returned by the clock can then be +/// converted to a number of seconds, milliseconds or even +/// microseconds. +/// +/// \see sf::Time +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Err.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Err.hpp new file mode 100644 index 0000000..7903020 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Err.hpp @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_ERR_HPP +#define SFML_ERR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Standard stream used by SFML to output warnings and errors +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API std::ostream& err(); + +} // namespace sf + + +#endif // SFML_ERR_HPP + + +//////////////////////////////////////////////////////////// +/// \fn sf::err +/// \ingroup system +/// +/// By default, sf::err() outputs to the same location as std::cerr, +/// (-> the stderr descriptor) which is the console if there's +/// one available. +/// +/// It is a standard std::ostream instance, so it supports all the +/// insertion operations defined by the STL +/// (operator <<, manipulators, etc.). +/// +/// sf::err() can be redirected to write to another output, independantly +/// of std::cerr, by using the rdbuf() function provided by the +/// std::ostream class. +/// +/// Example: +/// \code +/// // Redirect to a file +/// std::ofstream file("sfml-log.txt"); +/// std::streambuf* previous = sf::err().rdbuf(file.rdbuf()); +/// +/// // Redirect to nothing +/// sf::err().rdbuf(NULL); +/// +/// // Restore the original output +/// sf::err().rdbuf(previous); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Export.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Export.hpp new file mode 100644 index 0000000..ec08fbe --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_EXPORT_HPP +#define SFML_SYSTEM_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_EXPORTS) + + #define SFML_SYSTEM_API SFML_API_EXPORT + +#else + + #define SFML_SYSTEM_API SFML_API_IMPORT + +#endif + + +#endif // SFML_SYSTEM_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/InputStream.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/InputStream.hpp new file mode 100644 index 0000000..b79436a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/InputStream.hpp @@ -0,0 +1,151 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_INPUTSTREAM_HPP +#define SFML_INPUTSTREAM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract class for custom file input streams +/// +//////////////////////////////////////////////////////////// +class InputStream +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~InputStream() {} + + //////////////////////////////////////////////////////////// + /// \brief Read data from the stream + /// + /// After reading, the stream's reading position must be + /// advanced by the amount of bytes read. + /// + /// \param data Buffer where to copy the read data + /// \param size Desired number of bytes to read + /// + /// \return The number of bytes actually read, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 read(void* data, Int64 size) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Change the current reading position + /// + /// \param position The position to seek to, from the beginning + /// + /// \return The position actually sought to, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 seek(Int64 position) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get the current reading position in the stream + /// + /// \return The current position, or -1 on error. + /// + //////////////////////////////////////////////////////////// + virtual Int64 tell() = 0; + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the stream + /// + /// \return The total number of bytes available in the stream, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 getSize() = 0; +}; + +} // namespace sf + + +#endif // SFML_INPUTSTREAM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::InputStream +/// \ingroup system +/// +/// This class allows users to define their own file input sources +/// from which SFML can load resources. +/// +/// SFML resource classes like sf::Texture and +/// sf::SoundBuffer provide loadFromFile and loadFromMemory functions, +/// which read data from conventional sources. However, if you +/// have data coming from a different source (over a network, +/// embedded, encrypted, compressed, etc) you can derive your +/// own class from sf::InputStream and load SFML resources with +/// their loadFromStream function. +/// +/// Usage example: +/// \code +/// // custom stream class that reads from inside a zip file +/// class ZipStream : public sf::InputStream +/// { +/// public : +/// +/// ZipStream(std::string archive); +/// +/// bool open(std::string filename); +/// +/// Int64 read(void* data, Int64 size); +/// +/// Int64 seek(Int64 position); +/// +/// Int64 tell(); +/// +/// Int64 getSize(); +/// +/// private : +/// +/// ... +/// }; +/// +/// // now you can load textures... +/// sf::Texture texture; +/// ZipStream stream("resources.zip"); +/// stream.open("images/img.png"); +/// texture.loadFromStream(stream); +/// +/// // musics... +/// sf::Music music; +/// ZipStream stream("resources.zip"); +/// stream.open("musics/msc.ogg"); +/// music.openFromStream(stream); +/// +/// // etc. +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Lock.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Lock.hpp new file mode 100644 index 0000000..09c2a8e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Lock.hpp @@ -0,0 +1,139 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LOCK_HPP +#define SFML_LOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Mutex; + +//////////////////////////////////////////////////////////// +/// \brief Automatic wrapper for locking and unlocking mutexes +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Lock : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct the lock with a target mutex + /// + /// The mutex passed to sf::Lock is automatically locked. + /// + /// \param mutex Mutex to lock + /// + //////////////////////////////////////////////////////////// + explicit Lock(Mutex& mutex); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// The destructor of sf::Lock automatically unlocks its mutex. + /// + //////////////////////////////////////////////////////////// + ~Lock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Mutex& m_mutex; ///< Mutex to lock / unlock +}; + +} // namespace sf + + +#endif // SFML_LOCK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Lock +/// \ingroup system +/// +/// sf::Lock is a RAII wrapper for sf::Mutex. By unlocking +/// it in its destructor, it ensures that the mutex will +/// always be released when the current scope (most likely +/// a function) ends. +/// This is even more important when an exception or an early +/// return statement can interrupt the execution flow of the +/// function. +/// +/// For maximum robustness, sf::Lock should always be used +/// to lock/unlock a mutex. +/// +/// Usage example: +/// \code +/// sf::Mutex mutex; +/// +/// void function() +/// { +/// sf::Lock lock(mutex); // mutex is now locked +/// +/// functionThatMayThrowAnException(); // mutex is unlocked if this function throws +/// +/// if (someCondition) +/// return; // mutex is unlocked +/// +/// } // mutex is unlocked +/// \endcode +/// +/// Because the mutex is not explicitely unlocked in the code, +/// it may remain locked longer than needed. If the region +/// of the code that needs to be protected by the mutex is +/// not the entire function, a good practice is to create a +/// smaller, inner scope so that the lock is limited to this +/// part of the code. +/// +/// \code +/// sf::Mutex mutex; +/// +/// void function() +/// { +/// { +/// sf::Lock lock(mutex); +/// codeThatRequiresProtection(); +/// +/// } // mutex is unlocked here +/// +/// codeThatDoesntCareAboutTheMutex(); +/// } +/// \endcode +/// +/// Having a mutex locked longer than required is a bad practice +/// which can lead to bad performances. Don't forget that when +/// a mutex is locked, other threads may be waiting doing nothing +/// until it is released. +/// +/// \see sf::Mutex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Mutex.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Mutex.hpp new file mode 100644 index 0000000..ac95236 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Mutex.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEX_HPP +#define SFML_MUTEX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ + class MutexImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Blocks concurrent access to shared resources +/// from multiple threads +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Mutex : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Mutex(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Mutex(); + + //////////////////////////////////////////////////////////// + /// \brief Lock the mutex + /// + /// If the mutex is already locked in another thread, + /// this call will block the execution until the mutex + /// is released. + /// + /// \see unlock + /// + //////////////////////////////////////////////////////////// + void lock(); + + //////////////////////////////////////////////////////////// + /// \brief Unlock the mutex + /// + /// \see lock + /// + //////////////////////////////////////////////////////////// + void unlock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::MutexImpl* m_mutexImpl; ///< OS-specific implementation +}; + +} // namespace sf + + +#endif // SFML_MUTEX_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Mutex +/// \ingroup system +/// +/// Mutex stands for "MUTual EXclusion". A mutex is a +/// synchronization object, used when multiple threads are involved. +/// +/// When you want to protect a part of the code from being accessed +/// simultaneously by multiple threads, you typically use a +/// mutex. When a thread is locked by a mutex, any other thread +/// trying to lock it will be blocked until the mutex is released +/// by the thread that locked it. This way, you can allow only +/// one thread at a time to access a critical region of your code. +/// +/// Usage example: +/// \code +/// Database database; // this is a critical resource that needs some protection +/// sf::Mutex mutex; +/// +/// void thread1() +/// { +/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread2 +/// database.write(...); +/// mutex.unlock(); // if thread2 was waiting, it will now be unblocked +/// } +/// +/// void thread2() +/// { +/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread1 +/// database.write(...); +/// mutex.unlock(); // if thread1 was waiting, it will now be unblocked +/// } +/// \endcode +/// +/// Be very careful with mutexes. A bad usage can lead to bad problems, +/// like deadlocks (two threads are waiting for each other and the +/// application is globally stuck). +/// +/// To make the usage of mutexes more robust, particularly in +/// environments where exceptions can be thrown, you should +/// use the helper class sf::Lock to lock/unlock mutexes. +/// +/// SFML mutexes are recursive, which means that you can lock +/// a mutex multiple times in the same thread without creating +/// a deadlock. In this case, the first call to lock() behaves +/// as usual, and the following ones have no effect. +/// However, you must call unlock() exactly as many times as you +/// called lock(). If you don't, the mutex won't be released. +/// +/// \see sf::Lock +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/NonCopyable.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/NonCopyable.hpp new file mode 100644 index 0000000..8c9cdb6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/NonCopyable.hpp @@ -0,0 +1,119 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NONCOPYABLE_HPP +#define SFML_NONCOPYABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class that makes any derived +/// class non-copyable +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API NonCopyable +{ +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Because this class has a copy constructor, the compiler + /// will not automatically generate the default constructor. + /// That's why we must define it explicitely. + /// + //////////////////////////////////////////////////////////// + NonCopyable() {} + +private : + + //////////////////////////////////////////////////////////// + /// \brief Disabled copy constructor + /// + /// By making the copy constructor private, the compiler will + /// trigger an error if anyone outside tries to use it. + /// To prevent NonCopyable or friend classes from using it, + /// we also give no definition, so that the linker will + /// produce an error if the first protection was inefficient. + /// + //////////////////////////////////////////////////////////// + NonCopyable(const NonCopyable&); + + //////////////////////////////////////////////////////////// + /// \brief Disabled assignment operator + /// + /// By making the assignment operator private, the compiler will + /// trigger an error if anyone outside tries to use it. + /// To prevent NonCopyable or friend classes from using it, + /// we also give no definition, so that the linker will + /// produce an error if the first protection was inefficient. + /// + //////////////////////////////////////////////////////////// + NonCopyable& operator =(const NonCopyable&); +}; + +} // namespace sf + + +#endif // SFML_NONCOPYABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::NonCopyable +/// \ingroup system +/// +/// This class makes its instances non-copyable, by explicitely +/// disabling its copy constructor and its assignment operator. +/// +/// To create a non-copyable class, simply inherit from +/// sf::NonCopyable. +/// +/// The type of inheritance (public or private) doesn't matter, +/// the copy constructor and assignment operator are declared private +/// in sf::NonCopyable so they will end up being inaccessible in both +/// cases. Thus you can use a shorter syntax for inheriting from it +/// (see below). +/// +/// Usage example: +/// \code +/// class MyNonCopyableClass : sf::NonCopyable +/// { +/// ... +/// }; +/// \endcode +/// +/// Deciding whether the instances of a class can be copied +/// or not is a very important design choice. You are strongly +/// encouraged to think about it before writing a class, +/// and to use sf::NonCopyable when necessary to prevent +/// many potential future errors when using it. This is also +/// a very important indication to users of your class. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Sleep.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Sleep.hpp new file mode 100644 index 0000000..47567a9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Sleep.hpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SLEEP_HPP +#define SFML_SLEEP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup system +/// \brief Make the current thread sleep for a given duration +/// +/// sf::sleep is the best way to block a program or one of its +/// threads, as it doesn't consume any CPU power. +/// +/// \param duration Time to sleep +/// +//////////////////////////////////////////////////////////// +void SFML_SYSTEM_API sleep(Time duration); + +} // namespace sf + + +#endif // SFML_SLEEP_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/String.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/String.hpp new file mode 100644 index 0000000..080a809 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/String.hpp @@ -0,0 +1,543 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_STRING_HPP +#define SFML_STRING_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility string class that automatically handles +/// conversions between types and encodings +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API String +{ +public : + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::basic_string::iterator Iterator; ///< Iterator type + typedef std::basic_string::const_iterator ConstIterator; ///< Constant iterator type + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const std::size_t InvalidPos; ///< Represents an invalid position in the string + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an empty string. + /// + //////////////////////////////////////////////////////////// + String(); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a single ANSI character and a locale + /// + /// The source character is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiChar ANSI character to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(char ansiChar, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from single wide character + /// + /// \param wideChar Wide character to convert + /// + //////////////////////////////////////////////////////////// + String(wchar_t wideChar); + + //////////////////////////////////////////////////////////// + /// \brief Construct from single UTF-32 character + /// + /// \param utf32Char UTF-32 character to convert + /// + //////////////////////////////////////////////////////////// + String(Uint32 utf32Char); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a null-terminated C-style ANSI string and a locale + /// + /// The source string is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiString ANSI string to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(const char* ansiString, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from an ANSI string and a locale + /// + /// The source string is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiString ANSI string to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(const std::string& ansiString, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from null-terminated C-style wide string + /// + /// \param wideString Wide string to convert + /// + //////////////////////////////////////////////////////////// + String(const wchar_t* wideString); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a wide string + /// + /// \param wideString Wide string to convert + /// + //////////////////////////////////////////////////////////// + String(const std::wstring& wideString); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a null-terminated C-style UTF-32 string + /// + /// \param utf32String UTF-32 string to assign + /// + //////////////////////////////////////////////////////////// + String(const Uint32* utf32String); + + //////////////////////////////////////////////////////////// + /// \brief Construct from an UTF-32 string + /// + /// \param utf32String UTF-32 string to assign + /// + //////////////////////////////////////////////////////////// + String(const std::basic_string& utf32String); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + String(const String& copy); + + //////////////////////////////////////////////////////////// + /// \brief Implicit cast operator to std::string (ANSI string) + /// + /// The current global locale is used for conversion. If you + /// want to explicitely specify a locale, see toAnsiString. + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// This operator is defined for convenience, and is equivalent + /// to calling toAnsiString(). + /// + /// \return Converted ANSI string + /// + /// \see toAnsiString, operator std::wstring + /// + //////////////////////////////////////////////////////////// + operator std::string() const; + + //////////////////////////////////////////////////////////// + /// \brief Implicit cast operator to std::wstring (wide string) + /// + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// This operator is defined for convenience, and is equivalent + /// to calling toWideString(). + /// + /// \return Converted wide string + /// + /// \see toWideString, operator std::string + /// + //////////////////////////////////////////////////////////// + operator std::wstring() const; + + //////////////////////////////////////////////////////////// + /// \brief Convert the unicode string to an ANSI string + /// + /// The UTF-32 string is converted to an ANSI string in + /// the encoding defined by \a locale. + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// + /// \param locale Locale to use for conversion + /// + /// \return Converted ANSI string + /// + /// \see toWideString, operator std::string + /// + //////////////////////////////////////////////////////////// + std::string toAnsiString(const std::locale& locale = std::locale()) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert the unicode string to a wide string + /// + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// + /// \return Converted wide string + /// + /// \see toAnsiString, operator std::wstring + /// + //////////////////////////////////////////////////////////// + std::wstring toWideString() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + String& operator =(const String& right); + + //////////////////////////////////////////////////////////// + /// \brief Overload of += operator to append an UTF-32 string + /// + /// \param right String to append + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + String& operator +=(const String& right); + + //////////////////////////////////////////////////////////// + /// \brief Overload of [] operator to access a character by its position + /// + /// This function provides read-only access to characters. + /// Note: this function doesn't throw if \a index is out of range. + /// + /// \param index Index of the character to get + /// + /// \return Character at position \a index + /// + //////////////////////////////////////////////////////////// + Uint32 operator [](std::size_t index) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of [] operator to access a character by its position + /// + /// This function provides read and write access to characters. + /// Note: this function doesn't throw if \a index is out of range. + /// + /// \param index Index of the character to get + /// + /// \return Reference to the character at position \a index + /// + //////////////////////////////////////////////////////////// + Uint32& operator [](std::size_t index); + + //////////////////////////////////////////////////////////// + /// \brief Clear the string + /// + /// This function removes all the characters from the string. + /// + /// \see isEmpty, erase + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the string + /// + /// \return Number of characters in the string + /// + /// \see isEmpty + /// + //////////////////////////////////////////////////////////// + std::size_t getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Check whether the string is empty or not + /// + /// \return True if the string is empty (i.e. contains no character) + /// + /// \see clear, getSize + /// + //////////////////////////////////////////////////////////// + bool isEmpty() const; + + //////////////////////////////////////////////////////////// + /// \brief Erase one or more characters from the string + /// + /// This function removes a sequence of \a count characters + /// starting from \a position. + /// + /// \param position Position of the first character to erase + /// \param count Number of characters to erase + /// + //////////////////////////////////////////////////////////// + void erase(std::size_t position, std::size_t count = 1); + + //////////////////////////////////////////////////////////// + /// \brief Insert one or more characters into the string + /// + /// This function inserts the characters of \a str + /// into the string, starting from \a position. + /// + /// \param position Position of insertion + /// \param str Characters to insert + /// + //////////////////////////////////////////////////////////// + void insert(std::size_t position, const String& str); + + //////////////////////////////////////////////////////////// + /// \brief Find a sequence of one or more characters in the string + /// + /// This function searches for the characters of \a str + /// into the string, starting from \a start. + /// + /// \param str Characters to find + /// \param start Where to begin searching + /// + /// \return Position of \a str in the string, or String::InvalidPos if not found + /// + //////////////////////////////////////////////////////////// + std::size_t find(const String& str, std::size_t start = 0) const; + + //////////////////////////////////////////////////////////// + /// \brief Get a pointer to the C-style array of characters + /// + /// This functions provides a read-only access to a + /// null-terminated C-style representation of the string. + /// The returned pointer is temporary and is meant only for + /// immediate use, thus it is not recommended to store it. + /// + /// \return Read-only pointer to the array of characters + /// + //////////////////////////////////////////////////////////// + const Uint32* getData() const; + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// \return Read-write iterator to the beginning of the string characters + /// + /// \see end + /// + //////////////////////////////////////////////////////////// + Iterator begin(); + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// \return Read-only iterator to the beginning of the string characters + /// + /// \see end + /// + //////////////////////////////////////////////////////////// + ConstIterator begin() const; + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// The end iterator refers to 1 position past the last character; + /// thus it represents an invalid character and should never be + /// accessed. + /// + /// \return Read-write iterator to the end of the string characters + /// + /// \see begin + /// + //////////////////////////////////////////////////////////// + Iterator end(); + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// The end iterator refers to 1 position past the last character; + /// thus it represents an invalid character and should never be + /// accessed. + /// + /// \return Read-only iterator to the end of the string characters + /// + /// \see begin + /// + //////////////////////////////////////////////////////////// + ConstIterator end() const; + +private : + + friend SFML_SYSTEM_API bool operator ==(const String& left, const String& right); + friend SFML_SYSTEM_API bool operator <(const String& left, const String& right); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::basic_string m_string; ///< Internal string of UTF-32 characters +}; + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of == operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if both strings are equal +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator ==(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of != operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if both strings are different +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator !=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of < operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of > operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of <= operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of >= operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of binary + operator to concatenate two strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return Concatenated string +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API String operator +(const String& left, const String& right); + +} // namespace sf + + +#endif // SFML_STRING_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::String +/// \ingroup system +/// +/// sf::String is a utility string class defined mainly for +/// convenience. It is a Unicode string (implemented using +/// UTF-32), thus it can store any character in the world +/// (european, chinese, arabic, hebrew, etc.). +/// +/// It automatically handles conversions from/to ANSI and +/// wide strings, so that you can work with standard string +/// classes and still be compatible with functions taking a +/// sf::String. +/// +/// \code +/// sf::String s; +/// +/// std::string s1 = s; // automatically converted to ANSI string +/// std::wstring s2 = s; // automatically converted to wide string +/// s = "hello"; // automatically converted from ANSI string +/// s = L"hello"; // automatically converted from wide string +/// s += 'a'; // automatically converted from ANSI string +/// s += L'a'; // automatically converted from wide string +/// \endcode +/// +/// Conversions involving ANSI strings use the default user locale. However +/// it is possible to use a custom locale if necessary: +/// \code +/// std::locale locale; +/// sf::String s; +/// ... +/// std::string s1 = s.toAnsiString(locale); +/// s = sf::String("hello", locale); +/// \endcode +/// +/// sf::String defines the most important functions of the +/// standard std::string class: removing, random access, iterating, +/// appending, comparing, etc. However it is a simple class +/// provided for convenience, and you may have to consider using +/// a more optimized class if your program requires complex string +/// handling. The automatic conversion functions will then take +/// care of converting your string to sf::String whenever SFML +/// requires it. +/// +/// Please note that SFML also defines a low-level, generic +/// interface for Unicode handling, see the sf::Utf classes. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.hpp new file mode 100644 index 0000000..8313646 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.hpp @@ -0,0 +1,282 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREAD_HPP +#define SFML_THREAD_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class ThreadImpl; + struct ThreadFunc; +} + +//////////////////////////////////////////////////////////// +/// \brief Utility class to manipulate threads +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Thread : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a functor with no argument + /// + /// This constructor works for function objects, as well + /// as free function. + /// + /// Use this constructor for this kind of function: + /// \code + /// void function(); + /// + /// // --- or ---- + /// + /// struct Functor + /// { + /// void operator()(); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Functor or free function to use as the entry point of the thread + /// + //////////////////////////////////////////////////////////// + template + Thread(F function); + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a functor with an argument + /// + /// This constructor works for function objects, as well + /// as free function. + /// It is a template, which means that the argument can + /// have any type (int, std::string, void*, Toto, ...). + /// + /// Use this constructor for this kind of function: + /// \code + /// void function(int arg); + /// + /// // --- or ---- + /// + /// struct Functor + /// { + /// void operator()(std::string arg); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Functor or free function to use as the entry point of the thread + /// \param argument argument to forward to the function + /// + //////////////////////////////////////////////////////////// + template + Thread(F function, A argument); + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a member function and an object + /// + /// This constructor is template, which means that you can + /// use it with any class. + /// Use this constructor for this kind of function: + /// \code + /// class MyClass + /// { + /// public : + /// + /// void function(); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Entry point of the thread + /// \param object Pointer to the object to use + /// + //////////////////////////////////////////////////////////// + template + Thread(void(C::*function)(), C* object); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// This destructor calls Wait(), so that the internal thread + /// cannot survive after its sf::Thread instance is destroyed. + /// + //////////////////////////////////////////////////////////// + ~Thread(); + + //////////////////////////////////////////////////////////// + /// \brief Run the thread + /// + /// This function starts the entry point passed to the + /// thread's constructor, and returns immediately. + /// After this function returns, the thread's function is + /// running in parallel to the calling code. + /// + //////////////////////////////////////////////////////////// + void launch(); + + //////////////////////////////////////////////////////////// + /// \brief Wait until the thread finishes + /// + /// This function will block the execution until the + /// thread's function ends. + /// Warning: if the thread function never ends, the calling + /// thread will block forever. + /// If this function is called from its owner thread, it + /// returns without doing anything. + /// + //////////////////////////////////////////////////////////// + void wait(); + + //////////////////////////////////////////////////////////// + /// \brief Terminate the thread + /// + /// This function immediately stops the thread, without waiting + /// for its function to finish. + /// Terminating a thread with this function is not safe, + /// and can lead to local variables not being destroyed + /// on some operating systems. You should rather try to make + /// the thread function terminate by itself. + /// + //////////////////////////////////////////////////////////// + void terminate(); + +private : + + friend class priv::ThreadImpl; + + //////////////////////////////////////////////////////////// + /// \brief Internal entry point of the thread + /// + /// This function is called by the thread implementation. + /// + //////////////////////////////////////////////////////////// + void run(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::ThreadImpl* m_impl; ///< OS-specific implementation of the thread + priv::ThreadFunc* m_entryPoint; ///< Abstraction of the function to run +}; + +#include + +} // namespace sf + +#endif // SFML_THREAD_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Thread +/// \ingroup system +/// +/// Threads provide a way to run multiple parts of the code +/// in parallel. When you launch a new thread, the execution +/// is split and both the new thread and the caller run +/// in parallel. +/// +/// To use a sf::Thread, you construct it directly with the +/// function to execute as the entry point of the thread. +/// sf::Thread has multiple template constructors, which means +/// that you can use several types of entry points: +/// \li non-member functions with no argument +/// \li non-member functions with one argument of any type +/// \li functors with no argument (this one is particularly useful for compatibility with boost/std::bind) +/// \li functors with one argument of any type +/// \li member functions from any class with no argument +/// +/// The function argument, if any, is copied in the sf::Thread +/// instance, as well as the functor (if the corresponding +/// constructor is used). Class instances, however, are passed +/// by pointer so you must make sure that the object won't be +/// destroyed while the thread is still using it. +/// +/// The thread ends when its function is terminated. If the +/// owner sf::Thread instance is destroyed before the +/// thread is finished, the destructor will wait (see wait()) +/// +/// Usage examples: +/// \code +/// // example 1: non member function with one argument +/// +/// void threadFunc(int argument) +/// { +/// ... +/// } +/// +/// sf::Thread thread(&threadFunc, 5); +/// thread.launch(); // start the thread (internally calls threadFunc(5)) +/// \endcode +/// +/// \code +/// // example 2: member function +/// +/// class Task +/// { +/// public : +/// void run() +/// { +/// ... +/// } +/// }; +/// +/// Task task; +/// sf::Thread thread(&Task::run, &task); +/// thread.launch(); // start the thread (internally calls task.run()) +/// \endcode +/// +/// \code +/// // example 3: functor +/// +/// struct Task +/// { +/// void operator()() +/// { +/// ... +/// } +/// }; +/// +/// sf::Thread thread(Task()); +/// thread.launch(); // start the thread (internally calls operator() on the Task instance) +/// \endcode +/// +/// Creating parallel threads of execution can be dangerous: +/// all threads inside the same process share the same memory space, +/// which means that you may end up accessing the same variable +/// from multiple threads at the same time. To prevent this +/// kind of situations, you can use mutexes (see sf::Mutex). +/// +/// \see sf::Mutex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.inl new file mode 100644 index 0000000..126228a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Thread.inl @@ -0,0 +1,90 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + +namespace priv +{ +// Base class for abstract thread functions +struct ThreadFunc +{ + virtual ~ThreadFunc() {} + virtual void run() = 0; +}; + +// Specialization using a functor (including free functions) with no argument +template +struct ThreadFunctor : ThreadFunc +{ + ThreadFunctor(T functor) : m_functor(functor) {} + virtual void run() {m_functor();} + T m_functor; +}; + +// Specialization using a functor (including free functions) with one argument +template +struct ThreadFunctorWithArg : ThreadFunc +{ + ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {} + virtual void run() {m_function(m_arg);} + F m_function; + A m_arg; +}; + +// Specialization using a member function +template +struct ThreadMemberFunc : ThreadFunc +{ + ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {} + virtual void run() {(m_object->*m_function)();} + void(C::*m_function)(); + C* m_object; +}; + +} // namespace priv + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(F functor) : +m_impl (NULL), +m_entryPoint(new priv::ThreadFunctor(functor)) +{ +} + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(F function, A argument) : +m_impl (NULL), +m_entryPoint(new priv::ThreadFunctorWithArg(function, argument)) +{ +} + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(void(C::*function)(), C* object) : +m_impl (NULL), +m_entryPoint(new priv::ThreadMemberFunc(function, object)) +{ +} diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocal.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocal.hpp new file mode 100644 index 0000000..fe2ba82 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocal.hpp @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADLOCAL_HPP +#define SFML_THREADLOCAL_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class ThreadLocalImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Defines variables with thread-local storage +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API ThreadLocal : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param value Optional value to initalize the variable + /// + //////////////////////////////////////////////////////////// + ThreadLocal(void* value = NULL); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~ThreadLocal(); + + //////////////////////////////////////////////////////////// + /// \brief Set the thread-specific value of the variable + /// + /// \param value Value of the variable for the current thread + /// + //////////////////////////////////////////////////////////// + void setValue(void* value); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve the thread-specific value of the variable + /// + /// \return Value of the variable for the current thread + /// + //////////////////////////////////////////////////////////// + void* getValue() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::ThreadLocalImpl* m_impl; ///< Pointer to the OS specific implementation +}; + +} // namespace sf + + +#endif // SFML_THREADLOCAL_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ThreadLocal +/// \ingroup system +/// +/// This class manipulates void* parameters and thus is not +/// appropriate for strongly-typed variables. You should rather +/// use the sf::ThreadLocalPtr template class. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.hpp new file mode 100644 index 0000000..e6dc1eb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.hpp @@ -0,0 +1,158 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADLOCALPTR_HPP +#define SFML_THREADLOCALPTR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Pointer to a thread-local variable +/// +//////////////////////////////////////////////////////////// +template +class ThreadLocalPtr : private ThreadLocal +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param value Optional value to initalize the variable + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr(T* value = NULL); + + //////////////////////////////////////////////////////////// + /// \brief Overload of unary operator * + /// + /// Like raw pointers, applying the * operator returns a + /// reference to the pointed object. + /// + /// \return Reference to the pointed object + /// + //////////////////////////////////////////////////////////// + T& operator *() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of operator -> + /// + /// Like raw pointers, applying the -> operator returns the + /// pointed object. + /// + /// \return Pointed object + /// + //////////////////////////////////////////////////////////// + T* operator ->() const; + + //////////////////////////////////////////////////////////// + /// \brief Cast operator to implicitely convert the + /// pointer to its raw pointer type (T*) + /// + /// \return Pointer to the actual object + /// + //////////////////////////////////////////////////////////// + operator T*() const; + + //////////////////////////////////////////////////////////// + /// \brief Assignment operator for a raw pointer parameter + /// + /// \param value Pointer to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr& operator =(T* value); + + //////////////////////////////////////////////////////////// + /// \brief Assignment operator for a ThreadLocalPtr parameter + /// + /// \param right ThreadLocalPtr to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr& operator =(const ThreadLocalPtr& right); +}; + +} // namespace sf + +#include + + +#endif // SFML_THREADLOCALPTR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ThreadLocalPtr +/// \ingroup system +/// +/// sf::ThreadLocalPtr is a type-safe wrapper for storing +/// pointers to thread-local variables. A thread-local +/// variable holds a different value for each different +/// thread, unlike normal variable that are shared. +/// +/// Its usage is completely transparent, so that it is similar +/// to manipulating the raw pointer directly (like any smart pointer). +/// +/// Usage example: +/// \code +/// MyClass object1; +/// MyClass object2; +/// sf::ThreadLocalPtr objectPtr; +/// +/// void thread1() +/// { +/// objectPtr = &object1; // doesn't impact thread2 +/// ... +/// } +/// +/// void thread2() +/// { +/// objectPtr = &object2; // doesn't impact thread1 +/// ... +/// } +/// +/// int main() +/// { +/// // Create and launch the two threads +/// sf::Thread t1(&thread1); +/// sf::Thread t2(&thread2); +/// t1.launch(); +/// t2.launch(); +/// +/// return 0; +/// } +/// \endcode +/// +/// ThreadLocalPtr is designed for internal use; however you +/// can use it if you feel like it fits well your implementation. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.inl new file mode 100644 index 0000000..8442025 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/ThreadLocalPtr.inl @@ -0,0 +1,77 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +namespace sf +{ +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr::ThreadLocalPtr(T* value) : +ThreadLocal(value) +{ +} + + +//////////////////////////////////////////////////////////// +template +T& ThreadLocalPtr::operator *() const +{ + return *static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +T* ThreadLocalPtr::operator ->() const +{ + return static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr::operator T*() const +{ + return static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr& ThreadLocalPtr::operator =(T* value) +{ + setValue(value); + return *this; +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr& ThreadLocalPtr::operator =(const ThreadLocalPtr& right) +{ + setValue(right.getValue()); + return *this; +} + +} // namespace sf diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Time.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Time.hpp new file mode 100644 index 0000000..5037f52 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Time.hpp @@ -0,0 +1,452 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TIME_HPP +#define SFML_TIME_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Represents a time value +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Time +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Sets the time value to zero. + /// + //////////////////////////////////////////////////////////// + Time(); + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of seconds + /// + /// \return Time in seconds + /// + /// \see asMilliseconds, asMicroseconds + /// + //////////////////////////////////////////////////////////// + float asSeconds() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of milliseconds + /// + /// \return Time in milliseconds + /// + /// \see asSeconds, asMicroseconds + /// + //////////////////////////////////////////////////////////// + Int32 asMilliseconds() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of microseconds + /// + /// \return Time in microseconds + /// + /// \see asSeconds, asMilliseconds + /// + //////////////////////////////////////////////////////////// + Int64 asMicroseconds() const; + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Time Zero; ///< Predefined "zero" time value + +private : + + friend SFML_SYSTEM_API Time seconds(float); + friend SFML_SYSTEM_API Time milliseconds(Int32); + friend SFML_SYSTEM_API Time microseconds(Int64); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a number of microseconds + /// + /// This function is internal. To construct time values, + /// use sf::seconds, sf::milliseconds or sf::microseconds instead. + /// + /// \param microseconds Number of microseconds + /// + //////////////////////////////////////////////////////////// + explicit Time(Int64 microseconds); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Int64 m_microseconds; ///< Time value stored as microseconds +}; + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of seconds +/// +/// \param amount Number of seconds +/// +/// \return Time value constructed from the amount of seconds +/// +/// \see milliseconds, microseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time seconds(float amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of milliseconds +/// +/// \param amount Number of milliseconds +/// +/// \return Time value constructed from the amount of milliseconds +/// +/// \see seconds, microseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time milliseconds(Int32 amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of microseconds +/// +/// \param amount Number of microseconds +/// +/// \return Time value constructed from the amount of microseconds +/// +/// \see seconds, milliseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time microseconds(Int64 amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of == operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if both time values are equal +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator ==(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of != operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if both time values are different +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator !=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of < operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of > operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of <= operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of >= operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of unary - operator to negate a time value +/// +/// \param right Right operand (a time) +/// +/// \return Opposite of the time value +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator -(Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary + operator to add two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Sum of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator +(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary += operator to add/assign two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Sum of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator +=(Time& left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary - operator to subtract two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Difference of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator -(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary -= operator to subtract/assign two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Difference of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator -=(Time& left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Time left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Time left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a number) +/// \param right Right operand (a time) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(float left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a number) +/// \param right Right operand (a time) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Int64 left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary *= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator *=(Time& left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary *= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator *=(Time& left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary / operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator /(Time left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary / operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator /(Time left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary /= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator /=(Time& left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary /= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right); + +} // namespace sf + + +#endif // SFML_TIME_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Time +/// \ingroup system +/// +/// sf::Time encapsulates a time value in a flexible way. +/// It allows to define a time value either as a number of +/// seconds, milliseconds or microseconds. It also works the +/// other way round: you can read a time value as either +/// a number of seconds, milliseconds or microseconds. +/// +/// By using such a flexible interface, the API doesn't +/// impose any fixed type or resolution for time values, +/// and let the user choose its own favorite representation. +/// +/// Time values support the usual mathematical operations: +/// you can add or subtract two times, multiply or divide +/// a time by a number, compare two times, etc. +/// +/// Since they represent a time span and not an absolute time +/// value, times can also be negative. +/// +/// Usage example: +/// \code +/// sf::Time t1 = sf::seconds(0.1f); +/// Int32 milli = t1.asMilliseconds(); // 100 +/// +/// sf::Time t2 = sf::milliseconds(30); +/// Int64 micro = t2.asMicroseconds(); // 30000 +/// +/// sf::Time t3 = sf::microseconds(-800000); +/// float sec = t3.asSeconds(); // -0.8 +/// \endcode +/// +/// \code +/// void update(sf::Time elapsed) +/// { +/// position += speed * elapsed.asSeconds(); +/// } +/// +/// update(sf::milliseconds(100)); +/// \endcode +/// +/// \see sf::Clock +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.hpp new file mode 100644 index 0000000..48e6e1b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.hpp @@ -0,0 +1,763 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UTF_HPP +#define SFML_UTF_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +template +class Utf; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-8 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<8> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-8 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-8 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-8 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-8. + /// + /// \param input Codepoint to encode as UTF-8 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-8 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint8 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-8 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-8 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-8 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-8 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); +}; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-16 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<16> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-16 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-16 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-16 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-16. + /// + /// \param input Codepoint to encode as UTF-16 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-16 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint16 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-16 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-16 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-16 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-16 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); +}; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-32 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<32> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-32 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// For UTF-32, the character value is the same as the codepoint. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-32 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-32. + /// For UTF-32, the codepoint is the same as the character value. + /// + /// \param input Codepoint to encode as UTF-32 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-32 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-32 character + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-32 sequence + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-32 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-32 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single ANSI character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input ANSI character + /// \param locale Locale to use for conversion + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template + static Uint32 decodeAnsi(In input, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single wide character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input wide character + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template + static Uint32 decodeWide(In input); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to ANSI + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to ANSI (use 0 to skip it) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to wide + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to wide (use 0 to skip it) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); +}; + +#include + +// Make typedefs to get rid of the template syntax +typedef Utf<8> Utf8; +typedef Utf<16> Utf16; +typedef Utf<32> Utf32; + +} // namespace sf + + +#endif // SFML_UTF_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Utf +/// \ingroup system +/// +/// Utility class providing generic functions for UTF conversions. +/// +/// sf::Utf is a low-level, generic interface for counting, iterating, +/// encoding and decoding Unicode characters and strings. It is able +/// to handle ANSI, wide, latin-1, UTF-8, UTF-16 and UTF-32 encodings. +/// +/// sf::Utf functions are all static, these classes are not meant to +/// be instanciated. All the functions are template, so that you +/// can use any character / string type for a given encoding. +/// +/// It has 3 specializations: +/// \li sf::Utf<8> (typedef'd to sf::Utf8) +/// \li sf::Utf<16> (typedef'd to sf::Utf16) +/// \li sf::Utf<32> (typedef'd to sf::Utf32) +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.inl new file mode 100644 index 0000000..672a0fa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Utf.inl @@ -0,0 +1,752 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// References : +// +// http://www.unicode.org/ +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h +// http://people.w3.org/rishida/scripts/uniview/conversion +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement) +{ + // Some useful precomputed data + static const int trailing[256] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 + }; + static const Uint32 offsets[6] = + { + 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080 + }; + + // decode the character + int trailingBytes = trailing[static_cast(*begin)]; + if (begin + trailingBytes < end) + { + output = 0; + switch (trailingBytes) + { + case 5 : output += static_cast(*begin++); output <<= 6; + case 4 : output += static_cast(*begin++); output <<= 6; + case 3 : output += static_cast(*begin++); output <<= 6; + case 2 : output += static_cast(*begin++); output <<= 6; + case 1 : output += static_cast(*begin++); output <<= 6; + case 0 : output += static_cast(*begin++); + } + output -= offsets[trailingBytes]; + } + else + { + // Incomplete character + begin = end; + output = replacement; + } + + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement) +{ + // Some useful precomputed data + static const Uint8 firstBytes[7] = + { + 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC + }; + + // encode the character + if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) + { + // Invalid character + if (replacement) + *output++ = replacement; + } + else + { + // Valid character + + // Get the number of bytes to write + std::size_t bytestoWrite = 1; + if (input < 0x80) bytestoWrite = 1; + else if (input < 0x800) bytestoWrite = 2; + else if (input < 0x10000) bytestoWrite = 3; + else if (input <= 0x0010FFFF) bytestoWrite = 4; + + // Extract the bytes to write + Uint8 bytes[4]; + switch (bytestoWrite) + { + case 4 : bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 3 : bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 2 : bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 1 : bytes[0] = static_cast (input | firstBytes[bytestoWrite]); + } + + // Add them to the output + output = std::copy(bytes, bytes + bytestoWrite, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<8>::next(In begin, In end) +{ + Uint32 codepoint; + return decode(begin, end, codepoint); +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<8>::count(In begin, In end) +{ + std::size_t length = 0; + while (begin < end) + { + begin = next(begin, end); + ++length; + } + + return length; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeWide(*begin++); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + output = encode(*begin++, output); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeWide(codepoint, output, replacement); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint < 256 ? static_cast(codepoint) : replacement; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf8(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf16(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<16>::encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf32(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement) +{ + Uint16 first = *begin++; + + // If it's a surrogate pair, first convert to a single UTF-32 character + if ((first >= 0xD800) && (first <= 0xDBFF)) + { + if (begin < end) + { + Uint32 second = *begin++; + if ((second >= 0xDC00) && (second <= 0xDFFF)) + { + // The second element is valid: convert the two elements to a UTF-32 character + output = static_cast(((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000); + } + else + { + // Invalid character + output = replacement; + } + } + else + { + // Invalid character + begin = end; + output = replacement; + } + } + else + { + // We can make a direct copy + output = first; + } + + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::encode(Uint32 input, Out output, Uint16 replacement) +{ + if (input < 0xFFFF) + { + // The character can be copied directly, we just need to check if it's in the valid range + if ((input >= 0xD800) && (input <= 0xDFFF)) + { + // Invalid character (this range is reserved) + if (replacement) + *output++ = replacement; + } + else + { + // Valid character directly convertible to a single UTF-16 character + *output++ = static_cast(input); + } + } + else if (input > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (replacement) + *output++ = replacement; + } + else + { + // The input character will be converted to two UTF-16 elements + input -= 0x0010000; + *output++ = static_cast((input >> 10) + 0xD800); + *output++ = static_cast((input & 0x3FFUL) + 0xDC00); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<16>::next(In begin, In end) +{ + Uint32 codepoint; + return decode(begin, end, codepoint); +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<16>::count(In begin, In end) +{ + std::size_t length = 0; + while (begin < end) + { + begin = next(begin, end); + ++length; + } + + return length; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeWide(*begin++); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeWide(codepoint, output, replacement); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + *output++ = *begin < 256 ? static_cast(*begin) : replacement; + begin++; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf8(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<8>::encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf16(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf32(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/) +{ + output = *begin++; + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encode(Uint32 input, Out output, Uint32 /*replacement*/) +{ + *output++ = input; + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<32>::next(In begin, In /*end*/) +{ + return ++begin; +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<32>::count(In begin, In end) +{ + return begin - end; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + *output++ = decodeAnsi(*begin++, locale); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + *output++ = decodeWide(*begin++); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + output = encodeAnsi(*begin++, output, replacement, locale); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + output = encodeWide(*begin++, output, replacement); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + *output++ = *begin < 256 ? static_cast(*begin) : replacement; + begin++; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf8(In begin, In end, Out output) +{ + while (begin < end) + output = Utf<8>::encode(*begin++, output); + + return output; +} + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf16(In begin, In end, Out output) +{ + while (begin < end) + output = Utf<16>::encode(*begin++, output); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf32(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale) +{ + // On Windows, gcc's standard library (glibc++) has almost + // no support for Unicode stuff. As a consequence, in this + // context we can only use the default locale and ignore + // the one passed as parameter. + + #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ + (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ + !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ + + (void)locale; // to avoid warnings + + wchar_t character = 0; + mbtowc(&character, &input, 1); + return static_cast(character); + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& facet = std::use_facet< std::ctype >(locale); + + // Use the facet to convert each character of the input string + return static_cast(facet.widen(input)); + + #endif +} + + +//////////////////////////////////////////////////////////// +template +Uint32 Utf<32>::decodeWide(In input) +{ + // The encoding of wide characters is not well defined and is left to the system; + // however we can safely assume that it is UCS-2 on Windows and + // UCS-4 on Unix systems. + // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4, + // and UCS-4 *is* UTF-32). + + return input; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale) +{ + // On Windows, gcc's standard library (glibc++) has almost + // no support for Unicode stuff. As a consequence, in this + // context we can only use the default locale and ignore + // the one passed as parameter. + + #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ + (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ + !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ + + (void)locale; // to avoid warnings + + char character = 0; + if (wctomb(&character, static_cast(codepoint)) >= 0) + *output++ = character; + else if (replacement) + *output++ = replacement; + + return output; + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& facet = std::use_facet< std::ctype >(locale); + + // Use the facet to convert each character of the input string + *output++ = facet.narrow(static_cast(codepoint), replacement); + + return output; + + #endif +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encodeWide(Uint32 codepoint, Out output, wchar_t replacement) +{ + // The encoding of wide characters is not well defined and is left to the system; + // however we can safely assume that it is UCS-2 on Windows and + // UCS-4 on Unix systems. + // For UCS-2 we need to check if the source characters fits in (UCS-2 is a subset of UCS-4). + // For UCS-4 we can do a direct copy (UCS-4 *is* UTF-32). + + switch (sizeof(wchar_t)) + { + case 4: + { + *output++ = static_cast(codepoint); + break; + } + + default: + { + if ((codepoint <= 0xFFFF) && ((codepoint < 0xD800) || (codepoint > 0xDFFF))) + { + *output++ = static_cast(codepoint); + } + else if (replacement) + { + *output++ = replacement; + } + break; + } + } + + return output; +} diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.hpp new file mode 100644 index 0000000..5c3bb64 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.hpp @@ -0,0 +1,301 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR2_HPP +#define SFML_VECTOR2_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility template class for manipulating +/// 2-dimensional vectors +/// +//////////////////////////////////////////////////////////// +template +class Vector2 +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector2(0, 0). + /// + //////////////////////////////////////////////////////////// + Vector2(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// + //////////////////////////////////////////////////////////// + Vector2(T X, T Y); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Vector2(const Vector2& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of unary operator - +/// +/// \param right Vector to negate +/// +/// \return Memberwise opposite of the vector +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator += +/// +/// This operator performs a memberwise addition of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator +=(Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator -= +/// +/// This operator performs a memberwise subtraction of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator -=(Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator + +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise addition of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator +(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator - +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise subtraction of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise multiplication by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(const Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a scalar value) +/// \param right Right operand (a vector) +/// +/// \return Memberwise multiplication by \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(T left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator *= +/// +/// This operator performs a memberwise multiplication by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator *=(Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator / +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise division by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator /(const Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator /= +/// +/// This operator performs a memberwise division by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator /=(Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector2& left, const Vector2& right); + +#include + +// Define the most common types +typedef Vector2 Vector2i; +typedef Vector2 Vector2u; +typedef Vector2 Vector2f; + +} // namespace sf + + +#endif // SFML_VECTOR2_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vector2 +/// \ingroup system +/// +/// sf::Vector2 is a simple class that defines a mathematical +/// vector with two coordinates (x and y). It can be used to +/// represent anything that has two dimensions: a size, a point, +/// a velocity, etc. +/// +/// The template parameter T is the type of the coordinates. It +/// can be any type that supports arithmetic operations (+, -, /, *) +/// and comparisons (==, !=), for example int or float. +/// +/// You generally don't have to care about the templated form (sf::Vector2), +/// the most common specializations have special typedefs: +/// \li sf::Vector2 is sf::Vector2f +/// \li sf::Vector2 is sf::Vector2i +/// \li sf::Vector2 is sf::Vector2u +/// +/// The sf::Vector2 class has a small and simple interface, its x and y members +/// can be accessed directly (there's no accessor like setX(), getX()) and it +/// contains no mathematical function like dot product, cross product, length, etc. +/// +/// Usage example: +/// \code +/// sf::Vector2f v1(16.5f, 24.f); +/// v1.x = 18.2f; +/// float y = v1.y; +/// +/// sf::Vector2f v2 = v1 * 5.f; +/// sf::Vector2f v3; +/// v3 = v1 + v2; +/// +/// bool different = (v2 != v3); +/// \endcode +/// +/// Note: for 3-dimensional vectors, see sf::Vector3. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.inl new file mode 100644 index 0000000..e1a87ae --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector2.inl @@ -0,0 +1,161 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +inline Vector2::Vector2() : +x(0), +y(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2::Vector2(T X, T Y) : +x(X), +y(Y) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +inline Vector2::Vector2(const Vector2& vector) : +x(static_cast(vector.x)), +y(static_cast(vector.y)) +{ +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator -(const Vector2& right) +{ + return Vector2(-right.x, -right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator +=(Vector2& left, const Vector2& right) +{ + left.x += right.x; + left.y += right.y; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator -=(Vector2& left, const Vector2& right) +{ + left.x -= right.x; + left.y -= right.y; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator +(const Vector2& left, const Vector2& right) +{ + return Vector2(left.x + right.x, left.y + right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator -(const Vector2& left, const Vector2& right) +{ + return Vector2(left.x - right.x, left.y - right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator *(const Vector2& left, T right) +{ + return Vector2(left.x * right, left.y * right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator *(T left, const Vector2& right) +{ + return Vector2(right.x * left, right.y * left); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator *=(Vector2& left, T right) +{ + left.x *= right; + left.y *= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator /(const Vector2& left, T right) +{ + return Vector2(left.x / right, left.y / right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator /=(Vector2& left, T right) +{ + left.x /= right; + left.y /= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Vector2& left, const Vector2& right) +{ + return (left.x == right.x) && (left.y == right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Vector2& left, const Vector2& right) +{ + return (left.x != right.x) || (left.y != right.y); +} diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.hpp new file mode 100644 index 0000000..76a26cb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.hpp @@ -0,0 +1,302 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR3_HPP +#define SFML_VECTOR3_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility template class for manipulating +/// 3-dimensional vectors +/// +//////////////////////////////////////////////////////////// +template +class Vector3 +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector3(0, 0, 0). + /// + //////////////////////////////////////////////////////////// + Vector3(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// \param Z Z coordinate + /// + //////////////////////////////////////////////////////////// + Vector3(T X, T Y, T Z); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Vector3(const Vector3& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + T z; ///< Z coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of unary operator - +/// +/// \param left Vector to negate +/// +/// \return Memberwise opposite of the vector +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& left); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator += +/// +/// This operator performs a memberwise addition of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator +=(Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator -= +/// +/// This operator performs a memberwise subtraction of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator -=(Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator + +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise addition of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator +(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator - +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise subtraction of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise multiplication by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(const Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a scalar value) +/// \param right Right operand (a vector) +/// +/// \return Memberwise multiplication by \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(T left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator *= +/// +/// This operator performs a memberwise multiplication by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator *=(Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator / +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise division by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator /(const Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator /= +/// +/// This operator performs a memberwise division by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator /=(Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector3& left, const Vector3& right); + +#include + +// Define the most common types +typedef Vector3 Vector3i; +typedef Vector3 Vector3f; + +} // namespace sf + + +#endif // SFML_VECTOR3_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vector3 +/// \ingroup system +/// +/// sf::Vector3 is a simple class that defines a mathematical +/// vector with three coordinates (x, y and z). It can be used to +/// represent anything that has three dimensions: a size, a point, +/// a velocity, etc. +/// +/// The template parameter T is the type of the coordinates. It +/// can be any type that supports arithmetic operations (+, -, /, *) +/// and comparisons (==, !=), for example int or float. +/// +/// You generally don't have to care about the templated form (sf::Vector3), +/// the most common specializations have special typedefs: +/// \li sf::Vector3 is sf::Vector3f +/// \li sf::Vector3 is sf::Vector3i +/// +/// The sf::Vector3 class has a small and simple interface, its x and y members +/// can be accessed directly (there's no accessor like setX(), getX()) and it +/// contains no mathematical function like dot product, cross product, length, etc. +/// +/// Usage example: +/// \code +/// sf::Vector3f v1(16.5f, 24.f, -8.2f); +/// v1.x = 18.2f; +/// float y = v1.y; +/// float z = v1.z; +/// +/// sf::Vector3f v2 = v1 * 5.f; +/// sf::Vector3f v3; +/// v3 = v1 + v2; +/// +/// bool different = (v2 != v3); +/// \endcode +/// +/// Note: for 2-dimensional vectors, see sf::Vector2. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.inl b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.inl new file mode 100644 index 0000000..cff1a30 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/System/Vector3.inl @@ -0,0 +1,168 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +inline Vector3::Vector3() : +x(0), +y(0), +z(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3::Vector3(T X, T Y, T Z) : +x(X), +y(Y), +z(Z) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +inline Vector3::Vector3(const Vector3& vector) : +x(static_cast(vector.x)), +y(static_cast(vector.y)), +z(static_cast(vector.z)) +{ +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator -(const Vector3& left) +{ + return Vector3(-left.x, -left.y, -left.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator +=(Vector3& left, const Vector3& right) +{ + left.x += right.x; + left.y += right.y; + left.z += right.z; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator -=(Vector3& left, const Vector3& right) +{ + left.x -= right.x; + left.y -= right.y; + left.z -= right.z; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator +(const Vector3& left, const Vector3& right) +{ + return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator -(const Vector3& left, const Vector3& right) +{ + return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator *(const Vector3& left, T right) +{ + return Vector3(left.x * right, left.y * right, left.z * right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator *(T left, const Vector3& right) +{ + return Vector3(right.x * left, right.y * left, right.z * left); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator *=(Vector3& left, T right) +{ + left.x *= right; + left.y *= right; + left.z *= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator /(const Vector3& left, T right) +{ + return Vector3(left.x / right, left.y / right, left.z / right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator /=(Vector3& left, T right) +{ + left.x /= right; + left.y /= right; + left.z /= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Vector3& left, const Vector3& right) +{ + return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Vector3& left, const Vector3& right) +{ + return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); +} diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window.hpp new file mode 100644 index 0000000..5d51134 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window.hpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SFML_WINDOW_HPP +#define SFML_SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup window Window module +/// +/// Provides OpenGL-based windows, and abstractions for +/// events and input handling. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Context.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Context.hpp new file mode 100644 index 0000000..5f67164 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Context.hpp @@ -0,0 +1,140 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXT_HPP +#define SFML_CONTEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class GlContext; +} + +//////////////////////////////////////////////////////////// +/// \brief Class holding a valid drawing context +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Context : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// The constructor creates and activates the context + /// + //////////////////////////////////////////////////////////// + Context(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// The desctructor deactivates and destroys the context + /// + //////////////////////////////////////////////////////////// + ~Context(); + + //////////////////////////////////////////////////////////// + /// \brief Activate or deactivate explicitely the context + /// + /// \param active True to activate, false to deactivate + /// + /// \return True on success, false on failure + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active); + +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct a in-memory context + /// + /// This constructor is for internal use, you don't need + /// to bother with it. + /// + /// \param settings Creation parameters + /// \param width Back buffer width + /// \param height Back buffer height + /// + //////////////////////////////////////////////////////////// + Context(const ContextSettings& settings, unsigned int width, unsigned int height); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::GlContext* m_context; ///< Internal OpenGL context +}; + +} // namespace sf + + +#endif // SFML_CONTEXT_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::Context +/// \ingroup window +/// +/// If you need to make OpenGL calls without having an +/// active window (like in a thread), you can use an +/// instance of this class to get a valid context. +/// +/// Having a valid context is necessary for *every* OpenGL call. +/// +/// Note that a context is only active in its current thread, +/// if you create a new thread it will have no valid context +/// by default. +/// +/// To use a sf::Context instance, just construct it and let it +/// live as long as you need a valid context. No explicit activation +/// is needed, all it has to do is to exist. Its destructor +/// will take care of deactivating and freeing all the attached +/// resources. +/// +/// Usage example: +/// \code +/// void threadFunction(void*) +/// { +/// sf::Context context; +/// // from now on, you have a valid context +/// +/// // you can make OpenGL calls +/// glClear(GL_DEPTH_BUFFER_BIT); +/// } +/// // the context is automatically deactivated and destroyed +/// // by the sf::Context destructor +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/ContextSettings.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/ContextSettings.hpp new file mode 100644 index 0000000..1bd2b3e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/ContextSettings.hpp @@ -0,0 +1,104 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXTSETTINGS_HPP +#define SFML_CONTEXTSETTINGS_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Structure defining the settings of the OpenGL +/// context attached to a window +/// +//////////////////////////////////////////////////////////// +struct ContextSettings +{ + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param depth Depth buffer bits + /// \param stencil Stencil buffer bits + /// \param antialiasing Antialiasing level + /// \param major Major number of the context version + /// \param minor Minor number of the context version + /// + //////////////////////////////////////////////////////////// + explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) : + depthBits (depth), + stencilBits (stencil), + antialiasingLevel(antialiasing), + majorVersion (major), + minorVersion (minor) + { + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int depthBits; ///< Bits of the depth buffer + unsigned int stencilBits; ///< Bits of the stencil buffer + unsigned int antialiasingLevel; ///< Level of antialiasing + unsigned int majorVersion; ///< Major number of the context version to create + unsigned int minorVersion; ///< Minor number of the context version to create +}; + +} // namespace sf + + +#endif // SFML_CONTEXTSETTINGS_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ContextSettings +/// \ingroup window +/// +/// ContextSettings allows to define several advanced settings +/// of the OpenGL context attached to a window. All these +/// settings have no impact on the regular SFML rendering +/// (graphics module) -- except the anti-aliasing level, so +/// you may need to use this structure only if you're using +/// SFML as a windowing system for custom OpenGL rendering. +/// +/// The depthBits and stencilBits members define the number +/// of bits per pixel requested for the (respectively) depth +/// and stencil buffers. +/// +/// antialiasingLevel represents the requested number of +/// multisampling levels for anti-aliasing. +/// +/// majorVersion and minorVersion define the version of the +/// OpenGL context that you want. Only versions greater or +/// equal to 3.0 are relevant; versions lesser than 3.0 are +/// all handled the same way (i.e. you can use any version +/// < 3.0 if you don't want an OpenGL 3 context). +/// +/// Please note that these values are only a hint. +/// No failure will be reported if one or more of these values +/// are not supported by the system; instead, SFML will try to +/// find the closest valid match. You can then retrieve the +/// settings that the window actually used to create its context, +/// with Window::getSettings(). +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Event.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Event.hpp new file mode 100644 index 0000000..e86c2bf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Event.hpp @@ -0,0 +1,237 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_EVENT_HPP +#define SFML_EVENT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Defines a system event and its parameters +/// +//////////////////////////////////////////////////////////// +class Event +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Size events parameters (Resized) + /// + //////////////////////////////////////////////////////////// + struct SizeEvent + { + unsigned int width; ///< New width, in pixels + unsigned int height; ///< New height, in pixels + }; + + //////////////////////////////////////////////////////////// + /// \brief Keyboard event parameters (KeyPressed, KeyReleased) + /// + //////////////////////////////////////////////////////////// + struct KeyEvent + { + Keyboard::Key code; ///< Code of the key that has been pressed + bool alt; ///< Is the Alt key pressed? + bool control; ///< Is the Control key pressed? + bool shift; ///< Is the Shift key pressed? + bool system; ///< Is the System key pressed? + }; + + //////////////////////////////////////////////////////////// + /// \brief Text event parameters (TextEntered) + /// + //////////////////////////////////////////////////////////// + struct TextEvent + { + Uint32 unicode; ///< UTF-32 unicode value of the character + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse move event parameters (MouseMoved) + /// + //////////////////////////////////////////////////////////// + struct MouseMoveEvent + { + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse buttons events parameters + /// (MouseButtonPressed, MouseButtonReleased) + /// + //////////////////////////////////////////////////////////// + struct MouseButtonEvent + { + Mouse::Button button; ///< Code of the button that has been pressed + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse wheel events parameters (MouseWheelMoved) + /// + //////////////////////////////////////////////////////////// + struct MouseWheelEvent + { + int delta; ///< Number of ticks the wheel has moved (positive is up, negative is down) + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick connection events parameters + /// (JoystickConnected, JoystickDisconnected) + /// + //////////////////////////////////////////////////////////// + struct JoystickConnectEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick axis move event parameters (JoystickMoved) + /// + //////////////////////////////////////////////////////////// + struct JoystickMoveEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + Joystick::Axis axis; ///< Axis on which the joystick moved + float position; ///< New position on the axis (in range [-100 .. 100]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick buttons events parameters + /// (JoystickButtonPressed, JoystickButtonReleased) + /// + //////////////////////////////////////////////////////////// + struct JoystickButtonEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + unsigned int button; ///< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the different types of events + /// + //////////////////////////////////////////////////////////// + enum EventType + { + Closed, ///< The window requested to be closed (no data) + Resized, ///< The window was resized (data in event.size) + LostFocus, ///< The window lost the focus (no data) + GainedFocus, ///< The window gained the focus (no data) + TextEntered, ///< A character was entered (data in event.text) + KeyPressed, ///< A key was pressed (data in event.key) + KeyReleased, ///< A key was released (data in event.key) + MouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) + MouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton) + MouseButtonReleased, ///< A mouse button was released (data in event.mouseButton) + MouseMoved, ///< The mouse cursor moved (data in event.mouseMove) + MouseEntered, ///< The mouse cursor entered the area of the window (no data) + MouseLeft, ///< The mouse cursor left the area of the window (no data) + JoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton) + JoystickButtonReleased, ///< A joystick button was released (data in event.joystickButton) + JoystickMoved, ///< The joystick moved along an axis (data in event.joystickMove) + JoystickConnected, ///< A joystick was connected (data in event.joystickConnect) + JoystickDisconnected, ///< A joystick was disconnected (data in event.joystickConnect) + + Count ///< Keep last -- the total number of event types + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + EventType type; ///< Type of the event + + union + { + SizeEvent size; ///< Size event parameters (Event::Resized) + KeyEvent key; ///< Key event parameters (Event::KeyPressed, Event::KeyReleased) + TextEvent text; ///< Text event parameters (Event::TextEntered) + MouseMoveEvent mouseMove; ///< Mouse move event parameters (Event::MouseMoved) + MouseButtonEvent mouseButton; ///< Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased) + MouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (Event::MouseWheelMoved) + JoystickMoveEvent joystickMove; ///< Joystick move event parameters (Event::JoystickMoved) + JoystickButtonEvent joystickButton; ///< Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased) + JoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected) + }; +}; + +} // namespace sf + + +#endif // SFML_EVENT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Event +/// \ingroup window +/// +/// sf::Event holds all the informations about a system event +/// that just happened. Events are retrieved using the +/// sf::Window::pollEvent and sf::Window::waitEvent functions. +/// +/// A sf::Event instance contains the type of the event +/// (mouse moved, key pressed, window closed, ...) as well +/// as the details about this particular event. Please note that +/// the event parameters are defined in a union, which means that +/// only the member matching the type of the event will be properly +/// filled; all other members will have undefined values and must not +/// be read if the type of the event doesn't match. For example, +/// if you received a KeyPressed event, then you must read the +/// event.key member, all other members such as event.MouseMove +/// or event.text will have undefined values. +/// +/// Usage example: +/// \code +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// +/// // The escape key was pressed +/// if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)) +/// window.close(); +/// +/// // The window was resized +/// if (event.type == sf::Event::Resized) +/// doSomethingWithTheNewSize(event.size.width, event.size.height); +/// +/// // etc ... +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Export.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Export.hpp new file mode 100644 index 0000000..ff06576 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_EXPORT_HPP +#define SFML_WINDOW_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_WINDOW_EXPORTS) + + #define SFML_WINDOW_API SFML_API_EXPORT + +#else + + #define SFML_WINDOW_API SFML_API_IMPORT + +#endif + + +#endif // SFML_WINDOW_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/GlResource.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/GlResource.hpp new file mode 100644 index 0000000..560a637 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/GlResource.hpp @@ -0,0 +1,76 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLRESOURCE_HPP +#define SFML_GLRESOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class for classes that require an OpenGL context +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API GlResource +{ +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + GlResource(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~GlResource(); + + //////////////////////////////////////////////////////////// + /// \brief Make sure that a valid OpenGL context exists in the current thread + /// + //////////////////////////////////////////////////////////// + static void ensureGlContext(); +}; + +} // namespace sf + + +#endif // SFML_GLRESOURCE_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::GlResource +/// \ingroup window +/// +/// This class is for internal use only, it must be the base +/// of every class that requires a valid OpenGL context in +/// order to work. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Joystick.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Joystick.hpp new file mode 100644 index 0000000..8e65309 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Joystick.hpp @@ -0,0 +1,203 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICK_HPP +#define SFML_JOYSTICK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the joysticks +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Constants related to joysticks capabilities + /// + //////////////////////////////////////////////////////////// + enum + { + Count = 8, ///< Maximum number of supported joysticks + ButtonCount = 32, ///< Maximum number of supported buttons + AxisCount = 8 ///< Maximum number of supported axes + }; + + //////////////////////////////////////////////////////////// + /// \brief Axes supported by SFML joysticks + /// + //////////////////////////////////////////////////////////// + enum Axis + { + X, ///< The X axis + Y, ///< The Y axis + Z, ///< The Z axis + R, ///< The R axis + U, ///< The U axis + V, ///< The V axis + PovX, ///< The X axis of the point-of-view hat + PovY ///< The Y axis of the point-of-view hat + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick is connected + /// + /// \param joystick Index of the joystick to check + /// + /// \return True if the joystick is connected, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isConnected(unsigned int joystick); + + //////////////////////////////////////////////////////////// + /// \brief Return the number of buttons supported by a joystick + /// + /// If the joystick is not connected, this function returns 0. + /// + /// \param joystick Index of the joystick + /// + /// \return Number of buttons supported by the joystick + /// + //////////////////////////////////////////////////////////// + static unsigned int getButtonCount(unsigned int joystick); + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick supports a given axis + /// + /// If the joystick is not connected, this function returns false. + /// + /// \param joystick Index of the joystick + /// \param axis Axis to check + /// + /// \return True if the joystick supports the axis, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool hasAxis(unsigned int joystick, Axis axis); + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick button is pressed + /// + /// If the joystick is not connected, this function returns false. + /// + /// \param joystick Index of the joystick + /// \param button Button to check + /// + /// \return True if the button is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isButtonPressed(unsigned int joystick, unsigned int button); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of a joystick axis + /// + /// If the joystick is not connected, this function returns 0. + /// + /// \param joystick Index of the joystick + /// \param axis Axis to check + /// + /// \return Current position of the axis, in range [-100 .. 100] + /// + //////////////////////////////////////////////////////////// + static float getAxisPosition(unsigned int joystick, Axis axis); + + //////////////////////////////////////////////////////////// + /// \brief Update the states of all joysticks + /// + /// This function is used internally by SFML, so you normally + /// don't have to call it explicitely. However, you may need to + /// call it if you have no window yet (or no window at all): + /// in this case the joysticks states are not updated automatically. + /// + //////////////////////////////////////////////////////////// + static void update(); +}; + +} // namespace sf + + +#endif // SFML_JOYSTICK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Joystick +/// \ingroup window +/// +/// sf::Joystick provides an interface to the state of the +/// joysticks. It only contains static functions, so it's not +/// meant to be instanciated. Instead, each joystick is identified +/// by an index that is passed to the functions of this class. +/// +/// This class allows users to query the state of joysticks at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the JoystickMoved, JoystickButtonPressed +/// and JoystickButtonReleased events, sf::Joystick can retrieve the +/// state of axes and buttons of joysticks at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a button is pressed or released), and you +/// always get the real state of joysticks, even if they are +/// moved, pressed or released when your window is out of focus +/// and no event is triggered. +/// +/// SFML supports: +/// \li 8 joysticks (sf::Joystick::Count) +/// \li 32 buttons per joystick (sf::Joystick::ButtonCount) +/// \li 8 axes per joystick (sf::Joystick::AxisCount) +/// +/// Unlike the keyboard or mouse, the state of joysticks is sometimes +/// not directly available (depending on the OS), therefore an update() +/// function must be called in order to update the current state of +/// joysticks. When you have a window with event handling, this is done +/// automatically, you don't need to call anything. But if you have no +/// window, or if you want to check joysticks state before creating one, +/// you must call sf::Joystick::update explicitely. +/// +/// Usage example: +/// \code +/// // Is joystick #0 connected? +/// bool connected = sf::Joystick::isConnected(0); +/// +/// // How many buttons does joystick #0 support? +/// unsigned int buttons = sf::Joystick::getButtonCount(0); +/// +/// // Does joystick #0 define a X axis? +/// bool hasX = sf::Joystick::hasAxis(0, sf::Joystick::X); +/// +/// // Is button #2 pressed on joystick #0? +/// bool pressed = sf::Joystick::isButtonPressed(0, 2); +/// +/// // What's the current position of the Y axis on joystick #0? +/// float position = sf::Joystick::getAxisPosition(0, sf::Joystick::Y); +/// \endcode +/// +/// \see sf::Keyboard, sf::Mouse +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Keyboard.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Keyboard.hpp new file mode 100644 index 0000000..f10dc7c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Keyboard.hpp @@ -0,0 +1,209 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_KEYBOARD_HPP +#define SFML_KEYBOARD_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the keyboard +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Keyboard +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Key codes + /// + //////////////////////////////////////////////////////////// + enum Key + { + Unknown = -1, ///< Unhandled key + A = 0, ///< The A key + B, ///< The B key + C, ///< The C key + D, ///< The D key + E, ///< The E key + F, ///< The F key + G, ///< The G key + H, ///< The H key + I, ///< The I key + J, ///< The J key + K, ///< The K key + L, ///< The L key + M, ///< The M key + N, ///< The N key + O, ///< The O key + P, ///< The P key + Q, ///< The Q key + R, ///< The R key + S, ///< The S key + T, ///< The T key + U, ///< The U key + V, ///< The V key + W, ///< The W key + X, ///< The X key + Y, ///< The Y key + Z, ///< The Z key + Num0, ///< The 0 key + Num1, ///< The 1 key + Num2, ///< The 2 key + Num3, ///< The 3 key + Num4, ///< The 4 key + Num5, ///< The 5 key + Num6, ///< The 6 key + Num7, ///< The 7 key + Num8, ///< The 8 key + Num9, ///< The 9 key + Escape, ///< The Escape key + LControl, ///< The left Control key + LShift, ///< The left Shift key + LAlt, ///< The left Alt key + LSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ... + RControl, ///< The right Control key + RShift, ///< The right Shift key + RAlt, ///< The right Alt key + RSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ... + Menu, ///< The Menu key + LBracket, ///< The [ key + RBracket, ///< The ] key + SemiColon, ///< The ; key + Comma, ///< The , key + Period, ///< The . key + Quote, ///< The ' key + Slash, ///< The / key + BackSlash, ///< The \ key + Tilde, ///< The ~ key + Equal, ///< The = key + Dash, ///< The - key + Space, ///< The Space key + Return, ///< The Return key + BackSpace, ///< The Backspace key + Tab, ///< The Tabulation key + PageUp, ///< The Page up key + PageDown, ///< The Page down key + End, ///< The End key + Home, ///< The Home key + Insert, ///< The Insert key + Delete, ///< The Delete key + Add, ///< The + key + Subtract, ///< The - key + Multiply, ///< The * key + Divide, ///< The / key + Left, ///< Left arrow + Right, ///< Right arrow + Up, ///< Up arrow + Down, ///< Down arrow + Numpad0, ///< The numpad 0 key + Numpad1, ///< The numpad 1 key + Numpad2, ///< The numpad 2 key + Numpad3, ///< The numpad 3 key + Numpad4, ///< The numpad 4 key + Numpad5, ///< The numpad 5 key + Numpad6, ///< The numpad 6 key + Numpad7, ///< The numpad 7 key + Numpad8, ///< The numpad 8 key + Numpad9, ///< The numpad 9 key + F1, ///< The F1 key + F2, ///< The F2 key + F3, ///< The F3 key + F4, ///< The F4 key + F5, ///< The F5 key + F6, ///< The F6 key + F7, ///< The F7 key + F8, ///< The F8 key + F9, ///< The F9 key + F10, ///< The F10 key + F11, ///< The F11 key + F12, ///< The F12 key + F13, ///< The F13 key + F14, ///< The F14 key + F15, ///< The F15 key + Pause, ///< The Pause key + + KeyCount ///< Keep last -- the total number of keyboard keys + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a key is pressed + /// + /// \param key Key to check + /// + /// \return True if the key is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isKeyPressed(Key key); +}; + +} // namespace sf + + +#endif // SFML_KEYBOARD_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Keyboard +/// \ingroup window +/// +/// sf::Keyboard provides an interface to the state of the +/// keyboard. It only contains static functions (a single +/// keyboard is assumed), so it's not meant to be instanciated. +/// +/// This class allows users to query the keyboard state at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the KeyPressed and KeyReleased events, +/// sf::Keyboard can retrieve the state of a key at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a key is pressed or released), and you +/// always get the real state of the keyboard, even if keys are +/// pressed or released when your window is out of focus and no +/// event is triggered. +/// +/// Usage example: +/// \code +/// if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) +/// { +/// // move left... +/// } +/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) +/// { +/// // move right... +/// } +/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) +/// { +/// // quit... +/// } +/// \endcode +/// +/// \see sf::Joystick, sf::Mouse +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Mouse.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Mouse.hpp new file mode 100644 index 0000000..dd26d1a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Mouse.hpp @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MOUSE_HPP +#define SFML_MOUSE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Window; + +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the mouse +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Mouse +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Mouse buttons + /// + //////////////////////////////////////////////////////////// + enum Button + { + Left, ///< The left mouse button + Right, ///< The right mouse button + Middle, ///< The middle (wheel) mouse button + XButton1, ///< The first extra mouse button + XButton2, ///< The second extra mouse button + + ButtonCount ///< Keep last -- the total number of mouse buttons + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a mouse button is pressed + /// + /// \param button Button to check + /// + /// \return True if the button is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isButtonPressed(Button button); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in desktop coordinates + /// + /// This function returns the global position of the mouse + /// cursor on the desktop. + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i getPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i getPosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the global position of the mouse + /// cursor on the desktop. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector2i& position, const Window& relativeTo); +}; + +} // namespace sf + + +#endif // SFML_MOUSE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Mouse +/// \ingroup window +/// +/// sf::Mouse provides an interface to the state of the +/// mouse. It only contains static functions (a single +/// mouse is assumed), so it's not meant to be instanciated. +/// +/// This class allows users to query the mouse state at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the MouseMoved, MouseButtonPressed +/// and MouseButtonReleased events, sf::Mouse can retrieve the +/// state of the cursor and the buttons at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a button is pressed or released), and you +/// always get the real state of the mouse, even if it is +/// moved, pressed or released when your window is out of focus +/// and no event is triggered. +/// +/// The setPosition and getPosition functions can be used to change +/// or retrieve the current position of the mouse pointer. There are +/// two versions: one that operates in global coordinates (relative +/// to the desktop) and one that operates in window coordinates +/// (relative to a specific window). +/// +/// Usage example: +/// \code +/// if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) +/// { +/// // left click... +/// } +/// +/// // get global mouse position +/// sf::Vector2i position = sf::Mouse::getPosition(); +/// +/// // set mouse position relative to a window +/// sf::Mouse::setPosition(sf::Vector2i(100, 200), window); +/// \endcode +/// +/// \see sf::Joystick, sf::Keyboard +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/VideoMode.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/VideoMode.hpp new file mode 100644 index 0000000..beec607 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/VideoMode.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODE_HPP +#define SFML_VIDEOMODE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief VideoMode defines a video mode (width, height, bpp) +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API VideoMode +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructors initializes all members to 0. + /// + //////////////////////////////////////////////////////////// + VideoMode(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the video mode with its attributes + /// + /// \param modeWidth Width in pixels + /// \param modeHeight Height in pixels + /// \param modeBitsPerPixel Pixel depths in bits per pixel + /// + //////////////////////////////////////////////////////////// + VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel = 32); + + //////////////////////////////////////////////////////////// + /// \brief Get the current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode getDesktopMode(); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve all the video modes supported in fullscreen mode + /// + /// When creating a fullscreen window, the video mode is restricted + /// to be compatible with what the graphics driver and monitor + /// support. This function returns the complete list of all video + /// modes that can be used in fullscreen mode. + /// The returned array is sorted from best to worst, so that + /// the first element will always give the best mode (higher + /// width, height and bits-per-pixel). + /// + /// \return Array containing all the supported fullscreen modes + /// + //////////////////////////////////////////////////////////// + static const std::vector& getFullscreenModes(); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the video mode is valid + /// + /// The validity of video modes is only relevant when using + /// fullscreen windows; otherwise any video mode can be used + /// with no restriction. + /// + /// \return True if the video mode is valid for fullscreen mode + /// + //////////////////////////////////////////////////////////// + bool isValid() const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int width; ///< Video mode width, in pixels + unsigned int height; ///< Video mode height, in pixels + unsigned int bitsPerPixel; ///< Video mode pixel depth, in bits per pixels +}; + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of == operator to compare two video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if modes are equal +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator ==(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of != operator to compare two video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if modes are different +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator !=(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of < operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator <(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of > operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator >(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of <= operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator <=(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of >= operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator >=(const VideoMode& left, const VideoMode& right); + +} // namespace sf + + +#endif // SFML_VIDEOMODE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::VideoMode +/// \ingroup window +/// +/// A video mode is defined by a width and a height (in pixels) +/// and a depth (in bits per pixel). Video modes are used to +/// setup windows (sf::Window) at creation time. +/// +/// The main usage of video modes is for fullscreen mode: +/// indeed you must use one of the valid video modes +/// allowed by the OS (which are defined by what the monitor +/// and the graphics card support), otherwise your window +/// creation will just fail. +/// +/// sf::VideoMode provides a static function for retrieving +/// the list of all the video modes supported by the system: +/// getFullscreenModes(). +/// +/// A custom video mode can also be checked directly for +/// fullscreen compatibility with its isValid() function. +/// +/// Additionnally, sf::VideoMode provides a static function +/// to get the mode currently used by the desktop: getDesktopMode(). +/// This allows to build windows with the same size or pixel +/// depth as the current resolution. +/// +/// Usage example: +/// \code +/// // Display the list of all the video modes available for fullscreen +/// std::vector modes = sf::VideoMode::getFullscreenModes(); +/// for (std::size_t i = 0; i < modes.size(); ++i) +/// { +/// sf::VideoMode mode = modes[i]; +/// std::cout << "Mode #" << i << ": " +/// << mode.width << "x" << mode.height << " - " +/// << mode.bitsPerPixel << " bpp" << std::endl; +/// } +/// +/// // Create a window with the same pixel depth as the desktop +/// sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); +/// window.create(sf::VideoMode(1024, 768, desktop.bitsPerPixel), "SFML window"); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Window.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Window.hpp new file mode 100644 index 0000000..21bb2c5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/Window.hpp @@ -0,0 +1,541 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_HPP +#define SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class GlContext; + class WindowImpl; +} + +class Event; + +//////////////////////////////////////////////////////////// +/// \brief Window that serves as a target for OpenGL rendering +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Window : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor doesn't actually create the window, + /// use the other constructors or call "create" to do so. + /// + //////////////////////////////////////////////////////////// + Window(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a new window + /// + /// This constructor creates the window with the size and pixel + /// depth defined in \a mode. An optional style can be passed to + /// customize the look and behaviour of the window (borders, + /// title bar, resizable, closable, ...). If \a style contains + /// Style::Fullscreen, then \a mode must be a valid video mode. + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + Window(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Construct the window from an existing control + /// + /// Use this constructor if you want to create an OpenGL + /// rendering area into an already existing control. + /// + /// The second parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + explicit Window(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Closes the window and free all the resources attached to it. + /// + //////////////////////////////////////////////////////////// + virtual ~Window(); + + //////////////////////////////////////////////////////////// + /// \brief Create (or recreate) the window + /// + /// If the window was already created, it closes it first. + /// If \a style contains Style::Fullscreen, then \a mode + /// must be a valid video mode. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + void create(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Create (or recreate) the window from an existing control + /// + /// Use this function if you want to create an OpenGL + /// rendering area into an already existing control. + /// If the window was already created, it closes it first. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + void create(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Close the window and destroy all the attached resources + /// + /// After calling this function, the sf::Window instance remains + /// valid and you can call create() to recreate the window. + /// All other functions such as pollEvent() or display() will + /// still work (i.e. you don't have to test isOpen() every time), + /// and will have no effect on closed windows. + /// + //////////////////////////////////////////////////////////// + void close(); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the window is open + /// + /// This function returns whether or not the window exists. + /// Note that a hidden window (setVisible(false)) is open + /// (therefore this function would return true). + /// + /// \return True if the window is open, false if it has been closed + /// + //////////////////////////////////////////////////////////// + bool isOpen() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the settings of the OpenGL context of the window + /// + /// Note that these settings may be different from what was + /// passed to the constructor or the create() function, + /// if one or more settings were not supported. In this case, + /// SFML chose the closest match. + /// + /// \return Structure containing the OpenGL context settings + /// + //////////////////////////////////////////////////////////// + const ContextSettings& getSettings() const; + + //////////////////////////////////////////////////////////// + /// \brief Pop the event on top of the event queue, if any, and return it + /// + /// This function is not blocking: if there's no pending event then + /// it will return false and leave \a event unmodified. + /// Note that more than one event may be present in the event queue, + /// thus you should always call this function in a loop + /// to make sure that you process every pending event. + /// \code + /// sf::Event event; + /// while (window.pollEvent(event)) + /// { + /// // process event... + /// } + /// \endcode + /// + /// \param event Event to be returned + /// + /// \return True if an event was returned, or false if the event queue was empty + /// + /// \see waitEvent + /// + //////////////////////////////////////////////////////////// + bool pollEvent(Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Wait for an event and return it + /// + /// This function is blocking: if there's no pending event then + /// it will wait until an event is received. + /// After this function returns (and no error occured), + /// the \a event object is always valid and filled properly. + /// This function is typically used when you have a thread that + /// is dedicated to events handling: you want to make this thread + /// sleep as long as no new event is received. + /// \code + /// sf::Event event; + /// if (window.waitEvent(event)) + /// { + /// // process event... + /// } + /// \endcode + /// + /// \param event Event to be returned + /// + /// \return False if any error occured + /// + /// \see pollEvent + /// + //////////////////////////////////////////////////////////// + bool waitEvent(Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Get the position of the window + /// + /// \return Position of the window, in pixels + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + Vector2i getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the position of the window on screen + /// + /// This function only works for top-level windows + /// (i.e. it will be ignored for windows created from + /// the handle of a child window/control). + /// + /// \param position New position, in pixels + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rendering region of the window + /// + /// The size doesn't include the titlebar and borders + /// of the window. + /// + /// \return Size in pixels + /// + /// \see setSize + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the size of the rendering region of the window + /// + /// \param size New size, in pixels + /// + /// \see getSize + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2u size); + + //////////////////////////////////////////////////////////// + /// \brief Change the title of the window + /// + /// \param title New title + /// + /// \see setIcon + /// + //////////////////////////////////////////////////////////// + void setTitle(const String& title); + + //////////////////////////////////////////////////////////// + /// \brief Change the window's icon + /// + /// \a pixels must be an array of \a width x \a height pixels + /// in 32-bits RGBA format. + /// + /// The OS default icon is used by default. + /// + /// \param width Icon's width, in pixels + /// \param height Icon's height, in pixels + /// \param pixels Pointer to the array of pixels in memory + /// + /// \see setTitle + /// + //////////////////////////////////////////////////////////// + void setIcon(unsigned int width, unsigned int height, const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Show or hide the window + /// + /// The window is shown by default. + /// + /// \param visible True to show the window, false to hide it + /// + //////////////////////////////////////////////////////////// + void setVisible(bool visible); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable vertical synchronization + /// + /// Activating vertical synchronization will limit the number + /// of frames displayed to the refresh rate of the monitor. + /// This can avoid some visual artifacts, and limit the framerate + /// to a good value (but not constant across different computers). + /// + /// Vertical synchronization is disabled by default. + /// + /// \param enabled True to enable v-sync, false to deactivate it + /// + //////////////////////////////////////////////////////////// + void setVerticalSyncEnabled(bool enabled); + + //////////////////////////////////////////////////////////// + /// \brief Show or hide the mouse cursor + /// + /// The mouse cursor is visible by default. + /// + /// \param visible True to show the mouse cursor, false to hide it + /// + //////////////////////////////////////////////////////////// + void setMouseCursorVisible(bool visible); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable automatic key-repeat + /// + /// If key repeat is enabled, you will receive repeated + /// KeyPressed events while keeping a key pressed. If it is disabled, + /// you will only get a single event when the key is pressed. + /// + /// Key repeat is enabled by default. + /// + /// \param enabled True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + void setKeyRepeatEnabled(bool enabled); + + //////////////////////////////////////////////////////////// + /// \brief Limit the framerate to a maximum fixed frequency + /// + /// If a limit is set, the window will use a small delay after + /// each call to display() to ensure that the current frame + /// lasted long enough to match the framerate limit. + /// SFML will try to match the given limit as much as it can, + /// but since it internally uses sf::sleep, whose precision + /// depends on the underlying OS, the results may be a little + /// unprecise as well (for example, you can get 65 FPS when + /// requesting 60). + /// + /// \param limit Framerate limit, in frames per seconds (use 0 to disable limit) + /// + //////////////////////////////////////////////////////////// + void setFramerateLimit(unsigned int limit); + + //////////////////////////////////////////////////////////// + /// \brief Change the joystick threshold + /// + /// The joystick threshold is the value below which + /// no JoystickMoved event will be generated. + /// + /// The threshold value is 0.1 by default. + /// + /// \param threshold New threshold, in the range [0, 100] + /// + //////////////////////////////////////////////////////////// + void setJoystickThreshold(float threshold); + + //////////////////////////////////////////////////////////// + /// \brief Activate or deactivate the window as the current target + /// for OpenGL rendering + /// + /// A window is active only on the current thread, if you want to + /// make it active on another thread you have to deactivate it + /// on the previous thread first if it was active. + /// Only one window can be active on a thread at a time, thus + /// the window previously active (if any) automatically gets deactivated. + /// + /// \param active True to activate, false to deactivate + /// + /// \return True if operation was successful, false otherwise + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active = true) const; + + //////////////////////////////////////////////////////////// + /// \brief Display on screen what has been rendered to the window so far + /// + /// This function is typically called after all OpenGL rendering + /// has been done for the current frame, in order to show + /// it on screen. + /// + //////////////////////////////////////////////////////////// + void display(); + + //////////////////////////////////////////////////////////// + /// \brief Get the OS-specific handle of the window + /// + /// The type of the returned handle is sf::WindowHandle, + /// which is a typedef to the handle type defined by the OS. + /// You shouldn't need to use this function, unless you have + /// very specific stuff to implement that SFML doesn't support, + /// or implement a temporary workaround until a bug is fixed. + /// + /// \return System handle of the window + /// + //////////////////////////////////////////////////////////// + WindowHandle getSystemHandle() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been created + /// + /// This function is called so that derived classes can + /// perform their own specific initialization as soon as + /// the window is created. + /// + //////////////////////////////////////////////////////////// + virtual void onCreate(); + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been resized + /// + /// This function is called so that derived classes can + /// perform custom actions when the size of the window changes. + /// + //////////////////////////////////////////////////////////// + virtual void onResize(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Processes an event before it is sent to the user + /// + /// This function is called every time an event is received + /// from the internal window (through pollEvent or waitEvent). + /// It filters out unwanted events, and performs whatever internal + /// stuff the window needs before the event is returned to the + /// user. + /// + /// \param event Event to filter + /// + //////////////////////////////////////////////////////////// + bool filterEvent(const Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Perform some common internal initializations + /// + //////////////////////////////////////////////////////////// + void initialize(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::WindowImpl* m_impl; ///< Platform-specific implementation of the window + priv::GlContext* m_context; ///< Platform-specific implementation of the OpenGL context + Clock m_clock; ///< Clock for measuring the elapsed time between frames + Time m_frameTimeLimit; ///< Current framerate limit + Vector2u m_size; ///< Current size of the window +}; + +} // namespace sf + + +#endif // SFML_WINDOW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Window +/// \ingroup window +/// +/// sf::Window is the main class of the Window module. It defines +/// an OS window that is able to receive an OpenGL rendering. +/// +/// A sf::Window can create its own new window, or be embedded into +/// an already existing control using the create(handle) function. +/// This can be useful for embedding an OpenGL rendering area into +/// a view which is part of a bigger GUI with existing windows, +/// controls, etc. It can also serve as embedding an OpenGL rendering +/// area into a window created by another (probably richer) GUI library +/// like Qt or wxWidgets. +/// +/// The sf::Window class provides a simple interface for manipulating +/// the window: move, resize, show/hide, control mouse cursor, etc. +/// It also provides event handling through its pollEvent() and waitEvent() +/// functions. +/// +/// Note that OpenGL experts can pass their own parameters (antialiasing +/// level, bits for the depth and stencil buffers, etc.) to the +/// OpenGL context attached to the window, with the sf::ContextSettings +/// structure which is passed as an optional argument when creating the +/// window. +/// +/// Usage example: +/// \code +/// // Declare and create a new window +/// sf::Window window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Limit the framerate to 60 frames per second (this step is optional) +/// window.setFramerateLimit(60); +/// +/// // The main loop - ends as soon as the window is closed +/// while (window.isOpen()) +/// { +/// // Event processing +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// } +/// +/// // Activate the window for OpenGL rendering +/// window.setActive(); +/// +/// // OpenGL drawing commands go here... +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowHandle.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowHandle.hpp new file mode 100644 index 0000000..7fb2bb8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowHandle.hpp @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWHANDLE_HPP +#define SFML_WINDOWHANDLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +// Windows' HWND is a typedef on struct HWND__* +#if defined(SFML_SYSTEM_WINDOWS) + struct HWND__; +#endif + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Define a low-level window handle type, specific to +/// each platform +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + // Window handle is HWND (HWND__*) on Windows + typedef HWND__* WindowHandle; + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + // Window handle is Window (unsigned long) on Unix - X11 + typedef unsigned long WindowHandle; + +#elif defined(SFML_SYSTEM_MACOS) + + // Window handle is NSWindow (void*) on Mac OS X - Cocoa + typedef void* WindowHandle; + +#endif + +} // namespace sf + + +#endif // SFML_WINDOWHANDLE_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowStyle.hpp b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowStyle.hpp new file mode 100644 index 0000000..fa69d32 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Headers/Window/WindowStyle.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWSTYLE_HPP +#define SFML_WINDOWSTYLE_HPP + + +namespace sf +{ +namespace Style +{ + //////////////////////////////////////////////////////////// + /// \ingroup window + /// \brief Enumeration of the window styles + /// + //////////////////////////////////////////////////////////// + enum + { + None = 0, ///< No border / title bar (this flag and all others are mutually exclusive) + Titlebar = 1 << 0, ///< Title bar + fixed border + Resize = 1 << 1, ///< Titlebar + resizable border + maximize button + Close = 1 << 2, ///< Titlebar + close button + Fullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive) + + Default = Titlebar | Resize | Close ///< Default window style + }; +} + +} // namespace sf + + +#endif // SFML_WINDOWSTYLE_HPP diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..1c27720 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SFML + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.SFML + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/SFML b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/SFML new file mode 100755 index 0000000..6aa2e96 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/2.1.0/SFML differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/SFML.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..1e5ec6b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-audio + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.sfml-audio + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/sfml-audio b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/sfml-audio new file mode 100755 index 0000000..1f5f269 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/2.1.0/sfml-audio differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/sfml-audio b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/sfml-audio new file mode 120000 index 0000000..134330d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-audio.framework/sfml-audio @@ -0,0 +1 @@ +Versions/Current/sfml-audio \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..f5d7026 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-graphics + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.sfml-graphics + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/sfml-graphics b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/sfml-graphics new file mode 100755 index 0000000..8a22505 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/2.1.0/sfml-graphics differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/sfml-graphics b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/sfml-graphics new file mode 120000 index 0000000..209fa00 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-graphics.framework/sfml-graphics @@ -0,0 +1 @@ +Versions/Current/sfml-graphics \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..71104b6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-network + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.sfml-network + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/sfml-network b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/sfml-network new file mode 100755 index 0000000..f29c9c8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/2.1.0/sfml-network differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/sfml-network b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/sfml-network new file mode 120000 index 0000000..2d1647c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-network.framework/sfml-network @@ -0,0 +1 @@ +Versions/Current/sfml-network \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..089d958 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-system + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.sfml-system + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/sfml-system b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/sfml-system new file mode 100755 index 0000000..a29f395 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/2.1.0/sfml-system differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/sfml-system b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/sfml-system new file mode 120000 index 0000000..32a049f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-system.framework/sfml-system @@ -0,0 +1 @@ +Versions/Current/sfml-system \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Resources b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/Resources/Info.plist b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/Resources/Info.plist new file mode 100644 index 0000000..efeff2a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sfml-window + CFBundleIconFile + + CFBundleIdentifier + org.sfml-dev.sfml-window + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 2.1.0 + CFBundleShortVersionString + 2.1.0 + CSResourcesFileMapped + + + diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window new file mode 100755 index 0000000..c3fd8d4 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/2.1.0/sfml-window differ diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/Current b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/Current new file mode 120000 index 0000000..50aea0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/Versions/Current @@ -0,0 +1 @@ +2.1.0 \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/sfml-window b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/sfml-window new file mode 120000 index 0000000..67a7293 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/Frameworks/sfml-window.framework/sfml-window @@ -0,0 +1 @@ +Versions/Current/sfml-window \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/cmake/Modules/FindSFML.cmake b/SFML-2.1-osx-clang-universal/cmake/Modules/FindSFML.cmake new file mode 100644 index 0000000..3c57641 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/cmake/Modules/FindSFML.cmake @@ -0,0 +1,209 @@ +# This script locates the SFML library +# ------------------------------------ +# +# Usage +# ----- +# +# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main). +# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing. +# example: +# find_package(SFML COMPONENTS graphics window system) // find the graphics, window and system modules +# +# You can enforce a specific version, either MAJOR.MINOR or only MAJOR. +# If nothing is specified, the version won't be checked (ie. any version will be accepted). +# example: +# find_package(SFML COMPONENTS ...) // no specific version required +# find_package(SFML 2 COMPONENTS ...) // any 2.x version +# find_package(SFML 2.4 COMPONENTS ...) // version 2.4 or greater +# +# By default, the dynamic libraries of SFML will be found. To find the static ones instead, +# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...). +# In case of static linking, the SFML_STATIC macro will also be defined by this script. +# example: +# set(SFML_STATIC_LIBRARIES TRUE) +# find_package(SFML 2 COMPONENTS network system) +# +# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless +# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details. +# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which +# are available for both release and debug modes. +# +# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable +# to tell CMake where SFML is. +# +# Output +# ------ +# +# This script defines the following variables: +# - For each specified module XXX (system, window, graphics, network, audio, main): +# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found) +# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found) +# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary) +# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found +# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules +# - SFML_FOUND: true if all the required modules are found +# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file) +# +# example: +# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED) +# include_directories(${SFML_INCLUDE_DIR}) +# add_executable(myapp ...) +# target_link_libraries(myapp ${SFML_LIBRARIES}) + +# define the SFML_STATIC macro if static build was chosen +if(SFML_STATIC_LIBRARIES) + add_definitions(-DSFML_STATIC) +endif() + +# deduce the libraries suffix from the options +set(FIND_SFML_LIB_SUFFIX "") +if(SFML_STATIC_LIBRARIES) + set(FIND_SFML_LIB_SUFFIX "${FIND_SFML_LIB_SUFFIX}-s") +endif() + +# find the SFML include directory +find_path(SFML_INCLUDE_DIR SFML/Config.hpp + PATH_SUFFIXES include + PATHS + ${SFML_ROOT} + $ENV{SFML_ROOT} + ~/Library/Frameworks + /Library/Frameworks + /usr/local/ + /usr/ + /sw # Fink + /opt/local/ # DarwinPorts + /opt/csw/ # Blastwave + /opt/) + +# check the version number +set(SFML_VERSION_OK TRUE) +if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) + # extract the major and minor version numbers from SFML/Config.hpp + # we have to handle framework a little bit differently : + if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework") + set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp") + else() + set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp") + endif() + FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS) + STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}") + math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}") + + # if we could extract them, compare with the requested version number + if (SFML_VERSION_MAJOR) + # transform version numbers to an integer + math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10 + ${SFML_VERSION_MINOR}") + + # compare them + if(SFML_VERSION LESS SFML_REQUESTED_VERSION) + set(SFML_VERSION_OK FALSE) + endif() + else() + # SFML version is < 2.0 + if (SFML_REQUESTED_VERSION GREATER 19) + set(SFML_VERSION_OK FALSE) + set(SFML_VERSION_MAJOR 1) + set(SFML_VERSION_MINOR x) + endif() + endif() +endif() + +# find the requested modules +set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found +set(FIND_SFML_LIB_PATHS + ${SFML_ROOT} + $ENV{SFML_ROOT} + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt) +foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS}) + string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER) + string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER) + set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}${FIND_SFML_LIB_SUFFIX}) + + # no suffix for sfml-main, it is always a static library + if(FIND_SFML_COMPONENT_LOWER STREQUAL "main") + set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER}) + endif() + + # debug library + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG + NAMES ${FIND_SFML_COMPONENT_NAME}-d + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS}) + + # release library + find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE + NAMES ${FIND_SFML_COMPONENT_NAME} + PATH_SUFFIXES lib64 lib + PATHS ${FIND_SFML_LIB_PATHS}) + + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + # library found + set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE) + + # if both are found, set SFML_XXX_LIBRARY to contain both + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG} + optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + endif() + + # if only one debug/release variant is found, set the other to be equal to the found one + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE) + # debug and not release + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}) + endif() + if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) + # release and not debug + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE}) + endif() + else() + # library not found + set(SFML_FOUND FALSE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE) + set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "") + set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY") + endif() + + # mark as advanced + MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY + SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE + SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG) + + # add to the global list of libraries + set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}") +endforeach() + +# handle errors +if(NOT SFML_VERSION_OK) + # SFML version not ok + set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR})") + set(SFML_FOUND FALSE) +elseif(NOT SFML_FOUND) + # include directory or library not found + set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})") +endif() +if (NOT SFML_FOUND) + if(SFML_FIND_REQUIRED) + # fatal error + message(FATAL_ERROR ${FIND_SFML_ERROR}) + elseif(NOT SFML_FIND_QUIETLY) + # error but continue + message("${FIND_SFML_ERROR}") + endif() +endif() + +# handle success +if(SFML_FOUND) + message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}") +endif() diff --git a/SFML-2.1-osx-clang-universal/doc/html/Audio_2Export_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Audio_2Export_8hpp_source.htm new file mode 100644 index 0000000..cd19ffc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Audio_2Export_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Audio/Export.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_AUDIO_EXPORT_HPP
+
26 #define SFML_AUDIO_EXPORT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
35 // Define portable import / export macros
+
37 #if defined(SFML_AUDIO_EXPORTS)
+
38 
+
39  #define SFML_AUDIO_API SFML_API_EXPORT
+
40 
+
41 #else
+
42 
+
43  #define SFML_AUDIO_API SFML_API_IMPORT
+
44 
+
45 #endif
+
46 
+
47 
+
48 #endif // SFML_AUDIO_EXPORT_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Audio_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Audio_8hpp_source.htm new file mode 100644 index 0000000..fb86f08 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Audio_8hpp_source.htm @@ -0,0 +1,88 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Audio.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_AUDIO_HPP
+
26 #define SFML_AUDIO_HPP
+
27 
+
29 // Headers
+
31 
+
32 #include <SFML/System.hpp>
+
33 #include <SFML/Audio/Listener.hpp>
+
34 #include <SFML/Audio/Music.hpp>
+
35 #include <SFML/Audio/Sound.hpp>
+
36 #include <SFML/Audio/SoundBuffer.hpp>
+
37 #include <SFML/Audio/SoundBufferRecorder.hpp>
+
38 #include <SFML/Audio/SoundRecorder.hpp>
+
39 #include <SFML/Audio/SoundStream.hpp>
+
40 
+
41 
+
42 #endif // SFML_AUDIO_HPP
+
43 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/BlendMode_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/BlendMode_8hpp_source.htm new file mode 100644 index 0000000..54bc134 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/BlendMode_8hpp_source.htm @@ -0,0 +1,88 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
BlendMode.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_BLENDMODE_HPP
+
26 #define SFML_BLENDMODE_HPP
+
27 
+
28 namespace sf
+
29 {
+ +
36 {
+ + + + +
41 };
+
42 
+
43 } // namespace sf
+
44 
+
45 
+
46 #endif // SFML_BLENDMODE_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/CircleShape_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/CircleShape_8hpp_source.htm new file mode 100644 index 0000000..e281ded --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/CircleShape_8hpp_source.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
CircleShape.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CIRCLESHAPE_HPP
+
26 #define SFML_CIRCLESHAPE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Shape.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_GRAPHICS_API CircleShape : public Shape
+
42 {
+
43 public :
+
44 
+
52  explicit CircleShape(float radius = 0, unsigned int pointCount = 30);
+
53 
+
62  void setRadius(float radius);
+
63 
+
72  float getRadius() const;
+
73 
+
82  void setPointCount(unsigned int count);
+
83 
+
92  virtual unsigned int getPointCount() const;
+
93 
+
104  virtual Vector2f getPoint(unsigned int index) const;
+
105 
+
106 private :
+
107 
+
109  // Member data
+
111  float m_radius;
+
112  unsigned int m_pointCount;
+
113 };
+
114 
+
115 } // namespace sf
+
116 
+
117 
+
118 #endif // SFML_CIRCLESHAPE_HPP
+
119 
+
120 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Clock_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Clock_8hpp_source.htm new file mode 100644 index 0000000..798b218 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Clock_8hpp_source.htm @@ -0,0 +1,103 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Clock.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CLOCK_HPP
+
26 #define SFML_CLOCK_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/Time.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_SYSTEM_API Clock
+
42 {
+
43 public :
+
44 
+
51  Clock();
+
52 
+
63  Time getElapsedTime() const;
+
64 
+
74  Time restart();
+
75 
+
76 private :
+
77 
+
79  // Member data
+
81  Time m_startTime;
+
82 };
+
83 
+
84 } // namespace sf
+
85 
+
86 
+
87 #endif // SFML_CLOCK_HPP
+
88 
+
89 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Color_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Color_8hpp_source.htm new file mode 100644 index 0000000..5d01300 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Color_8hpp_source.htm @@ -0,0 +1,124 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Color.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_COLOR_HPP
+
26 #define SFML_COLOR_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 class SFML_GRAPHICS_API Color
+
41 {
+
42 public :
+
43 
+
51  Color();
+
52 
+
62  Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255);
+
63 
+
65  // Static member data
+
67  static const Color Black;
+
68  static const Color White;
+
69  static const Color Red;
+
70  static const Color Green;
+
71  static const Color Blue;
+
72  static const Color Yellow;
+
73  static const Color Magenta;
+
74  static const Color Cyan;
+
75  static const Color Transparent;
+
76 
+
78  // Member data
+
80  Uint8 r;
+
81  Uint8 g;
+
82  Uint8 b;
+
83  Uint8 a;
+
84 };
+
85 
+
98 SFML_GRAPHICS_API bool operator ==(const Color& left, const Color& right);
+
99 
+
112 SFML_GRAPHICS_API bool operator !=(const Color& left, const Color& right);
+
113 
+
127 SFML_GRAPHICS_API Color operator +(const Color& left, const Color& right);
+
128 
+
144 SFML_GRAPHICS_API Color operator *(const Color& left, const Color& right);
+
145 
+
160 SFML_GRAPHICS_API Color& operator +=(Color& left, const Color& right);
+
161 
+
178 SFML_GRAPHICS_API Color& operator *=(Color& left, const Color& right);
+
179 
+
180 } // namespace sf
+
181 
+
182 
+
183 #endif // SFML_COLOR_HPP
+
184 
+
185 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Config_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Config_8hpp_source.htm new file mode 100644 index 0000000..8df13f0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Config_8hpp_source.htm @@ -0,0 +1,196 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Config.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CONFIG_HPP
+
26 #define SFML_CONFIG_HPP
+
27 
+
28 
+
30 // Define the SFML version
+
32 #define SFML_VERSION_MAJOR 2
+
33 #define SFML_VERSION_MINOR 1
+
34 
+
35 
+
37 // Identify the operating system
+
39 #if defined(_WIN32) || defined(__WIN32__)
+
40 
+
41  // Windows
+
42  #define SFML_SYSTEM_WINDOWS
+
43  #ifndef NOMINMAX
+
44  #define NOMINMAX
+
45  #endif
+
46 
+
47 #elif defined(linux) || defined(__linux)
+
48 
+
49  // Linux
+
50  #define SFML_SYSTEM_LINUX
+
51 
+
52 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
+
53 
+
54  // MacOS
+
55  #define SFML_SYSTEM_MACOS
+
56 
+
57 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+
58 
+
59  // FreeBSD
+
60  #define SFML_SYSTEM_FREEBSD
+
61 
+
62 #else
+
63 
+
64  // Unsupported system
+
65  #error This operating system is not supported by SFML library
+
66 
+
67 #endif
+
68 
+
69 
+
71 // Define a portable debug macro
+
73 #if !defined(NDEBUG)
+
74 
+
75  #define SFML_DEBUG
+
76 
+
77 #endif
+
78 
+
79 
+
81 // Define helpers to create portable import / export macros for each module
+
83 #if !defined(SFML_STATIC)
+
84 
+
85  #if defined(SFML_SYSTEM_WINDOWS)
+
86 
+
87  // Windows compilers need specific (and different) keywords for export and import
+
88  #define SFML_API_EXPORT __declspec(dllexport)
+
89  #define SFML_API_IMPORT __declspec(dllimport)
+
90 
+
91  // For Visual C++ compilers, we also need to turn off this annoying C4251 warning
+
92  #ifdef _MSC_VER
+
93 
+
94  #pragma warning(disable : 4251)
+
95 
+
96  #endif
+
97 
+
98  #else // Linux, FreeBSD, Mac OS X
+
99 
+
100  #if __GNUC__ >= 4
+
101 
+
102  // GCC 4 has special keywords for showing/hidding symbols,
+
103  // the same keyword is used for both importing and exporting
+
104  #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default")))
+
105  #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default")))
+
106 
+
107  #else
+
108 
+
109  // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported
+
110  #define SFML_API_EXPORT
+
111  #define SFML_API_IMPORT
+
112 
+
113  #endif
+
114 
+
115  #endif
+
116 
+
117 #else
+
118 
+
119  // Static build doesn't need import/export macros
+
120  #define SFML_API_EXPORT
+
121  #define SFML_API_IMPORT
+
122 
+
123 #endif
+
124 
+
125 
+
127 // Define portable fixed-size types
+
129 namespace sf
+
130 {
+
131  // All "common" platforms use the same size for char, short and int
+
132  // (basically there are 3 types for 3 sizes, so no other match is possible),
+
133  // we can use them without doing any kind of check
+
134 
+
135  // 8 bits integer types
+
136  typedef signed char Int8;
+
137  typedef unsigned char Uint8;
+
138 
+
139  // 16 bits integer types
+
140  typedef signed short Int16;
+
141  typedef unsigned short Uint16;
+
142 
+
143  // 32 bits integer types
+
144  typedef signed int Int32;
+
145  typedef unsigned int Uint32;
+
146 
+
147  // 64 bits integer types
+
148  #if defined(_MSC_VER)
+
149  typedef signed __int64 Int64;
+
150  typedef unsigned __int64 Uint64;
+
151  #else
+
152  typedef signed long long Int64;
+
153  typedef unsigned long long Uint64;
+
154  #endif
+
155 
+
156 } // namespace sf
+
157 
+
158 
+
159 #endif // SFML_CONFIG_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ContextSettings_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/ContextSettings_8hpp_source.htm new file mode 100644 index 0000000..0afd1a0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/ContextSettings_8hpp_source.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
ContextSettings.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CONTEXTSETTINGS_HPP
+
26 #define SFML_CONTEXTSETTINGS_HPP
+
27 
+
28 
+
29 namespace sf
+
30 {
+ +
37 {
+
48  explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) :
+
49  depthBits (depth),
+
50  stencilBits (stencil),
+
51  antialiasingLevel(antialiasing),
+
52  majorVersion (major),
+
53  minorVersion (minor)
+
54  {
+
55  }
+
56 
+
58  // Member data
+
60  unsigned int depthBits;
+
61  unsigned int stencilBits;
+
62  unsigned int antialiasingLevel;
+
63  unsigned int majorVersion;
+
64  unsigned int minorVersion;
+
65 };
+
66 
+
67 } // namespace sf
+
68 
+
69 
+
70 #endif // SFML_CONTEXTSETTINGS_HPP
+
71 
+
72 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Context_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Context_8hpp_source.htm new file mode 100644 index 0000000..1b00b80 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Context_8hpp_source.htm @@ -0,0 +1,113 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Context.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CONTEXT_HPP
+
26 #define SFML_CONTEXT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 #include <SFML/Window/GlResource.hpp>
+
33 #include <SFML/Window/ContextSettings.hpp>
+
34 #include <SFML/System/NonCopyable.hpp>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
39 namespace priv
+
40 {
+
41  class GlContext;
+
42 }
+
43 
+
48 class SFML_WINDOW_API Context : GlResource, NonCopyable
+
49 {
+
50 public :
+
51 
+
58  Context();
+
59 
+
66  ~Context();
+
67 
+
76  bool setActive(bool active);
+
77 
+
78 public :
+
79 
+
91  Context(const ContextSettings& settings, unsigned int width, unsigned int height);
+
92 
+
93 private :
+
94 
+
96  // Member data
+
98  priv::GlContext* m_context;
+
99 };
+
100 
+
101 } // namespace sf
+
102 
+
103 
+
104 #endif // SFML_CONTEXT_HPP
+
105 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ConvexShape_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/ConvexShape_8hpp_source.htm new file mode 100644 index 0000000..ae8c693 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/ConvexShape_8hpp_source.htm @@ -0,0 +1,108 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
ConvexShape.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_CONVEXSHAPE_HPP
+
26 #define SFML_CONVEXSHAPE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Shape.hpp>
+
33 #include <vector>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
42 class SFML_GRAPHICS_API ConvexShape : public Shape
+
43 {
+
44 public :
+
45 
+
52  explicit ConvexShape(unsigned int pointCount = 0);
+
53 
+
64  void setPointCount(unsigned int count);
+
65 
+
74  virtual unsigned int getPointCount() const;
+
75 
+
91  void setPoint(unsigned int index, const Vector2f& point);
+
92 
+
105  virtual Vector2f getPoint(unsigned int index) const;
+
106 
+
107 private :
+
108 
+
110  // Member data
+
112  std::vector<Vector2f> m_points;
+
113 };
+
114 
+
115 } // namespace sf
+
116 
+
117 
+
118 #endif // SFML_CONVEXSHAPE_HPP
+
119 
+
120 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Drawable_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Drawable_8hpp_source.htm new file mode 100644 index 0000000..0287a0b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Drawable_8hpp_source.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Drawable.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_DRAWABLE_HPP
+
26 #define SFML_DRAWABLE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/RenderStates.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 class RenderTarget;
+
38 
+
44 class SFML_GRAPHICS_API Drawable
+
45 {
+
46 public :
+
47 
+
52  virtual ~Drawable() {}
+
53 
+
54 protected :
+
55 
+
56  friend class RenderTarget;
+
57 
+
69  virtual void draw(RenderTarget& target, RenderStates states) const = 0;
+
70 };
+
71 
+
72 } // namespace sf
+
73 
+
74 
+
75 #endif // SFML_DRAWABLE_HPP
+
76 
+
77 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Err_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Err_8hpp_source.htm new file mode 100644 index 0000000..47400b0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Err_8hpp_source.htm @@ -0,0 +1,89 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Err.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_ERR_HPP
+
26 #define SFML_ERR_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <ostream>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 SFML_SYSTEM_API std::ostream& err();
+
42 
+
43 } // namespace sf
+
44 
+
45 
+
46 #endif // SFML_ERR_HPP
+
47 
+
48 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Event_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Event_8hpp_source.htm new file mode 100644 index 0000000..1ac3646 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Event_8hpp_source.htm @@ -0,0 +1,192 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Event.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_EVENT_HPP
+
26 #define SFML_EVENT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 #include <SFML/Window/Joystick.hpp>
+
33 #include <SFML/Window/Keyboard.hpp>
+
34 #include <SFML/Window/Mouse.hpp>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
43 class Event
+
44 {
+
45 public :
+
46 
+
51  struct SizeEvent
+
52  {
+
53  unsigned int width;
+
54  unsigned int height;
+
55  };
+
56 
+
61  struct KeyEvent
+
62  {
+ +
64  bool alt;
+
65  bool control;
+
66  bool shift;
+
67  bool system;
+
68  };
+
69 
+
74  struct TextEvent
+
75  {
+
76  Uint32 unicode;
+
77  };
+
78 
+ +
84  {
+
85  int x;
+
86  int y;
+
87  };
+
88 
+ +
95  {
+ +
97  int x;
+
98  int y;
+
99  };
+
100 
+ +
106  {
+
107  int delta;
+
108  int x;
+
109  int y;
+
110  };
+
111 
+ +
118  {
+
119  unsigned int joystickId;
+
120  };
+
121 
+ +
127  {
+
128  unsigned int joystickId;
+ +
130  float position;
+
131  };
+
132 
+ +
139  {
+
140  unsigned int joystickId;
+
141  unsigned int button;
+
142  };
+
143 
+ +
149  {
+ + + + + + + + + + + + + + + + + + +
168 
+ +
170  };
+
171 
+
173  // Member data
+ +
176 
+
177  union
+
178  {
+ + + + + + + + + +
188  };
+
189 };
+
190 
+
191 } // namespace sf
+
192 
+
193 
+
194 #endif // SFML_EVENT_HPP
+
195 
+
196 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Font_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Font_8hpp_source.htm new file mode 100644 index 0000000..44fa77d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Font_8hpp_source.htm @@ -0,0 +1,166 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Font.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_FONT_HPP
+
26 #define SFML_FONT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Glyph.hpp>
+
33 #include <SFML/Graphics/Texture.hpp>
+
34 #include <SFML/Graphics/Rect.hpp>
+
35 #include <SFML/System/Vector2.hpp>
+
36 #include <SFML/System/String.hpp>
+
37 #include <map>
+
38 #include <string>
+
39 #include <vector>
+
40 
+
41 
+
42 namespace sf
+
43 {
+
44 class InputStream;
+
45 
+
50 class SFML_GRAPHICS_API Font
+
51 {
+
52 public :
+
53 
+
60  Font();
+
61 
+
68  Font(const Font& copy);
+
69 
+
76  ~Font();
+
77 
+
94  bool loadFromFile(const std::string& filename);
+
95 
+
113  bool loadFromMemory(const void* data, std::size_t sizeInBytes);
+
114 
+
131  bool loadFromStream(InputStream& stream);
+
132 
+
143  const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
+
144 
+
161  int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
+
162 
+
174  int getLineSpacing(unsigned int characterSize) const;
+
175 
+
188  const Texture& getTexture(unsigned int characterSize) const;
+
189 
+
198  Font& operator =(const Font& right);
+
199 
+
200 private :
+
201 
+
206  struct Row
+
207  {
+
208  Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight) {}
+
209 
+
210  unsigned int width;
+
211  unsigned int top;
+
212  unsigned int height;
+
213  };
+
214 
+
216  // Types
+
218  typedef std::map<Uint32, Glyph> GlyphTable;
+
219 
+
224  struct Page
+
225  {
+
226  Page();
+
227 
+
228  GlyphTable glyphs;
+
229  sf::Texture texture;
+
230  unsigned int nextRow;
+
231  std::vector<Row> rows;
+
232  };
+
233 
+
238  void cleanup();
+
239 
+
250  Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
+
251 
+
262  IntRect findGlyphRect(Page& page, unsigned int width, unsigned int height) const;
+
263 
+
272  bool setCurrentSize(unsigned int characterSize) const;
+
273 
+
275  // Types
+
277  typedef std::map<unsigned int, Page> PageTable;
+
278 
+
280  // Member data
+
282  void* m_library;
+
283  void* m_face;
+
284  void* m_streamRec;
+
285  int* m_refCount;
+
286  mutable PageTable m_pages;
+
287  mutable std::vector<Uint8> m_pixelBuffer;
+
288 };
+
289 
+
290 } // namespace sf
+
291 
+
292 
+
293 #endif // SFML_FONT_HPP
+
294 
+
295 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Ftp_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Ftp_8hpp_source.htm new file mode 100644 index 0000000..de50b37 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Ftp_8hpp_source.htm @@ -0,0 +1,261 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Ftp.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_FTP_HPP
+
26 #define SFML_FTP_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/TcpSocket.hpp>
+
33 #include <SFML/System/NonCopyable.hpp>
+
34 #include <SFML/System/Time.hpp>
+
35 #include <string>
+
36 #include <vector>
+
37 
+
38 
+
39 namespace sf
+
40 {
+
41 class IpAddress;
+
42 
+
47 class SFML_NETWORK_API Ftp : NonCopyable
+
48 {
+
49 public :
+
50 
+ +
56  {
+ + +
59  Ebcdic
+
60  };
+
61 
+
66  class SFML_NETWORK_API Response
+
67  {
+
68  public :
+
69 
+
74  enum Status
+
75  {
+
76  // 1xx: the requested action is being initiated,
+
77  // expect another reply before proceeding with a new command
+
78  RestartMarkerReply = 110,
+
79  ServiceReadySoon = 120,
+
80  DataConnectionAlreadyOpened = 125,
+
81  OpeningDataConnection = 150,
+
82 
+
83  // 2xx: the requested action has been successfully completed
+
84  Ok = 200,
+
85  PointlessCommand = 202,
+
86  SystemStatus = 211,
+
87  DirectoryStatus = 212,
+
88  FileStatus = 213,
+
89  HelpMessage = 214,
+
90  SystemType = 215,
+
91  ServiceReady = 220,
+
92  ClosingConnection = 221,
+
93  DataConnectionOpened = 225,
+
94  ClosingDataConnection = 226,
+
95  EnteringPassiveMode = 227,
+
96  LoggedIn = 230,
+
97  FileActionOk = 250,
+
98  DirectoryOk = 257,
+
99 
+
100  // 3xx: the command has been accepted, but the requested action
+
101  // is dormant, pending receipt of further information
+
102  NeedPassword = 331,
+
103  NeedAccountToLogIn = 332,
+
104  NeedInformation = 350,
+
105 
+
106  // 4xx: the command was not accepted and the requested action did not take place,
+
107  // but the error condition is temporary and the action may be requested again
+
108  ServiceUnavailable = 421,
+
109  DataConnectionUnavailable = 425,
+
110  TransferAborted = 426,
+
111  FileActionAborted = 450,
+
112  LocalError = 451,
+
113  InsufficientStorageSpace = 452,
+
114 
+
115  // 5xx: the command was not accepted and
+
116  // the requested action did not take place
+
117  CommandUnknown = 500,
+
118  ParametersUnknown = 501,
+
119  CommandNotImplemented = 502,
+
120  BadCommandSequence = 503,
+
121  ParameterNotImplemented = 504,
+
122  NotLoggedIn = 530,
+
123  NeedAccountToStore = 532,
+
124  FileUnavailable = 550,
+
125  PageTypeUnknown = 551,
+
126  NotEnoughMemory = 552,
+
127  FilenameNotAllowed = 553,
+
128 
+
129  // 10xx: SFML custom codes
+
130  InvalidResponse = 1000,
+
131  ConnectionFailed = 1001,
+
132  ConnectionClosed = 1002,
+
133  InvalidFile = 1003
+
134  };
+
135 
+
146  explicit Response(Status code = InvalidResponse, const std::string& message = "");
+
147 
+
157  bool isOk() const;
+
158 
+
165  Status getStatus() const;
+
166 
+
173  const std::string& getMessage() const;
+
174 
+
175  private :
+
176 
+
178  // Member data
+
180  Status m_status;
+
181  std::string m_message;
+
182  };
+
183 
+
188  class SFML_NETWORK_API DirectoryResponse : public Response
+
189  {
+
190  public :
+
191 
+
198  DirectoryResponse(const Response& response);
+
199 
+
206  const std::string& getDirectory() const;
+
207 
+
208  private :
+
209 
+
211  // Member data
+
213  std::string m_directory;
+
214  };
+
215 
+
216 
+
221  class SFML_NETWORK_API ListingResponse : public Response
+
222  {
+
223  public :
+
224 
+
232  ListingResponse(const Response& response, const std::vector<char>& data);
+
233 
+
240  const std::vector<std::string>& getListing() const;
+
241 
+
242  private :
+
243 
+
245  // Member data
+
247  std::vector<std::string> m_listing;
+
248  };
+
249 
+
250 
+
258  ~Ftp();
+
259 
+
281  Response connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero);
+
282 
+
291  Response disconnect();
+
292 
+
302  Response login();
+
303 
+
316  Response login(const std::string& name, const std::string& password);
+
317 
+
327  Response keepAlive();
+
328 
+
340  DirectoryResponse getWorkingDirectory();
+
341 
+
357  ListingResponse getDirectoryListing(const std::string& directory = "");
+
358 
+
371  Response changeDirectory(const std::string& directory);
+
372 
+
381  Response parentDirectory();
+
382 
+
396  Response createDirectory(const std::string& name);
+
397 
+
413  Response deleteDirectory(const std::string& name);
+
414 
+
429  Response renameFile(const std::string& file, const std::string& newName);
+
430 
+
446  Response deleteFile(const std::string& name);
+
447 
+
465  Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary);
+
466 
+
484  Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary);
+
485 
+
486 private :
+
487 
+
497  Response sendCommand(const std::string& command, const std::string& parameter = "");
+
498 
+
508  Response getResponse();
+
509 
+
515  class DataChannel;
+
516 
+
517  friend class DataChannel;
+
518 
+
520  // Member data
+
522  TcpSocket m_commandSocket;
+
523 };
+
524 
+
525 } // namespace sf
+
526 
+
527 
+
528 #endif // SFML_FTP_HPP
+
529 
+
530 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/GlResource_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/GlResource_8hpp_source.htm new file mode 100644 index 0000000..107f000 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/GlResource_8hpp_source.htm @@ -0,0 +1,96 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
GlResource.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_GLRESOURCE_HPP
+
26 #define SFML_GLRESOURCE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 class SFML_WINDOW_API GlResource
+
41 {
+
42 protected :
+
43 
+
48  GlResource();
+
49 
+
54  ~GlResource();
+
55 
+
60  static void ensureGlContext();
+
61 };
+
62 
+
63 } // namespace sf
+
64 
+
65 
+
66 #endif // SFML_GLRESOURCE_HPP
+
67 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Glyph_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Glyph_8hpp_source.htm new file mode 100644 index 0000000..6d39824 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Glyph_8hpp_source.htm @@ -0,0 +1,99 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Glyph.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_GLYPH_HPP
+
26 #define SFML_GLYPH_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Rect.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_GRAPHICS_API Glyph
+
42 {
+
43 public :
+
44 
+
49  Glyph() : advance(0) {}
+
50 
+
52  // Member data
+
54  int advance;
+ + +
57 };
+
58 
+
59 } // namespace sf
+
60 
+
61 
+
62 #endif // SFML_GLYPH_HPP
+
63 
+
64 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Graphics_2Export_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Graphics_2Export_8hpp_source.htm new file mode 100644 index 0000000..6fd0b39 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Graphics_2Export_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Graphics/Export.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_GRAPHICS_EXPORT_HPP
+
26 #define SFML_GRAPHICS_EXPORT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
35 // Define portable import / export macros
+
37 #if defined(SFML_GRAPHICS_EXPORTS)
+
38 
+
39  #define SFML_GRAPHICS_API SFML_API_EXPORT
+
40 
+
41 #else
+
42 
+
43  #define SFML_GRAPHICS_API SFML_API_IMPORT
+
44 
+
45 #endif
+
46 
+
47 
+
48 #endif // SFML_GRAPHICS_EXPORT_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Graphics_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Graphics_8hpp_source.htm new file mode 100644 index 0000000..6c1f575 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Graphics_8hpp_source.htm @@ -0,0 +1,101 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Graphics.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_GRAPHICS_HPP
+
26 #define SFML_GRAPHICS_HPP
+
27 
+
29 // Headers
+
31 
+
32 #include <SFML/Window.hpp>
+
33 #include <SFML/Graphics/BlendMode.hpp>
+
34 #include <SFML/Graphics/Color.hpp>
+
35 #include <SFML/Graphics/Font.hpp>
+
36 #include <SFML/Graphics/Glyph.hpp>
+
37 #include <SFML/Graphics/Image.hpp>
+
38 #include <SFML/Graphics/RenderStates.hpp>
+
39 #include <SFML/Graphics/RenderTexture.hpp>
+
40 #include <SFML/Graphics/RenderWindow.hpp>
+
41 #include <SFML/Graphics/Shader.hpp>
+
42 #include <SFML/Graphics/Shape.hpp>
+
43 #include <SFML/Graphics/CircleShape.hpp>
+
44 #include <SFML/Graphics/RectangleShape.hpp>
+
45 #include <SFML/Graphics/ConvexShape.hpp>
+
46 #include <SFML/Graphics/Sprite.hpp>
+
47 #include <SFML/Graphics/Text.hpp>
+
48 #include <SFML/Graphics/Texture.hpp>
+
49 #include <SFML/Graphics/Transform.hpp>
+
50 #include <SFML/Graphics/Vertex.hpp>
+
51 #include <SFML/Graphics/VertexArray.hpp>
+
52 #include <SFML/Graphics/View.hpp>
+
53 
+
54 
+
55 #endif // SFML_GRAPHICS_HPP
+
56 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Http_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Http_8hpp_source.htm new file mode 100644 index 0000000..28904b2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Http_8hpp_source.htm @@ -0,0 +1,225 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Http.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_HTTP_HPP
+
26 #define SFML_HTTP_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/IpAddress.hpp>
+
33 #include <SFML/Network/TcpSocket.hpp>
+
34 #include <SFML/System/NonCopyable.hpp>
+
35 #include <SFML/System/Time.hpp>
+
36 #include <map>
+
37 #include <string>
+
38 
+
39 
+
40 namespace sf
+
41 {
+
46 class SFML_NETWORK_API Http : NonCopyable
+
47 {
+
48 public :
+
49 
+
54  class SFML_NETWORK_API Request
+
55  {
+
56  public :
+
57 
+
62  enum Method
+
63  {
+
64  Get,
+
65  Post,
+
66  Head
+
67  };
+
68 
+
80  Request(const std::string& uri = "/", Method method = Get, const std::string& body = "");
+
81 
+
95  void setField(const std::string& field, const std::string& value);
+
96 
+
107  void setMethod(Method method);
+
108 
+
119  void setUri(const std::string& uri);
+
120 
+
130  void setHttpVersion(unsigned int major, unsigned int minor);
+
131 
+
142  void setBody(const std::string& body);
+
143 
+
144  private :
+
145 
+
146  friend class Http;
+
147 
+
157  std::string prepare() const;
+
158 
+
169  bool hasField(const std::string& field) const;
+
170 
+
172  // Types
+
174  typedef std::map<std::string, std::string> FieldTable;
+
175 
+
177  // Member data
+
179  FieldTable m_fields;
+
180  Method m_method;
+
181  std::string m_uri;
+
182  unsigned int m_majorVersion;
+
183  unsigned int m_minorVersion;
+
184  std::string m_body;
+
185  };
+
186 
+
191  class SFML_NETWORK_API Response
+
192  {
+
193  public :
+
194 
+
199  enum Status
+
200  {
+
201  // 2xx: success
+
202  Ok = 200,
+
203  Created = 201,
+
204  Accepted = 202,
+
205  NoContent = 204,
+
206  ResetContent = 205,
+
207  PartialContent = 206,
+
208 
+
209  // 3xx: redirection
+
210  MultipleChoices = 300,
+
211  MovedPermanently = 301,
+
212  MovedTemporarily = 302,
+
213  NotModified = 304,
+
214 
+
215  // 4xx: client error
+
216  BadRequest = 400,
+
217  Unauthorized = 401,
+
218  Forbidden = 403,
+
219  NotFound = 404,
+
220  RangeNotSatisfiable = 407,
+
221 
+
222  // 5xx: server error
+
223  InternalServerError = 500,
+
224  NotImplemented = 501,
+
225  BadGateway = 502,
+
226  ServiceNotAvailable = 503,
+
227  GatewayTimeout = 504,
+
228  VersionNotSupported = 505,
+
229 
+
230  // 10xx: SFML custom codes
+
231  InvalidResponse = 1000,
+
232  ConnectionFailed = 1001
+
233  };
+
234 
+
241  Response();
+
242 
+
255  const std::string& getField(const std::string& field) const;
+
256 
+
268  Status getStatus() const;
+
269 
+
278  unsigned int getMajorHttpVersion() const;
+
279 
+
288  unsigned int getMinorHttpVersion() const;
+
289 
+
302  const std::string& getBody() const;
+
303 
+
304  private :
+
305 
+
306  friend class Http;
+
307 
+
317  void parse(const std::string& data);
+
318 
+
320  // Types
+
322  typedef std::map<std::string, std::string> FieldTable;
+
323 
+
325  // Member data
+
327  FieldTable m_fields;
+
328  Status m_status;
+
329  unsigned int m_majorVersion;
+
330  unsigned int m_minorVersion;
+
331  std::string m_body;
+
332  };
+
333 
+
338  Http();
+
339 
+
354  Http(const std::string& host, unsigned short port = 0);
+
355 
+
371  void setHost(const std::string& host, unsigned short port = 0);
+
372 
+
391  Response sendRequest(const Request& request, Time timeout = Time::Zero);
+
392 
+
393 private :
+
394 
+
396  // Member data
+
398  TcpSocket m_connection;
+
399  IpAddress m_host;
+
400  std::string m_hostName;
+
401  unsigned short m_port;
+
402 };
+
403 
+
404 } // namespace sf
+
405 
+
406 
+
407 #endif // SFML_HTTP_HPP
+
408 
+
409 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Image_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Image_8hpp_source.htm new file mode 100644 index 0000000..6014b55 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Image_8hpp_source.htm @@ -0,0 +1,133 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Image.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_IMAGE_HPP
+
26 #define SFML_IMAGE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Color.hpp>
+
33 #include <SFML/Graphics/Rect.hpp>
+
34 #include <string>
+
35 #include <vector>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
40 class InputStream;
+
41 
+
46 class SFML_GRAPHICS_API Image
+
47 {
+
48 public :
+
49 
+
56  Image();
+
57 
+
66  void create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
+
67 
+
81  void create(unsigned int width, unsigned int height, const Uint8* pixels);
+
82 
+
98  bool loadFromFile(const std::string& filename);
+
99 
+
116  bool loadFromMemory(const void* data, std::size_t size);
+
117 
+
133  bool loadFromStream(InputStream& stream);
+
134 
+
150  bool saveToFile(const std::string& filename) const;
+
151 
+
158  Vector2u getSize() const;
+
159 
+
171  void createMaskFromColor(const Color& color, Uint8 alpha = 0);
+
172 
+
193  void copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
+
194 
+
209  void setPixel(unsigned int x, unsigned int y, const Color& color);
+
210 
+
226  Color getPixel(unsigned int x, unsigned int y) const;
+
227 
+
241  const Uint8* getPixelsPtr() const;
+
242 
+
247  void flipHorizontally();
+
248 
+
253  void flipVertically();
+
254 
+
255 private :
+
256 
+
258  // Member data
+
260  Vector2u m_size;
+
261  std::vector<Uint8> m_pixels;
+
262 };
+
263 
+
264 } // namespace sf
+
265 
+
266 
+
267 #endif // SFML_IMAGE_HPP
+
268 
+
269 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/InputStream_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/InputStream_8hpp_source.htm new file mode 100644 index 0000000..c300c76 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/InputStream_8hpp_source.htm @@ -0,0 +1,101 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
InputStream.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_INPUTSTREAM_HPP
+
26 #define SFML_INPUTSTREAM_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+ +
41 {
+
42 public :
+
43 
+
48  virtual ~InputStream() {}
+
49 
+
62  virtual Int64 read(void* data, Int64 size) = 0;
+
63 
+
72  virtual Int64 seek(Int64 position) = 0;
+
73 
+
80  virtual Int64 tell() = 0;
+
81 
+
88  virtual Int64 getSize() = 0;
+
89 };
+
90 
+
91 } // namespace sf
+
92 
+
93 
+
94 #endif // SFML_INPUTSTREAM_HPP
+
95 
+
96 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/IpAddress_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/IpAddress_8hpp_source.htm new file mode 100644 index 0000000..7e4dbc9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/IpAddress_8hpp_source.htm @@ -0,0 +1,139 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
IpAddress.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_IPADDRESS_HPP
+
26 #define SFML_IPADDRESS_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/System/Time.hpp>
+
33 #include <istream>
+
34 #include <ostream>
+
35 #include <string>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
44 class SFML_NETWORK_API IpAddress
+
45 {
+
46 public :
+
47 
+
54  IpAddress();
+
55 
+
65  IpAddress(const std::string& address);
+
66 
+
79  IpAddress(const char* address);
+
80 
+
94  IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3);
+
95 
+
109  explicit IpAddress(Uint32 address);
+
110 
+
123  std::string toString() const;
+
124 
+
139  Uint32 toInteger() const;
+
140 
+
155  static IpAddress getLocalAddress();
+
156 
+
179  static IpAddress getPublicAddress(Time timeout = Time::Zero);
+
180 
+
182  // Static member data
+
184  static const IpAddress None;
+
185  static const IpAddress LocalHost;
+
186  static const IpAddress Broadcast;
+
187 
+
188 private :
+
189 
+
191  // Member data
+
193  Uint32 m_address;
+
194 };
+
195 
+
205 SFML_NETWORK_API bool operator ==(const IpAddress& left, const IpAddress& right);
+
206 
+
216 SFML_NETWORK_API bool operator !=(const IpAddress& left, const IpAddress& right);
+
217 
+
227 SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right);
+
228 
+
238 SFML_NETWORK_API bool operator >(const IpAddress& left, const IpAddress& right);
+
239 
+
249 SFML_NETWORK_API bool operator <=(const IpAddress& left, const IpAddress& right);
+
250 
+
260 SFML_NETWORK_API bool operator >=(const IpAddress& left, const IpAddress& right);
+
261 
+
271 SFML_NETWORK_API std::istream& operator >>(std::istream& stream, IpAddress& address);
+
272 
+
282 SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address);
+
283 
+
284 } // namespace sf
+
285 
+
286 
+
287 #endif // SFML_IPADDRESS_HPP
+
288 
+
289 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Joystick_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Joystick_8hpp_source.htm new file mode 100644 index 0000000..5b30945 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Joystick_8hpp_source.htm @@ -0,0 +1,122 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Joystick.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_JOYSTICK_HPP
+
26 #define SFML_JOYSTICK_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 class SFML_WINDOW_API Joystick
+
41 {
+
42 public :
+
43 
+
48  enum
+
49  {
+
50  Count = 8,
+
51  ButtonCount = 32,
+
52  AxisCount = 8
+
53  };
+
54 
+
59  enum Axis
+
60  {
+
61  X,
+
62  Y,
+
63  Z,
+
64  R,
+
65  U,
+
66  V,
+
67  PovX,
+
68  PovY
+
69  };
+
70 
+
79  static bool isConnected(unsigned int joystick);
+
80 
+
91  static unsigned int getButtonCount(unsigned int joystick);
+
92 
+
104  static bool hasAxis(unsigned int joystick, Axis axis);
+
105 
+
117  static bool isButtonPressed(unsigned int joystick, unsigned int button);
+
118 
+
130  static float getAxisPosition(unsigned int joystick, Axis axis);
+
131 
+
141  static void update();
+
142 };
+
143 
+
144 } // namespace sf
+
145 
+
146 
+
147 #endif // SFML_JOYSTICK_HPP
+
148 
+
149 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Keyboard_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Keyboard_8hpp_source.htm new file mode 100644 index 0000000..3786383 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Keyboard_8hpp_source.htm @@ -0,0 +1,201 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Keyboard.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_KEYBOARD_HPP
+
26 #define SFML_KEYBOARD_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 class SFML_WINDOW_API Keyboard
+
41 {
+
42 public :
+
43 
+
48  enum Key
+
49  {
+
50  Unknown = -1,
+
51  A = 0,
+
52  B,
+
53  C,
+
54  D,
+
55  E,
+
56  F,
+
57  G,
+
58  H,
+
59  I,
+
60  J,
+
61  K,
+
62  L,
+
63  M,
+
64  N,
+
65  O,
+
66  P,
+
67  Q,
+
68  R,
+
69  S,
+
70  T,
+
71  U,
+
72  V,
+
73  W,
+
74  X,
+
75  Y,
+
76  Z,
+
77  Num0,
+
78  Num1,
+
79  Num2,
+
80  Num3,
+
81  Num4,
+
82  Num5,
+
83  Num6,
+
84  Num7,
+
85  Num8,
+
86  Num9,
+ + + +
90  LAlt,
+ + + +
94  RAlt,
+ +
96  Menu,
+ + + + + + + + + + + + + + +
111  Tab,
+ + +
114  End,
+ + + +
118  Add,
+ + + + + +
124  Up,
+ + + + + + + + + + + +
136  F1,
+
137  F2,
+
138  F3,
+
139  F4,
+
140  F5,
+
141  F6,
+
142  F7,
+
143  F8,
+
144  F9,
+
145  F10,
+
146  F11,
+
147  F12,
+
148  F13,
+
149  F14,
+
150  F15,
+ +
152 
+
153  KeyCount
+
154  };
+
155 
+
164  static bool isKeyPressed(Key key);
+
165 };
+
166 
+
167 } // namespace sf
+
168 
+
169 
+
170 #endif // SFML_KEYBOARD_HPP
+
171 
+
172 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Listener_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Listener_8hpp_source.htm new file mode 100644 index 0000000..055552a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Listener_8hpp_source.htm @@ -0,0 +1,108 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Listener.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_LISTENER_HPP
+
26 #define SFML_LISTENER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/System/Vector3.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
42 class SFML_AUDIO_API Listener
+
43 {
+
44 public :
+
45 
+
58  static void setGlobalVolume(float volume);
+
59 
+
68  static float getGlobalVolume();
+
69 
+
82  static void setPosition(float x, float y, float z);
+
83 
+
94  static void setPosition(const Vector3f& position);
+
95 
+
104  static Vector3f getPosition();
+
105 
+
121  static void setDirection(float x, float y, float z);
+
122 
+
136  static void setDirection(const Vector3f& direction);
+
137 
+
146  static Vector3f getDirection();
+
147 };
+
148 
+
149 } // namespace sf
+
150 
+
151 
+
152 #endif // SFML_LISTENER_HPP
+
153 
+
154 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Lock_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Lock_8hpp_source.htm new file mode 100644 index 0000000..49d6985 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Lock_8hpp_source.htm @@ -0,0 +1,103 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Lock.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_LOCK_HPP
+
26 #define SFML_LOCK_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/NonCopyable.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 class Mutex;
+
38 
+
43 class SFML_SYSTEM_API Lock : NonCopyable
+
44 {
+
45 public :
+
46 
+
55  explicit Lock(Mutex& mutex);
+
56 
+
63  ~Lock();
+
64 
+
65 private :
+
66 
+
68  // Member data
+
70  Mutex& m_mutex;
+
71 };
+
72 
+
73 } // namespace sf
+
74 
+
75 
+
76 #endif // SFML_LOCK_HPP
+
77 
+
78 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Mouse_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Mouse_8hpp_source.htm new file mode 100644 index 0000000..79122cb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Mouse_8hpp_source.htm @@ -0,0 +1,115 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Mouse.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_MOUSE_HPP
+
26 #define SFML_MOUSE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 #include <SFML/System/Vector2.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 class Window;
+
38 
+
43 class SFML_WINDOW_API Mouse
+
44 {
+
45 public :
+
46 
+
51  enum Button
+
52  {
+
53  Left,
+ + + + +
58 
+
59  ButtonCount
+
60  };
+
61 
+
70  static bool isButtonPressed(Button button);
+
71 
+
81  static Vector2i getPosition();
+
82 
+
94  static Vector2i getPosition(const Window& relativeTo);
+
95 
+
105  static void setPosition(const Vector2i& position);
+
106 
+
117  static void setPosition(const Vector2i& position, const Window& relativeTo);
+
118 };
+
119 
+
120 } // namespace sf
+
121 
+
122 
+
123 #endif // SFML_MOUSE_HPP
+
124 
+
125 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Music_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Music_8hpp_source.htm new file mode 100644 index 0000000..533492f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Music_8hpp_source.htm @@ -0,0 +1,131 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Music.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_MUSIC_HPP
+
26 #define SFML_MUSIC_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/Audio/SoundStream.hpp>
+
33 #include <SFML/System/Mutex.hpp>
+
34 #include <SFML/System/Time.hpp>
+
35 #include <string>
+
36 #include <vector>
+
37 
+
38 
+
39 namespace sf
+
40 {
+
41 namespace priv
+
42 {
+
43  class SoundFile;
+
44 }
+
45 
+
46 class InputStream;
+
47 
+
52 class SFML_AUDIO_API Music : public SoundStream
+
53 {
+
54 public :
+
55 
+
60  Music();
+
61 
+
66  ~Music();
+
67 
+
84  bool openFromFile(const std::string& filename);
+
85 
+
107  bool openFromMemory(const void* data, std::size_t sizeInBytes);
+
108 
+
129  bool openFromStream(InputStream& stream);
+
130 
+
137  Time getDuration() const;
+
138 
+
139 protected :
+
140 
+
152  virtual bool onGetData(Chunk& data);
+
153 
+
160  virtual void onSeek(Time timeOffset);
+
161 
+
162 private :
+
163 
+
168  void initialize();
+
169 
+
171  // Member data
+
173  priv::SoundFile* m_file;
+
174  Time m_duration;
+
175  std::vector<Int16> m_samples;
+
176  Mutex m_mutex;
+
177 };
+
178 
+
179 } // namespace sf
+
180 
+
181 
+
182 #endif // SFML_MUSIC_HPP
+
183 
+
184 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Mutex_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Mutex_8hpp_source.htm new file mode 100644 index 0000000..1c65afa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Mutex_8hpp_source.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Mutex.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_MUTEX_HPP
+
26 #define SFML_MUTEX_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/NonCopyable.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 namespace priv
+
38 {
+
39  class MutexImpl;
+
40 }
+
41 
+
47 class SFML_SYSTEM_API Mutex : NonCopyable
+
48 {
+
49 public :
+
50 
+
55  Mutex();
+
56 
+
61  ~Mutex();
+
62 
+
73  void lock();
+
74 
+
81  void unlock();
+
82 
+
83 private :
+
84 
+
86  // Member data
+
88  priv::MutexImpl* m_mutexImpl;
+
89 };
+
90 
+
91 } // namespace sf
+
92 
+
93 
+
94 #endif // SFML_MUTEX_HPP
+
95 
+
96 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Network_2Export_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Network_2Export_8hpp_source.htm new file mode 100644 index 0000000..2126679 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Network_2Export_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Network/Export.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_NETWORK_EXPORT_HPP
+
26 #define SFML_NETWORK_EXPORT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
35 // Define portable import / export macros
+
37 #if defined(SFML_NETWORK_EXPORTS)
+
38 
+
39  #define SFML_NETWORK_API SFML_API_EXPORT
+
40 
+
41 #else
+
42 
+
43  #define SFML_NETWORK_API SFML_API_IMPORT
+
44 
+
45 #endif
+
46 
+
47 
+
48 #endif // SFML_NETWORK_EXPORT_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Network_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Network_8hpp_source.htm new file mode 100644 index 0000000..d669def --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Network_8hpp_source.htm @@ -0,0 +1,89 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Network.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_NETWORK_HPP
+
26 #define SFML_NETWORK_HPP
+
27 
+
29 // Headers
+
31 
+
32 #include <SFML/System.hpp>
+
33 #include <SFML/Network/Ftp.hpp>
+
34 #include <SFML/Network/Http.hpp>
+
35 #include <SFML/Network/IpAddress.hpp>
+
36 #include <SFML/Network/Packet.hpp>
+
37 #include <SFML/Network/SocketSelector.hpp>
+
38 #include <SFML/Network/TcpListener.hpp>
+
39 #include <SFML/Network/TcpSocket.hpp>
+
40 #include <SFML/Network/UdpSocket.hpp>
+
41 
+
42 
+
43 #endif // SFML_NETWORK_HPP
+
44 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/NonCopyable_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/NonCopyable_8hpp_source.htm new file mode 100644 index 0000000..68f3c38 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/NonCopyable_8hpp_source.htm @@ -0,0 +1,99 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
NonCopyable.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_NONCOPYABLE_HPP
+
26 #define SFML_NONCOPYABLE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
41 class SFML_SYSTEM_API NonCopyable
+
42 {
+
43 protected :
+
44 
+ +
54 
+
55 private :
+
56 
+
67  NonCopyable(const NonCopyable&);
+
68 
+
79  NonCopyable& operator =(const NonCopyable&);
+
80 };
+
81 
+
82 } // namespace sf
+
83 
+
84 
+
85 #endif // SFML_NONCOPYABLE_HPP
+
86 
+
87 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/OpenGL_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/OpenGL_8hpp_source.htm new file mode 100644 index 0000000..01a0c44 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/OpenGL_8hpp_source.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
OpenGL.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_OPENGL_HPP
+
26 #define SFML_OPENGL_HPP
+
27 
+
28 
+
32 #include <SFML/Config.hpp>
+
33 
+
34 
+
39 #if defined(SFML_SYSTEM_WINDOWS)
+
40 
+
41  // The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them
+
42  #ifdef _MSC_VER
+
43  #include <windows.h>
+
44  #endif
+
45 
+
46  #include <GL/gl.h>
+
47  #include <GL/glu.h>
+
48 
+
49 #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
+
50 
+
51  #include <GL/gl.h>
+
52  #include <GL/glu.h>
+
53 
+
54 #elif defined(SFML_SYSTEM_MACOS)
+
55 
+
56  #include <OpenGL/gl.h>
+
57  #include <OpenGL/glu.h>
+
58 
+
59 #endif
+
60 
+
61 
+
62 #endif // SFML_OPENGL_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Packet_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Packet_8hpp_source.htm new file mode 100644 index 0000000..f074be5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Packet_8hpp_source.htm @@ -0,0 +1,169 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Packet.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_PACKET_HPP
+
26 #define SFML_PACKET_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <string>
+
33 #include <vector>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 class String;
+
39 class TcpSocket;
+
40 class UdpSocket;
+
41 
+
47 class SFML_NETWORK_API Packet
+
48 {
+
49  // A bool-like type that cannot be converted to integer or pointer types
+
50  typedef bool (Packet::*BoolType)(std::size_t);
+
51 
+
52 public :
+
53 
+
60  Packet();
+
61 
+
66  virtual ~Packet();
+
67 
+
77  void append(const void* data, std::size_t sizeInBytes);
+
78 
+
87  void clear();
+
88 
+
102  const void* getData() const;
+
103 
+
115  std::size_t getDataSize() const;
+
116 
+
129  bool endOfPacket() const;
+
130 
+
131 public:
+
132 
+
171  operator BoolType() const;
+
172 
+
177  Packet& operator >>(bool& data);
+
178  Packet& operator >>(Int8& data);
+
179  Packet& operator >>(Uint8& data);
+
180  Packet& operator >>(Int16& data);
+
181  Packet& operator >>(Uint16& data);
+
182  Packet& operator >>(Int32& data);
+
183  Packet& operator >>(Uint32& data);
+
184  Packet& operator >>(float& data);
+
185  Packet& operator >>(double& data);
+
186  Packet& operator >>(char* data);
+
187  Packet& operator >>(std::string& data);
+
188  Packet& operator >>(wchar_t* data);
+
189  Packet& operator >>(std::wstring& data);
+
190  Packet& operator >>(String& data);
+
191 
+
196  Packet& operator <<(bool data);
+
197  Packet& operator <<(Int8 data);
+
198  Packet& operator <<(Uint8 data);
+
199  Packet& operator <<(Int16 data);
+
200  Packet& operator <<(Uint16 data);
+
201  Packet& operator <<(Int32 data);
+
202  Packet& operator <<(Uint32 data);
+
203  Packet& operator <<(float data);
+
204  Packet& operator <<(double data);
+
205  Packet& operator <<(const char* data);
+
206  Packet& operator <<(const std::string& data);
+
207  Packet& operator <<(const wchar_t* data);
+
208  Packet& operator <<(const std::wstring& data);
+
209  Packet& operator <<(const String& data);
+
210 
+
211 protected:
+
212 
+
213  friend class TcpSocket;
+
214  friend class UdpSocket;
+
215 
+
234  virtual const void* onSend(std::size_t& size);
+
235 
+
253  virtual void onReceive(const void* data, std::size_t size);
+
254 
+
255 private :
+
256 
+
261  bool operator ==(const Packet& right) const;
+
262  bool operator !=(const Packet& right) const;
+
263 
+
274  bool checkSize(std::size_t size);
+
275 
+
277  // Member data
+
279  std::vector<char> m_data;
+
280  std::size_t m_readPos;
+
281  bool m_isValid;
+
282 };
+
283 
+
284 } // namespace sf
+
285 
+
286 
+
287 #endif // SFML_PACKET_HPP
+
288 
+
289 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/PrimitiveType_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/PrimitiveType_8hpp_source.htm new file mode 100644 index 0000000..c3cbca2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/PrimitiveType_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
PrimitiveType.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_PRIMITIVETYPE_HPP
+
26 #define SFML_PRIMITIVETYPE_HPP
+
27 
+
28 namespace sf
+
29 {
+ +
40 {
+ + + + + + + +
48 };
+
49 
+
50 } // namespace sf
+
51 
+
52 
+
53 #endif // SFML_PRIMITIVETYPE_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Rect_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Rect_8hpp_source.htm new file mode 100644 index 0000000..bc7d06d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Rect_8hpp_source.htm @@ -0,0 +1,128 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Rect.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RECT_HPP
+
26 #define SFML_RECT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Vector2.hpp>
+
32 #include <algorithm>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 template <typename T>
+
42 class Rect
+
43 {
+
44 public :
+
45 
+
53  Rect();
+
54 
+
67  Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight);
+
68 
+
79  Rect(const Vector2<T>& position, const Vector2<T>& size);
+
80 
+
92  template <typename U>
+
93  explicit Rect(const Rect<U>& rectangle);
+
94 
+
106  bool contains(T x, T y) const;
+
107 
+
118  bool contains(const Vector2<T>& point) const;
+
119 
+
130  bool intersects(const Rect<T>& rectangle) const;
+
131 
+
146  bool intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
+
147 
+
149  // Member data
+
151  T left;
+
152  T top;
+
153  T width;
+
154  T height;
+
155 };
+
156 
+
169 template <typename T>
+
170 bool operator ==(const Rect<T>& left, const Rect<T>& right);
+
171 
+
184 template <typename T>
+
185 bool operator !=(const Rect<T>& left, const Rect<T>& right);
+
186 
+
187 #include <SFML/Graphics/Rect.inl>
+
188 
+
189 // Create typedefs for the most common types
+
190 typedef Rect<int> IntRect;
+
191 typedef Rect<float> FloatRect;
+
192 
+
193 } // namespace sf
+
194 
+
195 
+
196 #endif // SFML_RECT_HPP
+
197 
+
198 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Rect_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Rect_8inl_source.htm new file mode 100644 index 0000000..ca98c52 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Rect_8inl_source.htm @@ -0,0 +1,196 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Rect.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 
+
27 template <typename T>
+
28 Rect<T>::Rect() :
+
29 left (0),
+
30 top (0),
+
31 width (0),
+
32 height(0)
+
33 {
+
34 
+
35 }
+
36 
+
37 
+
39 template <typename T>
+
40 Rect<T>::Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
+
41 left (rectLeft),
+
42 top (rectTop),
+
43 width (rectWidth),
+
44 height(rectHeight)
+
45 {
+
46 
+
47 }
+
48 
+
49 
+
51 template <typename T>
+
52 Rect<T>::Rect(const Vector2<T>& position, const Vector2<T>& size) :
+
53 left (position.x),
+
54 top (position.y),
+
55 width (size.x),
+
56 height(size.y)
+
57 {
+
58 
+
59 }
+
60 
+
61 
+
63 template <typename T>
+
64 template <typename U>
+
65 Rect<T>::Rect(const Rect<U>& rectangle) :
+
66 left (static_cast<T>(rectangle.left)),
+
67 top (static_cast<T>(rectangle.top)),
+
68 width (static_cast<T>(rectangle.width)),
+
69 height(static_cast<T>(rectangle.height))
+
70 {
+
71 }
+
72 
+
73 
+
75 template <typename T>
+
76 bool Rect<T>::contains(T x, T y) const
+
77 {
+
78  // Rectangles with negative dimensions are allowed, so we must handle them correctly
+
79 
+
80  // Compute the real min and max of the rectangle on both axes
+
81  T minX = std::min(left, left + width);
+
82  T maxX = std::max(left, left + width);
+
83  T minY = std::min(top, top + height);
+
84  T maxY = std::max(top, top + height);
+
85 
+
86  return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY);
+
87 }
+
88 
+
89 
+
91 template <typename T>
+
92 bool Rect<T>::contains(const Vector2<T>& point) const
+
93 {
+
94  return contains(point.x, point.y);
+
95 }
+
96 
+
97 
+
99 template <typename T>
+
100 bool Rect<T>::intersects(const Rect<T>& rectangle) const
+
101 {
+
102  Rect<T> intersection;
+
103  return intersects(rectangle, intersection);
+
104 }
+
105 
+
106 
+
108 template <typename T>
+
109 bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
+
110 {
+
111  // Rectangles with negative dimensions are allowed, so we must handle them correctly
+
112 
+
113  // Compute the min and max of the first rectangle on both axes
+
114  T r1MinX = std::min(left, left + width);
+
115  T r1MaxX = std::max(left, left + width);
+
116  T r1MinY = std::min(top, top + height);
+
117  T r1MaxY = std::max(top, top + height);
+
118 
+
119  // Compute the min and max of the second rectangle on both axes
+
120  T r2MinX = std::min(rectangle.left, rectangle.left + rectangle.width);
+
121  T r2MaxX = std::max(rectangle.left, rectangle.left + rectangle.width);
+
122  T r2MinY = std::min(rectangle.top, rectangle.top + rectangle.height);
+
123  T r2MaxY = std::max(rectangle.top, rectangle.top + rectangle.height);
+
124 
+
125  // Compute the intersection boundaries
+
126  T interLeft = std::max(r1MinX, r2MinX);
+
127  T interTop = std::max(r1MinY, r2MinY);
+
128  T interRight = std::min(r1MaxX, r2MaxX);
+
129  T interBottom = std::min(r1MaxY, r2MaxY);
+
130 
+
131  // If the intersection is valid (positive non zero area), then there is an intersection
+
132  if ((interLeft < interRight) && (interTop < interBottom))
+
133  {
+
134  intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
+
135  return true;
+
136  }
+
137  else
+
138  {
+
139  intersection = Rect<T>(0, 0, 0, 0);
+
140  return false;
+
141  }
+
142 }
+
143 
+
144 
+
146 template <typename T>
+
147 inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
+
148 {
+
149  return (left.left == right.left) && (left.width == right.width) &&
+
150  (left.top == right.top) && (left.height == right.height);
+
151 }
+
152 
+
153 
+
155 template <typename T>
+
156 inline bool operator !=(const Rect<T>& left, const Rect<T>& right)
+
157 {
+
158  return !(left == right);
+
159 }
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/RectangleShape_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/RectangleShape_8hpp_source.htm new file mode 100644 index 0000000..b6d9733 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/RectangleShape_8hpp_source.htm @@ -0,0 +1,107 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
RectangleShape.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RECTANGLESHAPE_HPP
+
26 #define SFML_RECTANGLESHAPE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Shape.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_GRAPHICS_API RectangleShape : public Shape
+
42 {
+
43 public :
+
44 
+
51  explicit RectangleShape(const Vector2f& size = Vector2f(0, 0));
+
52 
+
61  void setSize(const Vector2f& size);
+
62 
+
71  const Vector2f& getSize() const;
+
72 
+
79  virtual unsigned int getPointCount() const;
+
80 
+
91  virtual Vector2f getPoint(unsigned int index) const;
+
92 
+
93 private :
+
94 
+
96  // Member data
+
98  Vector2f m_size;
+
99 };
+
100 
+
101 } // namespace sf
+
102 
+
103 
+
104 #endif // SFML_RECTANGLESHAPE_HPP
+
105 
+
106 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/RenderStates_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/RenderStates_8hpp_source.htm new file mode 100644 index 0000000..3e78ba0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/RenderStates_8hpp_source.htm @@ -0,0 +1,118 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
RenderStates.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RENDERSTATES_HPP
+
26 #define SFML_RENDERSTATES_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/BlendMode.hpp>
+
33 #include <SFML/Graphics/Transform.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 class Shader;
+
39 class Texture;
+
40 
+
45 class SFML_GRAPHICS_API RenderStates
+
46 {
+
47 public :
+
48 
+
61  RenderStates();
+
62 
+
69  RenderStates(BlendMode theBlendMode);
+
70 
+
77  RenderStates(const Transform& theTransform);
+
78 
+
85  RenderStates(const Texture* theTexture);
+
86 
+
93  RenderStates(const Shader* theShader);
+
94 
+
104  RenderStates(BlendMode theBlendMode, const Transform& theTransform,
+
105  const Texture* theTexture, const Shader* theShader);
+
106 
+
108  // Static member data
+
110  static const RenderStates Default;
+
111 
+
113  // Member data
+ + +
117  const Texture* texture;
+
118  const Shader* shader;
+
119 };
+
120 
+
121 } // namespace sf
+
122 
+
123 
+
124 #endif // SFML_RENDERSTATES_HPP
+
125 
+
126 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/RenderTarget_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/RenderTarget_8hpp_source.htm new file mode 100644 index 0000000..84ce4ff --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/RenderTarget_8hpp_source.htm @@ -0,0 +1,172 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
RenderTarget.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RENDERTARGET_HPP
+
26 #define SFML_RENDERTARGET_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Color.hpp>
+
33 #include <SFML/Graphics/Rect.hpp>
+
34 #include <SFML/Graphics/View.hpp>
+
35 #include <SFML/Graphics/Transform.hpp>
+
36 #include <SFML/Graphics/BlendMode.hpp>
+
37 #include <SFML/Graphics/RenderStates.hpp>
+
38 #include <SFML/Graphics/PrimitiveType.hpp>
+
39 #include <SFML/Graphics/Vertex.hpp>
+
40 #include <SFML/System/NonCopyable.hpp>
+
41 
+
42 
+
43 namespace sf
+
44 {
+
45 class Drawable;
+
46 
+
51 class SFML_GRAPHICS_API RenderTarget : NonCopyable
+
52 {
+
53 public :
+
54 
+
59  virtual ~RenderTarget();
+
60 
+
70  void clear(const Color& color = Color(0, 0, 0, 255));
+
71 
+
91  void setView(const View& view);
+
92 
+
101  const View& getView() const;
+
102 
+
114  const View& getDefaultView() const;
+
115 
+
129  IntRect getViewport(const View& view) const;
+
130 
+
149  Vector2f mapPixelToCoords(const Vector2i& point) const;
+
150 
+
180  Vector2f mapPixelToCoords(const Vector2i& point, const View& view) const;
+
181 
+
200  Vector2i mapCoordsToPixel(const Vector2f& point) const;
+
201 
+
227  Vector2i mapCoordsToPixel(const Vector2f& point, const View& view) const;
+
228 
+
236  void draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default);
+
237 
+
247  void draw(const Vertex* vertices, unsigned int vertexCount,
+
248  PrimitiveType type, const RenderStates& states = RenderStates::Default);
+
249 
+
256  virtual Vector2u getSize() const = 0;
+
257 
+
290  void pushGLStates();
+
291 
+
301  void popGLStates();
+
302 
+
324  void resetGLStates();
+
325 
+
326 protected :
+
327 
+
332  RenderTarget();
+
333 
+
341  void initialize();
+
342 
+
343 private:
+
344 
+
349  void applyCurrentView();
+
350 
+
357  void applyBlendMode(BlendMode mode);
+
358 
+
365  void applyTransform(const Transform& transform);
+
366 
+
373  void applyTexture(const Texture* texture);
+
374 
+
381  void applyShader(const Shader* shader);
+
382 
+
395  virtual bool activate(bool active) = 0;
+
396 
+
401  struct StatesCache
+
402  {
+
403  enum {VertexCacheSize = 4};
+
404 
+
405  bool glStatesSet;
+
406  bool viewChanged;
+
407  BlendMode lastBlendMode;
+
408  Uint64 lastTextureId;
+
409  bool useVertexCache;
+
410  Vertex vertexCache[VertexCacheSize];
+
411  };
+
412 
+
414  // Member data
+
416  View m_defaultView;
+
417  View m_view;
+
418  StatesCache m_cache;
+
419 };
+
420 
+
421 } // namespace sf
+
422 
+
423 
+
424 #endif // SFML_RENDERTARGET_HPP
+
425 
+
426 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/RenderTexture_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/RenderTexture_8hpp_source.htm new file mode 100644 index 0000000..06ec919 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/RenderTexture_8hpp_source.htm @@ -0,0 +1,128 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
RenderTexture.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RENDERTEXTURE_HPP
+
26 #define SFML_RENDERTEXTURE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Texture.hpp>
+
33 #include <SFML/Graphics/RenderTarget.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 namespace priv
+
39 {
+
40  class RenderTextureImpl;
+
41 }
+
42 
+
47 class SFML_GRAPHICS_API RenderTexture : public RenderTarget
+
48 {
+
49 public :
+
50 
+
60  RenderTexture();
+
61 
+
66  virtual ~RenderTexture();
+
67 
+
86  bool create(unsigned int width, unsigned int height, bool depthBuffer = false);
+
87 
+
99  void setSmooth(bool smooth);
+
100 
+
109  bool isSmooth() const;
+
110 
+
122  void setRepeated(bool repeated);
+
123 
+
132  bool isRepeated() const;
+
133 
+
149  bool setActive(bool active = true);
+
150 
+
160  void display();
+
161 
+
171  virtual Vector2u getSize() const;
+
172 
+
187  const Texture& getTexture() const;
+
188 
+
189 private :
+
190 
+
202  virtual bool activate(bool active);
+
203 
+
205  // Member data
+
207  priv::RenderTextureImpl* m_impl;
+
208  Texture m_texture;
+
209 };
+
210 
+
211 } // namespace sf
+
212 
+
213 
+
214 #endif // SFML_RENDERTEXTURE_HPP
+
215 
+
216 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/RenderWindow_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/RenderWindow_8hpp_source.htm new file mode 100644 index 0000000..0c3af24 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/RenderWindow_8hpp_source.htm @@ -0,0 +1,117 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
RenderWindow.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_RENDERWINDOW_HPP
+
26 #define SFML_RENDERWINDOW_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/RenderTarget.hpp>
+
33 #include <SFML/Graphics/Image.hpp>
+
34 #include <SFML/Window/Window.hpp>
+
35 #include <string>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
44 class SFML_GRAPHICS_API RenderWindow : public Window, public RenderTarget
+
45 {
+
46 public :
+
47 
+
55  RenderWindow();
+
56 
+
76  RenderWindow(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
+
77 
+
93  explicit RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings());
+
94 
+
101  virtual ~RenderWindow();
+
102 
+
112  virtual Vector2u getSize() const;
+
113 
+
128  Image capture() const;
+
129 
+
130 protected:
+
131 
+
140  virtual void onCreate();
+
141 
+
149  virtual void onResize();
+
150 
+
151 private :
+
152 
+
161  virtual bool activate(bool active);
+
162 };
+
163 
+
164 } // namespace sf
+
165 
+
166 
+
167 #endif // SFML_RENDERWINDOW_HPP
+
168 
+
169 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Shader_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Shader_8hpp_source.htm new file mode 100644 index 0000000..4ab1994 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Shader_8hpp_source.htm @@ -0,0 +1,171 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Shader.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SHADER_HPP
+
26 #define SFML_SHADER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Transform.hpp>
+
33 #include <SFML/Graphics/Color.hpp>
+
34 #include <SFML/Window/GlResource.hpp>
+
35 #include <SFML/System/NonCopyable.hpp>
+
36 #include <SFML/System/Vector2.hpp>
+
37 #include <SFML/System/Vector3.hpp>
+
38 #include <map>
+
39 #include <string>
+
40 
+
41 
+
42 namespace sf
+
43 {
+
44 class InputStream;
+
45 class Texture;
+
46 
+
51 class SFML_GRAPHICS_API Shader : GlResource, NonCopyable
+
52 {
+
53 public :
+
54 
+
59  enum Type
+
60  {
+ +
62  Fragment
+
63  };
+
64 
+
70  struct CurrentTextureType {};
+
71  static CurrentTextureType CurrentTexture;
+
72 
+
73 public :
+
74 
+
81  Shader();
+
82 
+
87  ~Shader();
+
88 
+
108  bool loadFromFile(const std::string& filename, Type type);
+
109 
+
129  bool loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename);
+
130 
+
149  bool loadFromMemory(const std::string& shader, Type type);
+
150 
+
170  bool loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader);
+
171 
+
190  bool loadFromStream(InputStream& stream, Type type);
+
191 
+
211  bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
+
212 
+
232  void setParameter(const std::string& name, float x);
+
233 
+
254  void setParameter(const std::string& name, float x, float y);
+
255 
+
277  void setParameter(const std::string& name, float x, float y, float z);
+
278 
+
301  void setParameter(const std::string& name, float x, float y, float z, float w);
+
302 
+
322  void setParameter(const std::string& name, const Vector2f& vector);
+
323 
+
343  void setParameter(const std::string& name, const Vector3f& vector);
+
344 
+
370  void setParameter(const std::string& name, const Color& color);
+
371 
+
393  void setParameter(const std::string& name, const sf::Transform& transform);
+
394 
+
425  void setParameter(const std::string& name, const Texture& texture);
+
426 
+
448  void setParameter(const std::string& name, CurrentTextureType);
+
449 
+
471  static void bind(const Shader* shader);
+
472 
+
483  static bool isAvailable();
+
484 
+
485 private :
+
486 
+
499  bool compile(const char* vertexShaderCode, const char* fragmentShaderCode);
+
500 
+
508  void bindTextures() const;
+
509 
+
518  int getParamLocation(const std::string& name);
+
519 
+
521  // Types
+
523  typedef std::map<int, const Texture*> TextureTable;
+
524  typedef std::map<std::string, int> ParamTable;
+
525 
+
527  // Member data
+
529  unsigned int m_shaderProgram;
+
530  int m_currentTexture;
+
531  TextureTable m_textures;
+
532  ParamTable m_params;
+
533 };
+
534 
+
535 } // namespace sf
+
536 
+
537 
+
538 #endif // SFML_SHADER_HPP
+
539 
+
540 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Shape_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Shape_8hpp_source.htm new file mode 100644 index 0000000..784c7e4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Shape_8hpp_source.htm @@ -0,0 +1,156 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Shape.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SHAPE_HPP
+
26 #define SFML_SHAPE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Drawable.hpp>
+
33 #include <SFML/Graphics/Transformable.hpp>
+
34 #include <SFML/Graphics/VertexArray.hpp>
+
35 #include <SFML/System/Vector2.hpp>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
44 class SFML_GRAPHICS_API Shape : public Drawable, public Transformable
+
45 {
+
46 public :
+
47 
+
52  virtual ~Shape();
+
53 
+
74  void setTexture(const Texture* texture, bool resetRect = false);
+
75 
+
88  void setTextureRect(const IntRect& rect);
+
89 
+
105  void setFillColor(const Color& color);
+
106 
+
117  void setOutlineColor(const Color& color);
+
118 
+
132  void setOutlineThickness(float thickness);
+
133 
+
146  const Texture* getTexture() const;
+
147 
+
156  const IntRect& getTextureRect() const;
+
157 
+
166  const Color& getFillColor() const;
+
167 
+
176  const Color& getOutlineColor() const;
+
177 
+
186  float getOutlineThickness() const;
+
187 
+
196  virtual unsigned int getPointCount() const = 0;
+
197 
+
210  virtual Vector2f getPoint(unsigned int index) const = 0;
+
211 
+
224  FloatRect getLocalBounds() const;
+
225 
+
238  FloatRect getGlobalBounds() const;
+
239 
+
240 protected :
+
241 
+
246  Shape();
+
247 
+
256  void update();
+
257 
+
258 private :
+
259 
+
267  virtual void draw(RenderTarget& target, RenderStates states) const;
+
268 
+
273  void updateFillColors();
+
274 
+
279  void updateTexCoords();
+
280 
+
285  void updateOutline();
+
286 
+
291  void updateOutlineColors();
+
292 
+
293 private :
+
294 
+
296  // Member data
+
298  const Texture* m_texture;
+
299  IntRect m_textureRect;
+
300  Color m_fillColor;
+
301  Color m_outlineColor;
+
302  float m_outlineThickness;
+
303  VertexArray m_vertices;
+
304  VertexArray m_outlineVertices;
+
305  FloatRect m_insideBounds;
+
306  FloatRect m_bounds;
+
307 };
+
308 
+
309 } // namespace sf
+
310 
+
311 
+
312 #endif // SFML_SHAPE_HPP
+
313 
+
314 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Sleep_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Sleep_8hpp_source.htm new file mode 100644 index 0000000..f60dcb5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Sleep_8hpp_source.htm @@ -0,0 +1,87 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Sleep.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SLEEP_HPP
+
26 #define SFML_SLEEP_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/Time.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
47 void SFML_SYSTEM_API sleep(Time duration);
+
48 
+
49 } // namespace sf
+
50 
+
51 
+
52 #endif // SFML_SLEEP_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SocketHandle_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SocketHandle_8hpp_source.htm new file mode 100644 index 0000000..d3f7ad8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SocketHandle_8hpp_source.htm @@ -0,0 +1,100 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SocketHandle.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOCKETHANDLE_HPP
+
26 #define SFML_SOCKETHANDLE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 #if defined(SFML_SYSTEM_WINDOWS)
+
34  #include <basetsd.h>
+
35 #endif
+
36 
+
37 
+
38 namespace sf
+
39 {
+
41 // Define the low-level socket handle type, specific to
+
42 // each platform
+
44 #if defined(SFML_SYSTEM_WINDOWS)
+
45 
+
46  typedef UINT_PTR SocketHandle;
+
47 
+
48 #else
+
49 
+
50  typedef int SocketHandle;
+
51 
+
52 #endif
+
53 
+
54 } // namespace sf
+
55 
+
56 
+
57 #endif // SFML_SOCKETHANDLE_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SocketSelector_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SocketSelector_8hpp_source.htm new file mode 100644 index 0000000..fb8d20d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SocketSelector_8hpp_source.htm @@ -0,0 +1,119 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SocketSelector.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOCKETSELECTOR_HPP
+
26 #define SFML_SOCKETSELECTOR_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/System/Time.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 class Socket;
+
38 
+
43 class SFML_NETWORK_API SocketSelector
+
44 {
+
45 public :
+
46 
+ +
52 
+
59  SocketSelector(const SocketSelector& copy);
+
60 
+
65  ~SocketSelector();
+
66 
+
80  void add(Socket& socket);
+
81 
+
93  void remove(Socket& socket);
+
94 
+
105  void clear();
+
106 
+
123  bool wait(Time timeout = Time::Zero);
+
124 
+
142  bool isReady(Socket& socket) const;
+
143 
+
152  SocketSelector& operator =(const SocketSelector& right);
+
153 
+
154 private :
+
155 
+
156  struct SocketSelectorImpl;
+
157 
+
159  // Member data
+
161  SocketSelectorImpl* m_impl;
+
162 };
+
163 
+
164 } // namespace sf
+
165 
+
166 
+
167 #endif // SFML_SOCKETSELECTOR_HPP
+
168 
+
169 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Socket_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Socket_8hpp_source.htm new file mode 100644 index 0000000..0d29271 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Socket_8hpp_source.htm @@ -0,0 +1,144 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Socket.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOCKET_HPP
+
26 #define SFML_SOCKET_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/SocketHandle.hpp>
+
33 #include <SFML/System/NonCopyable.hpp>
+
34 #include <vector>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
39 class SocketSelector;
+
40 
+
45 class SFML_NETWORK_API Socket : NonCopyable
+
46 {
+
47 public :
+
48 
+
53  enum Status
+
54  {
+
55  Done,
+ + +
58  Error
+
59  };
+
60 
+
65  enum
+
66  {
+
67  AnyPort = 0
+
68  };
+
69 
+
70 public :
+
71 
+
76  virtual ~Socket();
+
77 
+
95  void setBlocking(bool blocking);
+
96 
+
105  bool isBlocking() const;
+
106 
+
107 protected :
+
108 
+
113  enum Type
+
114  {
+
115  Tcp,
+
116  Udp
+
117  };
+
118 
+
127  Socket(Type type);
+
128 
+
139  SocketHandle getHandle() const;
+
140 
+
147  void create();
+
148 
+
158  void create(SocketHandle handle);
+
159 
+
166  void close();
+
167 
+
168 private :
+
169 
+
170  friend class SocketSelector;
+
171 
+
173  // Member data
+
175  Type m_type;
+
176  SocketHandle m_socket;
+
177  bool m_isBlocking;
+
178 };
+
179 
+
180 } // namespace sf
+
181 
+
182 
+
183 #endif // SFML_SOCKET_HPP
+
184 
+
185 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SoundBufferRecorder_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SoundBufferRecorder_8hpp_source.htm new file mode 100644 index 0000000..dcf7341 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SoundBufferRecorder_8hpp_source.htm @@ -0,0 +1,109 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SoundBufferRecorder.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUNDBUFFERRECORDER_HPP
+
26 #define SFML_SOUNDBUFFERRECORDER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/Audio/SoundBuffer.hpp>
+
33 #include <SFML/Audio/SoundRecorder.hpp>
+
34 #include <vector>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
44 class SFML_AUDIO_API SoundBufferRecorder : public SoundRecorder
+
45 {
+
46 public :
+
47 
+
59  const SoundBuffer& getBuffer() const;
+
60 
+
61 protected:
+
62 
+
69  virtual bool onStart();
+
70 
+
80  virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount);
+
81 
+
86  virtual void onStop();
+
87 
+
88 private :
+
89 
+
91  // Member data
+
93  std::vector<Int16> m_samples;
+
94  SoundBuffer m_buffer;
+
95 };
+
96 
+
97 } // namespace sf
+
98 
+
99 #endif // SFML_SOUNDBUFFERRECORDER_HPP
+
100 
+
101 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SoundBuffer_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SoundBuffer_8hpp_source.htm new file mode 100644 index 0000000..7b8738c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SoundBuffer_8hpp_source.htm @@ -0,0 +1,152 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SoundBuffer.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUNDBUFFER_HPP
+
26 #define SFML_SOUNDBUFFER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/System/Time.hpp>
+
33 #include <string>
+
34 #include <vector>
+
35 #include <set>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
40 namespace priv
+
41 {
+
42  class SoundFile;
+
43 }
+
44 
+
45 class Sound;
+
46 class InputStream;
+
47 
+
52 class SFML_AUDIO_API SoundBuffer
+
53 {
+
54 public :
+
55 
+
60  SoundBuffer();
+
61 
+
68  SoundBuffer(const SoundBuffer& copy);
+
69 
+
74  ~SoundBuffer();
+
75 
+
90  bool loadFromFile(const std::string& filename);
+
91 
+
107  bool loadFromMemory(const void* data, std::size_t sizeInBytes);
+
108 
+
123  bool loadFromStream(InputStream& stream);
+
124 
+
141  bool loadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
+
142 
+
157  bool saveToFile(const std::string& filename) const;
+
158 
+
171  const Int16* getSamples() const;
+
172 
+
184  std::size_t getSampleCount() const;
+
185 
+
198  unsigned int getSampleRate() const;
+
199 
+
211  unsigned int getChannelCount() const;
+
212 
+
221  Time getDuration() const;
+
222 
+
231  SoundBuffer& operator =(const SoundBuffer& right);
+
232 
+
233 private :
+
234 
+
235  friend class Sound;
+
236 
+
245  bool initialize(priv::SoundFile& file);
+
246 
+
256  bool update(unsigned int channelCount, unsigned int sampleRate);
+
257 
+
264  void attachSound(Sound* sound) const;
+
265 
+
272  void detachSound(Sound* sound) const;
+
273 
+
275  // Types
+
277  typedef std::set<Sound*> SoundList;
+
278 
+
280  // Member data
+
282  unsigned int m_buffer;
+
283  std::vector<Int16> m_samples;
+
284  Time m_duration;
+
285  mutable SoundList m_sounds;
+
286 };
+
287 
+
288 } // namespace sf
+
289 
+
290 
+
291 #endif // SFML_SOUNDBUFFER_HPP
+
292 
+
293 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SoundRecorder_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SoundRecorder_8hpp_source.htm new file mode 100644 index 0000000..db985ba --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SoundRecorder_8hpp_source.htm @@ -0,0 +1,127 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SoundRecorder.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUNDRECORDER_HPP
+
26 #define SFML_SOUNDRECORDER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/System/Thread.hpp>
+
33 #include <vector>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
42 class SFML_AUDIO_API SoundRecorder
+
43 {
+
44 public :
+
45 
+
50  virtual ~SoundRecorder();
+
51 
+
67  void start(unsigned int sampleRate = 44100);
+
68 
+
75  void stop();
+
76 
+
87  unsigned int getSampleRate() const;
+
88 
+
100  static bool isAvailable();
+
101 
+
102 protected :
+
103 
+
110  SoundRecorder();
+
111 
+
123  virtual bool onStart();
+
124 
+
139  virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) = 0;
+
140 
+
150  virtual void onStop();
+
151 
+
152 private :
+
153 
+
161  void record();
+
162 
+
171  void processCapturedSamples();
+
172 
+
179  void cleanup();
+
180 
+
182  // Member data
+
184  Thread m_thread;
+
185  std::vector<Int16> m_samples;
+
186  unsigned int m_sampleRate;
+
187  bool m_isCapturing;
+
188 };
+
189 
+
190 } // namespace sf
+
191 
+
192 
+
193 #endif // SFML_SOUNDRECORDER_HPP
+
194 
+
195 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SoundSource_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SoundSource_8hpp_source.htm new file mode 100644 index 0000000..9c908b6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SoundSource_8hpp_source.htm @@ -0,0 +1,138 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SoundSource.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUNDSOURCE_HPP
+
26 #define SFML_SOUNDSOURCE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/System/Vector3.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_AUDIO_API SoundSource
+
42 {
+
43 public :
+
44 
+
49  enum Status
+
50  {
+ + +
53  Playing
+
54  };
+
55 
+
62  SoundSource(const SoundSource& copy);
+
63 
+
68  virtual ~SoundSource();
+
69 
+
84  void setPitch(float pitch);
+
85 
+
97  void setVolume(float volume);
+
98 
+
113  void setPosition(float x, float y, float z);
+
114 
+
127  void setPosition(const Vector3f& position);
+
128 
+
143  void setRelativeToListener(bool relative);
+
144 
+
160  void setMinDistance(float distance);
+
161 
+
179  void setAttenuation(float attenuation);
+
180 
+
189  float getPitch() const;
+
190 
+
199  float getVolume() const;
+
200 
+
209  Vector3f getPosition() const;
+
210 
+
220  bool isRelativeToListener() const;
+
221 
+
230  float getMinDistance() const;
+
231 
+
240  float getAttenuation() const;
+
241 
+
242 protected :
+
243 
+
250  SoundSource();
+
251 
+
258  Status getStatus() const;
+
259 
+
261  // Member data
+
263  unsigned int m_source;
+
264 };
+
265 
+
266 } // namespace sf
+
267 
+
268 
+
269 #endif // SFML_SOUNDSOURCE_HPP
+
270 
+
271 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/SoundStream_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/SoundStream_8hpp_source.htm new file mode 100644 index 0000000..5402426 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/SoundStream_8hpp_source.htm @@ -0,0 +1,159 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
SoundStream.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUNDSTREAM_HPP
+
26 #define SFML_SOUNDSTREAM_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/Audio/SoundSource.hpp>
+
33 #include <SFML/System/Thread.hpp>
+
34 #include <SFML/System/Time.hpp>
+
35 #include <cstdlib>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
44 class SFML_AUDIO_API SoundStream : public SoundSource
+
45 {
+
46 public :
+
47 
+
52  struct Chunk
+
53  {
+
54  const Int16* samples;
+
55  std::size_t sampleCount;
+
56  };
+
57 
+
62  virtual ~SoundStream();
+
63 
+
76  void play();
+
77 
+
87  void pause();
+
88 
+
99  void stop();
+
100 
+
109  unsigned int getChannelCount() const;
+
110 
+
120  unsigned int getSampleRate() const;
+
121 
+
128  Status getStatus() const;
+
129 
+
141  void setPlayingOffset(Time timeOffset);
+
142 
+
151  Time getPlayingOffset() const;
+
152 
+
166  void setLoop(bool loop);
+
167 
+
176  bool getLoop() const;
+
177 
+
178 protected :
+
179 
+
186  SoundStream();
+
187 
+
202  void initialize(unsigned int channelCount, unsigned int sampleRate);
+
203 
+
218  virtual bool onGetData(Chunk& data) = 0;
+
219 
+
229  virtual void onSeek(Time timeOffset) = 0;
+
230 
+
231 private :
+
232 
+
240  void streamData();
+
241 
+
255  bool fillAndPushBuffer(unsigned int bufferNum);
+
256 
+
266  bool fillQueue();
+
267 
+
274  void clearQueue();
+
275 
+
276  enum
+
277  {
+
278  BufferCount = 3
+
279  };
+
280 
+
282  // Member data
+
284  Thread m_thread;
+
285  bool m_isStreaming;
+
286  unsigned int m_buffers[BufferCount];
+
287  unsigned int m_channelCount;
+
288  unsigned int m_sampleRate;
+
289  Uint32 m_format;
+
290  bool m_loop;
+
291  Uint64 m_samplesProcessed;
+
292  bool m_endBuffers[BufferCount];
+
293 };
+
294 
+
295 } // namespace sf
+
296 
+
297 
+
298 #endif // SFML_SOUNDSTREAM_HPP
+
299 
+
300 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Sound_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Sound_8hpp_source.htm new file mode 100644 index 0000000..8dad4f2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Sound_8hpp_source.htm @@ -0,0 +1,133 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Sound.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SOUND_HPP
+
26 #define SFML_SOUND_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Audio/Export.hpp>
+
32 #include <SFML/Audio/SoundSource.hpp>
+
33 #include <SFML/System/Time.hpp>
+
34 #include <cstdlib>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
39 class SoundBuffer;
+
40 
+
45 class SFML_AUDIO_API Sound : public SoundSource
+
46 {
+
47 public :
+
48 
+
53  Sound();
+
54 
+
61  explicit Sound(const SoundBuffer& buffer);
+
62 
+
69  Sound(const Sound& copy);
+
70 
+
75  ~Sound();
+
76 
+
89  void play();
+
90 
+
100  void pause();
+
101 
+
112  void stop();
+
113 
+
126  void setBuffer(const SoundBuffer& buffer);
+
127 
+
141  void setLoop(bool loop);
+
142 
+
154  void setPlayingOffset(Time timeOffset);
+
155 
+
162  const SoundBuffer* getBuffer() const;
+
163 
+
172  bool getLoop() const;
+
173 
+
182  Time getPlayingOffset() const;
+
183 
+
190  Status getStatus() const;
+
191 
+
200  Sound& operator =(const Sound& right);
+
201 
+
211  void resetBuffer();
+
212 
+
213 private :
+
214 
+
216  // Member data
+
218  const SoundBuffer* m_buffer;
+
219 };
+
220 
+
221 } // namespace sf
+
222 
+
223 
+
224 #endif // SFML_SOUND_HPP
+
225 
+
226 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Sprite_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Sprite_8hpp_source.htm new file mode 100644 index 0000000..cbe7b91 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Sprite_8hpp_source.htm @@ -0,0 +1,132 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Sprite.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SPRITE_HPP
+
26 #define SFML_SPRITE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Drawable.hpp>
+
33 #include <SFML/Graphics/Transformable.hpp>
+
34 #include <SFML/Graphics/Vertex.hpp>
+
35 #include <SFML/Graphics/Rect.hpp>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
40 class Texture;
+
41 
+
47 class SFML_GRAPHICS_API Sprite : public Drawable, public Transformable
+
48 {
+
49 public :
+
50 
+
57  Sprite();
+
58 
+
67  explicit Sprite(const Texture& texture);
+
68 
+
78  Sprite(const Texture& texture, const IntRect& rectangle);
+
79 
+
99  void setTexture(const Texture& texture, bool resetRect = false);
+
100 
+
113  void setTextureRect(const IntRect& rectangle);
+
114 
+
128  void setColor(const Color& color);
+
129 
+
142  const Texture* getTexture() const;
+
143 
+
152  const IntRect& getTextureRect() const;
+
153 
+
162  const Color& getColor() const;
+
163 
+
176  FloatRect getLocalBounds() const;
+
177 
+
190  FloatRect getGlobalBounds() const;
+
191 
+
192 private :
+
193 
+
201  virtual void draw(RenderTarget& target, RenderStates states) const;
+
202 
+
207  void updatePositions();
+
208 
+
213  void updateTexCoords();
+
214 
+
216  // Member data
+
218  Vertex m_vertices[4];
+
219  const Texture* m_texture;
+
220  IntRect m_textureRect;
+
221 };
+
222 
+
223 } // namespace sf
+
224 
+
225 
+
226 #endif // SFML_SPRITE_HPP
+
227 
+
228 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/String_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/String_8hpp_source.htm new file mode 100644 index 0000000..73b05d9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/String_8hpp_source.htm @@ -0,0 +1,182 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
String.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_STRING_HPP
+
26 #define SFML_STRING_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <locale>
+
33 #include <string>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
43 class SFML_SYSTEM_API String
+
44 {
+
45 public :
+
46 
+
48  // Types
+
50  typedef std::basic_string<Uint32>::iterator Iterator;
+
51  typedef std::basic_string<Uint32>::const_iterator ConstIterator;
+
52 
+
54  // Static member data
+
56  static const std::size_t InvalidPos;
+
57 
+
64  String();
+
65 
+
76  String(char ansiChar, const std::locale& locale = std::locale());
+
77 
+
84  String(wchar_t wideChar);
+
85 
+
92  String(Uint32 utf32Char);
+
93 
+
104  String(const char* ansiString, const std::locale& locale = std::locale());
+
105 
+
116  String(const std::string& ansiString, const std::locale& locale = std::locale());
+
117 
+
124  String(const wchar_t* wideString);
+
125 
+
132  String(const std::wstring& wideString);
+
133 
+
140  String(const Uint32* utf32String);
+
141 
+
148  String(const std::basic_string<Uint32>& utf32String);
+
149 
+
156  String(const String& copy);
+
157 
+
173  operator std::string() const;
+
174 
+
188  operator std::wstring() const;
+
189 
+
205  std::string toAnsiString(const std::locale& locale = std::locale()) const;
+
206 
+
218  std::wstring toWideString() const;
+
219 
+
228  String& operator =(const String& right);
+
229 
+
238  String& operator +=(const String& right);
+
239 
+
251  Uint32 operator [](std::size_t index) const;
+
252 
+
264  Uint32& operator [](std::size_t index);
+
265 
+
274  void clear();
+
275 
+
284  std::size_t getSize() const;
+
285 
+
294  bool isEmpty() const;
+
295 
+
306  void erase(std::size_t position, std::size_t count = 1);
+
307 
+
318  void insert(std::size_t position, const String& str);
+
319 
+
332  std::size_t find(const String& str, std::size_t start = 0) const;
+
333 
+
345  const Uint32* getData() const;
+
346 
+
355  Iterator begin();
+
356 
+
365  ConstIterator begin() const;
+
366 
+
379  Iterator end();
+
380 
+
393  ConstIterator end() const;
+
394 
+
395 private :
+
396 
+
397  friend SFML_SYSTEM_API bool operator ==(const String& left, const String& right);
+
398  friend SFML_SYSTEM_API bool operator <(const String& left, const String& right);
+
399 
+
401  // Member data
+
403  std::basic_string<Uint32> m_string;
+
404 };
+
405 
+
416 SFML_SYSTEM_API bool operator ==(const String& left, const String& right);
+
417 
+
428 SFML_SYSTEM_API bool operator !=(const String& left, const String& right);
+
429 
+
440 SFML_SYSTEM_API bool operator <(const String& left, const String& right);
+
441 
+
452 SFML_SYSTEM_API bool operator >(const String& left, const String& right);
+
453 
+
464 SFML_SYSTEM_API bool operator <=(const String& left, const String& right);
+
465 
+
476 SFML_SYSTEM_API bool operator >=(const String& left, const String& right);
+
477 
+
488 SFML_SYSTEM_API String operator +(const String& left, const String& right);
+
489 
+
490 } // namespace sf
+
491 
+
492 
+
493 #endif // SFML_STRING_HPP
+
494 
+
495 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/System_2Export_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/System_2Export_8hpp_source.htm new file mode 100644 index 0000000..6cdd495 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/System_2Export_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
System/Export.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SYSTEM_EXPORT_HPP
+
26 #define SFML_SYSTEM_EXPORT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
35 // Define portable import / export macros
+
37 #if defined(SFML_SYSTEM_EXPORTS)
+
38 
+
39  #define SFML_SYSTEM_API SFML_API_EXPORT
+
40 
+
41 #else
+
42 
+
43  #define SFML_SYSTEM_API SFML_API_IMPORT
+
44 
+
45 #endif
+
46 
+
47 
+
48 #endif // SFML_SYSTEM_EXPORT_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/System_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/System_8hpp_source.htm new file mode 100644 index 0000000..4f17f6f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/System_8hpp_source.htm @@ -0,0 +1,93 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
System.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SYSTEM_HPP
+
26 #define SFML_SYSTEM_HPP
+
27 
+
29 // Headers
+
31 
+
32 #include <SFML/Config.hpp>
+
33 #include <SFML/System/Clock.hpp>
+
34 #include <SFML/System/Err.hpp>
+
35 #include <SFML/System/InputStream.hpp>
+
36 #include <SFML/System/Lock.hpp>
+
37 #include <SFML/System/Mutex.hpp>
+
38 #include <SFML/System/Sleep.hpp>
+
39 #include <SFML/System/String.hpp>
+
40 #include <SFML/System/Thread.hpp>
+
41 #include <SFML/System/ThreadLocal.hpp>
+
42 #include <SFML/System/ThreadLocalPtr.hpp>
+
43 #include <SFML/System/Utf.hpp>
+
44 #include <SFML/System/Vector2.hpp>
+
45 #include <SFML/System/Vector3.hpp>
+
46 
+
47 #endif // SFML_SYSTEM_HPP
+
48 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/TcpListener_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/TcpListener_8hpp_source.htm new file mode 100644 index 0000000..d9c344e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/TcpListener_8hpp_source.htm @@ -0,0 +1,105 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
TcpListener.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TCPLISTENER_HPP
+
26 #define SFML_TCPLISTENER_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/Socket.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
37 class TcpSocket;
+
38 
+
43 class SFML_NETWORK_API TcpListener : public Socket
+
44 {
+
45 public :
+
46 
+
51  TcpListener();
+
52 
+
64  unsigned short getLocalPort() const;
+
65 
+
81  Status listen(unsigned short port);
+
82 
+
92  void close();
+
93 
+
107  Status accept(TcpSocket& socket);
+
108 };
+
109 
+
110 
+
111 } // namespace sf
+
112 
+
113 
+
114 #endif // SFML_TCPLISTENER_HPP
+
115 
+
116 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/TcpSocket_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/TcpSocket_8hpp_source.htm new file mode 100644 index 0000000..e1030d9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/TcpSocket_8hpp_source.htm @@ -0,0 +1,133 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
TcpSocket.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TCPSOCKET_HPP
+
26 #define SFML_TCPSOCKET_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/Socket.hpp>
+
33 #include <SFML/System/Time.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 class TcpListener;
+
39 class IpAddress;
+
40 class Packet;
+
41 
+
46 class SFML_NETWORK_API TcpSocket : public Socket
+
47 {
+
48 public :
+
49 
+
54  TcpSocket();
+
55 
+
66  unsigned short getLocalPort() const;
+
67 
+
79  IpAddress getRemoteAddress() const;
+
80 
+
92  unsigned short getRemotePort() const;
+
93 
+
111  Status connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero);
+
112 
+
122  void disconnect();
+
123 
+
137  Status send(const void* data, std::size_t size);
+
138 
+
155  Status receive(void* data, std::size_t size, std::size_t& received);
+
156 
+
169  Status send(Packet& packet);
+
170 
+
185  Status receive(Packet& packet);
+
186 
+
187 private:
+
188 
+
189  friend class TcpListener;
+
190 
+
195  struct PendingPacket
+
196  {
+
197  PendingPacket();
+
198 
+
199  Uint32 Size;
+
200  std::size_t SizeReceived;
+
201  std::vector<char> Data;
+
202  };
+
203 
+
205  // Member data
+
207  PendingPacket m_pendingPacket;
+
208 };
+
209 
+
210 } // namespace sf
+
211 
+
212 
+
213 #endif // SFML_TCPSOCKET_HPP
+
214 
+
215 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Text_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Text_8hpp_source.htm new file mode 100644 index 0000000..e4a4b4f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Text_8hpp_source.htm @@ -0,0 +1,152 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Text.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TEXT_HPP
+
26 #define SFML_TEXT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Drawable.hpp>
+
33 #include <SFML/Graphics/Transformable.hpp>
+
34 #include <SFML/Graphics/Font.hpp>
+
35 #include <SFML/Graphics/Rect.hpp>
+
36 #include <SFML/Graphics/VertexArray.hpp>
+
37 #include <SFML/System/String.hpp>
+
38 #include <string>
+
39 #include <vector>
+
40 
+
41 
+
42 namespace sf
+
43 {
+
48 class SFML_GRAPHICS_API Text : public Drawable, public Transformable
+
49 {
+
50 public :
+
51 
+
56  enum Style
+
57  {
+
58  Regular = 0,
+
59  Bold = 1 << 0,
+
60  Italic = 1 << 1,
+
61  Underlined = 1 << 2
+
62  };
+
63 
+
70  Text();
+
71 
+
80  Text(const String& string, const Font& font, unsigned int characterSize = 30);
+
81 
+
101  void setString(const String& string);
+
102 
+
118  void setFont(const Font& font);
+
119 
+
130  void setCharacterSize(unsigned int size);
+
131 
+
144  void setStyle(Uint32 style);
+
145 
+
156  void setColor(const Color& color);
+
157 
+
175  const String& getString() const;
+
176 
+
189  const Font* getFont() const;
+
190 
+
199  unsigned int getCharacterSize() const;
+
200 
+
209  Uint32 getStyle() const;
+
210 
+
219  const Color& getColor() const;
+
220 
+
236  Vector2f findCharacterPos(std::size_t index) const;
+
237 
+
250  FloatRect getLocalBounds() const;
+
251 
+
264  FloatRect getGlobalBounds() const;
+
265 
+
266 private :
+
267 
+
275  virtual void draw(RenderTarget& target, RenderStates states) const;
+
276 
+
281  void updateGeometry();
+
282 
+
284  // Member data
+
286  String m_string;
+
287  const Font* m_font;
+
288  unsigned int m_characterSize;
+
289  Uint32 m_style;
+
290  Color m_color;
+
291  VertexArray m_vertices;
+
292  FloatRect m_bounds;
+
293 };
+
294 
+
295 } // namespace sf
+
296 
+
297 
+
298 #endif // SFML_TEXT_HPP
+
299 
+
300 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Texture_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Texture_8hpp_source.htm new file mode 100644 index 0000000..8d79e1a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Texture_8hpp_source.htm @@ -0,0 +1,167 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Texture.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TEXTURE_HPP
+
26 #define SFML_TEXTURE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Image.hpp>
+
33 #include <SFML/Window/GlResource.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 class Window;
+
39 class RenderTarget;
+
40 class RenderTexture;
+
41 class InputStream;
+
42 
+
47 class SFML_GRAPHICS_API Texture : GlResource
+
48 {
+
49 public :
+
50 
+ +
56  {
+ +
58  Pixels
+
59  };
+
60 
+
61 public :
+
62 
+
69  Texture();
+
70 
+
77  Texture(const Texture& copy);
+
78 
+
83  ~Texture();
+
84 
+
96  bool create(unsigned int width, unsigned int height);
+
97 
+
127  bool loadFromFile(const std::string& filename, const IntRect& area = IntRect());
+
128 
+
159  bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
+
160 
+
190  bool loadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
+
191 
+
214  bool loadFromImage(const Image& image, const IntRect& area = IntRect());
+
215 
+
222  Vector2u getSize() const;
+
223 
+
237  Image copyToImage() const;
+
238 
+
255  void update(const Uint8* pixels);
+
256 
+
277  void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
+
278 
+
297  void update(const Image& image);
+
298 
+
314  void update(const Image& image, unsigned int x, unsigned int y);
+
315 
+
334  void update(const Window& window);
+
335 
+
351  void update(const Window& window, unsigned int x, unsigned int y);
+
352 
+
367  void setSmooth(bool smooth);
+
368 
+
377  bool isSmooth() const;
+
378 
+
401  void setRepeated(bool repeated);
+
402 
+
411  bool isRepeated() const;
+
412 
+
421  Texture& operator =(const Texture& right);
+
422 
+
454  static void bind(const Texture* texture, CoordinateType coordinateType = Normalized);
+
455 
+
466  static unsigned int getMaximumSize();
+
467 
+
468 private :
+
469 
+
470  friend class RenderTexture;
+
471  friend class RenderTarget;
+
472 
+
486  static unsigned int getValidSize(unsigned int size);
+
487 
+
489  // Member data
+
491  Vector2u m_size;
+
492  Vector2u m_actualSize;
+
493  unsigned int m_texture;
+
494  bool m_isSmooth;
+
495  bool m_isRepeated;
+
496  mutable bool m_pixelsFlipped;
+
497  Uint64 m_cacheId;
+
498 };
+
499 
+
500 } // namespace sf
+
501 
+
502 
+
503 #endif // SFML_TEXTURE_HPP
+
504 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8hpp_source.htm new file mode 100644 index 0000000..db04afd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8hpp_source.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
ThreadLocalPtr.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_THREADLOCALPTR_HPP
+
26 #define SFML_THREADLOCALPTR_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/ThreadLocal.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 template <typename T>
+
41 class ThreadLocalPtr : private ThreadLocal
+
42 {
+
43 public :
+
44 
+
51  ThreadLocalPtr(T* value = NULL);
+
52 
+
62  T& operator *() const;
+
63 
+
73  T* operator ->() const;
+
74 
+
82  operator T*() const;
+
83 
+
92  ThreadLocalPtr<T>& operator =(T* value);
+
93 
+ +
103 };
+
104 
+
105 } // namespace sf
+
106 
+
107 #include <SFML/System/ThreadLocalPtr.inl>
+
108 
+
109 
+
110 #endif // SFML_THREADLOCALPTR_HPP
+
111 
+
112 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8inl_source.htm new file mode 100644 index 0000000..c8fd15f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocalPtr_8inl_source.htm @@ -0,0 +1,118 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
ThreadLocalPtr.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 
+
26 namespace sf
+
27 {
+
29 template <typename T>
+ +
31 ThreadLocal(value)
+
32 {
+
33 }
+
34 
+
35 
+
37 template <typename T>
+ +
39 {
+
40  return *static_cast<T*>(getValue());
+
41 }
+
42 
+
43 
+
45 template <typename T>
+ +
47 {
+
48  return static_cast<T*>(getValue());
+
49 }
+
50 
+
51 
+
53 template <typename T>
+ +
55 {
+
56  return static_cast<T*>(getValue());
+
57 }
+
58 
+
59 
+
61 template <typename T>
+ +
63 {
+
64  setValue(value);
+
65  return *this;
+
66 }
+
67 
+
68 
+
70 template <typename T>
+ +
72 {
+
73  setValue(right.getValue());
+
74  return *this;
+
75 }
+
76 
+
77 } // namespace sf
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ThreadLocal_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocal_8hpp_source.htm new file mode 100644 index 0000000..0e342a8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/ThreadLocal_8hpp_source.htm @@ -0,0 +1,111 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
ThreadLocal.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_THREADLOCAL_HPP
+
26 #define SFML_THREADLOCAL_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/NonCopyable.hpp>
+
33 #include <cstdlib>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 namespace priv
+
39 {
+
40  class ThreadLocalImpl;
+
41 }
+
42 
+
47 class SFML_SYSTEM_API ThreadLocal : NonCopyable
+
48 {
+
49 public :
+
50 
+
57  ThreadLocal(void* value = NULL);
+
58 
+
63  ~ThreadLocal();
+
64 
+
71  void setValue(void* value);
+
72 
+
79  void* getValue() const;
+
80 
+
81 private :
+
82 
+
84  // Member data
+
86  priv::ThreadLocalImpl* m_impl;
+
87 };
+
88 
+
89 } // namespace sf
+
90 
+
91 
+
92 #endif // SFML_THREADLOCAL_HPP
+
93 
+
94 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Thread_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Thread_8hpp_source.htm new file mode 100644 index 0000000..efcc49a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Thread_8hpp_source.htm @@ -0,0 +1,127 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Thread.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_THREAD_HPP
+
26 #define SFML_THREAD_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 #include <SFML/System/NonCopyable.hpp>
+
33 #include <cstdlib>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 namespace priv
+
39 {
+
40  class ThreadImpl;
+
41  struct ThreadFunc;
+
42 }
+
43 
+
48 class SFML_SYSTEM_API Thread : NonCopyable
+
49 {
+
50 public :
+
51 
+
74  template <typename F>
+
75  Thread(F function);
+
76 
+
102  template <typename F, typename A>
+
103  Thread(F function, A argument);
+
104 
+
125  template <typename C>
+
126  Thread(void(C::*function)(), C* object);
+
127 
+
135  ~Thread();
+
136 
+
146  void launch();
+
147 
+
159  void wait();
+
160 
+
172  void terminate();
+
173 
+
174 private :
+
175 
+
176  friend class priv::ThreadImpl;
+
177 
+
184  void run();
+
185 
+
187  // Member data
+
189  priv::ThreadImpl* m_impl;
+
190  priv::ThreadFunc* m_entryPoint;
+
191 };
+
192 
+
193 #include <SFML/System/Thread.inl>
+
194 
+
195 } // namespace sf
+
196 
+
197 #endif // SFML_THREAD_HPP
+
198 
+
199 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Thread_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Thread_8inl_source.htm new file mode 100644 index 0000000..ad840a4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Thread_8inl_source.htm @@ -0,0 +1,134 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Thread.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 namespace priv
+
26 {
+
27 // Base class for abstract thread functions
+
28 struct ThreadFunc
+
29 {
+
30  virtual ~ThreadFunc() {}
+
31  virtual void run() = 0;
+
32 };
+
33 
+
34 // Specialization using a functor (including free functions) with no argument
+
35 template <typename T>
+
36 struct ThreadFunctor : ThreadFunc
+
37 {
+
38  ThreadFunctor(T functor) : m_functor(functor) {}
+
39  virtual void run() {m_functor();}
+
40  T m_functor;
+
41 };
+
42 
+
43 // Specialization using a functor (including free functions) with one argument
+
44 template <typename F, typename A>
+
45 struct ThreadFunctorWithArg : ThreadFunc
+
46 {
+
47  ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {}
+
48  virtual void run() {m_function(m_arg);}
+
49  F m_function;
+
50  A m_arg;
+
51 };
+
52 
+
53 // Specialization using a member function
+
54 template <typename C>
+
55 struct ThreadMemberFunc : ThreadFunc
+
56 {
+
57  ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {}
+
58  virtual void run() {(m_object->*m_function)();}
+
59  void(C::*m_function)();
+
60  C* m_object;
+
61 };
+
62 
+
63 } // namespace priv
+
64 
+
65 
+
67 template <typename F>
+
68 Thread::Thread(F functor) :
+
69 m_impl (NULL),
+
70 m_entryPoint(new priv::ThreadFunctor<F>(functor))
+
71 {
+
72 }
+
73 
+
74 
+
76 template <typename F, typename A>
+
77 Thread::Thread(F function, A argument) :
+
78 m_impl (NULL),
+
79 m_entryPoint(new priv::ThreadFunctorWithArg<F, A>(function, argument))
+
80 {
+
81 }
+
82 
+
83 
+
85 template <typename C>
+
86 Thread::Thread(void(C::*function)(), C* object) :
+
87 m_impl (NULL),
+
88 m_entryPoint(new priv::ThreadMemberFunc<C>(function, object))
+
89 {
+
90 }
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Time_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Time_8hpp_source.htm new file mode 100644 index 0000000..1a348a5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Time_8hpp_source.htm @@ -0,0 +1,163 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Time.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TIME_HPP
+
26 #define SFML_TIME_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/System/Export.hpp>
+
32 
+
33 
+
34 namespace sf
+
35 {
+
40 class SFML_SYSTEM_API Time
+
41 {
+
42 public :
+
43 
+
50  Time();
+
51 
+
60  float asSeconds() const;
+
61 
+
70  Int32 asMilliseconds() const;
+
71 
+
80  Int64 asMicroseconds() const;
+
81 
+
83  // Static member data
+
85  static const Time Zero;
+
86 
+
87 private :
+
88 
+
89  friend SFML_SYSTEM_API Time seconds(float);
+
90  friend SFML_SYSTEM_API Time milliseconds(Int32);
+
91  friend SFML_SYSTEM_API Time microseconds(Int64);
+
92 
+
102  explicit Time(Int64 microseconds);
+
103 
+
104 private :
+
105 
+
107  // Member data
+
109  Int64 m_microseconds;
+
110 };
+
111 
+
123 SFML_SYSTEM_API Time seconds(float amount);
+
124 
+
136 SFML_SYSTEM_API Time milliseconds(Int32 amount);
+
137 
+
149 SFML_SYSTEM_API Time microseconds(Int64 amount);
+
150 
+
161 SFML_SYSTEM_API bool operator ==(Time left, Time right);
+
162 
+
173 SFML_SYSTEM_API bool operator !=(Time left, Time right);
+
174 
+
185 SFML_SYSTEM_API bool operator <(Time left, Time right);
+
186 
+
197 SFML_SYSTEM_API bool operator >(Time left, Time right);
+
198 
+
209 SFML_SYSTEM_API bool operator <=(Time left, Time right);
+
210 
+
221 SFML_SYSTEM_API bool operator >=(Time left, Time right);
+
222 
+
232 SFML_SYSTEM_API Time operator -(Time right);
+
233 
+
244 SFML_SYSTEM_API Time operator +(Time left, Time right);
+
245 
+
256 SFML_SYSTEM_API Time& operator +=(Time& left, Time right);
+
257 
+
268 SFML_SYSTEM_API Time operator -(Time left, Time right);
+
269 
+
280 SFML_SYSTEM_API Time& operator -=(Time& left, Time right);
+
281 
+
292 SFML_SYSTEM_API Time operator *(Time left, float right);
+
293 
+
304 SFML_SYSTEM_API Time operator *(Time left, Int64 right);
+
305 
+
316 SFML_SYSTEM_API Time operator *(float left, Time right);
+
317 
+
328 SFML_SYSTEM_API Time operator *(Int64 left, Time right);
+
329 
+
340 SFML_SYSTEM_API Time& operator *=(Time& left, float right);
+
341 
+
352 SFML_SYSTEM_API Time& operator *=(Time& left, Int64 right);
+
353 
+
364 SFML_SYSTEM_API Time operator /(Time left, float right);
+
365 
+
376 SFML_SYSTEM_API Time operator /(Time left, Int64 right);
+
377 
+
388 SFML_SYSTEM_API Time& operator /=(Time& left, float right);
+
389 
+
400 SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right);
+
401 
+
402 } // namespace sf
+
403 
+
404 
+
405 #endif // SFML_TIME_HPP
+
406 
+
407 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Transform_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Transform_8hpp_source.htm new file mode 100644 index 0000000..7494374 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Transform_8hpp_source.htm @@ -0,0 +1,143 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Transform.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TRANSFORM_HPP
+
26 #define SFML_TRANSFORM_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Rect.hpp>
+
33 #include <SFML/System/Vector2.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
42 class SFML_GRAPHICS_API Transform
+
43 {
+
44 public :
+
45 
+
52  Transform();
+
53 
+
68  Transform(float a00, float a01, float a02,
+
69  float a10, float a11, float a12,
+
70  float a20, float a21, float a22);
+
71 
+
87  const float* getMatrix() const;
+
88 
+
98  Transform getInverse() const;
+
99 
+
109  Vector2f transformPoint(float x, float y) const;
+
110 
+
119  Vector2f transformPoint(const Vector2f& point) const;
+
120 
+
135  FloatRect transformRect(const FloatRect& rectangle) const;
+
136 
+
149  Transform& combine(const Transform& transform);
+
150 
+
169  Transform& translate(float x, float y);
+
170 
+
188  Transform& translate(const Vector2f& offset);
+
189 
+
207  Transform& rotate(float angle);
+
208 
+
233  Transform& rotate(float angle, float centerX, float centerY);
+
234 
+
258  Transform& rotate(float angle, const Vector2f& center);
+
259 
+
278  Transform& scale(float scaleX, float scaleY);
+
279 
+
305  Transform& scale(float scaleX, float scaleY, float centerX, float centerY);
+
306 
+
324  Transform& scale(const Vector2f& factors);
+
325 
+
349  Transform& scale(const Vector2f& factors, const Vector2f& center);
+
350 
+
352  // Static member data
+
354  static const Transform Identity;
+
355 
+
356 private:
+
357 
+
359  // Member data
+
361  float m_matrix[16];
+
362 };
+
363 
+
376 SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right);
+
377 
+
390 SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right);
+
391 
+
404 SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right);
+
405 
+
406 } // namespace sf
+
407 
+
408 
+
409 #endif // SFML_TRANSFORM_HPP
+
410 
+
411 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Transformable_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Transformable_8hpp_source.htm new file mode 100644 index 0000000..681da64 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Transformable_8hpp_source.htm @@ -0,0 +1,144 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Transformable.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_TRANSFORMABLE_HPP
+
26 #define SFML_TRANSFORMABLE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Transform.hpp>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_GRAPHICS_API Transformable
+
42 {
+
43 public :
+
44 
+
49  Transformable();
+
50 
+
55  virtual ~Transformable();
+
56 
+
70  void setPosition(float x, float y);
+
71 
+
84  void setPosition(const Vector2f& position);
+
85 
+
98  void setRotation(float angle);
+
99 
+
113  void setScale(float factorX, float factorY);
+
114 
+
127  void setScale(const Vector2f& factors);
+
128 
+
145  void setOrigin(float x, float y);
+
146 
+
162  void setOrigin(const Vector2f& origin);
+
163 
+
172  const Vector2f& getPosition() const;
+
173 
+
184  float getRotation() const;
+
185 
+
194  const Vector2f& getScale() const;
+
195 
+
204  const Vector2f& getOrigin() const;
+
205 
+
223  void move(float offsetX, float offsetY);
+
224 
+
240  void move(const Vector2f& offset);
+
241 
+
255  void rotate(float angle);
+
256 
+
274  void scale(float factorX, float factorY);
+
275 
+
292  void scale(const Vector2f& factor);
+
293 
+
302  const Transform& getTransform() const;
+
303 
+
312  const Transform& getInverseTransform() const;
+
313 
+
314 private :
+
315 
+
317  // Member data
+
319  Vector2f m_origin;
+
320  Vector2f m_position;
+
321  float m_rotation;
+
322  Vector2f m_scale;
+
323  mutable Transform m_transform;
+
324  mutable bool m_transformNeedUpdate;
+
325  mutable Transform m_inverseTransform;
+
326  mutable bool m_inverseTransformNeedUpdate;
+
327 };
+
328 
+
329 } // namespace sf
+
330 
+
331 
+
332 #endif // SFML_TRANSFORMABLE_HPP
+
333 
+
334 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/UdpSocket_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/UdpSocket_8hpp_source.htm new file mode 100644 index 0000000..5e88e39 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/UdpSocket_8hpp_source.htm @@ -0,0 +1,123 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
UdpSocket.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_UDPSOCKET_HPP
+
26 #define SFML_UDPSOCKET_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Network/Export.hpp>
+
32 #include <SFML/Network/Socket.hpp>
+
33 #include <vector>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
38 class IpAddress;
+
39 class Packet;
+
40 
+
45 class SFML_NETWORK_API UdpSocket : public Socket
+
46 {
+
47 public :
+
48 
+
50  // Constants
+
52  enum
+
53  {
+
54  MaxDatagramSize = 65507
+
55  };
+
56 
+
61  UdpSocket();
+
62 
+
74  unsigned short getLocalPort() const;
+
75 
+
92  Status bind(unsigned short port);
+
93 
+
104  void unbind();
+
105 
+
123  Status send(const void* data, std::size_t size, const IpAddress& remoteAddress, unsigned short remotePort);
+
124 
+
146  Status receive(void* data, std::size_t size, std::size_t& received, IpAddress& remoteAddress, unsigned short& remotePort);
+
147 
+
164  Status send(Packet& packet, const IpAddress& remoteAddress, unsigned short remotePort);
+
165 
+
181  Status receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort);
+
182 
+
183 private:
+
184 
+
186  // Member data
+
188  std::vector<char> m_buffer;
+
189 };
+
190 
+
191 } // namespace sf
+
192 
+
193 
+
194 #endif // SFML_UDPSOCKET_HPP
+
195 
+
196 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Utf_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Utf_8hpp_source.htm new file mode 100644 index 0000000..72722ed --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Utf_8hpp_source.htm @@ -0,0 +1,247 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Utf.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_UTF_HPP
+
26 #define SFML_UTF_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 #include <algorithm>
+
33 #include <locale>
+
34 #include <string>
+
35 #include <cstdlib>
+
36 
+
37 
+
38 namespace sf
+
39 {
+
40 template <unsigned int N>
+
41 class Utf;
+
42 
+
47 template <>
+
48 class Utf<8>
+
49 {
+
50 public :
+
51 
+
66  template <typename In>
+
67  static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
68 
+
82  template <typename Out>
+
83  static Out encode(Uint32 input, Out output, Uint8 replacement = 0);
+
84 
+
97  template <typename In>
+
98  static In next(In begin, In end);
+
99 
+
113  template <typename In>
+
114  static std::size_t count(In begin, In end);
+
115 
+
130  template <typename In, typename Out>
+
131  static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
132 
+
143  template <typename In, typename Out>
+
144  static Out fromWide(In begin, In end, Out output);
+
145 
+
156  template <typename In, typename Out>
+
157  static Out fromLatin1(In begin, In end, Out output);
+
158 
+
174  template <typename In, typename Out>
+
175  static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
176 
+
188  template <typename In, typename Out>
+
189  static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
+
190 
+
202  template <typename In, typename Out>
+
203  static Out toLatin1(In begin, In end, Out output, char replacement = 0);
+
204 
+
220  template <typename In, typename Out>
+
221  static Out toUtf8(In begin, In end, Out output);
+
222 
+
233  template <typename In, typename Out>
+
234  static Out toUtf16(In begin, In end, Out output);
+
235 
+
246  template <typename In, typename Out>
+
247  static Out toUtf32(In begin, In end, Out output);
+
248 };
+
249 
+
254 template <>
+
255 class Utf<16>
+
256 {
+
257 public :
+
258 
+
273  template <typename In>
+
274  static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
275 
+
289  template <typename Out>
+
290  static Out encode(Uint32 input, Out output, Uint16 replacement = 0);
+
291 
+
304  template <typename In>
+
305  static In next(In begin, In end);
+
306 
+
320  template <typename In>
+
321  static std::size_t count(In begin, In end);
+
322 
+
337  template <typename In, typename Out>
+
338  static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
339 
+
350  template <typename In, typename Out>
+
351  static Out fromWide(In begin, In end, Out output);
+
352 
+
363  template <typename In, typename Out>
+
364  static Out fromLatin1(In begin, In end, Out output);
+
365 
+
381  template <typename In, typename Out>
+
382  static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
383 
+
395  template <typename In, typename Out>
+
396  static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
+
397 
+
409  template <typename In, typename Out>
+
410  static Out toLatin1(In begin, In end, Out output, char replacement = 0);
+
411 
+
422  template <typename In, typename Out>
+
423  static Out toUtf8(In begin, In end, Out output);
+
424 
+
440  template <typename In, typename Out>
+
441  static Out toUtf16(In begin, In end, Out output);
+
442 
+
453  template <typename In, typename Out>
+
454  static Out toUtf32(In begin, In end, Out output);
+
455 };
+
456 
+
461 template <>
+
462 class Utf<32>
+
463 {
+
464 public :
+
465 
+
481  template <typename In>
+
482  static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0);
+
483 
+
498  template <typename Out>
+
499  static Out encode(Uint32 input, Out output, Uint32 replacement = 0);
+
500 
+
513  template <typename In>
+
514  static In next(In begin, In end);
+
515 
+
528  template <typename In>
+
529  static std::size_t count(In begin, In end);
+
530 
+
545  template <typename In, typename Out>
+
546  static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale());
+
547 
+
558  template <typename In, typename Out>
+
559  static Out fromWide(In begin, In end, Out output);
+
560 
+
571  template <typename In, typename Out>
+
572  static Out fromLatin1(In begin, In end, Out output);
+
573 
+
589  template <typename In, typename Out>
+
590  static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
591 
+
603  template <typename In, typename Out>
+
604  static Out toWide(In begin, In end, Out output, wchar_t replacement = 0);
+
605 
+
617  template <typename In, typename Out>
+
618  static Out toLatin1(In begin, In end, Out output, char replacement = 0);
+
619 
+
630  template <typename In, typename Out>
+
631  static Out toUtf8(In begin, In end, Out output);
+
632 
+
643  template <typename In, typename Out>
+
644  static Out toUtf16(In begin, In end, Out output);
+
645 
+
661  template <typename In, typename Out>
+
662  static Out toUtf32(In begin, In end, Out output);
+
663 
+
677  template <typename In>
+
678  static Uint32 decodeAnsi(In input, const std::locale& locale = std::locale());
+
679 
+
692  template <typename In>
+
693  static Uint32 decodeWide(In input);
+
694 
+
710  template <typename Out>
+
711  static Out encodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale());
+
712 
+
727  template <typename Out>
+
728  static Out encodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0);
+
729 };
+
730 
+
731 #include <SFML/System/Utf.inl>
+
732 
+
733 // Make typedefs to get rid of the template syntax
+
734 typedef Utf<8> Utf8;
+
735 typedef Utf<16> Utf16;
+
736 typedef Utf<32> Utf32;
+
737 
+
738 } // namespace sf
+
739 
+
740 
+
741 #endif // SFML_UTF_HPP
+
742 
+
743 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Utf_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Utf_8inl_source.htm new file mode 100644 index 0000000..2d455a5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Utf_8inl_source.htm @@ -0,0 +1,754 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Utf.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 
+
27 // References :
+
28 //
+
29 // http://www.unicode.org/
+
30 // http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c
+
31 // http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h
+
32 // http://people.w3.org/rishida/scripts/uniview/conversion
+
33 //
+
35 
+
36 
+
38 template <typename In>
+
39 In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
+
40 {
+
41  // Some useful precomputed data
+
42  static const int trailing[256] =
+
43  {
+
44  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
45  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
46  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
47  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
48  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
49  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
50  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
51  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
+
52  };
+
53  static const Uint32 offsets[6] =
+
54  {
+
55  0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080
+
56  };
+
57 
+
58  // decode the character
+
59  int trailingBytes = trailing[static_cast<Uint8>(*begin)];
+
60  if (begin + trailingBytes < end)
+
61  {
+
62  output = 0;
+
63  switch (trailingBytes)
+
64  {
+
65  case 5 : output += static_cast<Uint8>(*begin++); output <<= 6;
+
66  case 4 : output += static_cast<Uint8>(*begin++); output <<= 6;
+
67  case 3 : output += static_cast<Uint8>(*begin++); output <<= 6;
+
68  case 2 : output += static_cast<Uint8>(*begin++); output <<= 6;
+
69  case 1 : output += static_cast<Uint8>(*begin++); output <<= 6;
+
70  case 0 : output += static_cast<Uint8>(*begin++);
+
71  }
+
72  output -= offsets[trailingBytes];
+
73  }
+
74  else
+
75  {
+
76  // Incomplete character
+
77  begin = end;
+
78  output = replacement;
+
79  }
+
80 
+
81  return begin;
+
82 }
+
83 
+
84 
+
86 template <typename Out>
+
87 Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
+
88 {
+
89  // Some useful precomputed data
+
90  static const Uint8 firstBytes[7] =
+
91  {
+
92  0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
+
93  };
+
94 
+
95  // encode the character
+
96  if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF)))
+
97  {
+
98  // Invalid character
+
99  if (replacement)
+
100  *output++ = replacement;
+
101  }
+
102  else
+
103  {
+
104  // Valid character
+
105 
+
106  // Get the number of bytes to write
+
107  std::size_t bytestoWrite = 1;
+
108  if (input < 0x80) bytestoWrite = 1;
+
109  else if (input < 0x800) bytestoWrite = 2;
+
110  else if (input < 0x10000) bytestoWrite = 3;
+
111  else if (input <= 0x0010FFFF) bytestoWrite = 4;
+
112 
+
113  // Extract the bytes to write
+
114  Uint8 bytes[4];
+
115  switch (bytestoWrite)
+
116  {
+
117  case 4 : bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
+
118  case 3 : bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
+
119  case 2 : bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
+
120  case 1 : bytes[0] = static_cast<Uint8> (input | firstBytes[bytestoWrite]);
+
121  }
+
122 
+
123  // Add them to the output
+
124  output = std::copy(bytes, bytes + bytestoWrite, output);
+
125  }
+
126 
+
127  return output;
+
128 }
+
129 
+
130 
+
132 template <typename In>
+
133 In Utf<8>::next(In begin, In end)
+
134 {
+
135  Uint32 codepoint;
+
136  return decode(begin, end, codepoint);
+
137 }
+
138 
+
139 
+
141 template <typename In>
+
142 std::size_t Utf<8>::count(In begin, In end)
+
143 {
+
144  std::size_t length = 0;
+
145  while (begin < end)
+
146  {
+
147  begin = next(begin, end);
+
148  ++length;
+
149  }
+
150 
+
151  return length;
+
152 }
+
153 
+
154 
+
156 template <typename In, typename Out>
+
157 Out Utf<8>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
+
158 {
+
159  while (begin < end)
+
160  {
+
161  Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
+
162  output = encode(codepoint, output);
+
163  }
+
164 
+
165  return output;
+
166 }
+
167 
+
168 
+
170 template <typename In, typename Out>
+
171 Out Utf<8>::fromWide(In begin, In end, Out output)
+
172 {
+
173  while (begin < end)
+
174  {
+
175  Uint32 codepoint = Utf<32>::decodeWide(*begin++);
+
176  output = encode(codepoint, output);
+
177  }
+
178 
+
179  return output;
+
180 }
+
181 
+
182 
+
184 template <typename In, typename Out>
+
185 Out Utf<8>::fromLatin1(In begin, In end, Out output)
+
186 {
+
187  // Latin-1 is directly compatible with Unicode encodings,
+
188  // and can thus be treated as (a sub-range of) UTF-32
+
189  while (begin < end)
+
190  output = encode(*begin++, output);
+
191 
+
192  return output;
+
193 }
+
194 
+
195 
+
197 template <typename In, typename Out>
+
198 Out Utf<8>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
+
199 {
+
200  while (begin < end)
+
201  {
+
202  Uint32 codepoint;
+
203  begin = decode(begin, end, codepoint);
+
204  output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
+
205  }
+
206 
+
207  return output;
+
208 }
+
209 
+
210 
+
212 template <typename In, typename Out>
+
213 Out Utf<8>::toWide(In begin, In end, Out output, wchar_t replacement)
+
214 {
+
215  while (begin < end)
+
216  {
+
217  Uint32 codepoint;
+
218  begin = decode(begin, end, codepoint);
+
219  output = Utf<32>::encodeWide(codepoint, output, replacement);
+
220  }
+
221 
+
222  return output;
+
223 }
+
224 
+
225 
+
227 template <typename In, typename Out>
+
228 Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement)
+
229 {
+
230  // Latin-1 is directly compatible with Unicode encodings,
+
231  // and can thus be treated as (a sub-range of) UTF-32
+
232  while (begin < end)
+
233  {
+
234  Uint32 codepoint;
+
235  begin = decode(begin, end, codepoint);
+
236  *output++ = codepoint < 256 ? static_cast<char>(codepoint) : replacement;
+
237  }
+
238 
+
239  return output;
+
240 }
+
241 
+
242 
+
244 template <typename In, typename Out>
+
245 Out Utf<8>::toUtf8(In begin, In end, Out output)
+
246 {
+
247  return std::copy(begin, end, output);
+
248 }
+
249 
+
250 
+
252 template <typename In, typename Out>
+
253 Out Utf<8>::toUtf16(In begin, In end, Out output)
+
254 {
+
255  while (begin < end)
+
256  {
+
257  Uint32 codepoint;
+
258  begin = decode(begin, end, codepoint);
+
259  output = Utf<16>::encode(codepoint, output);
+
260  }
+
261 
+
262  return output;
+
263 }
+
264 
+
265 
+
267 template <typename In, typename Out>
+
268 Out Utf<8>::toUtf32(In begin, In end, Out output)
+
269 {
+
270  while (begin < end)
+
271  {
+
272  Uint32 codepoint;
+
273  begin = decode(begin, end, codepoint);
+
274  *output++ = codepoint;
+
275  }
+
276 
+
277  return output;
+
278 }
+
279 
+
280 
+
282 template <typename In>
+
283 In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
+
284 {
+
285  Uint16 first = *begin++;
+
286 
+
287  // If it's a surrogate pair, first convert to a single UTF-32 character
+
288  if ((first >= 0xD800) && (first <= 0xDBFF))
+
289  {
+
290  if (begin < end)
+
291  {
+
292  Uint32 second = *begin++;
+
293  if ((second >= 0xDC00) && (second <= 0xDFFF))
+
294  {
+
295  // The second element is valid: convert the two elements to a UTF-32 character
+
296  output = static_cast<Uint32>(((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000);
+
297  }
+
298  else
+
299  {
+
300  // Invalid character
+
301  output = replacement;
+
302  }
+
303  }
+
304  else
+
305  {
+
306  // Invalid character
+
307  begin = end;
+
308  output = replacement;
+
309  }
+
310  }
+
311  else
+
312  {
+
313  // We can make a direct copy
+
314  output = first;
+
315  }
+
316 
+
317  return begin;
+
318 }
+
319 
+
320 
+
322 template <typename Out>
+
323 Out Utf<16>::encode(Uint32 input, Out output, Uint16 replacement)
+
324 {
+
325  if (input < 0xFFFF)
+
326  {
+
327  // The character can be copied directly, we just need to check if it's in the valid range
+
328  if ((input >= 0xD800) && (input <= 0xDFFF))
+
329  {
+
330  // Invalid character (this range is reserved)
+
331  if (replacement)
+
332  *output++ = replacement;
+
333  }
+
334  else
+
335  {
+
336  // Valid character directly convertible to a single UTF-16 character
+
337  *output++ = static_cast<Uint16>(input);
+
338  }
+
339  }
+
340  else if (input > 0x0010FFFF)
+
341  {
+
342  // Invalid character (greater than the maximum unicode value)
+
343  if (replacement)
+
344  *output++ = replacement;
+
345  }
+
346  else
+
347  {
+
348  // The input character will be converted to two UTF-16 elements
+
349  input -= 0x0010000;
+
350  *output++ = static_cast<Uint16>((input >> 10) + 0xD800);
+
351  *output++ = static_cast<Uint16>((input & 0x3FFUL) + 0xDC00);
+
352  }
+
353 
+
354  return output;
+
355 }
+
356 
+
357 
+
359 template <typename In>
+
360 In Utf<16>::next(In begin, In end)
+
361 {
+
362  Uint32 codepoint;
+
363  return decode(begin, end, codepoint);
+
364 }
+
365 
+
366 
+
368 template <typename In>
+
369 std::size_t Utf<16>::count(In begin, In end)
+
370 {
+
371  std::size_t length = 0;
+
372  while (begin < end)
+
373  {
+
374  begin = next(begin, end);
+
375  ++length;
+
376  }
+
377 
+
378  return length;
+
379 }
+
380 
+
381 
+
383 template <typename In, typename Out>
+
384 Out Utf<16>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
+
385 {
+
386  while (begin < end)
+
387  {
+
388  Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale);
+
389  output = encode(codepoint, output);
+
390  }
+
391 
+
392  return output;
+
393 }
+
394 
+
395 
+
397 template <typename In, typename Out>
+
398 Out Utf<16>::fromWide(In begin, In end, Out output)
+
399 {
+
400  while (begin < end)
+
401  {
+
402  Uint32 codepoint = Utf<32>::decodeWide(*begin++);
+
403  output = encode(codepoint, output);
+
404  }
+
405 
+
406  return output;
+
407 }
+
408 
+
409 
+
411 template <typename In, typename Out>
+
412 Out Utf<16>::fromLatin1(In begin, In end, Out output)
+
413 {
+
414  // Latin-1 is directly compatible with Unicode encodings,
+
415  // and can thus be treated as (a sub-range of) UTF-32
+
416  return std::copy(begin, end, output);
+
417 }
+
418 
+
419 
+
421 template <typename In, typename Out>
+
422 Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
+
423 {
+
424  while (begin < end)
+
425  {
+
426  Uint32 codepoint;
+
427  begin = decode(begin, end, codepoint);
+
428  output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale);
+
429  }
+
430 
+
431  return output;
+
432 }
+
433 
+
434 
+
436 template <typename In, typename Out>
+
437 Out Utf<16>::toWide(In begin, In end, Out output, wchar_t replacement)
+
438 {
+
439  while (begin < end)
+
440  {
+
441  Uint32 codepoint;
+
442  begin = decode(begin, end, codepoint);
+
443  output = Utf<32>::encodeWide(codepoint, output, replacement);
+
444  }
+
445 
+
446  return output;
+
447 }
+
448 
+
449 
+
451 template <typename In, typename Out>
+
452 Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement)
+
453 {
+
454  // Latin-1 is directly compatible with Unicode encodings,
+
455  // and can thus be treated as (a sub-range of) UTF-32
+
456  while (begin < end)
+
457  {
+
458  *output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
+
459  begin++;
+
460  }
+
461 
+
462  return output;
+
463 }
+
464 
+
465 
+
467 template <typename In, typename Out>
+
468 Out Utf<16>::toUtf8(In begin, In end, Out output)
+
469 {
+
470  while (begin < end)
+
471  {
+
472  Uint32 codepoint;
+
473  begin = decode(begin, end, codepoint);
+
474  output = Utf<8>::encode(codepoint, output);
+
475  }
+
476 
+
477  return output;
+
478 }
+
479 
+
480 
+
482 template <typename In, typename Out>
+
483 Out Utf<16>::toUtf16(In begin, In end, Out output)
+
484 {
+
485  return std::copy(begin, end, output);
+
486 }
+
487 
+
488 
+
490 template <typename In, typename Out>
+
491 Out Utf<16>::toUtf32(In begin, In end, Out output)
+
492 {
+
493  while (begin < end)
+
494  {
+
495  Uint32 codepoint;
+
496  begin = decode(begin, end, codepoint);
+
497  *output++ = codepoint;
+
498  }
+
499 
+
500  return output;
+
501 }
+
502 
+
503 
+
505 template <typename In>
+
506 In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/)
+
507 {
+
508  output = *begin++;
+
509  return begin;
+
510 }
+
511 
+
512 
+
514 template <typename Out>
+
515 Out Utf<32>::encode(Uint32 input, Out output, Uint32 /*replacement*/)
+
516 {
+
517  *output++ = input;
+
518  return output;
+
519 }
+
520 
+
521 
+
523 template <typename In>
+
524 In Utf<32>::next(In begin, In /*end*/)
+
525 {
+
526  return ++begin;
+
527 }
+
528 
+
529 
+
531 template <typename In>
+
532 std::size_t Utf<32>::count(In begin, In end)
+
533 {
+
534  return begin - end;
+
535 }
+
536 
+
537 
+
539 template <typename In, typename Out>
+
540 Out Utf<32>::fromAnsi(In begin, In end, Out output, const std::locale& locale)
+
541 {
+
542  while (begin < end)
+
543  *output++ = decodeAnsi(*begin++, locale);
+
544 
+
545  return output;
+
546 }
+
547 
+
548 
+
550 template <typename In, typename Out>
+
551 Out Utf<32>::fromWide(In begin, In end, Out output)
+
552 {
+
553  while (begin < end)
+
554  *output++ = decodeWide(*begin++);
+
555 
+
556  return output;
+
557 }
+
558 
+
559 
+
561 template <typename In, typename Out>
+
562 Out Utf<32>::fromLatin1(In begin, In end, Out output)
+
563 {
+
564  // Latin-1 is directly compatible with Unicode encodings,
+
565  // and can thus be treated as (a sub-range of) UTF-32
+
566  return std::copy(begin, end, output);
+
567 }
+
568 
+
569 
+
571 template <typename In, typename Out>
+
572 Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale)
+
573 {
+
574  while (begin < end)
+
575  output = encodeAnsi(*begin++, output, replacement, locale);
+
576 
+
577  return output;
+
578 }
+
579 
+
580 
+
582 template <typename In, typename Out>
+
583 Out Utf<32>::toWide(In begin, In end, Out output, wchar_t replacement)
+
584 {
+
585  while (begin < end)
+
586  output = encodeWide(*begin++, output, replacement);
+
587 
+
588  return output;
+
589 }
+
590 
+
591 
+
593 template <typename In, typename Out>
+
594 Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement)
+
595 {
+
596  // Latin-1 is directly compatible with Unicode encodings,
+
597  // and can thus be treated as (a sub-range of) UTF-32
+
598  while (begin < end)
+
599  {
+
600  *output++ = *begin < 256 ? static_cast<char>(*begin) : replacement;
+
601  begin++;
+
602  }
+
603 
+
604  return output;
+
605 }
+
606 
+
607 
+
609 template <typename In, typename Out>
+
610 Out Utf<32>::toUtf8(In begin, In end, Out output)
+
611 {
+
612  while (begin < end)
+
613  output = Utf<8>::encode(*begin++, output);
+
614 
+
615  return output;
+
616 }
+
617 
+
619 template <typename In, typename Out>
+
620 Out Utf<32>::toUtf16(In begin, In end, Out output)
+
621 {
+
622  while (begin < end)
+
623  output = Utf<16>::encode(*begin++, output);
+
624 
+
625  return output;
+
626 }
+
627 
+
628 
+
630 template <typename In, typename Out>
+
631 Out Utf<32>::toUtf32(In begin, In end, Out output)
+
632 {
+
633  return std::copy(begin, end, output);
+
634 }
+
635 
+
636 
+
638 template <typename In>
+
639 Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale)
+
640 {
+
641  // On Windows, gcc's standard library (glibc++) has almost
+
642  // no support for Unicode stuff. As a consequence, in this
+
643  // context we can only use the default locale and ignore
+
644  // the one passed as parameter.
+
645 
+
646  #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \
+
647  (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
+
648  !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
+
649 
+
650  (void)locale; // to avoid warnings
+
651 
+
652  wchar_t character = 0;
+
653  mbtowc(&character, &input, 1);
+
654  return static_cast<Uint32>(character);
+
655 
+
656  #else
+
657 
+
658  // Get the facet of the locale which deals with character conversion
+
659  const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
+
660 
+
661  // Use the facet to convert each character of the input string
+
662  return static_cast<Uint32>(facet.widen(input));
+
663 
+
664  #endif
+
665 }
+
666 
+
667 
+
669 template <typename In>
+
670 Uint32 Utf<32>::decodeWide(In input)
+
671 {
+
672  // The encoding of wide characters is not well defined and is left to the system;
+
673  // however we can safely assume that it is UCS-2 on Windows and
+
674  // UCS-4 on Unix systems.
+
675  // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4,
+
676  // and UCS-4 *is* UTF-32).
+
677 
+
678  return input;
+
679 }
+
680 
+
681 
+
683 template <typename Out>
+
684 Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale)
+
685 {
+
686  // On Windows, gcc's standard library (glibc++) has almost
+
687  // no support for Unicode stuff. As a consequence, in this
+
688  // context we can only use the default locale and ignore
+
689  // the one passed as parameter.
+
690 
+
691  #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \
+
692  (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \
+
693  !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */
+
694 
+
695  (void)locale; // to avoid warnings
+
696 
+
697  char character = 0;
+
698  if (wctomb(&character, static_cast<wchar_t>(codepoint)) >= 0)
+
699  *output++ = character;
+
700  else if (replacement)
+
701  *output++ = replacement;
+
702 
+
703  return output;
+
704 
+
705  #else
+
706 
+
707  // Get the facet of the locale which deals with character conversion
+
708  const std::ctype<wchar_t>& facet = std::use_facet< std::ctype<wchar_t> >(locale);
+
709 
+
710  // Use the facet to convert each character of the input string
+
711  *output++ = facet.narrow(static_cast<wchar_t>(codepoint), replacement);
+
712 
+
713  return output;
+
714 
+
715  #endif
+
716 }
+
717 
+
718 
+
720 template <typename Out>
+
721 Out Utf<32>::encodeWide(Uint32 codepoint, Out output, wchar_t replacement)
+
722 {
+
723  // The encoding of wide characters is not well defined and is left to the system;
+
724  // however we can safely assume that it is UCS-2 on Windows and
+
725  // UCS-4 on Unix systems.
+
726  // For UCS-2 we need to check if the source characters fits in (UCS-2 is a subset of UCS-4).
+
727  // For UCS-4 we can do a direct copy (UCS-4 *is* UTF-32).
+
728 
+
729  switch (sizeof(wchar_t))
+
730  {
+
731  case 4:
+
732  {
+
733  *output++ = static_cast<wchar_t>(codepoint);
+
734  break;
+
735  }
+
736 
+
737  default:
+
738  {
+
739  if ((codepoint <= 0xFFFF) && ((codepoint < 0xD800) || (codepoint > 0xDFFF)))
+
740  {
+
741  *output++ = static_cast<wchar_t>(codepoint);
+
742  }
+
743  else if (replacement)
+
744  {
+
745  *output++ = replacement;
+
746  }
+
747  break;
+
748  }
+
749  }
+
750 
+
751  return output;
+
752 }
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Vector2_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Vector2_8hpp_source.htm new file mode 100644 index 0000000..c2690aa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Vector2_8hpp_source.htm @@ -0,0 +1,143 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Vector2.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VECTOR2_HPP
+
26 #define SFML_VECTOR2_HPP
+
27 
+
28 
+
29 namespace sf
+
30 {
+
36 template <typename T>
+
37 class Vector2
+
38 {
+
39 public :
+
40 
+
47  Vector2();
+
48 
+
56  Vector2(T X, T Y);
+
57 
+
69  template <typename U>
+
70  explicit Vector2(const Vector2<U>& vector);
+
71 
+
73  // Member data
+
75  T x;
+
76  T y;
+
77 };
+
78 
+
88 template <typename T>
+
89 Vector2<T> operator -(const Vector2<T>& right);
+
90 
+
104 template <typename T>
+
105 Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right);
+
106 
+
120 template <typename T>
+
121 Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right);
+
122 
+
133 template <typename T>
+
134 Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right);
+
135 
+
146 template <typename T>
+
147 Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right);
+
148 
+
159 template <typename T>
+
160 Vector2<T> operator *(const Vector2<T>& left, T right);
+
161 
+
172 template <typename T>
+
173 Vector2<T> operator *(T left, const Vector2<T>& right);
+
174 
+
188 template <typename T>
+
189 Vector2<T>& operator *=(Vector2<T>& left, T right);
+
190 
+
201 template <typename T>
+
202 Vector2<T> operator /(const Vector2<T>& left, T right);
+
203 
+
217 template <typename T>
+
218 Vector2<T>& operator /=(Vector2<T>& left, T right);
+
219 
+
232 template <typename T>
+
233 bool operator ==(const Vector2<T>& left, const Vector2<T>& right);
+
234 
+
247 template <typename T>
+
248 bool operator !=(const Vector2<T>& left, const Vector2<T>& right);
+
249 
+
250 #include <SFML/System/Vector2.inl>
+
251 
+
252 // Define the most common types
+
253 typedef Vector2<int> Vector2i;
+ +
255 typedef Vector2<float> Vector2f;
+
256 
+
257 } // namespace sf
+
258 
+
259 
+
260 #endif // SFML_VECTOR2_HPP
+
261 
+
262 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Vector2_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Vector2_8inl_source.htm new file mode 100644 index 0000000..33ea8c4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Vector2_8inl_source.htm @@ -0,0 +1,193 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Vector2.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 
+
27 template <typename T>
+
28 inline Vector2<T>::Vector2() :
+
29 x(0),
+
30 y(0)
+
31 {
+
32 
+
33 }
+
34 
+
35 
+
37 template <typename T>
+
38 inline Vector2<T>::Vector2(T X, T Y) :
+
39 x(X),
+
40 y(Y)
+
41 {
+
42 
+
43 }
+
44 
+
45 
+
47 template <typename T>
+
48 template <typename U>
+
49 inline Vector2<T>::Vector2(const Vector2<U>& vector) :
+
50 x(static_cast<T>(vector.x)),
+
51 y(static_cast<T>(vector.y))
+
52 {
+
53 }
+
54 
+
55 
+
57 template <typename T>
+
58 inline Vector2<T> operator -(const Vector2<T>& right)
+
59 {
+
60  return Vector2<T>(-right.x, -right.y);
+
61 }
+
62 
+
63 
+
65 template <typename T>
+
66 inline Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right)
+
67 {
+
68  left.x += right.x;
+
69  left.y += right.y;
+
70 
+
71  return left;
+
72 }
+
73 
+
74 
+
76 template <typename T>
+
77 inline Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right)
+
78 {
+
79  left.x -= right.x;
+
80  left.y -= right.y;
+
81 
+
82  return left;
+
83 }
+
84 
+
85 
+
87 template <typename T>
+
88 inline Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right)
+
89 {
+
90  return Vector2<T>(left.x + right.x, left.y + right.y);
+
91 }
+
92 
+
93 
+
95 template <typename T>
+
96 inline Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right)
+
97 {
+
98  return Vector2<T>(left.x - right.x, left.y - right.y);
+
99 }
+
100 
+
101 
+
103 template <typename T>
+
104 inline Vector2<T> operator *(const Vector2<T>& left, T right)
+
105 {
+
106  return Vector2<T>(left.x * right, left.y * right);
+
107 }
+
108 
+
109 
+
111 template <typename T>
+
112 inline Vector2<T> operator *(T left, const Vector2<T>& right)
+
113 {
+
114  return Vector2<T>(right.x * left, right.y * left);
+
115 }
+
116 
+
117 
+
119 template <typename T>
+
120 inline Vector2<T>& operator *=(Vector2<T>& left, T right)
+
121 {
+
122  left.x *= right;
+
123  left.y *= right;
+
124 
+
125  return left;
+
126 }
+
127 
+
128 
+
130 template <typename T>
+
131 inline Vector2<T> operator /(const Vector2<T>& left, T right)
+
132 {
+
133  return Vector2<T>(left.x / right, left.y / right);
+
134 }
+
135 
+
136 
+
138 template <typename T>
+
139 inline Vector2<T>& operator /=(Vector2<T>& left, T right)
+
140 {
+
141  left.x /= right;
+
142  left.y /= right;
+
143 
+
144  return left;
+
145 }
+
146 
+
147 
+
149 template <typename T>
+
150 inline bool operator ==(const Vector2<T>& left, const Vector2<T>& right)
+
151 {
+
152  return (left.x == right.x) && (left.y == right.y);
+
153 }
+
154 
+
155 
+
157 template <typename T>
+
158 inline bool operator !=(const Vector2<T>& left, const Vector2<T>& right)
+
159 {
+
160  return (left.x != right.x) || (left.y != right.y);
+
161 }
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Vector3_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Vector3_8hpp_source.htm new file mode 100644 index 0000000..1231740 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Vector3_8hpp_source.htm @@ -0,0 +1,143 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Vector3.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VECTOR3_HPP
+
26 #define SFML_VECTOR3_HPP
+
27 
+
28 
+
29 namespace sf
+
30 {
+
36 template <typename T>
+
37 class Vector3
+
38 {
+
39 public :
+
40 
+
47  Vector3();
+
48 
+
57  Vector3(T X, T Y, T Z);
+
58 
+
70  template <typename U>
+
71  explicit Vector3(const Vector3<U>& vector);
+
72 
+
74  // Member data
+
76  T x;
+
77  T y;
+
78  T z;
+
79 };
+
80 
+
90 template <typename T>
+
91 Vector3<T> operator -(const Vector3<T>& left);
+
92 
+
106 template <typename T>
+
107 Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right);
+
108 
+
122 template <typename T>
+
123 Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right);
+
124 
+
135 template <typename T>
+
136 Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right);
+
137 
+
148 template <typename T>
+
149 Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right);
+
150 
+
161 template <typename T>
+
162 Vector3<T> operator *(const Vector3<T>& left, T right);
+
163 
+
174 template <typename T>
+
175 Vector3<T> operator *(T left, const Vector3<T>& right);
+
176 
+
190 template <typename T>
+
191 Vector3<T>& operator *=(Vector3<T>& left, T right);
+
192 
+
203 template <typename T>
+
204 Vector3<T> operator /(const Vector3<T>& left, T right);
+
205 
+
219 template <typename T>
+
220 Vector3<T>& operator /=(Vector3<T>& left, T right);
+
221 
+
234 template <typename T>
+
235 bool operator ==(const Vector3<T>& left, const Vector3<T>& right);
+
236 
+
249 template <typename T>
+
250 bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
+
251 
+
252 #include <SFML/System/Vector3.inl>
+
253 
+
254 // Define the most common types
+
255 typedef Vector3<int> Vector3i;
+
256 typedef Vector3<float> Vector3f;
+
257 
+
258 } // namespace sf
+
259 
+
260 
+
261 #endif // SFML_VECTOR3_HPP
+
262 
+
263 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Vector3_8inl_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Vector3_8inl_source.htm new file mode 100644 index 0000000..ef0a1c1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Vector3_8inl_source.htm @@ -0,0 +1,200 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Vector3.inl
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 
+
27 template <typename T>
+
28 inline Vector3<T>::Vector3() :
+
29 x(0),
+
30 y(0),
+
31 z(0)
+
32 {
+
33 
+
34 }
+
35 
+
36 
+
38 template <typename T>
+
39 inline Vector3<T>::Vector3(T X, T Y, T Z) :
+
40 x(X),
+
41 y(Y),
+
42 z(Z)
+
43 {
+
44 
+
45 }
+
46 
+
47 
+
49 template <typename T>
+
50 template <typename U>
+
51 inline Vector3<T>::Vector3(const Vector3<U>& vector) :
+
52 x(static_cast<T>(vector.x)),
+
53 y(static_cast<T>(vector.y)),
+
54 z(static_cast<T>(vector.z))
+
55 {
+
56 }
+
57 
+
58 
+
60 template <typename T>
+
61 inline Vector3<T> operator -(const Vector3<T>& left)
+
62 {
+
63  return Vector3<T>(-left.x, -left.y, -left.z);
+
64 }
+
65 
+
66 
+
68 template <typename T>
+
69 inline Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right)
+
70 {
+
71  left.x += right.x;
+
72  left.y += right.y;
+
73  left.z += right.z;
+
74 
+
75  return left;
+
76 }
+
77 
+
78 
+
80 template <typename T>
+
81 inline Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right)
+
82 {
+
83  left.x -= right.x;
+
84  left.y -= right.y;
+
85  left.z -= right.z;
+
86 
+
87  return left;
+
88 }
+
89 
+
90 
+
92 template <typename T>
+
93 inline Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right)
+
94 {
+
95  return Vector3<T>(left.x + right.x, left.y + right.y, left.z + right.z);
+
96 }
+
97 
+
98 
+
100 template <typename T>
+
101 inline Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right)
+
102 {
+
103  return Vector3<T>(left.x - right.x, left.y - right.y, left.z - right.z);
+
104 }
+
105 
+
106 
+
108 template <typename T>
+
109 inline Vector3<T> operator *(const Vector3<T>& left, T right)
+
110 {
+
111  return Vector3<T>(left.x * right, left.y * right, left.z * right);
+
112 }
+
113 
+
114 
+
116 template <typename T>
+
117 inline Vector3<T> operator *(T left, const Vector3<T>& right)
+
118 {
+
119  return Vector3<T>(right.x * left, right.y * left, right.z * left);
+
120 }
+
121 
+
122 
+
124 template <typename T>
+
125 inline Vector3<T>& operator *=(Vector3<T>& left, T right)
+
126 {
+
127  left.x *= right;
+
128  left.y *= right;
+
129  left.z *= right;
+
130 
+
131  return left;
+
132 }
+
133 
+
134 
+
136 template <typename T>
+
137 inline Vector3<T> operator /(const Vector3<T>& left, T right)
+
138 {
+
139  return Vector3<T>(left.x / right, left.y / right, left.z / right);
+
140 }
+
141 
+
142 
+
144 template <typename T>
+
145 inline Vector3<T>& operator /=(Vector3<T>& left, T right)
+
146 {
+
147  left.x /= right;
+
148  left.y /= right;
+
149  left.z /= right;
+
150 
+
151  return left;
+
152 }
+
153 
+
154 
+
156 template <typename T>
+
157 inline bool operator ==(const Vector3<T>& left, const Vector3<T>& right)
+
158 {
+
159  return (left.x == right.x) && (left.y == right.y) && (left.z == right.z);
+
160 }
+
161 
+
162 
+
164 template <typename T>
+
165 inline bool operator !=(const Vector3<T>& left, const Vector3<T>& right)
+
166 {
+
167  return (left.x != right.x) || (left.y != right.y) || (left.z != right.z);
+
168 }
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/VertexArray_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/VertexArray_8hpp_source.htm new file mode 100644 index 0000000..1ffd346 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/VertexArray_8hpp_source.htm @@ -0,0 +1,128 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
VertexArray.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VERTEXARRAY_HPP
+
26 #define SFML_VERTEXARRAY_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Vertex.hpp>
+
33 #include <SFML/Graphics/PrimitiveType.hpp>
+
34 #include <SFML/Graphics/Rect.hpp>
+
35 #include <SFML/Graphics/Drawable.hpp>
+
36 #include <vector>
+
37 
+
38 
+
39 namespace sf
+
40 {
+
45 class SFML_GRAPHICS_API VertexArray : public Drawable
+
46 {
+
47 public :
+
48 
+
55  VertexArray();
+
56 
+
64  explicit VertexArray(PrimitiveType type, unsigned int vertexCount = 0);
+
65 
+
72  unsigned int getVertexCount() const;
+
73 
+
88  Vertex& operator [](unsigned int index);
+
89 
+
104  const Vertex& operator [](unsigned int index) const;
+
105 
+
115  void clear();
+
116 
+
129  void resize(unsigned int vertexCount);
+
130 
+
137  void append(const Vertex& vertex);
+
138 
+
153  void setPrimitiveType(PrimitiveType type);
+
154 
+
161  PrimitiveType getPrimitiveType() const;
+
162 
+
172  FloatRect getBounds() const;
+
173 
+
174 private :
+
175 
+
183  virtual void draw(RenderTarget& target, RenderStates states) const;
+
184 
+
185 private:
+
186 
+
188  // Member data
+
190  std::vector<Vertex> m_vertices;
+
191  PrimitiveType m_primitiveType;
+
192 };
+
193 
+
194 } // namespace sf
+
195 
+
196 
+
197 #endif // SFML_VERTEXARRAY_HPP
+
198 
+
199 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Vertex_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Vertex_8hpp_source.htm new file mode 100644 index 0000000..0c7954a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Vertex_8hpp_source.htm @@ -0,0 +1,108 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Vertex.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VERTEX_HPP
+
26 #define SFML_VERTEX_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Color.hpp>
+
33 #include <SFML/System/Vector2.hpp>
+
34 
+
35 
+
36 namespace sf
+
37 {
+
42 class SFML_GRAPHICS_API Vertex
+
43 {
+
44 public :
+
45 
+
50  Vertex();
+
51 
+
60  Vertex(const Vector2f& thePosition);
+
61 
+
71  Vertex(const Vector2f& thePosition, const Color& theColor);
+
72 
+
82  Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords);
+
83 
+
92  Vertex(const Vector2f& thePosition, const Color& theColor, const Vector2f& theTexCoords);
+
93 
+
95  // Member data
+ + + +
100 };
+
101 
+
102 } // namespace sf
+
103 
+
104 
+
105 #endif // SFML_VERTEX_HPP
+
106 
+
107 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/VideoMode_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/VideoMode_8hpp_source.htm new file mode 100644 index 0000000..a6fa4a9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/VideoMode_8hpp_source.htm @@ -0,0 +1,119 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
VideoMode.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VIDEOMODE_HPP
+
26 #define SFML_VIDEOMODE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 #include <vector>
+
33 
+
34 
+
35 namespace sf
+
36 {
+
41 class SFML_WINDOW_API VideoMode
+
42 {
+
43 public :
+
44 
+
51  VideoMode();
+
52 
+
61  VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel = 32);
+
62 
+
69  static VideoMode getDesktopMode();
+
70 
+
85  static const std::vector<VideoMode>& getFullscreenModes();
+
86 
+
97  bool isValid() const;
+
98 
+
100  // Member data
+
102  unsigned int width;
+
103  unsigned int height;
+
104  unsigned int bitsPerPixel;
+
105 };
+
106 
+
117 SFML_WINDOW_API bool operator ==(const VideoMode& left, const VideoMode& right);
+
118 
+
129 SFML_WINDOW_API bool operator !=(const VideoMode& left, const VideoMode& right);
+
130 
+
141 SFML_WINDOW_API bool operator <(const VideoMode& left, const VideoMode& right);
+
142 
+
153 SFML_WINDOW_API bool operator >(const VideoMode& left, const VideoMode& right);
+
154 
+
165 SFML_WINDOW_API bool operator <=(const VideoMode& left, const VideoMode& right);
+
166 
+
177 SFML_WINDOW_API bool operator >=(const VideoMode& left, const VideoMode& right);
+
178 
+
179 } // namespace sf
+
180 
+
181 
+
182 #endif // SFML_VIDEOMODE_HPP
+
183 
+
184 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/View_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/View_8hpp_source.htm new file mode 100644 index 0000000..7d6e68b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/View_8hpp_source.htm @@ -0,0 +1,146 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
View.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_VIEW_HPP
+
26 #define SFML_VIEW_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Graphics/Export.hpp>
+
32 #include <SFML/Graphics/Rect.hpp>
+
33 #include <SFML/Graphics/Transform.hpp>
+
34 #include <SFML/System/Vector2.hpp>
+
35 
+
36 
+
37 namespace sf
+
38 {
+
43 class SFML_GRAPHICS_API View
+
44 {
+
45 public :
+
46 
+
53  View();
+
54 
+
61  explicit View(const FloatRect& rectangle);
+
62 
+
70  View(const Vector2f& center, const Vector2f& size);
+
71 
+
81  void setCenter(float x, float y);
+
82 
+
91  void setCenter(const Vector2f& center);
+
92 
+
102  void setSize(float width, float height);
+
103 
+
112  void setSize(const Vector2f& size);
+
113 
+
124  void setRotation(float angle);
+
125 
+
141  void setViewport(const FloatRect& viewport);
+
142 
+
153  void reset(const FloatRect& rectangle);
+
154 
+
163  const Vector2f& getCenter() const;
+
164 
+
173  const Vector2f& getSize() const;
+
174 
+
183  float getRotation() const;
+
184 
+
193  const FloatRect& getViewport() const;
+
194 
+
204  void move(float offsetX, float offsetY);
+
205 
+
214  void move(const Vector2f& offset);
+
215 
+
224  void rotate(float angle);
+
225 
+
241  void zoom(float factor);
+
242 
+
253  const Transform& getTransform() const;
+
254 
+
265  const Transform& getInverseTransform() const;
+
266 
+
267 private :
+
268 
+
270  // Member data
+
272  Vector2f m_center;
+
273  Vector2f m_size;
+
274  float m_rotation;
+
275  FloatRect m_viewport;
+
276  mutable Transform m_transform;
+
277  mutable Transform m_inverseTransform;
+
278  mutable bool m_transformUpdated;
+
279  mutable bool m_invTransformUpdated;
+
280 };
+
281 
+
282 } // namespace sf
+
283 
+
284 
+
285 #endif // SFML_VIEW_HPP
+
286 
+
287 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/WindowHandle_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/WindowHandle_8hpp_source.htm new file mode 100644 index 0000000..90879dd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/WindowHandle_8hpp_source.htm @@ -0,0 +1,105 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
WindowHandle.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_WINDOWHANDLE_HPP
+
26 #define SFML_WINDOWHANDLE_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 // Windows' HWND is a typedef on struct HWND__*
+
34 #if defined(SFML_SYSTEM_WINDOWS)
+
35  struct HWND__;
+
36 #endif
+
37 
+
38 namespace sf
+
39 {
+
44 #if defined(SFML_SYSTEM_WINDOWS)
+
45 
+
46  // Window handle is HWND (HWND__*) on Windows
+
47  typedef HWND__* WindowHandle;
+
48 
+
49 #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
+
50 
+
51  // Window handle is Window (unsigned long) on Unix - X11
+
52  typedef unsigned long WindowHandle;
+
53 
+
54 #elif defined(SFML_SYSTEM_MACOS)
+
55 
+
56  // Window handle is NSWindow (void*) on Mac OS X - Cocoa
+
57  typedef void* WindowHandle;
+
58 
+
59 #endif
+
60 
+
61 } // namespace sf
+
62 
+
63 
+
64 #endif // SFML_WINDOWHANDLE_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/WindowStyle_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/WindowStyle_8hpp_source.htm new file mode 100644 index 0000000..7e34bd1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/WindowStyle_8hpp_source.htm @@ -0,0 +1,95 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
WindowStyle.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_WINDOWSTYLE_HPP
+
26 #define SFML_WINDOWSTYLE_HPP
+
27 
+
28 
+
29 namespace sf
+
30 {
+
31 namespace Style
+
32 {
+
38  enum
+
39  {
+
40  None = 0,
+
41  Titlebar = 1 << 0,
+
42  Resize = 1 << 1,
+
43  Close = 1 << 2,
+
44  Fullscreen = 1 << 3,
+
45 
+ +
47  };
+
48 }
+
49 
+
50 } // namespace sf
+
51 
+
52 
+
53 #endif // SFML_WINDOWSTYLE_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Window_2Export_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Window_2Export_8hpp_source.htm new file mode 100644 index 0000000..6afc4fb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Window_2Export_8hpp_source.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Window/Export.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_WINDOW_EXPORT_HPP
+
26 #define SFML_WINDOW_EXPORT_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Config.hpp>
+
32 
+
33 
+
35 // Define portable import / export macros
+
37 #if defined(SFML_WINDOW_EXPORTS)
+
38 
+
39  #define SFML_WINDOW_API SFML_API_EXPORT
+
40 
+
41 #else
+
42 
+
43  #define SFML_WINDOW_API SFML_API_IMPORT
+
44 
+
45 #endif
+
46 
+
47 
+
48 #endif // SFML_WINDOW_EXPORT_HPP
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Window_2Window_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Window_2Window_8hpp_source.htm new file mode 100644 index 0000000..3dab402 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Window_2Window_8hpp_source.htm @@ -0,0 +1,179 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Window/Window.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_WINDOW_HPP
+
26 #define SFML_WINDOW_HPP
+
27 
+
29 // Headers
+
31 #include <SFML/Window/Export.hpp>
+
32 #include <SFML/Window/ContextSettings.hpp>
+
33 #include <SFML/Window/VideoMode.hpp>
+
34 #include <SFML/Window/WindowHandle.hpp>
+
35 #include <SFML/Window/WindowStyle.hpp>
+
36 #include <SFML/Window/GlResource.hpp>
+
37 #include <SFML/System/Clock.hpp>
+
38 #include <SFML/System/Vector2.hpp>
+
39 #include <SFML/System/NonCopyable.hpp>
+
40 #include <SFML/System/String.hpp>
+
41 
+
42 
+
43 namespace sf
+
44 {
+
45 namespace priv
+
46 {
+
47  class GlContext;
+
48  class WindowImpl;
+
49 }
+
50 
+
51 class Event;
+
52 
+
57 class SFML_WINDOW_API Window : GlResource, NonCopyable
+
58 {
+
59 public :
+
60 
+
68  Window();
+
69 
+
89  Window(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
+
90 
+
105  explicit Window(WindowHandle handle, const ContextSettings& settings = ContextSettings());
+
106 
+
113  virtual ~Window();
+
114 
+
128  void create(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
+
129 
+
141  void create(WindowHandle handle, const ContextSettings& settings = ContextSettings());
+
142 
+
153  void close();
+
154 
+
165  bool isOpen() const;
+
166 
+
178  const ContextSettings& getSettings() const;
+
179 
+
203  bool pollEvent(Event& event);
+
204 
+
230  bool waitEvent(Event& event);
+
231 
+
240  Vector2i getPosition() const;
+
241 
+
254  void setPosition(const Vector2i& position);
+
255 
+
267  Vector2u getSize() const;
+
268 
+
277  void setSize(const Vector2u size);
+
278 
+
287  void setTitle(const String& title);
+
288 
+
304  void setIcon(unsigned int width, unsigned int height, const Uint8* pixels);
+
305 
+
314  void setVisible(bool visible);
+
315 
+
329  void setVerticalSyncEnabled(bool enabled);
+
330 
+
339  void setMouseCursorVisible(bool visible);
+
340 
+
353  void setKeyRepeatEnabled(bool enabled);
+
354 
+
370  void setFramerateLimit(unsigned int limit);
+
371 
+
383  void setJoystickThreshold(float threshold);
+
384 
+
400  bool setActive(bool active = true) const;
+
401 
+
410  void display();
+
411 
+
424  WindowHandle getSystemHandle() const;
+
425 
+
426 protected :
+
427 
+
436  virtual void onCreate();
+
437 
+
445  virtual void onResize();
+
446 
+
447 private:
+
448 
+
461  bool filterEvent(const Event& event);
+
462 
+
467  void initialize();
+
468 
+
470  // Member data
+
472  priv::WindowImpl* m_impl;
+
473  priv::GlContext* m_context;
+
474  Clock m_clock;
+
475  Time m_frameTimeLimit;
+
476  Vector2u m_size;
+
477 };
+
478 
+
479 } // namespace sf
+
480 
+
481 
+
482 #endif // SFML_WINDOW_HPP
+
483 
+
484 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/Window_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/Window_8hpp_source.htm new file mode 100644 index 0000000..745d06d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/Window_8hpp_source.htm @@ -0,0 +1,90 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
Window.hpp
+
+
+
1 //
+
3 // SFML - Simple and Fast Multimedia Library
+
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+
5 //
+
6 // This software is provided 'as-is', without any express or implied warranty.
+
7 // In no event will the authors be held liable for any damages arising from the use of this software.
+
8 //
+
9 // Permission is granted to anyone to use this software for any purpose,
+
10 // including commercial applications, and to alter it and redistribute it freely,
+
11 // subject to the following restrictions:
+
12 //
+
13 // 1. The origin of this software must not be misrepresented;
+
14 // you must not claim that you wrote the original software.
+
15 // If you use this software in a product, an acknowledgment
+
16 // in the product documentation would be appreciated but is not required.
+
17 //
+
18 // 2. Altered source versions must be plainly marked as such,
+
19 // and must not be misrepresented as being the original software.
+
20 //
+
21 // 3. This notice may not be removed or altered from any source distribution.
+
22 //
+
24 
+
25 #ifndef SFML_SFML_WINDOW_HPP
+
26 #define SFML_SFML_WINDOW_HPP
+
27 
+
29 // Headers
+
31 
+
32 #include <SFML/System.hpp>
+
33 #include <SFML/Window/Context.hpp>
+
34 #include <SFML/Window/ContextSettings.hpp>
+
35 #include <SFML/Window/Event.hpp>
+
36 #include <SFML/Window/Joystick.hpp>
+
37 #include <SFML/Window/Keyboard.hpp>
+
38 #include <SFML/Window/Mouse.hpp>
+
39 #include <SFML/Window/VideoMode.hpp>
+
40 #include <SFML/Window/Window.hpp>
+
41 #include <SFML/Window/WindowStyle.hpp>
+
42 
+
43 
+
44 #endif // SFML_SFML_WINDOW_HPP
+
45 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/annotated.htm b/SFML-2.1-osx-clang-universal/doc/html/annotated.htm new file mode 100644 index 0000000..233533c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/annotated.htm @@ -0,0 +1,134 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
Class List
+
+
+
Here are the classes, structs, unions and interfaces with brief descriptions:
+
[detail level 123]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\Nsf
 oCListenerThe audio listener is the point in the scene from where all the sounds are heard
 oCMusicStreamed music played from an audio file
 oCSoundRegular sound that can be played in the audio environment
 oCSoundBufferStorage for audio samples defining a sound
 oCSoundBufferRecorderSpecialized SoundRecorder which stores the captured audio data into a sound buffer
 oCSoundRecorderAbstract base class for capturing sound data
 oCSoundSourceBase class defining a sound's properties
 oCSoundStreamAbstract base class for streamed audio sources
 |\CChunkStructure defining a chunk of audio data to stream
 oCCircleShapeSpecialized shape representing a circle
 oCColorUtility class for manpulating RGBA colors
 oCConvexShapeSpecialized shape representing a convex polygon
 oCDrawableAbstract base class for objects that can be drawn to a render target
 oCFontClass for loading and manipulating character fonts
 oCGlyphStructure describing a glyph
 oCImageClass for loading, manipulating and saving images
 oCRectUtility class for manipulating 2D axis aligned rectangles
 oCRectangleShapeSpecialized shape representing a rectangle
 oCRenderStatesDefine the states used for drawing to a RenderTarget
 oCRenderTargetBase class for all render targets (window, texture, ...)
 oCRenderTextureTarget for off-screen 2D rendering into a texture
 oCRenderWindowWindow that can serve as a target for 2D drawing
 oCShaderShader class (vertex and fragment)
 |\CCurrentTextureTypeSpecial type/value that can be passed to setParameter, and that represents the texture of the object being drawn
 oCShapeBase class for textured shapes with outline
 oCSpriteDrawable representation of a texture, with its own transformations, color, etc
 oCTextGraphical text that can be drawn to a render target
 oCTextureImage living on the graphics card that can be used for drawing
 oCTransformDefine a 3x3 transform matrix
 oCTransformableDecomposed transform defined by a position, a rotation and a scale
 oCVertexDefine a point with color and texture coordinates
 oCVertexArrayDefine a set of one or more 2D primitives
 oCView2D camera that defines what region is shown on screen
 oCFtpA FTP client
 |oCDirectoryResponseSpecialization of FTP response returning a directory
 |oCListingResponseSpecialization of FTP response returning a filename lisiting
 |\CResponseDefine a FTP response
 oCHttpA HTTP client
 |oCRequestDefine a HTTP request
 |\CResponseDefine a HTTP response
 oCIpAddressEncapsulate an IPv4 network address
 oCPacketUtility class to build blocks of data to transfer over the network
 oCSocketBase class for all the socket types
 oCSocketSelectorMultiplexer that allows to read from multiple sockets
 oCTcpListenerSocket that listens to new TCP connections
 oCTcpSocketSpecialized socket using the TCP protocol
 oCUdpSocketSpecialized socket using the UDP protocol
 oCClockUtility class that measures the elapsed time
 oCInputStreamAbstract class for custom file input streams
 oCLockAutomatic wrapper for locking and unlocking mutexes
 oCMutexBlocks concurrent access to shared resources from multiple threads
 oCNonCopyableUtility class that makes any derived class non-copyable
 oCStringUtility string class that automatically handles conversions between types and encodings
 oCThreadUtility class to manipulate threads
 oCThreadLocalDefines variables with thread-local storage
 oCThreadLocalPtrPointer to a thread-local variable
 oCTimeRepresents a time value
 oCUtfUtility class providing generic functions for UTF conversions
 oCUtf< 8 >Specialization of the Utf template for UTF-8
 oCUtf< 16 >Specialization of the Utf template for UTF-16
 oCUtf< 32 >Specialization of the Utf template for UTF-32
 oCVector2Utility template class for manipulating 2-dimensional vectors
 oCVector3Utility template class for manipulating 3-dimensional vectors
 oCContextClass holding a valid drawing context
 oCContextSettingsStructure defining the settings of the OpenGL context attached to a window
 oCEventDefines a system event and its parameters
 |oCJoystickButtonEventJoystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased)
 |oCJoystickConnectEventJoystick connection events parameters (JoystickConnected, JoystickDisconnected)
 |oCJoystickMoveEventJoystick axis move event parameters (JoystickMoved)
 |oCKeyEventKeyboard event parameters (KeyPressed, KeyReleased)
 |oCMouseButtonEventMouse buttons events parameters (MouseButtonPressed, MouseButtonReleased)
 |oCMouseMoveEventMouse move event parameters (MouseMoved)
 |oCMouseWheelEventMouse wheel events parameters (MouseWheelMoved)
 |oCSizeEventSize events parameters (Resized)
 |\CTextEventText event parameters (TextEntered)
 oCGlResourceBase class for classes that require an OpenGL context
 oCJoystickGive access to the real-time state of the joysticks
 oCKeyboardGive access to the real-time state of the keyboard
 oCMouseGive access to the real-time state of the mouse
 oCVideoModeVideoMode defines a video mode (width, height, bpp)
 \CWindowWindow that serves as a target for OpenGL rendering
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/bc_s.png b/SFML-2.1-osx-clang-universal/doc/html/bc_s.png new file mode 100644 index 0000000..224b29a Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/bc_s.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/bdwn.png b/SFML-2.1-osx-clang-universal/doc/html/bdwn.png new file mode 100644 index 0000000..940a0b9 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/bdwn.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classes.htm b/SFML-2.1-osx-clang-universal/doc/html/classes.htm new file mode 100644 index 0000000..33f1d8b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classes.htm @@ -0,0 +1,96 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
Class Index
+
+
+
C | D | E | F | G | H | I | J | K | L | M | N | P | R | S | T | U | V | W
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
  C  
+
Glyph (sf)   
  M  
+
Http::Response (sf)   ThreadLocal (sf)   
  H  
+
  S  
+
ThreadLocalPtr (sf)   
SoundStream::Chunk (sf)   Mouse (sf)   Time (sf)   
CircleShape (sf)   Http (sf)   Event::MouseButtonEvent (sf)   Shader (sf)   Transform (sf)   
Clock (sf)   
  I  
+
Event::MouseMoveEvent (sf)   Shape (sf)   Transformable (sf)   
Color (sf)   Event::MouseWheelEvent (sf)   Event::SizeEvent (sf)   
  U  
+
Context (sf)   Image (sf)   Music (sf)   Socket (sf)   
ContextSettings (sf)   InputStream (sf)   Mutex (sf)   SocketSelector (sf)   UdpSocket (sf)   
ConvexShape (sf)   IpAddress (sf)   
  N  
+
Sound (sf)   Utf (sf)   
Shader::CurrentTextureType (sf)   
  J  
+
SoundBuffer (sf)   Utf< 16 > (sf)   
  D  
+
NonCopyable (sf)   SoundBufferRecorder (sf)   Utf< 32 > (sf)   
Joystick (sf)   
  P  
+
SoundRecorder (sf)   Utf< 8 > (sf)   
Ftp::DirectoryResponse (sf)   Event::JoystickButtonEvent (sf)   SoundSource (sf)   
  V  
+
Drawable (sf)   Event::JoystickConnectEvent (sf)   Packet (sf)   SoundStream (sf)   
  E  
+
Event::JoystickMoveEvent (sf)   
  R  
+
Sprite (sf)   Vector2 (sf)   
  K  
+
String (sf)   Vector3 (sf)   
Event (sf)   Rect (sf)   
  T  
+
Vertex (sf)   
  F  
+
Keyboard (sf)   RectangleShape (sf)   VertexArray (sf)   
Event::KeyEvent (sf)   RenderStates (sf)   TcpListener (sf)   VideoMode (sf)   
Font (sf)   
  L  
+
RenderTarget (sf)   TcpSocket (sf)   View (sf)   
Ftp (sf)   RenderTexture (sf)   Text (sf)   
  W  
+
  G  
+
Listener (sf)   RenderWindow (sf)   Event::TextEvent (sf)   
Ftp::ListingResponse (sf)   Http::Request (sf)   Texture (sf)   Window (sf)   
GlResource (sf)   Lock (sf)   Ftp::Response (sf)   Thread (sf)   
+
C | D | E | F | G | H | I | J | K | L | M | N | P | R | S | T | U | V | W
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape-members.htm new file mode 100644 index 0000000..f4c3e4e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape-members.htm @@ -0,0 +1,97 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::CircleShape Member List
+
+
+ +

This is the complete list of members for sf::CircleShape, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CircleShape(float radius=0, unsigned int pointCount=30)sf::CircleShapeexplicit
getFillColor() const sf::Shape
getGlobalBounds() const sf::Shape
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Shape
getOrigin() const sf::Transformable
getOutlineColor() const sf::Shape
getOutlineThickness() const sf::Shape
getPoint(unsigned int index) const sf::CircleShapevirtual
getPointCount() const sf::CircleShapevirtual
getPosition() const sf::Transformable
getRadius() const sf::CircleShape
getRotation() const sf::Transformable
getScale() const sf::Transformable
getTexture() const sf::Shape
getTextureRect() const sf::Shape
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setFillColor(const Color &color)sf::Shape
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setOutlineColor(const Color &color)sf::Shape
setOutlineThickness(float thickness)sf::Shape
setPointCount(unsigned int count)sf::CircleShape
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRadius(float radius)sf::CircleShape
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setTexture(const Texture *texture, bool resetRect=false)sf::Shape
setTextureRect(const IntRect &rect)sf::Shape
Shape()sf::Shapeprotected
Transformable()sf::Transformable
update()sf::Shapeprotected
~Drawable()sf::Drawableinlinevirtual
~Shape()sf::Shapevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.htm new file mode 100644 index 0000000..97fa2c2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.htm @@ -0,0 +1,1418 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized shape representing a circle. + More...

+ +

#include <CircleShape.hpp>

+
+Inheritance diagram for sf::CircleShape:
+
+
+ + +sf::Shape +sf::Drawable +sf::Transformable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 CircleShape (float radius=0, unsigned int pointCount=30)
 Default constructor. More...
 
void setRadius (float radius)
 Set the radius of the circle. More...
 
float getRadius () const
 Get the radius of the circle. More...
 
void setPointCount (unsigned int count)
 Set the number of points of the circle. More...
 
virtual unsigned int getPointCount () const
 Get the number of points of the shape. More...
 
virtual Vector2f getPoint (unsigned int index) const
 Get a point of the shape. More...
 
void setTexture (const Texture *texture, bool resetRect=false)
 Change the source texture of the shape. More...
 
void setTextureRect (const IntRect &rect)
 Set the sub-rectangle of the texture that the shape will display. More...
 
void setFillColor (const Color &color)
 Set the fill color of the shape. More...
 
void setOutlineColor (const Color &color)
 Set the outline color of the shape. More...
 
void setOutlineThickness (float thickness)
 Set the thickness of the shape's outline. More...
 
const TexturegetTexture () const
 Get the source texture of the shape. More...
 
const IntRectgetTextureRect () const
 Get the sub-rectangle of the texture displayed by the shape. More...
 
const ColorgetFillColor () const
 Get the fill color of the shape. More...
 
const ColorgetOutlineColor () const
 Get the outline color of the shape. More...
 
float getOutlineThickness () const
 Get the outline thickness of the shape. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+ + + + +

+Protected Member Functions

void update ()
 Recompute the internal geometry of the shape. More...
 
+

Detailed Description

+

Specialized shape representing a circle.

+

This class inherits all the functions of sf::Transformable (position, rotation, scale, bounds, ...) as well as the functions of sf::Shape (outline, color, texture, ...).

+

Usage example:

+
+
circle.setRadius(150);
+ + +
circle.setPosition(10, 20);
+
...
+
window.draw(circle);
+

Since the graphics card can't draw perfect circles, we have to fake them with multiple triangles connected to each other. The "points count" property of sf::CircleShape defines how many of these triangles to use, and therefore defines the quality of the circle.

+

The number of points can also be used for another purpose; with small numbers you can create any regular polygon shape: equilateral triangle, square, pentagon, hexagon, ...

+
See Also
sf::Shape, sf::RectangleShape, sf::ConvexShape
+ +

Definition at line 41 of file CircleShape.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
sf::CircleShape::CircleShape (float radius = 0,
unsigned int pointCount = 30 
)
+
+explicit
+
+ +

Default constructor.

+
Parameters
+ + + +
radiusRadius of the circle
pointCountNumber of points composing the circle
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getFillColor () const
+
+inherited
+
+ +

Get the fill color of the shape.

+
Returns
Fill color of the shape
+
See Also
setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getGlobalBounds () const
+
+inherited
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getLocalBounds () const
+
+inherited
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getOutlineColor () const
+
+inherited
+
+ +

Get the outline color of the shape.

+
Returns
Outline color of the shape
+
See Also
setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Shape::getOutlineThickness () const
+
+inherited
+
+ +

Get the outline thickness of the shape.

+
Returns
Outline thickness of the shape
+
See Also
setOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual Vector2f sf::CircleShape::getPoint (unsigned int index) const
+
+virtual
+
+ +

Get a point of the shape.

+

The result is undefined if index is out of the valid range.

+
Parameters
+ + +
indexIndex of the point to get, in range [0 .. getPointCount() - 1]
+
+
+
Returns
Index-th point of the shape
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual unsigned int sf::CircleShape::getPointCount () const
+
+virtual
+
+ +

Get the number of points of the shape.

+
Returns
Number of points of the shape
+
See Also
setPointCount
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + +
float sf::CircleShape::getRadius () const
+
+ +

Get the radius of the circle.

+
Returns
Radius of the circle
+
See Also
setRadius
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Texture* sf::Shape::getTexture () const
+
+inherited
+
+ +

Get the source texture of the shape.

+

If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

+
Returns
Pointer to the shape's texture
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const IntRect& sf::Shape::getTextureRect () const
+
+inherited
+
+ +

Get the sub-rectangle of the texture displayed by the shape.

+
Returns
Texture rectangle of the shape
+
See Also
setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setFillColor (const Colorcolor)
+
+inherited
+
+ +

Set the fill color of the shape.

+

This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sf::Color::Transparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.

+
Parameters
+ + +
colorNew color of the shape
+
+
+
See Also
getFillColor, setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineColor (const Colorcolor)
+
+inherited
+
+ +

Set the outline color of the shape.

+

By default, the shape's outline color is opaque white.

+
Parameters
+ + +
colorNew outline color of the shape
+
+
+
See Also
getOutlineColor, setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineThickness (float thickness)
+
+inherited
+
+ +

Set the thickness of the shape's outline.

+

Note that negative values are allowed (so that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

+
Parameters
+ + +
thicknessNew outline thickness
+
+
+
See Also
getOutlineThickness
+ +
+
+ +
+
+ + + + + + + + +
void sf::CircleShape::setPointCount (unsigned int count)
+
+ +

Set the number of points of the circle.

+
Parameters
+ + +
countNew number of points of the circle
+
+
+
See Also
getPointCount
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::CircleShape::setRadius (float radius)
+
+ +

Set the radius of the circle.

+
Parameters
+ + +
radiusNew radius of the circle
+
+
+
See Also
getRadius
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Shape::setTexture (const Texturetexture,
bool resetRect = false 
)
+
+inherited
+
+ +

Change the source texture of the shape.

+

The texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the shape tries to use it, the behaviour is undefined. texture can be NULL to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

+
Parameters
+ + + +
textureNew texture
resetRectShould the texture rect be reset to the size of the new texture?
+
+
+
See Also
getTexture, setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setTextureRect (const IntRectrect)
+
+inherited
+
+ +

Set the sub-rectangle of the texture that the shape will display.

+

The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.

+
Parameters
+ + +
rectRectangle defining the region of the texture to display
+
+
+
See Also
getTextureRect, setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Shape::update ()
+
+protectedinherited
+
+ +

Recompute the internal geometry of the shape.

+

This function must be called by the derived class everytime the shape's points change (ie. the result of either getPointCount or getPoint is different).

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.png new file mode 100644 index 0000000..b7c65ef Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1CircleShape.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock-members.htm new file mode 100644 index 0000000..0d833a9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Clock Member List
+
+
+ +

This is the complete list of members for sf::Clock, including all inherited members.

+ + + + +
Clock()sf::Clock
getElapsedTime() const sf::Clock
restart()sf::Clock
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock.htm new file mode 100644 index 0000000..232056e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Clock.htm @@ -0,0 +1,148 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Clock Class Reference
+
+
+ +

Utility class that measures the elapsed time. + More...

+ +

#include <Clock.hpp>

+ + + + + + + + + + + +

+Public Member Functions

 Clock ()
 Default constructor. More...
 
Time getElapsedTime () const
 Get the elapsed time. More...
 
Time restart ()
 Restart the clock. More...
 
+

Detailed Description

+

Utility class that measures the elapsed time.

+

sf::Clock is a lightweight class for measuring time.

+

Its provides the most precise time that the underlying OS can achieve (generally microseconds or nanoseconds). It also ensures monotonicity, which means that the returned time can never go backward, even if the system time is changed.

+

Usage example:

+
sf::Clock clock;
+
...
+
Time time1 = clock.getElapsedTime();
+
...
+
Time time2 = clock.restart();
+

The sf::Time value returned by the clock can then be converted to a number of seconds, milliseconds or even microseconds.

+
See Also
sf::Time
+ +

Definition at line 41 of file Clock.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Clock::Clock ()
+
+ +

Default constructor.

+

The clock starts automatically after being constructed.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
Time sf::Clock::getElapsedTime () const
+
+ +

Get the elapsed time.

+

This function returns the time elapsed since the last call to restart() (or the construction of the instance if restart() has not been called).

+
Returns
Time elapsed
+ +
+
+ +
+
+ + + + + + + +
Time sf::Clock::restart ()
+
+ +

Restart the clock.

+

This function puts the time counter back to zero. It also returns the time elapsed since the clock was started.

+
Returns
Time elapsed
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color-members.htm new file mode 100644 index 0000000..b1b5e9f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color-members.htm @@ -0,0 +1,76 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Color Member List
+
+
+ +

This is the complete list of members for sf::Color, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + +
asf::Color
bsf::Color
Blacksf::Colorstatic
Bluesf::Colorstatic
Color()sf::Color
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255)sf::Color
Cyansf::Colorstatic
gsf::Color
Greensf::Colorstatic
Magentasf::Colorstatic
operator!=(const Color &left, const Color &right)sf::Colorrelated
operator*(const Color &left, const Color &right)sf::Colorrelated
operator*=(Color &left, const Color &right)sf::Colorrelated
operator+(const Color &left, const Color &right)sf::Colorrelated
operator+=(Color &left, const Color &right)sf::Colorrelated
operator==(const Color &left, const Color &right)sf::Colorrelated
rsf::Color
Redsf::Colorstatic
Transparentsf::Colorstatic
Whitesf::Colorstatic
Yellowsf::Colorstatic
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color.htm new file mode 100644 index 0000000..0c157aa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Color.htm @@ -0,0 +1,791 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Utility class for manpulating RGBA colors. + More...

+ +

#include <Color.hpp>

+ + + + + + + + +

+Public Member Functions

 Color ()
 Default constructor. More...
 
 Color (Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha=255)
 Construct the color from its 4 RGBA components. More...
 
+ + + + + + + + + + + + + +

+Public Attributes

Uint8 r
 Red component. More...
 
Uint8 g
 Green component. More...
 
Uint8 b
 Blue component. More...
 
Uint8 a
 Alpha (opacity) component. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Attributes

static const Color Black
 Black predefined color. More...
 
static const Color White
 White predefined color. More...
 
static const Color Red
 Red predefined color. More...
 
static const Color Green
 Green predefined color. More...
 
static const Color Blue
 Blue predefined color. More...
 
static const Color Yellow
 Yellow predefined color. More...
 
static const Color Magenta
 Magenta predefined color. More...
 
static const Color Cyan
 Cyan predefined color. More...
 
static const Color Transparent
 Transparent (black) predefined color. More...
 
+ + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
bool operator== (const Color &left, const Color &right)
 Overload of the == operator. More...
 
bool operator!= (const Color &left, const Color &right)
 Overload of the != operator. More...
 
Color operator+ (const Color &left, const Color &right)
 Overload of the binary + operator. More...
 
Color operator* (const Color &left, const Color &right)
 Overload of the binary * operator. More...
 
Coloroperator+= (Color &left, const Color &right)
 Overload of the binary += operator. More...
 
Coloroperator*= (Color &left, const Color &right)
 Overload of the binary *= operator. More...
 
+

Detailed Description

+

Utility class for manpulating RGBA colors.

+

sf::Color is a simple color class composed of 4 components:

+
    +
  • Red
  • +
  • Green
  • +
  • Blue
  • +
  • Alpha (opacity)
  • +
+

Each component is a public member, an unsigned integer in the range [0, 255]. Thus, colors can be constructed and manipulated very easily:

+
sf::Color color(255, 0, 0); // red
+
color.r = 0; // make it black
+
color.b = 128; // make it dark blue
+

The fourth component of colors, named "alpha", represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components is.

+

The most common colors are already defined as static variables:

+

Colors can also be added and modulated (multiplied) using the overloaded operators + and *.

+ +

Definition at line 40 of file Color.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Color::Color ()
+
+ +

Default constructor.

+

Constructs an opaque black color. It is equivalent to sf::Color(0, 0, 0, 255).

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::Color::Color (Uint8 red,
Uint8 green,
Uint8 blue,
Uint8 alpha = 255 
)
+
+ +

Construct the color from its 4 RGBA components.

+
Parameters
+ + + + + +
redRed component (in the range [0, 255])
greenGreen component (in the range [0, 255])
blueBlue component (in the range [0, 255])
alphaAlpha (opacity) component (in the range [0, 255])
+
+
+ +
+
+

Friends And Related Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the != operator.

+

This operator compares two colors and check if they are different.

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
True if colors are different, false if they are equal
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Color operator* (const Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the binary * operator.

+

This operator returns the component-wise multiplication (also called "modulation") of two colors. Components are then divided by 255 so that the result is still in the range [0, 255].

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
Result of left * right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Color & operator*= (Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the binary *= operator.

+

This operator returns the component-wise multiplication (also called "modulation") of two colors, and assigns the result to the left operand. Components are then divided by 255 so that the result is still in the range [0, 255].

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Color operator+ (const Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the binary + operator.

+

This operator returns the component-wise sum of two colors. Components that exceed 255 are clamped to 255.

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
Result of left + right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Color & operator+= (Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the binary += operator.

+

This operator computes the component-wise sum of two colors, and assigns the result to the left operand. Components that exceed 255 are clamped to 255.

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Colorleft,
const Colorright 
)
+
+related
+
+ +

Overload of the == operator.

+

This operator compares two colors and check if they are equal.

+
Parameters
+ + + +
leftLeft operand
rightRight operand
+
+
+
Returns
True if colors are equal, false if they are different
+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
Uint8 sf::Color::a
+
+ +

Alpha (opacity) component.

+ +

Definition at line 83 of file Color.hpp.

+ +
+
+ +
+
+ + + + +
Uint8 sf::Color::b
+
+ +

Blue component.

+ +

Definition at line 82 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Black
+
+static
+
+ +

Black predefined color.

+ +

Definition at line 67 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Blue
+
+static
+
+ +

Blue predefined color.

+ +

Definition at line 71 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Cyan
+
+static
+
+ +

Cyan predefined color.

+ +

Definition at line 74 of file Color.hpp.

+ +
+
+ +
+
+ + + + +
Uint8 sf::Color::g
+
+ +

Green component.

+ +

Definition at line 81 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Green
+
+static
+
+ +

Green predefined color.

+ +

Definition at line 70 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Magenta
+
+static
+
+ +

Magenta predefined color.

+ +

Definition at line 73 of file Color.hpp.

+ +
+
+ +
+
+ + + + +
Uint8 sf::Color::r
+
+ +

Red component.

+ +

Definition at line 80 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Red
+
+static
+
+ +

Red predefined color.

+ +

Definition at line 69 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Transparent
+
+static
+
+ +

Transparent (black) predefined color.

+ +

Definition at line 75 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::White
+
+static
+
+ +

White predefined color.

+ +

Definition at line 68 of file Color.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const Color sf::Color::Yellow
+
+static
+
+ +

Yellow predefined color.

+ +

Definition at line 72 of file Color.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context-members.htm new file mode 100644 index 0000000..006161e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context-members.htm @@ -0,0 +1,63 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Context Member List
+
+
+ +

This is the complete list of members for sf::Context, including all inherited members.

+ + + + + + + + + +
Context()sf::Context
Context(const ContextSettings &settings, unsigned int width, unsigned int height)sf::Context
ensureGlContext()sf::GlResourceprivatestatic
GlResource()sf::GlResourceprivate
NonCopyable()sf::NonCopyableinlineprivate
setActive(bool active)sf::Context
~Context()sf::Context
~GlResource()sf::GlResourceprivate
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.htm new file mode 100644 index 0000000..2cfad7b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.htm @@ -0,0 +1,221 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Class holding a valid drawing context. + More...

+ +

#include <Context.hpp>

+
+Inheritance diagram for sf::Context:
+
+
+ + +sf::GlResource +sf::NonCopyable + +
+ + + + + + + + + + + + + + +

+Public Member Functions

 Context ()
 Default constructor. More...
 
 ~Context ()
 Destructor. More...
 
bool setActive (bool active)
 Activate or deactivate explicitely the context. More...
 
 Context (const ContextSettings &settings, unsigned int width, unsigned int height)
 Construct a in-memory context. More...
 
+ + + + +

+Static Private Member Functions

static void ensureGlContext ()
 Make sure that a valid OpenGL context exists in the current thread. More...
 
+

Detailed Description

+

Class holding a valid drawing context.

+

If you need to make OpenGL calls without having an active window (like in a thread), you can use an instance of this class to get a valid context.

+

Having a valid context is necessary for every OpenGL call.

+

Note that a context is only active in its current thread, if you create a new thread it will have no valid context by default.

+

To use a sf::Context instance, just construct it and let it live as long as you need a valid context. No explicit activation is needed, all it has to do is to exist. Its destructor will take care of deactivating and freeing all the attached resources.

+

Usage example:

+
void threadFunction(void*)
+
{
+
sf::Context context;
+
// from now on, you have a valid context
+
+
// you can make OpenGL calls
+
glClear(GL_DEPTH_BUFFER_BIT);
+
}
+
// the context is automatically deactivated and destroyed
+
// by the sf::Context destructor
+
+

Definition at line 48 of file Context.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Context::Context ()
+
+ +

Default constructor.

+

The constructor creates and activates the context

+ +
+
+ +
+
+ + + + + + + +
sf::Context::~Context ()
+
+ +

Destructor.

+

The desctructor deactivates and destroys the context

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::Context::Context (const ContextSettingssettings,
unsigned int width,
unsigned int height 
)
+
+ +

Construct a in-memory context.

+

This constructor is for internal use, you don't need to bother with it.

+
Parameters
+ + + + +
settingsCreation parameters
widthBack buffer width
heightBack buffer height
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
bool sf::Context::setActive (bool active)
+
+ +

Activate or deactivate explicitely the context.

+
Parameters
+ + +
activeTrue to activate, false to deactivate
+
+
+
Returns
True on success, false on failure
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.png new file mode 100644 index 0000000..b82e46e Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Context.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ContextSettings-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ContextSettings-members.htm new file mode 100644 index 0000000..0f6e1ab --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ContextSettings-members.htm @@ -0,0 +1,61 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::ContextSettings Member List
+
+
+ +

This is the complete list of members for sf::ContextSettings, including all inherited members.

+ + + + + + + +
antialiasingLevelsf::ContextSettings
ContextSettings(unsigned int depth=0, unsigned int stencil=0, unsigned int antialiasing=0, unsigned int major=2, unsigned int minor=0)sf::ContextSettingsinlineexplicit
depthBitssf::ContextSettings
majorVersionsf::ContextSettings
minorVersionsf::ContextSettings
stencilBitssf::ContextSettings
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape-members.htm new file mode 100644 index 0000000..25a0e1b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape-members.htm @@ -0,0 +1,96 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::ConvexShape Member List
+
+
+ +

This is the complete list of members for sf::ConvexShape, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConvexShape(unsigned int pointCount=0)sf::ConvexShapeexplicit
getFillColor() const sf::Shape
getGlobalBounds() const sf::Shape
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Shape
getOrigin() const sf::Transformable
getOutlineColor() const sf::Shape
getOutlineThickness() const sf::Shape
getPoint(unsigned int index) const sf::ConvexShapevirtual
getPointCount() const sf::ConvexShapevirtual
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getTexture() const sf::Shape
getTextureRect() const sf::Shape
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setFillColor(const Color &color)sf::Shape
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setOutlineColor(const Color &color)sf::Shape
setOutlineThickness(float thickness)sf::Shape
setPoint(unsigned int index, const Vector2f &point)sf::ConvexShape
setPointCount(unsigned int count)sf::ConvexShape
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setTexture(const Texture *texture, bool resetRect=false)sf::Shape
setTextureRect(const IntRect &rect)sf::Shape
Shape()sf::Shapeprotected
Transformable()sf::Transformable
update()sf::Shapeprotected
~Drawable()sf::Drawableinlinevirtual
~Shape()sf::Shapevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.htm new file mode 100644 index 0000000..5eeb3fd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.htm @@ -0,0 +1,1401 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized shape representing a convex polygon. + More...

+ +

#include <ConvexShape.hpp>

+
+Inheritance diagram for sf::ConvexShape:
+
+
+ + +sf::Shape +sf::Drawable +sf::Transformable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 ConvexShape (unsigned int pointCount=0)
 Default constructor. More...
 
void setPointCount (unsigned int count)
 Set the number of points of the polygon. More...
 
virtual unsigned int getPointCount () const
 Get the number of points of the polygon. More...
 
void setPoint (unsigned int index, const Vector2f &point)
 Set the position of a point. More...
 
virtual Vector2f getPoint (unsigned int index) const
 Get the position of a point. More...
 
void setTexture (const Texture *texture, bool resetRect=false)
 Change the source texture of the shape. More...
 
void setTextureRect (const IntRect &rect)
 Set the sub-rectangle of the texture that the shape will display. More...
 
void setFillColor (const Color &color)
 Set the fill color of the shape. More...
 
void setOutlineColor (const Color &color)
 Set the outline color of the shape. More...
 
void setOutlineThickness (float thickness)
 Set the thickness of the shape's outline. More...
 
const TexturegetTexture () const
 Get the source texture of the shape. More...
 
const IntRectgetTextureRect () const
 Get the sub-rectangle of the texture displayed by the shape. More...
 
const ColorgetFillColor () const
 Get the fill color of the shape. More...
 
const ColorgetOutlineColor () const
 Get the outline color of the shape. More...
 
float getOutlineThickness () const
 Get the outline thickness of the shape. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+ + + + +

+Protected Member Functions

void update ()
 Recompute the internal geometry of the shape. More...
 
+

Detailed Description

+

Specialized shape representing a convex polygon.

+

This class inherits all the functions of sf::Transformable (position, rotation, scale, bounds, ...) as well as the functions of sf::Shape (outline, color, texture, ...).

+

It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly. Moreover, the points must be defined in order; using a random order would result in an incorrect shape.

+

Usage example:

+
+
polygon.setPointCount(3);
+
polygon.setPoint(0, sf::Vector2f(0, 0));
+
polygon.setPoint(1, sf::Vector2f(0, 10));
+
polygon.setPoint(2, sf::Vector2f(25, 5));
+ + +
polygon.setPosition(10, 20);
+
...
+
window.draw(polygon);
+
See Also
sf::Shape, sf::RectangleShape, sf::CircleShape
+ +

Definition at line 42 of file ConvexShape.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
sf::ConvexShape::ConvexShape (unsigned int pointCount = 0)
+
+explicit
+
+ +

Default constructor.

+
Parameters
+ + +
pointCountNumber of points of the polygon
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getFillColor () const
+
+inherited
+
+ +

Get the fill color of the shape.

+
Returns
Fill color of the shape
+
See Also
setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getGlobalBounds () const
+
+inherited
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getLocalBounds () const
+
+inherited
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getOutlineColor () const
+
+inherited
+
+ +

Get the outline color of the shape.

+
Returns
Outline color of the shape
+
See Also
setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Shape::getOutlineThickness () const
+
+inherited
+
+ +

Get the outline thickness of the shape.

+
Returns
Outline thickness of the shape
+
See Also
setOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual Vector2f sf::ConvexShape::getPoint (unsigned int index) const
+
+virtual
+
+ +

Get the position of a point.

+

The result is undefined if index is out of the valid range.

+
Parameters
+ + +
indexIndex of the point to get, in range [0 .. getPointCount() - 1]
+
+
+
Returns
Position of the index-th point of the polygon
+
See Also
setPoint
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual unsigned int sf::ConvexShape::getPointCount () const
+
+virtual
+
+ +

Get the number of points of the polygon.

+
Returns
Number of points of the polygon
+
See Also
setPointCount
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Texture* sf::Shape::getTexture () const
+
+inherited
+
+ +

Get the source texture of the shape.

+

If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

+
Returns
Pointer to the shape's texture
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const IntRect& sf::Shape::getTextureRect () const
+
+inherited
+
+ +

Get the sub-rectangle of the texture displayed by the shape.

+
Returns
Texture rectangle of the shape
+
See Also
setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setFillColor (const Colorcolor)
+
+inherited
+
+ +

Set the fill color of the shape.

+

This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sf::Color::Transparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.

+
Parameters
+ + +
colorNew color of the shape
+
+
+
See Also
getFillColor, setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineColor (const Colorcolor)
+
+inherited
+
+ +

Set the outline color of the shape.

+

By default, the shape's outline color is opaque white.

+
Parameters
+ + +
colorNew outline color of the shape
+
+
+
See Also
getOutlineColor, setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineThickness (float thickness)
+
+inherited
+
+ +

Set the thickness of the shape's outline.

+

Note that negative values are allowed (so that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

+
Parameters
+ + +
thicknessNew outline thickness
+
+
+
See Also
getOutlineThickness
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::ConvexShape::setPoint (unsigned int index,
const Vector2fpoint 
)
+
+ +

Set the position of a point.

+

Don't forget that the polygon must remain convex, and the points need to stay ordered! setPointCount must be called first in order to set the total number of points. The result is undefined if index is out of the valid range.

+
Parameters
+ + + +
indexIndex of the point to change, in range [0 .. getPointCount() - 1]
pointNew position of the point
+
+
+
See Also
getPoint
+ +
+
+ +
+
+ + + + + + + + +
void sf::ConvexShape::setPointCount (unsigned int count)
+
+ +

Set the number of points of the polygon.

+

count must be greater than 2 to define a valid shape.

+
Parameters
+ + +
countNew number of points of the polygon
+
+
+
See Also
getPointCount
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Shape::setTexture (const Texturetexture,
bool resetRect = false 
)
+
+inherited
+
+ +

Change the source texture of the shape.

+

The texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the shape tries to use it, the behaviour is undefined. texture can be NULL to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

+
Parameters
+ + + +
textureNew texture
resetRectShould the texture rect be reset to the size of the new texture?
+
+
+
See Also
getTexture, setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setTextureRect (const IntRectrect)
+
+inherited
+
+ +

Set the sub-rectangle of the texture that the shape will display.

+

The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.

+
Parameters
+ + +
rectRectangle defining the region of the texture to display
+
+
+
See Also
getTextureRect, setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Shape::update ()
+
+protectedinherited
+
+ +

Recompute the internal geometry of the shape.

+

This function must be called by the derived class everytime the shape's points change (ie. the result of either getPointCount or getPoint is different).

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.png new file mode 100644 index 0000000..99b556c Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ConvexShape.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable-members.htm new file mode 100644 index 0000000..db3b626 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Drawable Member List
+
+
+ +

This is the complete list of members for sf::Drawable, including all inherited members.

+ + + + +
draw(RenderTarget &target, RenderStates states) const =0sf::Drawableprotectedpure virtual
RenderTarget (defined in sf::Drawable)sf::Drawablefriend
~Drawable()sf::Drawableinlinevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.htm new file mode 100644 index 0000000..af9e4cf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.htm @@ -0,0 +1,208 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Abstract base class for objects that can be drawn to a render target. + More...

+ +

#include <Drawable.hpp>

+
+Inheritance diagram for sf::Drawable:
+
+
+ + +sf::Shape +sf::Sprite +sf::Text +sf::VertexArray +sf::CircleShape +sf::ConvexShape +sf::RectangleShape + +
+ + + + + +

+Public Member Functions

virtual ~Drawable ()
 Virtual destructor. More...
 
+ + + + +

+Protected Member Functions

virtual void draw (RenderTarget &target, RenderStates states) const =0
 Draw the object to a render target. More...
 
+ + + +

+Friends

+class RenderTarget
 
+

Detailed Description

+

Abstract base class for objects that can be drawn to a render target.

+

sf::Drawable is a very simple base class that allows objects of derived classes to be drawn to a sf::RenderTarget.

+

All you have to do in your derived class is to override the draw virtual function.

+

Note that inheriting from sf::Drawable is not mandatory, but it allows this nice syntax "window.draw(object)" rather than "object.draw(window)", which is more consistent with other SFML classes.

+

Example:

+
class MyDrawable : public sf::Drawable
+
{
+
public :
+
+
...
+
+
private :
+
+
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
+
{
+
// You can draw other high-level objects
+
target.draw(m_sprite, states);
+
+
// ... or use the low-level API
+
states.texture = &m_texture;
+
target.draw(m_vertices, states);
+
+
// ... or draw with OpenGL directly
+
glBegin(GL_QUADS);
+
...
+
glEnd();
+
}
+
+
sf::Sprite m_sprite;
+
sf::Texture m_texture;
+
sf::VertexArray m_vertices;
+
};
+
See Also
sf::RenderTarget
+ +

Definition at line 44 of file Drawable.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Drawable::~Drawable ()
+
+inlinevirtual
+
+ +

Virtual destructor.

+ +

Definition at line 52 of file Drawable.hpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual void sf::Drawable::draw (RenderTargettarget,
RenderStates states 
) const
+
+protectedpure virtual
+
+ +

Draw the object to a render target.

+

This is a pure virtual function that has to be implemented by the derived class to define how the drawable should be drawn.

+
Parameters
+ + + +
targetRender target to draw to
statesCurrent render states
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.png new file mode 100644 index 0000000..b9876ce Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Drawable.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event-members.htm new file mode 100644 index 0000000..8844f8b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event-members.htm @@ -0,0 +1,85 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event Member List
+
+ + + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event.htm new file mode 100644 index 0000000..709cedf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Event.htm @@ -0,0 +1,440 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event Class Reference
+
+
+ +

Defines a system event and its parameters. + More...

+ +

#include <Event.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

struct  JoystickButtonEvent
 Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased) More...
 
struct  JoystickConnectEvent
 Joystick connection events parameters (JoystickConnected, JoystickDisconnected) More...
 
struct  JoystickMoveEvent
 Joystick axis move event parameters (JoystickMoved) More...
 
struct  KeyEvent
 Keyboard event parameters (KeyPressed, KeyReleased) More...
 
struct  MouseButtonEvent
 Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased) More...
 
struct  MouseMoveEvent
 Mouse move event parameters (MouseMoved) More...
 
struct  MouseWheelEvent
 Mouse wheel events parameters (MouseWheelMoved) More...
 
struct  SizeEvent
 Size events parameters (Resized) More...
 
struct  TextEvent
 Text event parameters (TextEntered) More...
 
+ + + + +

+Public Types

enum  EventType {
+  Closed, +
+  Resized, +
+  LostFocus, +
+  GainedFocus, +
+  TextEntered, +
+  KeyPressed, +
+  KeyReleased, +
+  MouseWheelMoved, +
+  MouseButtonPressed, +
+  MouseButtonReleased, +
+  MouseMoved, +
+  MouseEntered, +
+  MouseLeft, +
+  JoystickButtonPressed, +
+  JoystickButtonReleased, +
+  JoystickMoved, +
+  JoystickConnected, +
+  JoystickDisconnected, +
+  Count +
+ }
 Enumeration of the different types of events. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Attributes

EventType type
 Type of the event. More...
 
+union {
   SizeEvent   size
 Size event parameters (Event::Resized) More...
 
   KeyEvent   key
 Key event parameters (Event::KeyPressed, Event::KeyReleased) More...
 
   TextEvent   text
 Text event parameters (Event::TextEntered) More...
 
   MouseMoveEvent   mouseMove
 Mouse move event parameters (Event::MouseMoved) More...
 
   MouseButtonEvent   mouseButton
 Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased) More...
 
   MouseWheelEvent   mouseWheel
 Mouse wheel event parameters (Event::MouseWheelMoved) More...
 
   JoystickMoveEvent   joystickMove
 Joystick move event parameters (Event::JoystickMoved) More...
 
   JoystickButtonEvent   joystickButton
 Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased) More...
 
   JoystickConnectEvent   joystickConnect
 Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected) More...
 
}; 
 
+

Detailed Description

+

Defines a system event and its parameters.

+

sf::Event holds all the informations about a system event that just happened.

+

Events are retrieved using the sf::Window::pollEvent and sf::Window::waitEvent functions.

+

A sf::Event instance contains the type of the event (mouse moved, key pressed, window closed, ...) as well as the details about this particular event. Please note that the event parameters are defined in a union, which means that only the member matching the type of the event will be properly filled; all other members will have undefined values and must not be read if the type of the event doesn't match. For example, if you received a KeyPressed event, then you must read the event.key member, all other members such as event.MouseMove or event.text will have undefined values.

+

Usage example:

+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// Request for closing the window
+
if (event.type == sf::Event::Closed)
+
window.close();
+
+
// The escape key was pressed
+
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))
+
window.close();
+
+
// The window was resized
+
if (event.type == sf::Event::Resized)
+
doSomethingWithTheNewSize(event.size.width, event.size.height);
+
+
// etc ...
+
}
+
+

Definition at line 43 of file Event.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Event::EventType
+
+ +

Enumeration of the different types of events.

+ + + + + + + + + + + + + + + + + + + + +
Enumerator
Closed  +

The window requested to be closed (no data)

+
Resized  +

The window was resized (data in event.size)

+
LostFocus  +

The window lost the focus (no data)

+
GainedFocus  +

The window gained the focus (no data)

+
TextEntered  +

A character was entered (data in event.text)

+
KeyPressed  +

A key was pressed (data in event.key)

+
KeyReleased  +

A key was released (data in event.key)

+
MouseWheelMoved  +

The mouse wheel was scrolled (data in event.mouseWheel)

+
MouseButtonPressed  +

A mouse button was pressed (data in event.mouseButton)

+
MouseButtonReleased  +

A mouse button was released (data in event.mouseButton)

+
MouseMoved  +

The mouse cursor moved (data in event.mouseMove)

+
MouseEntered  +

The mouse cursor entered the area of the window (no data)

+
MouseLeft  +

The mouse cursor left the area of the window (no data)

+
JoystickButtonPressed  +

A joystick button was pressed (data in event.joystickButton)

+
JoystickButtonReleased  +

A joystick button was released (data in event.joystickButton)

+
JoystickMoved  +

The joystick moved along an axis (data in event.joystickMove)

+
JoystickConnected  +

A joystick was connected (data in event.joystickConnect)

+
JoystickDisconnected  +

A joystick was disconnected (data in event.joystickConnect)

+
Count  +

Keep last – the total number of event types.

+
+ +

Definition at line 148 of file Event.hpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
JoystickButtonEvent sf::Event::joystickButton
+
+ +

Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased)

+ +

Definition at line 186 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
JoystickConnectEvent sf::Event::joystickConnect
+
+ +

Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected)

+ +

Definition at line 187 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
JoystickMoveEvent sf::Event::joystickMove
+
+ +

Joystick move event parameters (Event::JoystickMoved)

+ +

Definition at line 185 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
KeyEvent sf::Event::key
+
+ +

Key event parameters (Event::KeyPressed, Event::KeyReleased)

+ +

Definition at line 180 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
MouseButtonEvent sf::Event::mouseButton
+
+ +

Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)

+ +

Definition at line 183 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
MouseMoveEvent sf::Event::mouseMove
+
+ +

Mouse move event parameters (Event::MouseMoved)

+ +

Definition at line 182 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
MouseWheelEvent sf::Event::mouseWheel
+
+ +

Mouse wheel event parameters (Event::MouseWheelMoved)

+ +

Definition at line 184 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
SizeEvent sf::Event::size
+
+ +

Size event parameters (Event::Resized)

+ +

Definition at line 179 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
TextEvent sf::Event::text
+
+ +

Text event parameters (Event::TextEntered)

+ +

Definition at line 181 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
EventType sf::Event::type
+
+ +

Type of the event.

+ +

Definition at line 175 of file Event.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font-members.htm new file mode 100644 index 0000000..db8b6d2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font-members.htm @@ -0,0 +1,66 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Font Member List
+
+
+ +

This is the complete list of members for sf::Font, including all inherited members.

+ + + + + + + + + + + + +
Font()sf::Font
Font(const Font &copy)sf::Font
getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const sf::Font
getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const sf::Font
getLineSpacing(unsigned int characterSize) const sf::Font
getTexture(unsigned int characterSize) const sf::Font
loadFromFile(const std::string &filename)sf::Font
loadFromMemory(const void *data, std::size_t sizeInBytes)sf::Font
loadFromStream(InputStream &stream)sf::Font
operator=(const Font &right)sf::Font
~Font()sf::Font
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font.htm new file mode 100644 index 0000000..841c87e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Font.htm @@ -0,0 +1,456 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Class for loading and manipulating character fonts. + More...

+ +

#include <Font.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Font ()
 Default constructor. More...
 
 Font (const Font &copy)
 Copy constructor. More...
 
 ~Font ()
 Destructor. More...
 
bool loadFromFile (const std::string &filename)
 Load the font from a file. More...
 
bool loadFromMemory (const void *data, std::size_t sizeInBytes)
 Load the font from a file in memory. More...
 
bool loadFromStream (InputStream &stream)
 Load the font from a custom stream. More...
 
const GlyphgetGlyph (Uint32 codePoint, unsigned int characterSize, bool bold) const
 Retrieve a glyph of the font. More...
 
int getKerning (Uint32 first, Uint32 second, unsigned int characterSize) const
 Get the kerning offset of two glyphs. More...
 
int getLineSpacing (unsigned int characterSize) const
 Get the line spacing. More...
 
const TexturegetTexture (unsigned int characterSize) const
 Retrieve the texture containing the loaded glyphs of a certain size. More...
 
Fontoperator= (const Font &right)
 Overload of assignment operator. More...
 
+

Detailed Description

+

Class for loading and manipulating character fonts.

+

Fonts can be loaded from a file, from memory or from a custom stream, and supports the most common types of fonts.

+

See the loadFromFile function for the complete list of supported formats.

+

Once it is loaded, a sf::Font instance provides three types of information about the font:

+
    +
  • Global metrics, such as the line spacing
  • +
  • Per-glyph metrics, such as bounding box or kerning
  • +
  • Pixel representation of glyphs
  • +
+

Fonts alone are not very useful: they hold the font data but cannot make anything useful of it. To do so you need to use the sf::Text class, which is able to properly output text with several options such as character size, style, color, position, rotation, etc. This separation allows more flexibility and better performances: indeed a sf::Font is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a sf::Text is a lightweight object which can combine the glyphs data and metrics of a sf::Font to display any text on a render target. Note that it is also possible to bind several sf::Text instances to the same sf::Font.

+

It is important to note that the sf::Text instance doesn't copy the font that it uses, it only keeps a reference to it. Thus, a sf::Font must not be destructed while it is used by a sf::Text (i.e. never write a function that uses a local sf::Font instance for creating a text).

+

Usage example:

+
// Declare a new font
+
sf::Font font;
+
+
// Load it from a file
+
if (!font.loadFromFile("arial.ttf"))
+
{
+
// error...
+
}
+
+
// Create a text which uses our font
+
sf::Text text1;
+
text1.setFont(font);
+
text1.setCharacterSize(30);
+ +
+
// Create another text using the same font, but with different parameters
+
sf::Text text2;
+
text2.setFont(font);
+
text2.setCharacterSize(50);
+ +

Apart from loading font files, and passing them to instances of sf::Text, you should normally not have to deal directly with this class. However, it may be useful to access the font metrics or rasterized glyphs for advanced usage.

+
See Also
sf::Text
+ +

Definition at line 50 of file Font.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Font::Font ()
+
+ +

Default constructor.

+

This constructor defines an empty font

+ +
+
+ +
+
+ + + + + + + + +
sf::Font::Font (const Fontcopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::Font::~Font ()
+
+ +

Destructor.

+

Cleans up all the internal resources used by the font

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
const Glyph& sf::Font::getGlyph (Uint32 codePoint,
unsigned int characterSize,
bool bold 
) const
+
+ +

Retrieve a glyph of the font.

+
Parameters
+ + + + +
codePointUnicode code point of the character to get
characterSizeReference character size
boldRetrieve the bold version or the regular one?
+
+
+
Returns
The glyph corresponding to codePoint and characterSize
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int sf::Font::getKerning (Uint32 first,
Uint32 second,
unsigned int characterSize 
) const
+
+ +

Get the kerning offset of two glyphs.

+

The kerning is an extra offset (negative) to apply between two glyphs when rendering them, to make the pair look more "natural". For example, the pair "AV" have a special kerning to make them closer than other characters. Most of the glyphs pairs have a kerning offset of zero, though.

+
Parameters
+ + + + +
firstUnicode code point of the first character
secondUnicode code point of the second character
characterSizeReference character size
+
+
+
Returns
Kerning value for first and second, in pixels
+ +
+
+ +
+
+ + + + + + + + +
int sf::Font::getLineSpacing (unsigned int characterSize) const
+
+ +

Get the line spacing.

+

Line spacing is the vertical offset to apply between two consecutive lines of text.

+
Parameters
+ + +
characterSizeReference character size
+
+
+
Returns
Line spacing, in pixels
+ +
+
+ +
+
+ + + + + + + + +
const Texture& sf::Font::getTexture (unsigned int characterSize) const
+
+ +

Retrieve the texture containing the loaded glyphs of a certain size.

+

The contents of the returned texture changes as more glyphs are requested, thus it is not very relevant. It is mainly used internally by sf::Text.

+
Parameters
+ + +
characterSizeReference character size
+
+
+
Returns
Texture containing the glyphs of the requested size
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Font::loadFromFile (const std::string & filename)
+
+ +

Load the font from a file.

+

The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Note that this function know nothing about the standard fonts installed on the user's system, thus you can't load them directly.

+
Parameters
+ + +
filenamePath of the font file to load
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromMemory, loadFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Font::loadFromMemory (const void * data,
std::size_t sizeInBytes 
)
+
+ +

Load the font from a file in memory.

+

The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Warning: SFML cannot preload all the font data in this function, so the buffer pointed by data has to remain valid as long as the font is used.

+
Parameters
+ + + +
dataPointer to the file data in memory
sizeInBytesSize of the data to load, in bytes
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromStream
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Font::loadFromStream (InputStreamstream)
+
+ +

Load the font from a custom stream.

+

The supported font formats are: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. Warning: SFML cannot preload all the font data in this function, so the contents of stream have to remain valid as long as the font is used.

+
Parameters
+ + +
streamSource stream to read from
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + +
Font& sf::Font::operator= (const Fontright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp-members.htm new file mode 100644 index 0000000..15f9318 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp-members.htm @@ -0,0 +1,77 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Ftp Member List
+
+
+ +

This is the complete list of members for sf::Ftp, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + +
Ascii enum valuesf::Ftp
Binary enum valuesf::Ftp
changeDirectory(const std::string &directory)sf::Ftp
connect(const IpAddress &server, unsigned short port=21, Time timeout=Time::Zero)sf::Ftp
createDirectory(const std::string &name)sf::Ftp
DataChannel (defined in sf::Ftp)sf::Ftpfriend
deleteDirectory(const std::string &name)sf::Ftp
deleteFile(const std::string &name)sf::Ftp
disconnect()sf::Ftp
download(const std::string &remoteFile, const std::string &localPath, TransferMode mode=Binary)sf::Ftp
Ebcdic enum valuesf::Ftp
getDirectoryListing(const std::string &directory="")sf::Ftp
getWorkingDirectory()sf::Ftp
keepAlive()sf::Ftp
login()sf::Ftp
login(const std::string &name, const std::string &password)sf::Ftp
NonCopyable()sf::NonCopyableinlineprivate
parentDirectory()sf::Ftp
renameFile(const std::string &file, const std::string &newName)sf::Ftp
TransferMode enum namesf::Ftp
upload(const std::string &localFile, const std::string &remotePath, TransferMode mode=Binary)sf::Ftp
~Ftp()sf::Ftp
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.htm new file mode 100644 index 0000000..817fb3e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.htm @@ -0,0 +1,693 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

A FTP client. + More...

+ +

#include <Ftp.hpp>

+
+Inheritance diagram for sf::Ftp:
+
+
+ + +sf::NonCopyable + +
+ + + + + + + + + + + +

+Classes

class  DirectoryResponse
 Specialization of FTP response returning a directory. More...
 
class  ListingResponse
 Specialization of FTP response returning a filename lisiting. More...
 
class  Response
 Define a FTP response. More...
 
+ + + + +

+Public Types

enum  TransferMode {
+  Binary, +
+  Ascii, +
+  Ebcdic +
+ }
 Enumeration of transfer modes. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 ~Ftp ()
 Destructor. More...
 
Response connect (const IpAddress &server, unsigned short port=21, Time timeout=Time::Zero)
 Connect to the specified FTP server. More...
 
Response disconnect ()
 Close the connection with the server. More...
 
Response login ()
 Log in using an anonymous account. More...
 
Response login (const std::string &name, const std::string &password)
 Log in using a username and a password. More...
 
Response keepAlive ()
 Send a null command to keep the connection alive. More...
 
DirectoryResponse getWorkingDirectory ()
 Get the current working directory. More...
 
ListingResponse getDirectoryListing (const std::string &directory="")
 Get the contents of the given directory. More...
 
Response changeDirectory (const std::string &directory)
 Change the current working directory. More...
 
Response parentDirectory ()
 Go to the parent directory of the current one. More...
 
Response createDirectory (const std::string &name)
 Create a new directory. More...
 
Response deleteDirectory (const std::string &name)
 Remove an existing directory. More...
 
Response renameFile (const std::string &file, const std::string &newName)
 Rename an existing file. More...
 
Response deleteFile (const std::string &name)
 Remove an existing file. More...
 
Response download (const std::string &remoteFile, const std::string &localPath, TransferMode mode=Binary)
 Download a file from the server. More...
 
Response upload (const std::string &localFile, const std::string &remotePath, TransferMode mode=Binary)
 Upload a file to the server. More...
 
+ + + +

+Friends

+class DataChannel
 
+

Detailed Description

+

A FTP client.

+

sf::Ftp is a very simple FTP client that allows you to communicate with a FTP server.

+

The FTP protocol allows you to manipulate a remote file system (list files, upload, download, create, remove, ...).

+

Using the FTP client consists of 4 parts:

+
    +
  • Connecting to the FTP server
  • +
  • Logging in (either as a registered user or anonymously)
  • +
  • Sending commands to the server
  • +
  • Disconnecting (this part can be done implicitely by the destructor)
  • +
+

Every command returns a FTP response, which contains the status code as well as a message from the server. Some commands such as getWorkingDirectory and getDirectoryListing return additional data, and use a class derived from sf::Ftp::Response to provide this data.

+

All commands, especially upload and download, may take some time to complete. This is important to know if you don't want to block your application while the server is completing the task.

+

Usage example:

+
// Create a new FTP client
+
sf::Ftp ftp;
+
+
// Connect to the server
+
sf::Ftp::Response response = ftp.connect("ftp://ftp.myserver.com");
+
if (response.isOk())
+
std::cout << "Connected" << std::endl;
+
+
// Log in
+
response = ftp.login("laurent", "dF6Zm89D");
+
if (response.isOk())
+
std::cout << "Logged in" << std::endl;
+
+
// Print the working directory
+ +
if (directory.isOk())
+
std::cout << "Working directory: " << directory.getDirectory() << std::endl;
+
+
// Create a new directory
+
response = ftp.createDirectory("files");
+
if (response.isOk())
+
std::cout << "Created new directory" << std::endl;
+
+
// Upload a file to this new directory
+
response = ftp.upload("local-path/file.txt", "files", sf::Ftp::Ascii);
+
if (response.isOk())
+
std::cout << "File uploaded" << std::endl;
+
+
// Disconnect from the server (optional)
+
ftp.disconnect();
+
+

Definition at line 47 of file Ftp.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Ftp::TransferMode
+
+ +

Enumeration of transfer modes.

+ + + + +
Enumerator
Binary  +

Binary mode (file is transfered as a sequence of bytes)

+
Ascii  +

Text mode using ASCII encoding.

+
Ebcdic  +

Text mode using EBCDIC encoding.

+
+ +

Definition at line 55 of file Ftp.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Ftp::~Ftp ()
+
+ +

Destructor.

+

Automatically closes the connection with the server if it is still opened.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Response sf::Ftp::changeDirectory (const std::string & directory)
+
+ +

Change the current working directory.

+

The new directory must be relative to the current one.

+
Parameters
+ + +
directoryNew working directory
+
+
+
Returns
Server response to the request
+
See Also
getWorkingDirectory, getDirectoryListing, parentDirectory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Response sf::Ftp::connect (const IpAddressserver,
unsigned short port = 21,
Time timeout = Time::Zero 
)
+
+ +

Connect to the specified FTP server.

+

The port has a default value of 21, which is the standard port used by the FTP protocol. You shouldn't use a different value, unless you really know what you do. This function tries to connect to the server so it may take a while to complete, especially if the server is not reachable. To avoid blocking your application for too long, you can use a timeout. The default value, Time::Zero, means that the system timeout will be used (which is usually pretty long).

+
Parameters
+ + + + +
serverName or address of the FTP server to connect to
portPort used for the connection
timeoutMaximum time to wait
+
+
+
Returns
Server response to the request
+
See Also
disconnect
+ +
+
+ +
+
+ + + + + + + + +
Response sf::Ftp::createDirectory (const std::string & name)
+
+ +

Create a new directory.

+

The new directory is created as a child of the current working directory.

+
Parameters
+ + +
nameName of the directory to create
+
+
+
Returns
Server response to the request
+
See Also
deleteDirectory
+ +
+
+ +
+
+ + + + + + + + +
Response sf::Ftp::deleteDirectory (const std::string & name)
+
+ +

Remove an existing directory.

+

The directory to remove must be relative to the current working directory. Use this function with caution, the directory will be removed permanently!

+
Parameters
+ + +
nameName of the directory to remove
+
+
+
Returns
Server response to the request
+
See Also
createDirectory
+ +
+
+ +
+
+ + + + + + + + +
Response sf::Ftp::deleteFile (const std::string & name)
+
+ +

Remove an existing file.

+

The file name must be relative to the current working directory. Use this function with caution, the file will be removed permanently!

+
Parameters
+ + +
nameFile to remove
+
+
+
Returns
Server response to the request
+
See Also
renameFile
+ +
+
+ +
+
+ + + + + + + +
Response sf::Ftp::disconnect ()
+
+ +

Close the connection with the server.

+
Returns
Server response to the request
+
See Also
connect
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Response sf::Ftp::download (const std::string & remoteFile,
const std::string & localPath,
TransferMode mode = Binary 
)
+
+ +

Download a file from the server.

+

The filename of the distant file is relative to the current working directory of the server, and the local destination path is relative to the current directory of your application.

+
Parameters
+ + + + +
remoteFileFilename of the distant file to download
localPathWhere to put to file on the local computer
modeTransfer mode
+
+
+
Returns
Server response to the request
+
See Also
upload
+ +
+
+ +
+
+ + + + + + + + +
ListingResponse sf::Ftp::getDirectoryListing (const std::string & directory = "")
+
+ +

Get the contents of the given directory.

+

This function retrieves the sub-directories and files contained in the given directory. It is not recursive. The directory parameter is relative to the current working directory.

+
Parameters
+ + +
directoryDirectory to list
+
+
+
Returns
Server response to the request
+
See Also
getWorkingDirectory, changeDirectory, parentDirectory
+ +
+
+ +
+
+ + + + + + + +
DirectoryResponse sf::Ftp::getWorkingDirectory ()
+
+ +

Get the current working directory.

+

The working directory is the root path for subsequent operations involving directories and/or filenames.

+
Returns
Server response to the request
+
See Also
getDirectoryListing, changeDirectory, parentDirectory
+ +
+
+ +
+
+ + + + + + + +
Response sf::Ftp::keepAlive ()
+
+ +

Send a null command to keep the connection alive.

+

This command is useful because the server may close the connection automatically if no command is sent.

+
Returns
Server response to the request
+ +
+
+ +
+
+ + + + + + + +
Response sf::Ftp::login ()
+
+ +

Log in using an anonymous account.

+

Logging in is mandatory after connecting to the server. Users that are not logged in cannot perform any operation.

+
Returns
Server response to the request
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Response sf::Ftp::login (const std::string & name,
const std::string & password 
)
+
+ +

Log in using a username and a password.

+

Logging in is mandatory after connecting to the server. Users that are not logged in cannot perform any operation.

+
Parameters
+ + + +
nameUser name
passwordPassword
+
+
+
Returns
Server response to the request
+ +
+
+ +
+
+ + + + + + + +
Response sf::Ftp::parentDirectory ()
+
+ +

Go to the parent directory of the current one.

+
Returns
Server response to the request
+
See Also
getWorkingDirectory, getDirectoryListing, changeDirectory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Response sf::Ftp::renameFile (const std::string & file,
const std::string & newName 
)
+
+ +

Rename an existing file.

+

The filenames must be relative to the current working directory.

+
Parameters
+ + + +
fileFile to rename
newNameNew name of the file
+
+
+
Returns
Server response to the request
+
See Also
deleteFile
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Response sf::Ftp::upload (const std::string & localFile,
const std::string & remotePath,
TransferMode mode = Binary 
)
+
+ +

Upload a file to the server.

+

The name of the local file is relative to the current working directory of your application, and the remote path is relative to the current directory of the FTP server.

+
Parameters
+ + + + +
localFilePath of the local file to upload
remotePathWhere to put to file on the server
modeTransfer mode
+
+
+
Returns
Server response to the request
+
See Also
download
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.png new file mode 100644 index 0000000..04916fc Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse-members.htm new file mode 100644 index 0000000..96a3564 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse-members.htm @@ -0,0 +1,105 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Ftp::DirectoryResponse Member List
+
+
+ +

This is the complete list of members for sf::Ftp::DirectoryResponse, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BadCommandSequence enum valuesf::Ftp::Response
ClosingConnection enum valuesf::Ftp::Response
ClosingDataConnection enum valuesf::Ftp::Response
CommandNotImplemented enum valuesf::Ftp::Response
CommandUnknown enum valuesf::Ftp::Response
ConnectionClosed enum valuesf::Ftp::Response
ConnectionFailed enum valuesf::Ftp::Response
DataConnectionAlreadyOpened enum valuesf::Ftp::Response
DataConnectionOpened enum valuesf::Ftp::Response
DataConnectionUnavailable enum valuesf::Ftp::Response
DirectoryOk enum valuesf::Ftp::Response
DirectoryResponse(const Response &response)sf::Ftp::DirectoryResponse
DirectoryStatus enum valuesf::Ftp::Response
EnteringPassiveMode enum valuesf::Ftp::Response
FileActionAborted enum valuesf::Ftp::Response
FileActionOk enum valuesf::Ftp::Response
FilenameNotAllowed enum valuesf::Ftp::Response
FileStatus enum valuesf::Ftp::Response
FileUnavailable enum valuesf::Ftp::Response
getDirectory() const sf::Ftp::DirectoryResponse
getMessage() const sf::Ftp::Response
getStatus() const sf::Ftp::Response
HelpMessage enum valuesf::Ftp::Response
InsufficientStorageSpace enum valuesf::Ftp::Response
InvalidFile enum valuesf::Ftp::Response
InvalidResponse enum valuesf::Ftp::Response
isOk() const sf::Ftp::Response
LocalError enum valuesf::Ftp::Response
LoggedIn enum valuesf::Ftp::Response
NeedAccountToLogIn enum valuesf::Ftp::Response
NeedAccountToStore enum valuesf::Ftp::Response
NeedInformation enum valuesf::Ftp::Response
NeedPassword enum valuesf::Ftp::Response
NotEnoughMemory enum valuesf::Ftp::Response
NotLoggedIn enum valuesf::Ftp::Response
Ok enum valuesf::Ftp::Response
OpeningDataConnection enum valuesf::Ftp::Response
PageTypeUnknown enum valuesf::Ftp::Response
ParameterNotImplemented enum valuesf::Ftp::Response
ParametersUnknown enum valuesf::Ftp::Response
PointlessCommand enum valuesf::Ftp::Response
Response(Status code=InvalidResponse, const std::string &message="")sf::Ftp::Responseexplicit
RestartMarkerReply enum valuesf::Ftp::Response
ServiceReady enum valuesf::Ftp::Response
ServiceReadySoon enum valuesf::Ftp::Response
ServiceUnavailable enum valuesf::Ftp::Response
Status enum namesf::Ftp::Response
SystemStatus enum valuesf::Ftp::Response
SystemType enum valuesf::Ftp::Response
TransferAborted enum valuesf::Ftp::Response
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.htm new file mode 100644 index 0000000..e1225c2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.htm @@ -0,0 +1,468 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Ftp::DirectoryResponse Class Reference
+
+
+ +

Specialization of FTP response returning a directory. + More...

+ +

#include <Ftp.hpp>

+
+Inheritance diagram for sf::Ftp::DirectoryResponse:
+
+
+ + +sf::Ftp::Response + +
+ + + + + +

+Public Types

enum  Status {
+  RestartMarkerReply = 110, +
+  ServiceReadySoon = 120, +
+  DataConnectionAlreadyOpened = 125, +
+  OpeningDataConnection = 150, +
+  Ok = 200, +
+  PointlessCommand = 202, +
+  SystemStatus = 211, +
+  DirectoryStatus = 212, +
+  FileStatus = 213, +
+  HelpMessage = 214, +
+  SystemType = 215, +
+  ServiceReady = 220, +
+  ClosingConnection = 221, +
+  DataConnectionOpened = 225, +
+  ClosingDataConnection = 226, +
+  EnteringPassiveMode = 227, +
+  LoggedIn = 230, +
+  FileActionOk = 250, +
+  DirectoryOk = 257, +
+  NeedPassword = 331, +
+  NeedAccountToLogIn = 332, +
+  NeedInformation = 350, +
+  ServiceUnavailable = 421, +
+  DataConnectionUnavailable = 425, +
+  TransferAborted = 426, +
+  FileActionAborted = 450, +
+  LocalError = 451, +
+  InsufficientStorageSpace = 452, +
+  CommandUnknown = 500, +
+  ParametersUnknown = 501, +
+  CommandNotImplemented = 502, +
+  BadCommandSequence = 503, +
+  ParameterNotImplemented = 504, +
+  NotLoggedIn = 530, +
+  NeedAccountToStore = 532, +
+  FileUnavailable = 550, +
+  PageTypeUnknown = 551, +
+  NotEnoughMemory = 552, +
+  FilenameNotAllowed = 553, +
+  InvalidResponse = 1000, +
+  ConnectionFailed = 1001, +
+  ConnectionClosed = 1002, +
+  InvalidFile = 1003 +
+ }
 Status codes possibly returned by a FTP response. More...
 
+ + + + + + + + + + + + + + + + +

+Public Member Functions

 DirectoryResponse (const Response &response)
 Default constructor. More...
 
const std::string & getDirectory () const
 Get the directory returned in the response. More...
 
bool isOk () const
 Check if the status code means a success. More...
 
Status getStatus () const
 Get the status code of the response. More...
 
const std::string & getMessage () const
 Get the full message contained in the response. More...
 
+

Detailed Description

+

Specialization of FTP response returning a directory.

+ +

Definition at line 188 of file Ftp.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
enum sf::Ftp::Response::Status
+
+inherited
+
+ +

Status codes possibly returned by a FTP response.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
RestartMarkerReply  +

Restart marker reply.

+
ServiceReadySoon  +

Service ready in N minutes.

+
DataConnectionAlreadyOpened  +

Data connection already opened, transfer starting.

+
OpeningDataConnection  +

File status ok, about to open data connection.

+
Ok  +

Command ok.

+
PointlessCommand  +

Command not implemented.

+
SystemStatus  +

System status, or system help reply.

+
DirectoryStatus  +

Directory status.

+
FileStatus  +

File status.

+
HelpMessage  +

Help message.

+
SystemType  +

NAME system type, where NAME is an official system name from the list in the Assigned Numbers document.

+
ServiceReady  +

Service ready for new user.

+
ClosingConnection  +

Service closing control connection.

+
DataConnectionOpened  +

Data connection open, no transfer in progress.

+
ClosingDataConnection  +

Closing data connection, requested file action successful.

+
EnteringPassiveMode  +

Entering passive mode.

+
LoggedIn  +

User logged in, proceed. Logged out if appropriate.

+
FileActionOk  +

Requested file action ok.

+
DirectoryOk  +

PATHNAME created.

+
NeedPassword  +

User name ok, need password.

+
NeedAccountToLogIn  +

Need account for login.

+
NeedInformation  +

Requested file action pending further information.

+
ServiceUnavailable  +

Service not available, closing control connection.

+
DataConnectionUnavailable  +

Can't open data connection.

+
TransferAborted  +

Connection closed, transfer aborted.

+
FileActionAborted  +

Requested file action not taken.

+
LocalError  +

Requested action aborted, local error in processing.

+
InsufficientStorageSpace  +

Requested action not taken; insufficient storage space in system, file unavailable.

+
CommandUnknown  +

Syntax error, command unrecognized.

+
ParametersUnknown  +

Syntax error in parameters or arguments.

+
CommandNotImplemented  +

Command not implemented.

+
BadCommandSequence  +

Bad sequence of commands.

+
ParameterNotImplemented  +

Command not implemented for that parameter.

+
NotLoggedIn  +

Not logged in.

+
NeedAccountToStore  +

Need account for storing files.

+
FileUnavailable  +

Requested action not taken, file unavailable.

+
PageTypeUnknown  +

Requested action aborted, page type unknown.

+
NotEnoughMemory  +

Requested file action aborted, exceeded storage allocation.

+
FilenameNotAllowed  +

Requested action not taken, file name not allowed.

+
InvalidResponse  +

Response is not a valid FTP one.

+
ConnectionFailed  +

Connection with server failed.

+
ConnectionClosed  +

Connection with server closed.

+
InvalidFile  +

Invalid file to upload / download.

+
+ +

Definition at line 74 of file Ftp.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
sf::Ftp::DirectoryResponse::DirectoryResponse (const Responseresponse)
+
+ +

Default constructor.

+
Parameters
+ + +
responseSource response
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const std::string& sf::Ftp::DirectoryResponse::getDirectory () const
+
+ +

Get the directory returned in the response.

+
Returns
Directory name
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const std::string& sf::Ftp::Response::getMessage () const
+
+inherited
+
+ +

Get the full message contained in the response.

+
Returns
The response message
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Status sf::Ftp::Response::getStatus () const
+
+inherited
+
+ +

Get the status code of the response.

+
Returns
Status code
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Ftp::Response::isOk () const
+
+inherited
+
+ +

Check if the status code means a success.

+

This function is defined for convenience, it is equivalent to testing if the status code is < 400.

+
Returns
True if the status is a success, false if it is a failure
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.png new file mode 100644 index 0000000..0f475fa Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1DirectoryResponse.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse-members.htm new file mode 100644 index 0000000..8185203 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse-members.htm @@ -0,0 +1,105 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Ftp::ListingResponse Member List
+
+
+ +

This is the complete list of members for sf::Ftp::ListingResponse, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BadCommandSequence enum valuesf::Ftp::Response
ClosingConnection enum valuesf::Ftp::Response
ClosingDataConnection enum valuesf::Ftp::Response
CommandNotImplemented enum valuesf::Ftp::Response
CommandUnknown enum valuesf::Ftp::Response
ConnectionClosed enum valuesf::Ftp::Response
ConnectionFailed enum valuesf::Ftp::Response
DataConnectionAlreadyOpened enum valuesf::Ftp::Response
DataConnectionOpened enum valuesf::Ftp::Response
DataConnectionUnavailable enum valuesf::Ftp::Response
DirectoryOk enum valuesf::Ftp::Response
DirectoryStatus enum valuesf::Ftp::Response
EnteringPassiveMode enum valuesf::Ftp::Response
FileActionAborted enum valuesf::Ftp::Response
FileActionOk enum valuesf::Ftp::Response
FilenameNotAllowed enum valuesf::Ftp::Response
FileStatus enum valuesf::Ftp::Response
FileUnavailable enum valuesf::Ftp::Response
getListing() const sf::Ftp::ListingResponse
getMessage() const sf::Ftp::Response
getStatus() const sf::Ftp::Response
HelpMessage enum valuesf::Ftp::Response
InsufficientStorageSpace enum valuesf::Ftp::Response
InvalidFile enum valuesf::Ftp::Response
InvalidResponse enum valuesf::Ftp::Response
isOk() const sf::Ftp::Response
ListingResponse(const Response &response, const std::vector< char > &data)sf::Ftp::ListingResponse
LocalError enum valuesf::Ftp::Response
LoggedIn enum valuesf::Ftp::Response
NeedAccountToLogIn enum valuesf::Ftp::Response
NeedAccountToStore enum valuesf::Ftp::Response
NeedInformation enum valuesf::Ftp::Response
NeedPassword enum valuesf::Ftp::Response
NotEnoughMemory enum valuesf::Ftp::Response
NotLoggedIn enum valuesf::Ftp::Response
Ok enum valuesf::Ftp::Response
OpeningDataConnection enum valuesf::Ftp::Response
PageTypeUnknown enum valuesf::Ftp::Response
ParameterNotImplemented enum valuesf::Ftp::Response
ParametersUnknown enum valuesf::Ftp::Response
PointlessCommand enum valuesf::Ftp::Response
Response(Status code=InvalidResponse, const std::string &message="")sf::Ftp::Responseexplicit
RestartMarkerReply enum valuesf::Ftp::Response
ServiceReady enum valuesf::Ftp::Response
ServiceReadySoon enum valuesf::Ftp::Response
ServiceUnavailable enum valuesf::Ftp::Response
Status enum namesf::Ftp::Response
SystemStatus enum valuesf::Ftp::Response
SystemType enum valuesf::Ftp::Response
TransferAborted enum valuesf::Ftp::Response
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.htm new file mode 100644 index 0000000..aa484e4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.htm @@ -0,0 +1,479 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Ftp::ListingResponse Class Reference
+
+
+ +

Specialization of FTP response returning a filename lisiting. + More...

+ +

#include <Ftp.hpp>

+
+Inheritance diagram for sf::Ftp::ListingResponse:
+
+
+ + +sf::Ftp::Response + +
+ + + + + +

+Public Types

enum  Status {
+  RestartMarkerReply = 110, +
+  ServiceReadySoon = 120, +
+  DataConnectionAlreadyOpened = 125, +
+  OpeningDataConnection = 150, +
+  Ok = 200, +
+  PointlessCommand = 202, +
+  SystemStatus = 211, +
+  DirectoryStatus = 212, +
+  FileStatus = 213, +
+  HelpMessage = 214, +
+  SystemType = 215, +
+  ServiceReady = 220, +
+  ClosingConnection = 221, +
+  DataConnectionOpened = 225, +
+  ClosingDataConnection = 226, +
+  EnteringPassiveMode = 227, +
+  LoggedIn = 230, +
+  FileActionOk = 250, +
+  DirectoryOk = 257, +
+  NeedPassword = 331, +
+  NeedAccountToLogIn = 332, +
+  NeedInformation = 350, +
+  ServiceUnavailable = 421, +
+  DataConnectionUnavailable = 425, +
+  TransferAborted = 426, +
+  FileActionAborted = 450, +
+  LocalError = 451, +
+  InsufficientStorageSpace = 452, +
+  CommandUnknown = 500, +
+  ParametersUnknown = 501, +
+  CommandNotImplemented = 502, +
+  BadCommandSequence = 503, +
+  ParameterNotImplemented = 504, +
+  NotLoggedIn = 530, +
+  NeedAccountToStore = 532, +
+  FileUnavailable = 550, +
+  PageTypeUnknown = 551, +
+  NotEnoughMemory = 552, +
+  FilenameNotAllowed = 553, +
+  InvalidResponse = 1000, +
+  ConnectionFailed = 1001, +
+  ConnectionClosed = 1002, +
+  InvalidFile = 1003 +
+ }
 Status codes possibly returned by a FTP response. More...
 
+ + + + + + + + + + + + + + + + +

+Public Member Functions

 ListingResponse (const Response &response, const std::vector< char > &data)
 Default constructor. More...
 
const std::vector< std::string > & getListing () const
 Return the array of directory/file names. More...
 
bool isOk () const
 Check if the status code means a success. More...
 
Status getStatus () const
 Get the status code of the response. More...
 
const std::string & getMessage () const
 Get the full message contained in the response. More...
 
+

Detailed Description

+

Specialization of FTP response returning a filename lisiting.

+ +

Definition at line 221 of file Ftp.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
enum sf::Ftp::Response::Status
+
+inherited
+
+ +

Status codes possibly returned by a FTP response.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
RestartMarkerReply  +

Restart marker reply.

+
ServiceReadySoon  +

Service ready in N minutes.

+
DataConnectionAlreadyOpened  +

Data connection already opened, transfer starting.

+
OpeningDataConnection  +

File status ok, about to open data connection.

+
Ok  +

Command ok.

+
PointlessCommand  +

Command not implemented.

+
SystemStatus  +

System status, or system help reply.

+
DirectoryStatus  +

Directory status.

+
FileStatus  +

File status.

+
HelpMessage  +

Help message.

+
SystemType  +

NAME system type, where NAME is an official system name from the list in the Assigned Numbers document.

+
ServiceReady  +

Service ready for new user.

+
ClosingConnection  +

Service closing control connection.

+
DataConnectionOpened  +

Data connection open, no transfer in progress.

+
ClosingDataConnection  +

Closing data connection, requested file action successful.

+
EnteringPassiveMode  +

Entering passive mode.

+
LoggedIn  +

User logged in, proceed. Logged out if appropriate.

+
FileActionOk  +

Requested file action ok.

+
DirectoryOk  +

PATHNAME created.

+
NeedPassword  +

User name ok, need password.

+
NeedAccountToLogIn  +

Need account for login.

+
NeedInformation  +

Requested file action pending further information.

+
ServiceUnavailable  +

Service not available, closing control connection.

+
DataConnectionUnavailable  +

Can't open data connection.

+
TransferAborted  +

Connection closed, transfer aborted.

+
FileActionAborted  +

Requested file action not taken.

+
LocalError  +

Requested action aborted, local error in processing.

+
InsufficientStorageSpace  +

Requested action not taken; insufficient storage space in system, file unavailable.

+
CommandUnknown  +

Syntax error, command unrecognized.

+
ParametersUnknown  +

Syntax error in parameters or arguments.

+
CommandNotImplemented  +

Command not implemented.

+
BadCommandSequence  +

Bad sequence of commands.

+
ParameterNotImplemented  +

Command not implemented for that parameter.

+
NotLoggedIn  +

Not logged in.

+
NeedAccountToStore  +

Need account for storing files.

+
FileUnavailable  +

Requested action not taken, file unavailable.

+
PageTypeUnknown  +

Requested action aborted, page type unknown.

+
NotEnoughMemory  +

Requested file action aborted, exceeded storage allocation.

+
FilenameNotAllowed  +

Requested action not taken, file name not allowed.

+
InvalidResponse  +

Response is not a valid FTP one.

+
ConnectionFailed  +

Connection with server failed.

+
ConnectionClosed  +

Connection with server closed.

+
InvalidFile  +

Invalid file to upload / download.

+
+ +

Definition at line 74 of file Ftp.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::Ftp::ListingResponse::ListingResponse (const Responseresponse,
const std::vector< char > & data 
)
+
+ +

Default constructor.

+
Parameters
+ + + +
responseSource response
dataData containing the raw listing
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const std::vector<std::string>& sf::Ftp::ListingResponse::getListing () const
+
+ +

Return the array of directory/file names.

+
Returns
Array containing the requested listing
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const std::string& sf::Ftp::Response::getMessage () const
+
+inherited
+
+ +

Get the full message contained in the response.

+
Returns
The response message
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Status sf::Ftp::Response::getStatus () const
+
+inherited
+
+ +

Get the status code of the response.

+
Returns
Status code
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Ftp::Response::isOk () const
+
+inherited
+
+ +

Check if the status code means a success.

+

This function is defined for convenience, it is equivalent to testing if the status code is < 400.

+
Returns
True if the status is a success, false if it is a failure
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.png new file mode 100644 index 0000000..f829455 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1ListingResponse.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response-members.htm new file mode 100644 index 0000000..fa740d0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response-members.htm @@ -0,0 +1,103 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Ftp::Response Member List
+
+
+ +

This is the complete list of members for sf::Ftp::Response, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BadCommandSequence enum valuesf::Ftp::Response
ClosingConnection enum valuesf::Ftp::Response
ClosingDataConnection enum valuesf::Ftp::Response
CommandNotImplemented enum valuesf::Ftp::Response
CommandUnknown enum valuesf::Ftp::Response
ConnectionClosed enum valuesf::Ftp::Response
ConnectionFailed enum valuesf::Ftp::Response
DataConnectionAlreadyOpened enum valuesf::Ftp::Response
DataConnectionOpened enum valuesf::Ftp::Response
DataConnectionUnavailable enum valuesf::Ftp::Response
DirectoryOk enum valuesf::Ftp::Response
DirectoryStatus enum valuesf::Ftp::Response
EnteringPassiveMode enum valuesf::Ftp::Response
FileActionAborted enum valuesf::Ftp::Response
FileActionOk enum valuesf::Ftp::Response
FilenameNotAllowed enum valuesf::Ftp::Response
FileStatus enum valuesf::Ftp::Response
FileUnavailable enum valuesf::Ftp::Response
getMessage() const sf::Ftp::Response
getStatus() const sf::Ftp::Response
HelpMessage enum valuesf::Ftp::Response
InsufficientStorageSpace enum valuesf::Ftp::Response
InvalidFile enum valuesf::Ftp::Response
InvalidResponse enum valuesf::Ftp::Response
isOk() const sf::Ftp::Response
LocalError enum valuesf::Ftp::Response
LoggedIn enum valuesf::Ftp::Response
NeedAccountToLogIn enum valuesf::Ftp::Response
NeedAccountToStore enum valuesf::Ftp::Response
NeedInformation enum valuesf::Ftp::Response
NeedPassword enum valuesf::Ftp::Response
NotEnoughMemory enum valuesf::Ftp::Response
NotLoggedIn enum valuesf::Ftp::Response
Ok enum valuesf::Ftp::Response
OpeningDataConnection enum valuesf::Ftp::Response
PageTypeUnknown enum valuesf::Ftp::Response
ParameterNotImplemented enum valuesf::Ftp::Response
ParametersUnknown enum valuesf::Ftp::Response
PointlessCommand enum valuesf::Ftp::Response
Response(Status code=InvalidResponse, const std::string &message="")sf::Ftp::Responseexplicit
RestartMarkerReply enum valuesf::Ftp::Response
ServiceReady enum valuesf::Ftp::Response
ServiceReadySoon enum valuesf::Ftp::Response
ServiceUnavailable enum valuesf::Ftp::Response
Status enum namesf::Ftp::Response
SystemStatus enum valuesf::Ftp::Response
SystemType enum valuesf::Ftp::Response
TransferAborted enum valuesf::Ftp::Response
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.htm new file mode 100644 index 0000000..48e45d2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.htm @@ -0,0 +1,436 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Ftp::Response Class Reference
+
+
+ +

Define a FTP response. + More...

+ +

#include <Ftp.hpp>

+
+Inheritance diagram for sf::Ftp::Response:
+
+
+ + +sf::Ftp::DirectoryResponse +sf::Ftp::ListingResponse + +
+ + + + + +

+Public Types

enum  Status {
+  RestartMarkerReply = 110, +
+  ServiceReadySoon = 120, +
+  DataConnectionAlreadyOpened = 125, +
+  OpeningDataConnection = 150, +
+  Ok = 200, +
+  PointlessCommand = 202, +
+  SystemStatus = 211, +
+  DirectoryStatus = 212, +
+  FileStatus = 213, +
+  HelpMessage = 214, +
+  SystemType = 215, +
+  ServiceReady = 220, +
+  ClosingConnection = 221, +
+  DataConnectionOpened = 225, +
+  ClosingDataConnection = 226, +
+  EnteringPassiveMode = 227, +
+  LoggedIn = 230, +
+  FileActionOk = 250, +
+  DirectoryOk = 257, +
+  NeedPassword = 331, +
+  NeedAccountToLogIn = 332, +
+  NeedInformation = 350, +
+  ServiceUnavailable = 421, +
+  DataConnectionUnavailable = 425, +
+  TransferAborted = 426, +
+  FileActionAborted = 450, +
+  LocalError = 451, +
+  InsufficientStorageSpace = 452, +
+  CommandUnknown = 500, +
+  ParametersUnknown = 501, +
+  CommandNotImplemented = 502, +
+  BadCommandSequence = 503, +
+  ParameterNotImplemented = 504, +
+  NotLoggedIn = 530, +
+  NeedAccountToStore = 532, +
+  FileUnavailable = 550, +
+  PageTypeUnknown = 551, +
+  NotEnoughMemory = 552, +
+  FilenameNotAllowed = 553, +
+  InvalidResponse = 1000, +
+  ConnectionFailed = 1001, +
+  ConnectionClosed = 1002, +
+  InvalidFile = 1003 +
+ }
 Status codes possibly returned by a FTP response. More...
 
+ + + + + + + + + + + + + +

+Public Member Functions

 Response (Status code=InvalidResponse, const std::string &message="")
 Default constructor. More...
 
bool isOk () const
 Check if the status code means a success. More...
 
Status getStatus () const
 Get the status code of the response. More...
 
const std::string & getMessage () const
 Get the full message contained in the response. More...
 
+

Detailed Description

+

Define a FTP response.

+ +

Definition at line 66 of file Ftp.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Ftp::Response::Status
+
+ +

Status codes possibly returned by a FTP response.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
RestartMarkerReply  +

Restart marker reply.

+
ServiceReadySoon  +

Service ready in N minutes.

+
DataConnectionAlreadyOpened  +

Data connection already opened, transfer starting.

+
OpeningDataConnection  +

File status ok, about to open data connection.

+
Ok  +

Command ok.

+
PointlessCommand  +

Command not implemented.

+
SystemStatus  +

System status, or system help reply.

+
DirectoryStatus  +

Directory status.

+
FileStatus  +

File status.

+
HelpMessage  +

Help message.

+
SystemType  +

NAME system type, where NAME is an official system name from the list in the Assigned Numbers document.

+
ServiceReady  +

Service ready for new user.

+
ClosingConnection  +

Service closing control connection.

+
DataConnectionOpened  +

Data connection open, no transfer in progress.

+
ClosingDataConnection  +

Closing data connection, requested file action successful.

+
EnteringPassiveMode  +

Entering passive mode.

+
LoggedIn  +

User logged in, proceed. Logged out if appropriate.

+
FileActionOk  +

Requested file action ok.

+
DirectoryOk  +

PATHNAME created.

+
NeedPassword  +

User name ok, need password.

+
NeedAccountToLogIn  +

Need account for login.

+
NeedInformation  +

Requested file action pending further information.

+
ServiceUnavailable  +

Service not available, closing control connection.

+
DataConnectionUnavailable  +

Can't open data connection.

+
TransferAborted  +

Connection closed, transfer aborted.

+
FileActionAborted  +

Requested file action not taken.

+
LocalError  +

Requested action aborted, local error in processing.

+
InsufficientStorageSpace  +

Requested action not taken; insufficient storage space in system, file unavailable.

+
CommandUnknown  +

Syntax error, command unrecognized.

+
ParametersUnknown  +

Syntax error in parameters or arguments.

+
CommandNotImplemented  +

Command not implemented.

+
BadCommandSequence  +

Bad sequence of commands.

+
ParameterNotImplemented  +

Command not implemented for that parameter.

+
NotLoggedIn  +

Not logged in.

+
NeedAccountToStore  +

Need account for storing files.

+
FileUnavailable  +

Requested action not taken, file unavailable.

+
PageTypeUnknown  +

Requested action aborted, page type unknown.

+
NotEnoughMemory  +

Requested file action aborted, exceeded storage allocation.

+
FilenameNotAllowed  +

Requested action not taken, file name not allowed.

+
InvalidResponse  +

Response is not a valid FTP one.

+
ConnectionFailed  +

Connection with server failed.

+
ConnectionClosed  +

Connection with server closed.

+
InvalidFile  +

Invalid file to upload / download.

+
+ +

Definition at line 74 of file Ftp.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
sf::Ftp::Response::Response (Status code = InvalidResponse,
const std::string & message = "" 
)
+
+explicit
+
+ +

Default constructor.

+

This constructor is used by the FTP client to build the response.

+
Parameters
+ + + +
codeResponse status code
messageResponse message
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const std::string& sf::Ftp::Response::getMessage () const
+
+ +

Get the full message contained in the response.

+
Returns
The response message
+ +
+
+ +
+
+ + + + + + + +
Status sf::Ftp::Response::getStatus () const
+
+ +

Get the status code of the response.

+
Returns
Status code
+ +
+
+ +
+
+ + + + + + + +
bool sf::Ftp::Response::isOk () const
+
+ +

Check if the status code means a success.

+

This function is defined for convenience, it is equivalent to testing if the status code is < 400.

+
Returns
True if the status is a success, false if it is a failure
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.png new file mode 100644 index 0000000..d56a74e Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Ftp_1_1Response.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource-members.htm new file mode 100644 index 0000000..35884bd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::GlResource Member List
+
+
+ +

This is the complete list of members for sf::GlResource, including all inherited members.

+ + + + +
ensureGlContext()sf::GlResourceprotectedstatic
GlResource()sf::GlResourceprotected
~GlResource()sf::GlResourceprotected
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.htm new file mode 100644 index 0000000..a02516f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.htm @@ -0,0 +1,175 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Base class for classes that require an OpenGL context. + More...

+ +

#include <GlResource.hpp>

+
+Inheritance diagram for sf::GlResource:
+
+
+ + +sf::Context +sf::Shader +sf::Texture +sf::Window +sf::RenderWindow + +
+ + + + + + + + +

+Protected Member Functions

 GlResource ()
 Default constructor. More...
 
 ~GlResource ()
 Destructor. More...
 
+ + + + +

+Static Protected Member Functions

static void ensureGlContext ()
 Make sure that a valid OpenGL context exists in the current thread. More...
 
+

Detailed Description

+

Base class for classes that require an OpenGL context.

+

This class is for internal use only, it must be the base of every class that requires a valid OpenGL context in order to work.

+ +

Definition at line 40 of file GlResource.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
sf::GlResource::GlResource ()
+
+protected
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::GlResource::~GlResource ()
+
+protected
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
static void sf::GlResource::ensureGlContext ()
+
+staticprotected
+
+ +

Make sure that a valid OpenGL context exists in the current thread.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.png new file mode 100644 index 0000000..6b62eee Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1GlResource.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph-members.htm new file mode 100644 index 0000000..94d4719 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph-members.htm @@ -0,0 +1,59 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Glyph Member List
+
+
+ +

This is the complete list of members for sf::Glyph, including all inherited members.

+ + + + + +
advancesf::Glyph
boundssf::Glyph
Glyph()sf::Glyphinline
textureRectsf::Glyph
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph.htm new file mode 100644 index 0000000..fcdab58 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Glyph.htm @@ -0,0 +1,172 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Structure describing a glyph. + More...

+ +

#include <Glyph.hpp>

+ + + + + +

+Public Member Functions

 Glyph ()
 Default constructor. More...
 
+ + + + + + + + + + +

+Public Attributes

int advance
 Offset to move horizontically to the next character. More...
 
IntRect bounds
 Bounding rectangle of the glyph, in coordinates relative to the baseline. More...
 
IntRect textureRect
 Texture coordinates of the glyph inside the font's texture. More...
 
+

Detailed Description

+

Structure describing a glyph.

+

A glyph is the visual representation of a character.

+

The sf::Glyph structure provides the information needed to handle the glyph:

+
    +
  • its coordinates in the font's texture
  • +
  • its bounding rectangle
  • +
  • the offset to apply to get the starting position of the next glyph
  • +
+
See Also
sf::Font
+ +

Definition at line 41 of file Glyph.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
sf::Glyph::Glyph ()
+
+inline
+
+ +

Default constructor.

+ +

Definition at line 49 of file Glyph.hpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
int sf::Glyph::advance
+
+ +

Offset to move horizontically to the next character.

+ +

Definition at line 54 of file Glyph.hpp.

+ +
+
+ +
+
+ + + + +
IntRect sf::Glyph::bounds
+
+ +

Bounding rectangle of the glyph, in coordinates relative to the baseline.

+ +

Definition at line 55 of file Glyph.hpp.

+ +
+
+ +
+
+ + + + +
IntRect sf::Glyph::textureRect
+
+ +

Texture coordinates of the glyph inside the font's texture.

+ +

Definition at line 56 of file Glyph.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http-members.htm new file mode 100644 index 0000000..7293824 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http-members.htm @@ -0,0 +1,60 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Http Member List
+
+
+ +

This is the complete list of members for sf::Http, including all inherited members.

+ + + + + + +
Http()sf::Http
Http(const std::string &host, unsigned short port=0)sf::Http
NonCopyable()sf::NonCopyableinlineprivate
sendRequest(const Request &request, Time timeout=Time::Zero)sf::Http
setHost(const std::string &host, unsigned short port=0)sf::Http
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.htm new file mode 100644 index 0000000..19c40f2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.htm @@ -0,0 +1,275 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Http Class Reference
+
+
+ +

A HTTP client. + More...

+ +

#include <Http.hpp>

+
+Inheritance diagram for sf::Http:
+
+
+ + +sf::NonCopyable + +
+ + + + + + + + +

+Classes

class  Request
 Define a HTTP request. More...
 
class  Response
 Define a HTTP response. More...
 
+ + + + + + + + + + + + + +

+Public Member Functions

 Http ()
 Default constructor. More...
 
 Http (const std::string &host, unsigned short port=0)
 Construct the HTTP client with the target host. More...
 
void setHost (const std::string &host, unsigned short port=0)
 Set the target host. More...
 
Response sendRequest (const Request &request, Time timeout=Time::Zero)
 Send a HTTP request and return the server's response. More...
 
+

Detailed Description

+

A HTTP client.

+

sf::Http is a very simple HTTP client that allows you to communicate with a web server.

+

You can retrieve web pages, send data to an interactive resource, download a remote file, etc.

+

The HTTP client is split into 3 classes:

+ +

sf::Http::Request builds the request that will be sent to the server. A request is made of:

+
    +
  • a method (what you want to do)
  • +
  • a target URI (usually the name of the web page or file)
  • +
  • one or more header fields (options that you can pass to the server)
  • +
  • an optional body (for POST requests)
  • +
+

sf::Http::Response parse the response from the web server and provides getters to read them. The response contains:

+
    +
  • a status code
  • +
  • header fields (that may be answers to the ones that you requested)
  • +
  • a body, which contains the contents of the requested resource
  • +
+

sf::Http provides a simple function, SendRequest, to send a sf::Http::Request and return the corresponding sf::Http::Response from the server.

+

Usage example:

+
// Create a new HTTP client
+
sf::Http http;
+
+
// We'll work on http://www.sfml-dev.org
+
http.setHost("http://www.sfml-dev.org");
+
+
// Prepare a request to get the 'features.php' page
+
sf::Http::Request request("features.php");
+
+
// Send the request
+
sf::Http::Response response = http.sendRequest(request);
+
+
// Check the status code and display the result
+ +
if (status == sf::Http::Response::Ok)
+
{
+
std::cout << response.getBody() << std::endl;
+
}
+
else
+
{
+
std::cout << "Error " << status << std::endl;
+
}
+
+

Definition at line 46 of file Http.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Http::Http ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::Http::Http (const std::string & host,
unsigned short port = 0 
)
+
+ +

Construct the HTTP client with the target host.

+

This is equivalent to calling setHost(host, port). The port has a default value of 0, which means that the HTTP client will use the right port according to the protocol used (80 for HTTP, 443 for HTTPS). You should leave it like this unless you really need a port other than the standard one, or use an unknown protocol.

+
Parameters
+ + + +
hostWeb server to connect to
portPort to use for connection
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
Response sf::Http::sendRequest (const Requestrequest,
Time timeout = Time::Zero 
)
+
+ +

Send a HTTP request and return the server's response.

+

You must have a valid host before sending a request (see setHost). Any missing mandatory header field in the request will be added with an appropriate value. Warning: this function waits for the server's response and may not return instantly; use a thread if you don't want to block your application, or use a timeout to limit the time to wait. A value of Time::Zero means that the client will use the system defaut timeout (which is usually pretty long).

+
Parameters
+ + + +
requestRequest to send
timeoutMaximum time to wait
+
+
+
Returns
Server's response
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Http::setHost (const std::string & host,
unsigned short port = 0 
)
+
+ +

Set the target host.

+

This function just stores the host address and port, it doesn't actually connect to it until you send a request. The port has a default value of 0, which means that the HTTP client will use the right port according to the protocol used (80 for HTTP, 443 for HTTPS). You should leave it like this unless you really need a port other than the standard one, or use an unknown protocol.

+
Parameters
+ + + +
hostWeb server to connect to
portPort to use for connection
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.png new file mode 100644 index 0000000..6f251bf Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request-members.htm new file mode 100644 index 0000000..b486974 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request-members.htm @@ -0,0 +1,66 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Http::Request Member List
+
+
+ +

This is the complete list of members for sf::Http::Request, including all inherited members.

+ + + + + + + + + + + + +
Get enum valuesf::Http::Request
Head enum valuesf::Http::Request
Http (defined in sf::Http::Request)sf::Http::Requestfriend
Method enum namesf::Http::Request
Post enum valuesf::Http::Request
Request(const std::string &uri="/", Method method=Get, const std::string &body="")sf::Http::Request
setBody(const std::string &body)sf::Http::Request
setField(const std::string &field, const std::string &value)sf::Http::Request
setHttpVersion(unsigned int major, unsigned int minor)sf::Http::Request
setMethod(Method method)sf::Http::Request
setUri(const std::string &uri)sf::Http::Request
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request.htm new file mode 100644 index 0000000..904478f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Request.htm @@ -0,0 +1,330 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Http::Request Class Reference
+
+
+ +

Define a HTTP request. + More...

+ +

#include <Http.hpp>

+ + + + + +

+Public Types

enum  Method {
+  Get, +
+  Post, +
+  Head +
+ }
 Enumerate the available HTTP methods for a request. More...
 
+ + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Request (const std::string &uri="/", Method method=Get, const std::string &body="")
 Default constructor. More...
 
void setField (const std::string &field, const std::string &value)
 Set the value of a field. More...
 
void setMethod (Method method)
 Set the request method. More...
 
void setUri (const std::string &uri)
 Set the requested URI. More...
 
void setHttpVersion (unsigned int major, unsigned int minor)
 Set the HTTP version for the request. More...
 
void setBody (const std::string &body)
 Set the body of the request. More...
 
+ + + +

+Friends

+class Http
 
+

Detailed Description

+

Define a HTTP request.

+ +

Definition at line 54 of file Http.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Http::Request::Method
+
+ +

Enumerate the available HTTP methods for a request.

+ + + + +
Enumerator
Get  +

Request in get mode, standard method to retrieve a page.

+
Post  +

Request in post mode, usually to send data to a page.

+
Head  +

Request a page's header only.

+
+ +

Definition at line 62 of file Http.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::Http::Request::Request (const std::string & uri = "/",
Method method = Get,
const std::string & body = "" 
)
+
+ +

Default constructor.

+

This constructor creates a GET request, with the root URI ("/") and an empty body.

+
Parameters
+ + + + +
uriTarget URI
methodMethod to use for the request
bodyContent of the request's body
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void sf::Http::Request::setBody (const std::string & body)
+
+ +

Set the body of the request.

+

The body of a request is optional and only makes sense for POST requests. It is ignored for all other methods. The body is empty by default.

+
Parameters
+ + +
bodyContent of the body
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Http::Request::setField (const std::string & field,
const std::string & value 
)
+
+ +

Set the value of a field.

+

The field is created if it doesn't exist. The name of the field is case insensitive. By default, a request doesn't contain any field (but the mandatory fields are added later by the HTTP client when sending the request).

+
Parameters
+ + + +
fieldName of the field to set
valueValue of the field
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Http::Request::setHttpVersion (unsigned int major,
unsigned int minor 
)
+
+ +

Set the HTTP version for the request.

+

The HTTP version is 1.0 by default.

+
Parameters
+ + + +
majorMajor HTTP version number
minorMinor HTTP version number
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Http::Request::setMethod (Method method)
+
+ +

Set the request method.

+

See the Method enumeration for a complete list of all the availale methods. The method is Http::Request::Get by default.

+
Parameters
+ + +
methodMethod to use for the request
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Http::Request::setUri (const std::string & uri)
+
+ +

Set the requested URI.

+

The URI is the resource (usually a web page or a file) that you want to get or post. The URI is "/" (the root page) by default.

+
Parameters
+ + +
uriURI to request, relative to the host
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response-members.htm new file mode 100644 index 0000000..d744fa4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response-members.htm @@ -0,0 +1,86 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Http::Response Member List
+
+ + + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response.htm new file mode 100644 index 0000000..4411dfe --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Http_1_1Response.htm @@ -0,0 +1,366 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Http::Response Class Reference
+
+
+ +

Define a HTTP response. + More...

+ +

#include <Http.hpp>

+ + + + + +

+Public Types

enum  Status {
+  Ok = 200, +
+  Created = 201, +
+  Accepted = 202, +
+  NoContent = 204, +
+  ResetContent = 205, +
+  PartialContent = 206, +
+  MultipleChoices = 300, +
+  MovedPermanently = 301, +
+  MovedTemporarily = 302, +
+  NotModified = 304, +
+  BadRequest = 400, +
+  Unauthorized = 401, +
+  Forbidden = 403, +
+  NotFound = 404, +
+  RangeNotSatisfiable = 407, +
+  InternalServerError = 500, +
+  NotImplemented = 501, +
+  BadGateway = 502, +
+  ServiceNotAvailable = 503, +
+  GatewayTimeout = 504, +
+  VersionNotSupported = 505, +
+  InvalidResponse = 1000, +
+  ConnectionFailed = 1001 +
+ }
 Enumerate all the valid status codes for a response. More...
 
+ + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Response ()
 Default constructor. More...
 
const std::string & getField (const std::string &field) const
 Get the value of a field. More...
 
Status getStatus () const
 Get the response status code. More...
 
unsigned int getMajorHttpVersion () const
 Get the major HTTP version number of the response. More...
 
unsigned int getMinorHttpVersion () const
 Get the minor HTTP version number of the response. More...
 
const std::string & getBody () const
 Get the body of the response. More...
 
+ + + +

+Friends

+class Http
 
+

Detailed Description

+

Define a HTTP response.

+ +

Definition at line 191 of file Http.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Http::Response::Status
+
+ +

Enumerate all the valid status codes for a response.

+ + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
Ok  +

Most common code returned when operation was successful.

+
Created  +

The resource has successfully been created.

+
Accepted  +

The request has been accepted, but will be processed later by the server.

+
NoContent  +

The server didn't send any data in return.

+
ResetContent  +

The server informs the client that it should clear the view (form) that caused the request to be sent.

+
PartialContent  +

The server has sent a part of the resource, as a response to a partial GET request.

+
MultipleChoices  +

The requested page can be accessed from several locations.

+
MovedPermanently  +

The requested page has permanently moved to a new location.

+
MovedTemporarily  +

The requested page has temporarily moved to a new location.

+
NotModified  +

For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed.

+
BadRequest  +

The server couldn't understand the request (syntax error)

+
Unauthorized  +

The requested page needs an authentification to be accessed.

+
Forbidden  +

The requested page cannot be accessed at all, even with authentification.

+
NotFound  +

The requested page doesn't exist.

+
RangeNotSatisfiable  +

The server can't satisfy the partial GET request (with a "Range" header field)

+
InternalServerError  +

The server encountered an unexpected error.

+
NotImplemented  +

The server doesn't implement a requested feature.

+
BadGateway  +

The gateway server has received an error from the source server.

+
ServiceNotAvailable  +

The server is temporarily unavailable (overloaded, in maintenance, ...)

+
GatewayTimeout  +

The gateway server couldn't receive a response from the source server.

+
VersionNotSupported  +

The server doesn't support the requested HTTP version.

+
InvalidResponse  +

Response is not a valid HTTP one.

+
ConnectionFailed  +

Connection with server failed.

+
+ +

Definition at line 199 of file Http.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Http::Response::Response ()
+
+ +

Default constructor.

+

Constructs an empty response.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const std::string& sf::Http::Response::getBody () const
+
+ +

Get the body of the response.

+

The body of a response may contain:

+
    +
  • the requested page (for GET requests)
  • +
  • a response from the server (for POST requests)
  • +
  • nothing (for HEAD requests)
  • +
  • an error message (in case of an error)
  • +
+
Returns
The response body
+ +
+
+ +
+
+ + + + + + + + +
const std::string& sf::Http::Response::getField (const std::string & field) const
+
+ +

Get the value of a field.

+

If the field field is not found in the response header, the empty string is returned. This function uses case-insensitive comparisons.

+
Parameters
+ + +
fieldName of the field to get
+
+
+
Returns
Value of the field, or empty string if not found
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::Http::Response::getMajorHttpVersion () const
+
+ +

Get the major HTTP version number of the response.

+
Returns
Major HTTP version number
+
See Also
getMinorHttpVersion
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::Http::Response::getMinorHttpVersion () const
+
+ +

Get the minor HTTP version number of the response.

+
Returns
Minor HTTP version number
+
See Also
getMajorHttpVersion
+ +
+
+ +
+
+ + + + + + + +
Status sf::Http::Response::getStatus () const
+
+ +

Get the response status code.

+

The status code should be the first thing to be checked after receiving a response, it defines whether it is a success, a failure or anything else (see the Status enumeration).

+
Returns
Status code of the response
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image-members.htm new file mode 100644 index 0000000..a2f39b9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image-members.htm @@ -0,0 +1,70 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Image Member List
+
+
+ +

This is the complete list of members for sf::Image, including all inherited members.

+ + + + + + + + + + + + + + + + +
copy(const Image &source, unsigned int destX, unsigned int destY, const IntRect &sourceRect=IntRect(0, 0, 0, 0), bool applyAlpha=false)sf::Image
create(unsigned int width, unsigned int height, const Color &color=Color(0, 0, 0))sf::Image
create(unsigned int width, unsigned int height, const Uint8 *pixels)sf::Image
createMaskFromColor(const Color &color, Uint8 alpha=0)sf::Image
flipHorizontally()sf::Image
flipVertically()sf::Image
getPixel(unsigned int x, unsigned int y) const sf::Image
getPixelsPtr() const sf::Image
getSize() const sf::Image
Image()sf::Image
loadFromFile(const std::string &filename)sf::Image
loadFromMemory(const void *data, std::size_t size)sf::Image
loadFromStream(InputStream &stream)sf::Image
saveToFile(const std::string &filename) const sf::Image
setPixel(unsigned int x, unsigned int y, const Color &color)sf::Image
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image.htm new file mode 100644 index 0000000..858a697 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Image.htm @@ -0,0 +1,613 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Image Class Reference
+
+
+ +

Class for loading, manipulating and saving images. + More...

+ +

#include <Image.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Image ()
 Default constructor. More...
 
void create (unsigned int width, unsigned int height, const Color &color=Color(0, 0, 0))
 Create the image and fill it with a unique color. More...
 
void create (unsigned int width, unsigned int height, const Uint8 *pixels)
 Create the image from an array of pixels. More...
 
bool loadFromFile (const std::string &filename)
 Load the image from a file on disk. More...
 
bool loadFromMemory (const void *data, std::size_t size)
 Load the image from a file in memory. More...
 
bool loadFromStream (InputStream &stream)
 Load the image from a custom stream. More...
 
bool saveToFile (const std::string &filename) const
 Save the image to a file on disk. More...
 
Vector2u getSize () const
 Return the size (width and height) of the image. More...
 
void createMaskFromColor (const Color &color, Uint8 alpha=0)
 Create a transparency mask from a specified color-key. More...
 
void copy (const Image &source, unsigned int destX, unsigned int destY, const IntRect &sourceRect=IntRect(0, 0, 0, 0), bool applyAlpha=false)
 Copy pixels from another image onto this one. More...
 
void setPixel (unsigned int x, unsigned int y, const Color &color)
 Change the color of a pixel. More...
 
Color getPixel (unsigned int x, unsigned int y) const
 Get the color of a pixel. More...
 
const Uint8 * getPixelsPtr () const
 Get a read-only pointer to the array of pixels. More...
 
void flipHorizontally ()
 Flip the image horizontally (left <-> right) More...
 
void flipVertically ()
 Flip the image vertically (top <-> bottom) More...
 
+

Detailed Description

+

Class for loading, manipulating and saving images.

+

sf::Image is an abstraction to manipulate images as bidimensional arrays of pixels.

+

The class provides functions to load, read, write and save pixels, as well as many other useful functions.

+

sf::Image can handle a unique internal representation of pixels, which is RGBA 32 bits. This means that a pixel must be composed of 8 bits red, green, blue and alpha channels – just like a sf::Color. All the functions that return an array of pixels follow this rule, and all parameters that you pass to sf::Image functions (such as loadFromPixels) must use this representation as well.

+

A sf::Image can be copied, but it is a heavy resource and if possible you should always use [const] references to pass or return them to avoid useless copies.

+

Usage example:

+
// Load an image file from a file
+
sf::Image background;
+
if (!background.loadFromFile("background.jpg"))
+
return -1;
+
+
// Create a 20x20 image filled with black color
+
sf::Image image;
+
image.create(20, 20, sf::Color::Black);
+
+
// Copy image1 on image2 at position (10, 10)
+
image.copy(background, 10, 10);
+
+
// Make the top-left pixel transparent
+
sf::Color color = image.getPixel(0, 0);
+
color.a = 0;
+
image.setPixel(0, 0, color);
+
+
// Save the image to a file
+
if (!image.saveToFile("result.png"))
+
return -1;
+
See Also
sf::Texture
+ +

Definition at line 46 of file Image.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Image::Image ()
+
+ +

Default constructor.

+

Creates an empty image.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Image::copy (const Imagesource,
unsigned int destX,
unsigned int destY,
const IntRectsourceRect = IntRect(0, 0, 0, 0),
bool applyAlpha = false 
)
+
+ +

Copy pixels from another image onto this one.

+

This function does a slow pixel copy and should not be used intensively. It can be used to prepare a complex static image from several others, but if you need this kind of feature in real-time you'd better use sf::RenderTexture.

+

If sourceRect is empty, the whole image is copied. If applyAlpha is set to true, the transparency of source pixels is applied. If it is false, the pixels are copied unchanged with their alpha value.

+
Parameters
+ + + + + + +
sourceSource image to copy
destXX coordinate of the destination position
destYY coordinate of the destination position
sourceRectSub-rectangle of the source image to copy
applyAlphaShould the copy take in account the source transparency?
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Image::create (unsigned int width,
unsigned int height,
const Colorcolor = Color(0, 0, 0) 
)
+
+ +

Create the image and fill it with a unique color.

+
Parameters
+ + + + +
widthWidth of the image
heightHeight of the image
colorFill color
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Image::create (unsigned int width,
unsigned int height,
const Uint8 * pixels 
)
+
+ +

Create the image from an array of pixels.

+

The pixel array is assumed to contain 32-bits RGBA pixels, and have the given width and height. If not, this is an undefined behaviour. If pixels is null, an empty image is created.

+
Parameters
+ + + + +
widthWidth of the image
heightHeight of the image
pixelsArray of pixels to copy to the image
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Image::createMaskFromColor (const Colorcolor,
Uint8 alpha = 0 
)
+
+ +

Create a transparency mask from a specified color-key.

+

This function sets the alpha value of every pixel matching the given color to alpha (0 by default), so that they become transparent.

+
Parameters
+ + + +
colorColor to make transparent
alphaAlpha value to assign to transparent pixels
+
+
+ +
+
+ +
+
+ + + + + + + +
void sf::Image::flipHorizontally ()
+
+ +

Flip the image horizontally (left <-> right)

+ +
+
+ +
+
+ + + + + + + +
void sf::Image::flipVertically ()
+
+ +

Flip the image vertically (top <-> bottom)

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Color sf::Image::getPixel (unsigned int x,
unsigned int y 
) const
+
+ +

Get the color of a pixel.

+

This function doesn't check the validity of the pixel coordinates, using out-of-range values will result in an undefined behaviour.

+
Parameters
+ + + +
xX coordinate of pixel to get
yY coordinate of pixel to get
+
+
+
Returns
Color of the pixel at coordinates (x, y)
+
See Also
setPixel
+ +
+
+ +
+
+ + + + + + + +
const Uint8* sf::Image::getPixelsPtr () const
+
+ +

Get a read-only pointer to the array of pixels.

+

The returned value points to an array of RGBA pixels made of 8 bits integers components. The size of the array is width * height * 4 (getSize().x * getSize().y * 4). Warning: the returned pointer may become invalid if you modify the image, so you should never store it for too long. If the image is empty, a null pointer is returned.

+
Returns
Read-only pointer to the array of pixels
+ +
+
+ +
+
+ + + + + + + +
Vector2u sf::Image::getSize () const
+
+ +

Return the size (width and height) of the image.

+
Returns
Size of the image, in pixels
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Image::loadFromFile (const std::string & filename)
+
+ +

Load the image from a file on disk.

+

The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic. Some format options are not supported, like progressive jpeg. If this function fails, the image is left unchanged.

+
Parameters
+ + +
filenamePath of the image file to load
+
+
+
Returns
True if loading was successful
+
See Also
loadFromMemory, loadFromStream, saveToFile
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Image::loadFromMemory (const void * data,
std::size_t size 
)
+
+ +

Load the image from a file in memory.

+

The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic. Some format options are not supported, like progressive jpeg. If this function fails, the image is left unchanged.

+
Parameters
+ + + +
dataPointer to the file data in memory
sizeSize of the data to load, in bytes
+
+
+
Returns
True if loading was successful
+
See Also
loadFromFile, loadFromStream
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Image::loadFromStream (InputStreamstream)
+
+ +

Load the image from a custom stream.

+

The supported image formats are bmp, png, tga, jpg, gif, psd, hdr and pic. Some format options are not supported, like progressive jpeg. If this function fails, the image is left unchanged.

+
Parameters
+ + +
streamSource stream to read from
+
+
+
Returns
True if loading was successful
+
See Also
loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Image::saveToFile (const std::string & filename) const
+
+ +

Save the image to a file on disk.

+

The format of the image is automatically deduced from the extension. The supported image formats are bmp, png, tga and jpg. The destination file is overwritten if it already exists. This function fails if the image is empty.

+
Parameters
+ + +
filenamePath of the file to save
+
+
+
Returns
True if saving was successful
+
See Also
create, loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Image::setPixel (unsigned int x,
unsigned int y,
const Colorcolor 
)
+
+ +

Change the color of a pixel.

+

This function doesn't check the validity of the pixel coordinates, using out-of-range values will result in an undefined behaviour.

+
Parameters
+ + + + +
xX coordinate of pixel to change
yY coordinate of pixel to change
colorNew color of the pixel
+
+
+
See Also
getPixel
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream-members.htm new file mode 100644 index 0000000..7cb7f26 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream-members.htm @@ -0,0 +1,60 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::InputStream Member List
+
+
+ +

This is the complete list of members for sf::InputStream, including all inherited members.

+ + + + + + +
getSize()=0sf::InputStreampure virtual
read(void *data, Int64 size)=0sf::InputStreampure virtual
seek(Int64 position)=0sf::InputStreampure virtual
tell()=0sf::InputStreampure virtual
~InputStream()sf::InputStreaminlinevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream.htm new file mode 100644 index 0000000..d563fce --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1InputStream.htm @@ -0,0 +1,283 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::InputStream Class Referenceabstract
+
+
+ +

Abstract class for custom file input streams. + More...

+ +

#include <InputStream.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Member Functions

virtual ~InputStream ()
 Virtual destructor. More...
 
virtual Int64 read (void *data, Int64 size)=0
 Read data from the stream. More...
 
virtual Int64 seek (Int64 position)=0
 Change the current reading position. More...
 
virtual Int64 tell ()=0
 Get the current reading position in the stream. More...
 
virtual Int64 getSize ()=0
 Return the size of the stream. More...
 
+

Detailed Description

+

Abstract class for custom file input streams.

+

This class allows users to define their own file input sources from which SFML can load resources.

+

SFML resource classes like sf::Texture and sf::SoundBuffer provide loadFromFile and loadFromMemory functions, which read data from conventional sources. However, if you have data coming from a different source (over a network, embedded, encrypted, compressed, etc) you can derive your own class from sf::InputStream and load SFML resources with their loadFromStream function.

+

Usage example:

+
// custom stream class that reads from inside a zip file
+
class ZipStream : public sf::InputStream
+
{
+
public :
+
+
ZipStream(std::string archive);
+
+
bool open(std::string filename);
+
+
Int64 read(void* data, Int64 size);
+
+
Int64 seek(Int64 position);
+
+
Int64 tell();
+
+
Int64 getSize();
+
+
private :
+
+
...
+
};
+
+
// now you can load textures...
+
sf::Texture texture;
+
ZipStream stream("resources.zip");
+
stream.open("images/img.png");
+
texture.loadFromStream(stream);
+
+
// musics...
+
sf::Music music;
+
ZipStream stream("resources.zip");
+
stream.open("musics/msc.ogg");
+
music.openFromStream(stream);
+
+
// etc.
+
+

Definition at line 40 of file InputStream.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::InputStream::~InputStream ()
+
+inlinevirtual
+
+ +

Virtual destructor.

+ +

Definition at line 48 of file InputStream.hpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual Int64 sf::InputStream::getSize ()
+
+pure virtual
+
+ +

Return the size of the stream.

+
Returns
The total number of bytes available in the stream, or -1 on error
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual Int64 sf::InputStream::read (void * data,
Int64 size 
)
+
+pure virtual
+
+ +

Read data from the stream.

+

After reading, the stream's reading position must be advanced by the amount of bytes read.

+
Parameters
+ + + +
dataBuffer where to copy the read data
sizeDesired number of bytes to read
+
+
+
Returns
The number of bytes actually read, or -1 on error
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual Int64 sf::InputStream::seek (Int64 position)
+
+pure virtual
+
+ +

Change the current reading position.

+
Parameters
+ + +
positionThe position to seek to, from the beginning
+
+
+
Returns
The position actually sought to, or -1 on error
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual Int64 sf::InputStream::tell ()
+
+pure virtual
+
+ +

Get the current reading position in the stream.

+
Returns
The current position, or -1 on error.
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress-members.htm new file mode 100644 index 0000000..5e81581 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress-members.htm @@ -0,0 +1,67 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::IpAddress Member List
+
+
+ +

This is the complete list of members for sf::IpAddress, including all inherited members.

+ + + + + + + + + + + + + +
Broadcastsf::IpAddressstatic
getLocalAddress()sf::IpAddressstatic
getPublicAddress(Time timeout=Time::Zero)sf::IpAddressstatic
IpAddress()sf::IpAddress
IpAddress(const std::string &address)sf::IpAddress
IpAddress(const char *address)sf::IpAddress
IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3)sf::IpAddress
IpAddress(Uint32 address)sf::IpAddressexplicit
LocalHostsf::IpAddressstatic
Nonesf::IpAddressstatic
toInteger() const sf::IpAddress
toString() const sf::IpAddress
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress.htm new file mode 100644 index 0000000..d3547f2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1IpAddress.htm @@ -0,0 +1,459 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Encapsulate an IPv4 network address. + More...

+ +

#include <IpAddress.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 IpAddress ()
 Default constructor. More...
 
 IpAddress (const std::string &address)
 Construct the address from a string. More...
 
 IpAddress (const char *address)
 Construct the address from a string. More...
 
 IpAddress (Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3)
 Construct the address from 4 bytes. More...
 
 IpAddress (Uint32 address)
 Construct the address from a 32-bits integer. More...
 
std::string toString () const
 Get a string representation of the address. More...
 
Uint32 toInteger () const
 Get an integer representation of the address. More...
 
+ + + + + + + +

+Static Public Member Functions

static IpAddress getLocalAddress ()
 Get the computer's local address. More...
 
static IpAddress getPublicAddress (Time timeout=Time::Zero)
 Get the computer's public address. More...
 
+ + + + + + + + + + +

+Static Public Attributes

static const IpAddress None
 Value representing an empty/invalid address. More...
 
static const IpAddress LocalHost
 The "localhost" address (for connecting a computer to itself locally) More...
 
static const IpAddress Broadcast
 The "broadcast" address (for sending UDP messages to everyone on a local network) More...
 
+

Detailed Description

+

Encapsulate an IPv4 network address.

+

sf::IpAddress is a utility class for manipulating network addresses.

+

It provides a set a implicit constructors and conversion functions to easily build or transform an IP address from/to various representations.

+

Usage example:

+
sf::IpAddress a0; // an invalid address
+
sf::IpAddress a1 = sf::IpAddress::None; // an invalid address (same as a0)
+
sf::IpAddress a2("127.0.0.1"); // the local host address
+
sf::IpAddress a3 = sf::IpAddress::Broadcast; // the broadcast address
+
sf::IpAddress a4(192, 168, 1, 56); // a local address
+
sf::IpAddress a5("my_computer"); // a local address created from a network name
+
sf::IpAddress a6("89.54.1.169"); // a distant address
+
sf::IpAddress a7("www.google.com"); // a distant address created from a network name
+
sf::IpAddress a8 = sf::IpAddress::getLocalAddress(); // my address on the local network
+
sf::IpAddress a9 = sf::IpAddress::getPublicAddress(); // my address on the internet
+

Note that sf::IpAddress currently doesn't support IPv6 nor other types of network addresses.

+ +

Definition at line 44 of file IpAddress.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::IpAddress::IpAddress ()
+
+ +

Default constructor.

+

This constructor creates an empty (invalid) address

+ +
+
+ +
+
+ + + + + + + + +
sf::IpAddress::IpAddress (const std::string & address)
+
+ +

Construct the address from a string.

+

Here address can be either a decimal address (ex: "192.168.1.56") or a network name (ex: "localhost").

+
Parameters
+ + +
addressIP address or network name
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::IpAddress::IpAddress (const char * address)
+
+ +

Construct the address from a string.

+

Here address can be either a decimal address (ex: "192.168.1.56") or a network name (ex: "localhost"). This is equivalent to the constructor taking a std::string parameter, it is defined for convenience so that the implicit conversions from literal strings to IpAddress work.

+
Parameters
+ + +
addressIP address or network name
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::IpAddress::IpAddress (Uint8 byte0,
Uint8 byte1,
Uint8 byte2,
Uint8 byte3 
)
+
+ +

Construct the address from 4 bytes.

+

Calling IpAddress(a, b, c, d) is equivalent to calling IpAddress("a.b.c.d"), but safer as it doesn't have to parse a string to get the address components.

+
Parameters
+ + + + + +
byte0First byte of the address
byte1Second byte of the address
byte2Third byte of the address
byte3Fourth byte of the address
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
sf::IpAddress::IpAddress (Uint32 address)
+
+explicit
+
+ +

Construct the address from a 32-bits integer.

+

This constructor uses the internal representation of the address directly. It should be used for optimization purposes, and only if you got that representation from IpAddress::ToInteger().

+
Parameters
+ + +
address4 bytes of the address packed into a 32-bits integer
+
+
+
See Also
toInteger
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
static IpAddress sf::IpAddress::getLocalAddress ()
+
+static
+
+ +

Get the computer's local address.

+

The local address is the address of the computer from the LAN point of view, i.e. something like 192.168.1.56. It is meaningful only for communications over the local network. Unlike getPublicAddress, this function is fast and may be used safely anywhere.

+
Returns
Local IP address of the computer
+
See Also
getPublicAddress
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static IpAddress sf::IpAddress::getPublicAddress (Time timeout = Time::Zero)
+
+static
+
+ +

Get the computer's public address.

+

The public address is the address of the computer from the internet point of view, i.e. something like 89.54.1.169. It is necessary for communications over the world wide web. The only way to get a public address is to ask it to a distant website; as a consequence, this function depends on both your network connection and the server, and may be very slow. You should use it as few as possible. Because this function depends on the network connection and on a distant server, you may use a time limit if you don't want your program to be possibly stuck waiting in case there is a problem; this limit is deactivated by default.

+
Parameters
+ + +
timeoutMaximum time to wait
+
+
+
Returns
Public IP address of the computer
+
See Also
getLocalAddress
+ +
+
+ +
+
+ + + + + + + +
Uint32 sf::IpAddress::toInteger () const
+
+ +

Get an integer representation of the address.

+

The returned number is the internal representation of the address, and should be used for optimization purposes only (like sending the address through a socket). The integer produced by this function can then be converted back to a sf::IpAddress with the proper constructor.

+
Returns
32-bits unsigned integer representation of the address
+
See Also
toString
+ +
+
+ +
+
+ + + + + + + +
std::string sf::IpAddress::toString () const
+
+ +

Get a string representation of the address.

+

The returned string is the decimal representation of the IP address (like "192.168.1.56"), even if it was constructed from a host name.

+
Returns
String representation of the address
+
See Also
toInteger
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
const IpAddress sf::IpAddress::Broadcast
+
+static
+
+ +

The "broadcast" address (for sending UDP messages to everyone on a local network)

+ +

Definition at line 186 of file IpAddress.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const IpAddress sf::IpAddress::LocalHost
+
+static
+
+ +

The "localhost" address (for connecting a computer to itself locally)

+ +

Definition at line 185 of file IpAddress.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const IpAddress sf::IpAddress::None
+
+static
+
+ +

Value representing an empty/invalid address.

+ +

Definition at line 184 of file IpAddress.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick-members.htm new file mode 100644 index 0000000..1670946 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick-members.htm @@ -0,0 +1,73 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Joystick Member List
+
+
+ +

This is the complete list of members for sf::Joystick, including all inherited members.

+ + + + + + + + + + + + + + + + + + + +
Axis enum namesf::Joystick
AxisCount enum valuesf::Joystick
ButtonCount enum valuesf::Joystick
Count enum valuesf::Joystick
getAxisPosition(unsigned int joystick, Axis axis)sf::Joystickstatic
getButtonCount(unsigned int joystick)sf::Joystickstatic
hasAxis(unsigned int joystick, Axis axis)sf::Joystickstatic
isButtonPressed(unsigned int joystick, unsigned int button)sf::Joystickstatic
isConnected(unsigned int joystick)sf::Joystickstatic
PovX enum valuesf::Joystick
PovY enum valuesf::Joystick
R enum valuesf::Joystick
U enum valuesf::Joystick
update()sf::Joystickstatic
V enum valuesf::Joystick
X enum valuesf::Joystick
Y enum valuesf::Joystick
Z enum valuesf::Joystick
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick.htm new file mode 100644 index 0000000..b9f0314 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Joystick.htm @@ -0,0 +1,448 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Give access to the real-time state of the joysticks. + More...

+ +

#include <Joystick.hpp>

+ + + + + + + + +

+Public Types

enum  {
+  Count = 8, +
+  ButtonCount = 32, +
+  AxisCount = 8 +
+ }
 Constants related to joysticks capabilities. More...
 
enum  Axis {
+  X, +
+  Y, +
+  Z, +
+  R, +
+  U, +
+  V, +
+  PovX, +
+  PovY +
+ }
 Axes supported by SFML joysticks. More...
 
+ + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

static bool isConnected (unsigned int joystick)
 Check if a joystick is connected. More...
 
static unsigned int getButtonCount (unsigned int joystick)
 Return the number of buttons supported by a joystick. More...
 
static bool hasAxis (unsigned int joystick, Axis axis)
 Check if a joystick supports a given axis. More...
 
static bool isButtonPressed (unsigned int joystick, unsigned int button)
 Check if a joystick button is pressed. More...
 
static float getAxisPosition (unsigned int joystick, Axis axis)
 Get the current position of a joystick axis. More...
 
static void update ()
 Update the states of all joysticks. More...
 
+

Detailed Description

+

Give access to the real-time state of the joysticks.

+

sf::Joystick provides an interface to the state of the joysticks.

+

It only contains static functions, so it's not meant to be instanciated. Instead, each joystick is identified by an index that is passed to the functions of this class.

+

This class allows users to query the state of joysticks at any time and directly, without having to deal with a window and its events. Compared to the JoystickMoved, JoystickButtonPressed and JoystickButtonReleased events, sf::Joystick can retrieve the state of axes and buttons of joysticks at any time (you don't need to store and update a boolean on your side in order to know if a button is pressed or released), and you always get the real state of joysticks, even if they are moved, pressed or released when your window is out of focus and no event is triggered.

+

SFML supports:

+ +

Unlike the keyboard or mouse, the state of joysticks is sometimes not directly available (depending on the OS), therefore an update() function must be called in order to update the current state of joysticks. When you have a window with event handling, this is done automatically, you don't need to call anything. But if you have no window, or if you want to check joysticks state before creating one, you must call sf::Joystick::update explicitely.

+

Usage example:

+
// Is joystick #0 connected?
+
bool connected = sf::Joystick::isConnected(0);
+
+
// How many buttons does joystick #0 support?
+
unsigned int buttons = sf::Joystick::getButtonCount(0);
+
+
// Does joystick #0 define a X axis?
+ +
+
// Is button #2 pressed on joystick #0?
+
bool pressed = sf::Joystick::isButtonPressed(0, 2);
+
+
// What's the current position of the Y axis on joystick #0?
+ +
See Also
sf::Keyboard, sf::Mouse
+ +

Definition at line 40 of file Joystick.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
anonymous enum
+
+ +

Constants related to joysticks capabilities.

+ + + + +
Enumerator
Count  +

Maximum number of supported joysticks.

+
ButtonCount  +

Maximum number of supported buttons.

+
AxisCount  +

Maximum number of supported axes.

+
+ +

Definition at line 48 of file Joystick.hpp.

+ +
+
+ +
+
+ + + + +
enum sf::Joystick::Axis
+
+ +

Axes supported by SFML joysticks.

+ + + + + + + + + +
Enumerator
X  +

The X axis.

+
Y  +

The Y axis.

+
Z  +

The Z axis.

+
R  +

The R axis.

+
U  +

The U axis.

+
V  +

The V axis.

+
PovX  +

The X axis of the point-of-view hat.

+
PovY  +

The Y axis of the point-of-view hat.

+
+ +

Definition at line 59 of file Joystick.hpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static float sf::Joystick::getAxisPosition (unsigned int joystick,
Axis axis 
)
+
+static
+
+ +

Get the current position of a joystick axis.

+

If the joystick is not connected, this function returns 0.

+
Parameters
+ + + +
joystickIndex of the joystick
axisAxis to check
+
+
+
Returns
Current position of the axis, in range [-100 .. 100]
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static unsigned int sf::Joystick::getButtonCount (unsigned int joystick)
+
+static
+
+ +

Return the number of buttons supported by a joystick.

+

If the joystick is not connected, this function returns 0.

+
Parameters
+ + +
joystickIndex of the joystick
+
+
+
Returns
Number of buttons supported by the joystick
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static bool sf::Joystick::hasAxis (unsigned int joystick,
Axis axis 
)
+
+static
+
+ +

Check if a joystick supports a given axis.

+

If the joystick is not connected, this function returns false.

+
Parameters
+ + + +
joystickIndex of the joystick
axisAxis to check
+
+
+
Returns
True if the joystick supports the axis, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static bool sf::Joystick::isButtonPressed (unsigned int joystick,
unsigned int button 
)
+
+static
+
+ +

Check if a joystick button is pressed.

+

If the joystick is not connected, this function returns false.

+
Parameters
+ + + +
joystickIndex of the joystick
buttonButton to check
+
+
+
Returns
True if the button is pressed, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static bool sf::Joystick::isConnected (unsigned int joystick)
+
+static
+
+ +

Check if a joystick is connected.

+
Parameters
+ + +
joystickIndex of the joystick to check
+
+
+
Returns
True if the joystick is connected, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static void sf::Joystick::update ()
+
+static
+
+ +

Update the states of all joysticks.

+

This function is used internally by SFML, so you normally don't have to call it explicitely. However, you may need to call it if you have no window yet (or no window at all): in this case the joysticks states are not updated automatically.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard-members.htm new file mode 100644 index 0000000..7359069 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard-members.htm @@ -0,0 +1,160 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Keyboard Member List
+
+
+ +

This is the complete list of members for sf::Keyboard, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
A enum valuesf::Keyboard
Add enum valuesf::Keyboard
B enum valuesf::Keyboard
BackSlash enum valuesf::Keyboard
BackSpace enum valuesf::Keyboard
C enum valuesf::Keyboard
Comma enum valuesf::Keyboard
D enum valuesf::Keyboard
Dash enum valuesf::Keyboard
Delete enum valuesf::Keyboard
Divide enum valuesf::Keyboard
Down enum valuesf::Keyboard
E enum valuesf::Keyboard
End enum valuesf::Keyboard
Equal enum valuesf::Keyboard
Escape enum valuesf::Keyboard
F enum valuesf::Keyboard
F1 enum valuesf::Keyboard
F10 enum valuesf::Keyboard
F11 enum valuesf::Keyboard
F12 enum valuesf::Keyboard
F13 enum valuesf::Keyboard
F14 enum valuesf::Keyboard
F15 enum valuesf::Keyboard
F2 enum valuesf::Keyboard
F3 enum valuesf::Keyboard
F4 enum valuesf::Keyboard
F5 enum valuesf::Keyboard
F6 enum valuesf::Keyboard
F7 enum valuesf::Keyboard
F8 enum valuesf::Keyboard
F9 enum valuesf::Keyboard
G enum valuesf::Keyboard
H enum valuesf::Keyboard
Home enum valuesf::Keyboard
I enum valuesf::Keyboard
Insert enum valuesf::Keyboard
isKeyPressed(Key key)sf::Keyboardstatic
J enum valuesf::Keyboard
K enum valuesf::Keyboard
Key enum namesf::Keyboard
KeyCount enum valuesf::Keyboard
L enum valuesf::Keyboard
LAlt enum valuesf::Keyboard
LBracket enum valuesf::Keyboard
LControl enum valuesf::Keyboard
Left enum valuesf::Keyboard
LShift enum valuesf::Keyboard
LSystem enum valuesf::Keyboard
M enum valuesf::Keyboard
Menu enum valuesf::Keyboard
Multiply enum valuesf::Keyboard
N enum valuesf::Keyboard
Num0 enum valuesf::Keyboard
Num1 enum valuesf::Keyboard
Num2 enum valuesf::Keyboard
Num3 enum valuesf::Keyboard
Num4 enum valuesf::Keyboard
Num5 enum valuesf::Keyboard
Num6 enum valuesf::Keyboard
Num7 enum valuesf::Keyboard
Num8 enum valuesf::Keyboard
Num9 enum valuesf::Keyboard
Numpad0 enum valuesf::Keyboard
Numpad1 enum valuesf::Keyboard
Numpad2 enum valuesf::Keyboard
Numpad3 enum valuesf::Keyboard
Numpad4 enum valuesf::Keyboard
Numpad5 enum valuesf::Keyboard
Numpad6 enum valuesf::Keyboard
Numpad7 enum valuesf::Keyboard
Numpad8 enum valuesf::Keyboard
Numpad9 enum valuesf::Keyboard
O enum valuesf::Keyboard
P enum valuesf::Keyboard
PageDown enum valuesf::Keyboard
PageUp enum valuesf::Keyboard
Pause enum valuesf::Keyboard
Period enum valuesf::Keyboard
Q enum valuesf::Keyboard
Quote enum valuesf::Keyboard
R enum valuesf::Keyboard
RAlt enum valuesf::Keyboard
RBracket enum valuesf::Keyboard
RControl enum valuesf::Keyboard
Return enum valuesf::Keyboard
Right enum valuesf::Keyboard
RShift enum valuesf::Keyboard
RSystem enum valuesf::Keyboard
S enum valuesf::Keyboard
SemiColon enum valuesf::Keyboard
Slash enum valuesf::Keyboard
Space enum valuesf::Keyboard
Subtract enum valuesf::Keyboard
T enum valuesf::Keyboard
Tab enum valuesf::Keyboard
Tilde enum valuesf::Keyboard
U enum valuesf::Keyboard
Unknown enum valuesf::Keyboard
Up enum valuesf::Keyboard
V enum valuesf::Keyboard
W enum valuesf::Keyboard
X enum valuesf::Keyboard
Y enum valuesf::Keyboard
Z enum valuesf::Keyboard
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard.htm new file mode 100644 index 0000000..e1afd2b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Keyboard.htm @@ -0,0 +1,667 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Give access to the real-time state of the keyboard. + More...

+ +

#include <Keyboard.hpp>

+ + + + + +

+Public Types

enum  Key {
+  Unknown = -1, +
+  A = 0, +
+  B, +
+  C, +
+  D, +
+  E, +
+  F, +
+  G, +
+  H, +
+  I, +
+  J, +
+  K, +
+  L, +
+  M, +
+  N, +
+  O, +
+  P, +
+  Q, +
+  R, +
+  S, +
+  T, +
+  U, +
+  V, +
+  W, +
+  X, +
+  Y, +
+  Z, +
+  Num0, +
+  Num1, +
+  Num2, +
+  Num3, +
+  Num4, +
+  Num5, +
+  Num6, +
+  Num7, +
+  Num8, +
+  Num9, +
+  Escape, +
+  LControl, +
+  LShift, +
+  LAlt, +
+  LSystem, +
+  RControl, +
+  RShift, +
+  RAlt, +
+  RSystem, +
+  Menu, +
+  LBracket, +
+  RBracket, +
+  SemiColon, +
+  Comma, +
+  Period, +
+  Quote, +
+  Slash, +
+  BackSlash, +
+  Tilde, +
+  Equal, +
+  Dash, +
+  Space, +
+  Return, +
+  BackSpace, +
+  Tab, +
+  PageUp, +
+  PageDown, +
+  End, +
+  Home, +
+  Insert, +
+  Delete, +
+  Add, +
+  Subtract, +
+  Multiply, +
+  Divide, +
+  Left, +
+  Right, +
+  Up, +
+  Down, +
+  Numpad0, +
+  Numpad1, +
+  Numpad2, +
+  Numpad3, +
+  Numpad4, +
+  Numpad5, +
+  Numpad6, +
+  Numpad7, +
+  Numpad8, +
+  Numpad9, +
+  F1, +
+  F2, +
+  F3, +
+  F4, +
+  F5, +
+  F6, +
+  F7, +
+  F8, +
+  F9, +
+  F10, +
+  F11, +
+  F12, +
+  F13, +
+  F14, +
+  F15, +
+  Pause, +
+  KeyCount +
+ }
 Key codes. More...
 
+ + + + +

+Static Public Member Functions

static bool isKeyPressed (Key key)
 Check if a key is pressed. More...
 
+

Detailed Description

+

Give access to the real-time state of the keyboard.

+

sf::Keyboard provides an interface to the state of the keyboard.

+

It only contains static functions (a single keyboard is assumed), so it's not meant to be instanciated.

+

This class allows users to query the keyboard state at any time and directly, without having to deal with a window and its events. Compared to the KeyPressed and KeyReleased events, sf::Keyboard can retrieve the state of a key at any time (you don't need to store and update a boolean on your side in order to know if a key is pressed or released), and you always get the real state of the keyboard, even if keys are pressed or released when your window is out of focus and no event is triggered.

+

Usage example:

+
+
{
+
// move left...
+
}
+ +
{
+
// move right...
+
}
+ +
{
+
// quit...
+
}
+
See Also
sf::Joystick, sf::Mouse
+ +

Definition at line 40 of file Keyboard.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Keyboard::Key
+
+ +

Key codes.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
Unknown  +

Unhandled key.

+
A  +

The A key.

+
B  +

The B key.

+
C  +

The C key.

+
D  +

The D key.

+
E  +

The E key.

+
F  +

The F key.

+
G  +

The G key.

+
H  +

The H key.

+
I  +

The I key.

+
J  +

The J key.

+
K  +

The K key.

+
L  +

The L key.

+
M  +

The M key.

+
N  +

The N key.

+
O  +

The O key.

+
P  +

The P key.

+
Q  +

The Q key.

+
R  +

The R key.

+
S  +

The S key.

+
T  +

The T key.

+
U  +

The U key.

+
V  +

The V key.

+
W  +

The W key.

+
X  +

The X key.

+
Y  +

The Y key.

+
Z  +

The Z key.

+
Num0  +

The 0 key.

+
Num1  +

The 1 key.

+
Num2  +

The 2 key.

+
Num3  +

The 3 key.

+
Num4  +

The 4 key.

+
Num5  +

The 5 key.

+
Num6  +

The 6 key.

+
Num7  +

The 7 key.

+
Num8  +

The 8 key.

+
Num9  +

The 9 key.

+
Escape  +

The Escape key.

+
LControl  +

The left Control key.

+
LShift  +

The left Shift key.

+
LAlt  +

The left Alt key.

+
LSystem  +

The left OS specific key: window (Windows and Linux), apple (MacOS X), ...

+
RControl  +

The right Control key.

+
RShift  +

The right Shift key.

+
RAlt  +

The right Alt key.

+
RSystem  +

The right OS specific key: window (Windows and Linux), apple (MacOS X), ...

+
Menu  +

The Menu key.

+
LBracket  +

The [ key.

+
RBracket  +

The ] key.

+
SemiColon  +

The ; key.

+
Comma  +

The , key.

+
Period  +

The . key.

+
Quote  +

The ' key.

+
Slash  +

The / key.

+
BackSlash  +

The \ key.

+
Tilde  +

The ~ key.

+
Equal  +

The = key.

+
Dash  +

The - key.

+
Space  +

The Space key.

+
Return  +

The Return key.

+
BackSpace  +

The Backspace key.

+
Tab  +

The Tabulation key.

+
PageUp  +

The Page up key.

+
PageDown  +

The Page down key.

+
End  +

The End key.

+
Home  +

The Home key.

+
Insert  +

The Insert key.

+
Delete  +

The Delete key.

+
Add  +

The + key.

+
Subtract  +

The - key.

+
Multiply  +

The * key.

+
Divide  +

The / key.

+
Left  +

Left arrow.

+
Right  +

Right arrow.

+
Up  +

Up arrow.

+
Down  +

Down arrow.

+
Numpad0  +

The numpad 0 key.

+
Numpad1  +

The numpad 1 key.

+
Numpad2  +

The numpad 2 key.

+
Numpad3  +

The numpad 3 key.

+
Numpad4  +

The numpad 4 key.

+
Numpad5  +

The numpad 5 key.

+
Numpad6  +

The numpad 6 key.

+
Numpad7  +

The numpad 7 key.

+
Numpad8  +

The numpad 8 key.

+
Numpad9  +

The numpad 9 key.

+
F1  +

The F1 key.

+
F2  +

The F2 key.

+
F3  +

The F3 key.

+
F4  +

The F4 key.

+
F5  +

The F5 key.

+
F6  +

The F6 key.

+
F7  +

The F7 key.

+
F8  +

The F8 key.

+
F9  +

The F9 key.

+
F10  +

The F10 key.

+
F11  +

The F11 key.

+
F12  +

The F12 key.

+
F13  +

The F13 key.

+
F14  +

The F14 key.

+
F15  +

The F15 key.

+
Pause  +

The Pause key.

+
KeyCount  +

Keep last – the total number of keyboard keys.

+
+ +

Definition at line 48 of file Keyboard.hpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
static bool sf::Keyboard::isKeyPressed (Key key)
+
+static
+
+ +

Check if a key is pressed.

+
Parameters
+ + +
keyKey to check
+
+
+
Returns
True if the key is pressed, false otherwise
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener-members.htm new file mode 100644 index 0000000..1988c73 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener-members.htm @@ -0,0 +1,63 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Listener Member List
+
+
+ +

This is the complete list of members for sf::Listener, including all inherited members.

+ + + + + + + + + +
getDirection()sf::Listenerstatic
getGlobalVolume()sf::Listenerstatic
getPosition()sf::Listenerstatic
setDirection(float x, float y, float z)sf::Listenerstatic
setDirection(const Vector3f &direction)sf::Listenerstatic
setGlobalVolume(float volume)sf::Listenerstatic
setPosition(float x, float y, float z)sf::Listenerstatic
setPosition(const Vector3f &position)sf::Listenerstatic
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener.htm new file mode 100644 index 0000000..6339c4d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Listener.htm @@ -0,0 +1,396 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Listener Class Reference
+
+
+ +

The audio listener is the point in the scene from where all the sounds are heard. + More...

+ +

#include <Listener.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

static void setGlobalVolume (float volume)
 Change the global volume of all the sounds and musics. More...
 
static float getGlobalVolume ()
 Get the current value of the global volume. More...
 
static void setPosition (float x, float y, float z)
 Set the position of the listener in the scene. More...
 
static void setPosition (const Vector3f &position)
 Set the position of the listener in the scene. More...
 
static Vector3f getPosition ()
 Get the current position of the listener in the scene. More...
 
static void setDirection (float x, float y, float z)
 Set the orientation of the listener in the scene. More...
 
static void setDirection (const Vector3f &direction)
 Set the orientation of the listener in the scene. More...
 
static Vector3f getDirection ()
 Get the current orientation of the listener in the scene. More...
 
+

Detailed Description

+

The audio listener is the point in the scene from where all the sounds are heard.

+

The audio listener defines the global properties of the audio environment, it defines where and how sounds and musics are heard.

+

If sf::View is the eyes of the user, then sf::Listener is his ears (by the way, they are often linked together – same position, orientation, etc.).

+

sf::Listener is a simple interface, which allows to setup the listener in the 3D audio environment (position and direction), and to adjust the global volume.

+

Because the listener is unique in the scene, sf::Listener only contains static functions and doesn't have to be instanciated.

+

Usage example:

+
// Move the listener to the position (1, 0, -5)
+ +
+
// Make it face the right axis (1, 0, 0)
+ +
+
// Reduce the global volume
+ +
+

Definition at line 42 of file Listener.hpp.

+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
static Vector3f sf::Listener::getDirection ()
+
+static
+
+ +

Get the current orientation of the listener in the scene.

+
Returns
Listener's orientation
+
See Also
setDirection
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static float sf::Listener::getGlobalVolume ()
+
+static
+
+ +

Get the current value of the global volume.

+
Returns
Current global volume, in the range [0, 100]
+
See Also
setGlobalVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static Vector3f sf::Listener::getPosition ()
+
+static
+
+ +

Get the current position of the listener in the scene.

+
Returns
Listener's position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void sf::Listener::setDirection (float x,
float y,
float z 
)
+
+static
+
+ +

Set the orientation of the listener in the scene.

+

The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1).

+
Parameters
+ + + + +
xX coordinate of the listener's orientation
yY coordinate of the listener's orientation
zZ coordinate of the listener's orientation
+
+
+
See Also
getDirection, setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void sf::Listener::setDirection (const Vector3fdirection)
+
+static
+
+ +

Set the orientation of the listener in the scene.

+

The orientation defines the 3D axes of the listener (left, up, front) in the scene. The orientation vector doesn't have to be normalized. The default listener's orientation is (0, 0, -1).

+
Parameters
+ + +
directionNew listener's orientation
+
+
+
See Also
getDirection, setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void sf::Listener::setGlobalVolume (float volume)
+
+static
+
+ +

Change the global volume of all the sounds and musics.

+

The volume is a number between 0 and 100; it is combined with the individual volume of each sound / music. The default value for the volume is 100 (maximum).

+
Parameters
+ + +
volumeNew global volume, in the range [0, 100]
+
+
+
See Also
getGlobalVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void sf::Listener::setPosition (float x,
float y,
float z 
)
+
+static
+
+ +

Set the position of the listener in the scene.

+

The default listener's position is (0, 0, 0).

+
Parameters
+ + + + +
xX coordinate of the listener's position
yY coordinate of the listener's position
zZ coordinate of the listener's position
+
+
+
See Also
getPosition, setDirection
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void sf::Listener::setPosition (const Vector3fposition)
+
+static
+
+ +

Set the position of the listener in the scene.

+

The default listener's position is (0, 0, 0).

+
Parameters
+ + +
positionNew listener's position
+
+
+
See Also
getPosition, setDirection
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock-members.htm new file mode 100644 index 0000000..0527346 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Lock Member List
+
+
+ +

This is the complete list of members for sf::Lock, including all inherited members.

+ + + + +
Lock(Mutex &mutex)sf::Lockexplicit
NonCopyable()sf::NonCopyableinlineprivate
~Lock()sf::Lock
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.htm new file mode 100644 index 0000000..15558a9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.htm @@ -0,0 +1,169 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Lock Class Reference
+
+
+ +

Automatic wrapper for locking and unlocking mutexes. + More...

+ +

#include <Lock.hpp>

+
+Inheritance diagram for sf::Lock:
+
+
+ + +sf::NonCopyable + +
+ + + + + + + + +

+Public Member Functions

 Lock (Mutex &mutex)
 Construct the lock with a target mutex. More...
 
 ~Lock ()
 Destructor. More...
 
+

Detailed Description

+

Automatic wrapper for locking and unlocking mutexes.

+

sf::Lock is a RAII wrapper for sf::Mutex.

+

By unlocking it in its destructor, it ensures that the mutex will always be released when the current scope (most likely a function) ends. This is even more important when an exception or an early return statement can interrupt the execution flow of the function.

+

For maximum robustness, sf::Lock should always be used to lock/unlock a mutex.

+

Usage example:

+
sf::Mutex mutex;
+
+
void function()
+
{
+
sf::Lock lock(mutex); // mutex is now locked
+
+
functionThatMayThrowAnException(); // mutex is unlocked if this function throws
+
+
if (someCondition)
+
return; // mutex is unlocked
+
+
} // mutex is unlocked
+

Because the mutex is not explicitely unlocked in the code, it may remain locked longer than needed. If the region of the code that needs to be protected by the mutex is not the entire function, a good practice is to create a smaller, inner scope so that the lock is limited to this part of the code.

+
sf::Mutex mutex;
+
+
void function()
+
{
+
{
+
sf::Lock lock(mutex);
+
codeThatRequiresProtection();
+
+
} // mutex is unlocked here
+
+
codeThatDoesntCareAboutTheMutex();
+
}
+

Having a mutex locked longer than required is a bad practice which can lead to bad performances. Don't forget that when a mutex is locked, other threads may be waiting doing nothing until it is released.

+
See Also
sf::Mutex
+ +

Definition at line 43 of file Lock.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
sf::Lock::Lock (Mutexmutex)
+
+explicit
+
+ +

Construct the lock with a target mutex.

+

The mutex passed to sf::Lock is automatically locked.

+
Parameters
+ + +
mutexMutex to lock
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::Lock::~Lock ()
+
+ +

Destructor.

+

The destructor of sf::Lock automatically unlocks its mutex.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.png new file mode 100644 index 0000000..5878b10 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Lock.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse-members.htm new file mode 100644 index 0000000..4029f88 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse-members.htm @@ -0,0 +1,67 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Mouse Member List
+
+
+ +

This is the complete list of members for sf::Mouse, including all inherited members.

+ + + + + + + + + + + + + +
Button enum namesf::Mouse
ButtonCount enum valuesf::Mouse
getPosition()sf::Mousestatic
getPosition(const Window &relativeTo)sf::Mousestatic
isButtonPressed(Button button)sf::Mousestatic
Left enum valuesf::Mouse
Middle enum valuesf::Mouse
Right enum valuesf::Mouse
setPosition(const Vector2i &position)sf::Mousestatic
setPosition(const Vector2i &position, const Window &relativeTo)sf::Mousestatic
XButton1 enum valuesf::Mouse
XButton2 enum valuesf::Mouse
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse.htm new file mode 100644 index 0000000..af21749 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mouse.htm @@ -0,0 +1,331 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Give access to the real-time state of the mouse. + More...

+ +

#include <Mouse.hpp>

+ + + + + +

+Public Types

enum  Button {
+  Left, +
+  Right, +
+  Middle, +
+  XButton1, +
+  XButton2, +
+  ButtonCount +
+ }
 Mouse buttons. More...
 
+ + + + + + + + + + + + + + + + +

+Static Public Member Functions

static bool isButtonPressed (Button button)
 Check if a mouse button is pressed. More...
 
static Vector2i getPosition ()
 Get the current position of the mouse in desktop coordinates. More...
 
static Vector2i getPosition (const Window &relativeTo)
 Get the current position of the mouse in window coordinates. More...
 
static void setPosition (const Vector2i &position)
 Set the current position of the mouse in desktop coordinates. More...
 
static void setPosition (const Vector2i &position, const Window &relativeTo)
 Set the current position of the mouse in window coordinates. More...
 
+

Detailed Description

+

Give access to the real-time state of the mouse.

+

sf::Mouse provides an interface to the state of the mouse.

+

It only contains static functions (a single mouse is assumed), so it's not meant to be instanciated.

+

This class allows users to query the mouse state at any time and directly, without having to deal with a window and its events. Compared to the MouseMoved, MouseButtonPressed and MouseButtonReleased events, sf::Mouse can retrieve the state of the cursor and the buttons at any time (you don't need to store and update a boolean on your side in order to know if a button is pressed or released), and you always get the real state of the mouse, even if it is moved, pressed or released when your window is out of focus and no event is triggered.

+

The setPosition and getPosition functions can be used to change or retrieve the current position of the mouse pointer. There are two versions: one that operates in global coordinates (relative to the desktop) and one that operates in window coordinates (relative to a specific window).

+

Usage example:

+
+
{
+
// left click...
+
}
+
+
// get global mouse position
+ +
+
// set mouse position relative to a window
+ +
See Also
sf::Joystick, sf::Keyboard
+ +

Definition at line 43 of file Mouse.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Mouse::Button
+
+ +

Mouse buttons.

+ + + + + + + +
Enumerator
Left  +

The left mouse button.

+
Right  +

The right mouse button.

+
Middle  +

The middle (wheel) mouse button.

+
XButton1  +

The first extra mouse button.

+
XButton2  +

The second extra mouse button.

+
ButtonCount  +

Keep last – the total number of mouse buttons.

+
+ +

Definition at line 51 of file Mouse.hpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
static Vector2i sf::Mouse::getPosition ()
+
+static
+
+ +

Get the current position of the mouse in desktop coordinates.

+

This function returns the global position of the mouse cursor on the desktop.

+
Returns
Current position of the mouse
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static Vector2i sf::Mouse::getPosition (const WindowrelativeTo)
+
+static
+
+ +

Get the current position of the mouse in window coordinates.

+

This function returns the current position of the mouse cursor, relative to the given window.

+
Parameters
+ + +
relativeToReference window
+
+
+
Returns
Current position of the mouse
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static bool sf::Mouse::isButtonPressed (Button button)
+
+static
+
+ +

Check if a mouse button is pressed.

+
Parameters
+ + +
buttonButton to check
+
+
+
Returns
True if the button is pressed, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
static void sf::Mouse::setPosition (const Vector2iposition)
+
+static
+
+ +

Set the current position of the mouse in desktop coordinates.

+

This function sets the global position of the mouse cursor on the desktop.

+
Parameters
+ + +
positionNew position of the mouse
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static void sf::Mouse::setPosition (const Vector2iposition,
const WindowrelativeTo 
)
+
+static
+
+ +

Set the current position of the mouse in window coordinates.

+

This function sets the current position of the mouse cursor, relative to the given window.

+
Parameters
+ + + +
positionNew position of the mouse
relativeToReference window
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music-members.htm new file mode 100644 index 0000000..ce28d10 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music-members.htm @@ -0,0 +1,97 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Music Member List
+
+
+ +

This is the complete list of members for sf::Music, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getAttenuation() const sf::SoundSource
getChannelCount() const sf::SoundStream
getDuration() const sf::Music
getLoop() const sf::SoundStream
getMinDistance() const sf::SoundSource
getPitch() const sf::SoundSource
getPlayingOffset() const sf::SoundStream
getPosition() const sf::SoundSource
getSampleRate() const sf::SoundStream
getStatus() const sf::SoundStream
getVolume() const sf::SoundSource
sf::SoundStream::initialize(unsigned int channelCount, unsigned int sampleRate)sf::SoundStreamprotected
isRelativeToListener() const sf::SoundSource
m_sourcesf::SoundSourceprotected
Music()sf::Music
onGetData(Chunk &data)sf::Musicprotectedvirtual
onSeek(Time timeOffset)sf::Musicprotectedvirtual
openFromFile(const std::string &filename)sf::Music
openFromMemory(const void *data, std::size_t sizeInBytes)sf::Music
openFromStream(InputStream &stream)sf::Music
pause()sf::SoundStream
Paused enum valuesf::SoundSource
play()sf::SoundStream
Playing enum valuesf::SoundSource
setAttenuation(float attenuation)sf::SoundSource
setLoop(bool loop)sf::SoundStream
setMinDistance(float distance)sf::SoundSource
setPitch(float pitch)sf::SoundSource
setPlayingOffset(Time timeOffset)sf::SoundStream
setPosition(float x, float y, float z)sf::SoundSource
setPosition(const Vector3f &position)sf::SoundSource
setRelativeToListener(bool relative)sf::SoundSource
setVolume(float volume)sf::SoundSource
SoundSource(const SoundSource &copy)sf::SoundSource
SoundSource()sf::SoundSourceprotected
SoundStream()sf::SoundStreamprotected
Status enum namesf::SoundSource
stop()sf::SoundStream
Stopped enum valuesf::SoundSource
~Music()sf::Music
~SoundSource()sf::SoundSourcevirtual
~SoundStream()sf::SoundStreamvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.htm new file mode 100644 index 0000000..341b1f1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.htm @@ -0,0 +1,1248 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Streamed music played from an audio file. + More...

+ +

#include <Music.hpp>

+
+Inheritance diagram for sf::Music:
+
+
+ + +sf::SoundStream +sf::SoundSource + +
+ + + + + +

+Public Types

enum  Status {
+  Stopped, +
+  Paused, +
+  Playing +
+ }
 Enumeration of the sound source states. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Music ()
 Default constructor. More...
 
 ~Music ()
 Destructor. More...
 
bool openFromFile (const std::string &filename)
 Open a music from an audio file. More...
 
bool openFromMemory (const void *data, std::size_t sizeInBytes)
 Open a music from an audio file in memory. More...
 
bool openFromStream (InputStream &stream)
 Open a music from an audio file in a custom stream. More...
 
Time getDuration () const
 Get the total duration of the music. More...
 
void play ()
 Start or resume playing the audio stream. More...
 
void pause ()
 Pause the audio stream. More...
 
void stop ()
 Stop playing the audio stream. More...
 
unsigned int getChannelCount () const
 Return the number of channels of the stream. More...
 
unsigned int getSampleRate () const
 Get the stream sample rate of the stream. More...
 
Status getStatus () const
 Get the current status of the stream (stopped, paused, playing) More...
 
void setPlayingOffset (Time timeOffset)
 Change the current playing position of the stream. More...
 
Time getPlayingOffset () const
 Get the current playing position of the stream. More...
 
void setLoop (bool loop)
 Set whether or not the stream should loop after reaching the end. More...
 
bool getLoop () const
 Tell whether or not the stream is in loop mode. More...
 
void setPitch (float pitch)
 Set the pitch of the sound. More...
 
void setVolume (float volume)
 Set the volume of the sound. More...
 
void setPosition (float x, float y, float z)
 Set the 3D position of the sound in the audio scene. More...
 
void setPosition (const Vector3f &position)
 Set the 3D position of the sound in the audio scene. More...
 
void setRelativeToListener (bool relative)
 Make the sound's position relative to the listener or absolute. More...
 
void setMinDistance (float distance)
 Set the minimum distance of the sound. More...
 
void setAttenuation (float attenuation)
 Set the attenuation factor of the sound. More...
 
float getPitch () const
 Get the pitch of the sound. More...
 
float getVolume () const
 Get the volume of the sound. More...
 
Vector3f getPosition () const
 Get the 3D position of the sound in the audio scene. More...
 
bool isRelativeToListener () const
 Tell whether the sound's position is relative to the listener or is absolute. More...
 
float getMinDistance () const
 Get the minimum distance of the sound. More...
 
float getAttenuation () const
 Get the attenuation factor of the sound. More...
 
+ + + + + + + + + + +

+Protected Member Functions

virtual bool onGetData (Chunk &data)
 Request a new chunk of audio samples from the stream source. More...
 
virtual void onSeek (Time timeOffset)
 Change the current playing position in the stream source. More...
 
void initialize (unsigned int channelCount, unsigned int sampleRate)
 Define the audio stream parameters. More...
 
+ + + + +

+Protected Attributes

unsigned int m_source
 OpenAL source identifier. More...
 
+

Detailed Description

+

Streamed music played from an audio file.

+

Musics are sounds that are streamed rather than completely loaded in memory.

+

This is especially useful for compressed musics that usually take hundreds of MB when they are uncompressed: by streaming it instead of loading it entirely, you avoid saturating the memory and have almost no loading delay.

+

Apart from that, a sf::Music has almost the same features as the sf::SoundBuffer / sf::Sound pair: you can play/pause/stop it, request its parameters (channels, sample rate), change the way it is played (pitch, volume, 3D position, ...), etc.

+

As a sound stream, a music is played in its own thread in order not to block the rest of the program. This means that you can leave the music alone after calling play(), it will manage itself very well.

+

Usage example:

+
// Declare a new music
+
sf::Music music;
+
+
// Open it from an audio file
+
if (!music.openFromFile("music.ogg"))
+
{
+
// error...
+
}
+
+
// Change some parameters
+
music.setPosition(0, 1, 10); // change its 3D position
+
music.setPitch(2); // increase the pitch
+
music.setVolume(50); // reduce the volume
+
music.setLoop(true); // make it loop
+
+
// Play it
+
music.play();
+
See Also
sf::Sound, sf::SoundStream
+ +

Definition at line 52 of file Music.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
enum sf::SoundSource::Status
+
+inherited
+
+ +

Enumeration of the sound source states.

+ + + + +
Enumerator
Stopped  +

Sound is not playing.

+
Paused  +

Sound is paused.

+
Playing  +

Sound is playing.

+
+ +

Definition at line 49 of file SoundSource.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Music::Music ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + +
sf::Music::~Music ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getAttenuation () const
+
+inherited
+
+ +

Get the attenuation factor of the sound.

+
Returns
Attenuation factor of the sound
+
See Also
setAttenuation, getMinDistance
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
unsigned int sf::SoundStream::getChannelCount () const
+
+inherited
+
+ +

Return the number of channels of the stream.

+

1 channel means a mono sound, 2 means stereo, etc.

+
Returns
Number of channels
+ +
+
+ +
+
+ + + + + + + +
Time sf::Music::getDuration () const
+
+ +

Get the total duration of the music.

+
Returns
Music duration
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::SoundStream::getLoop () const
+
+inherited
+
+ +

Tell whether or not the stream is in loop mode.

+
Returns
True if the stream is looping, false otherwise
+
See Also
setLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getMinDistance () const
+
+inherited
+
+ +

Get the minimum distance of the sound.

+
Returns
Minimum distance of the sound
+
See Also
setMinDistance, getAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getPitch () const
+
+inherited
+
+ +

Get the pitch of the sound.

+
Returns
Pitch of the sound
+
See Also
setPitch
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Time sf::SoundStream::getPlayingOffset () const
+
+inherited
+
+ +

Get the current playing position of the stream.

+
Returns
Current playing position, from the beginning of the stream
+
See Also
setPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Vector3f sf::SoundSource::getPosition () const
+
+inherited
+
+ +

Get the 3D position of the sound in the audio scene.

+
Returns
Position of the sound
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
unsigned int sf::SoundStream::getSampleRate () const
+
+inherited
+
+ +

Get the stream sample rate of the stream.

+

The sample rate is the number of audio samples played per second. The higher, the better the quality.

+
Returns
Sample rate, in number of samples per second
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Status sf::SoundStream::getStatus () const
+
+inherited
+
+ +

Get the current status of the stream (stopped, paused, playing)

+
Returns
Current status
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getVolume () const
+
+inherited
+
+ +

Get the volume of the sound.

+
Returns
Volume of the sound, in the range [0, 100]
+
See Also
setVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::SoundStream::initialize (unsigned int channelCount,
unsigned int sampleRate 
)
+
+protectedinherited
+
+ +

Define the audio stream parameters.

+

This function must be called by derived classes as soon as they know the audio settings of the stream to play. Any attempt to manipulate the stream (play(), ...) before calling this function will fail. It can be called multiple times if the settings of the audio stream change, but only when the stream is stopped.

+
Parameters
+ + + +
channelCountNumber of channels of the stream
sampleRateSample rate, in samples per second
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::SoundSource::isRelativeToListener () const
+
+inherited
+
+ +

Tell whether the sound's position is relative to the listener or is absolute.

+
Returns
True if the position is relative, false if it's absolute
+
See Also
setRelativeToListener
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual bool sf::Music::onGetData (Chunkdata)
+
+protectedvirtual
+
+ +

Request a new chunk of audio samples from the stream source.

+

This function fills the chunk from the next samples to read from the audio file.

+
Parameters
+ + +
dataChunk of data to fill
+
+
+
Returns
True to continue playback, false to stop
+ +

Implements sf::SoundStream.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual void sf::Music::onSeek (Time timeOffset)
+
+protectedvirtual
+
+ +

Change the current playing position in the stream source.

+
Parameters
+ + +
timeOffsetNew playing position, from the beginning of the music
+
+
+ +

Implements sf::SoundStream.

+ +
+
+ +
+
+ + + + + + + + +
bool sf::Music::openFromFile (const std::string & filename)
+
+ +

Open a music from an audio file.

+

This function doesn't start playing the music (call play() to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.

+
Parameters
+ + +
filenamePath of the music file to open
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
openFromMemory, openFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Music::openFromMemory (const void * data,
std::size_t sizeInBytes 
)
+
+ +

Open a music from an audio file in memory.

+

This function doesn't start playing the music (call play() to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. Since the music is not loaded completely but rather streamed continuously, the data must remain available as long as the music is playing (ie. you can't deallocate it right after calling this function).

+
Parameters
+ + + +
dataPointer to the file data in memory
sizeInBytesSize of the data to load, in bytes
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
openFromFile, openFromStream
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Music::openFromStream (InputStreamstream)
+
+ +

Open a music from an audio file in a custom stream.

+

This function doesn't start playing the music (call play() to do so). Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. Since the music is not loaded completely but rather streamed continuously, the stream must remain alive as long as the music is playing (ie. you can't destroy it right after calling this function).

+
Parameters
+ + +
streamSource stream to read from
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
openFromFile, openFromMemory
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::SoundStream::pause ()
+
+inherited
+
+ +

Pause the audio stream.

+

This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect.

+
See Also
play, stop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::SoundStream::play ()
+
+inherited
+
+ +

Start or resume playing the audio stream.

+

This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the stream is played.

+
See Also
pause, stop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setAttenuation (float attenuation)
+
+inherited
+
+ +

Set the attenuation factor of the sound.

+

The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.

+
Parameters
+ + +
attenuationNew attenuation factor of the sound
+
+
+
See Also
getAttenuation, setMinDistance
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundStream::setLoop (bool loop)
+
+inherited
+
+ +

Set whether or not the stream should loop after reaching the end.

+

If set, the stream will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for streams is false.

+
Parameters
+ + +
loopTrue to play in loop, false to play once
+
+
+
See Also
getLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setMinDistance (float distance)
+
+inherited
+
+ +

Set the minimum distance of the sound.

+

The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head +of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.

+
Parameters
+ + +
distanceNew minimum distance of the sound
+
+
+
See Also
getMinDistance, setAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPitch (float pitch)
+
+inherited
+
+ +

Set the pitch of the sound.

+

The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1.

+
Parameters
+ + +
pitchNew pitch to apply to the sound
+
+
+
See Also
getPitch
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundStream::setPlayingOffset (Time timeOffset)
+
+inherited
+
+ +

Change the current playing position of the stream.

+

The playing position can be changed when the stream is either paused or playing.

+
Parameters
+ + +
timeOffsetNew playing position, from the beginning of the stream
+
+
+
See Also
getPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::SoundSource::setPosition (float x,
float y,
float z 
)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + + + +
xX coordinate of the position of the sound in the scene
yY coordinate of the position of the sound in the scene
zZ coordinate of the position of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPosition (const Vector3fposition)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + +
positionPosition of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setRelativeToListener (bool relative)
+
+inherited
+
+ +

Make the sound's position relative to the listener or absolute.

+

Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute).

+
Parameters
+ + +
relativeTrue to set the position relative, false to set it absolute
+
+
+
See Also
isRelativeToListener
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setVolume (float volume)
+
+inherited
+
+ +

Set the volume of the sound.

+

The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100.

+
Parameters
+ + +
volumeVolume of the sound
+
+
+
See Also
getVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::SoundStream::stop ()
+
+inherited
+
+ +

Stop playing the audio stream.

+

This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause()).

+
See Also
play, pause
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
unsigned int sf::SoundSource::m_source
+
+protectedinherited
+
+ +

OpenAL source identifier.

+ +

Definition at line 263 of file SoundSource.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.png new file mode 100644 index 0000000..36d7a6c Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Music.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex-members.htm new file mode 100644 index 0000000..0cd11c0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex-members.htm @@ -0,0 +1,60 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Mutex Member List
+
+
+ +

This is the complete list of members for sf::Mutex, including all inherited members.

+ + + + + + +
lock()sf::Mutex
Mutex()sf::Mutex
NonCopyable()sf::NonCopyableinlineprivate
unlock()sf::Mutex
~Mutex()sf::Mutex
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.htm new file mode 100644 index 0000000..522ae5f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.htm @@ -0,0 +1,189 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Mutex Class Reference
+
+
+ +

Blocks concurrent access to shared resources from multiple threads. + More...

+ +

#include <Mutex.hpp>

+
+Inheritance diagram for sf::Mutex:
+
+
+ + +sf::NonCopyable + +
+ + + + + + + + + + + + + + +

+Public Member Functions

 Mutex ()
 Default constructor. More...
 
 ~Mutex ()
 Destructor. More...
 
void lock ()
 Lock the mutex. More...
 
void unlock ()
 Unlock the mutex. More...
 
+

Detailed Description

+

Blocks concurrent access to shared resources from multiple threads.

+

Mutex stands for "MUTual EXclusion".

+

A mutex is a synchronization object, used when multiple threads are involved.

+

When you want to protect a part of the code from being accessed simultaneously by multiple threads, you typically use a mutex. When a thread is locked by a mutex, any other thread trying to lock it will be blocked until the mutex is released by the thread that locked it. This way, you can allow only one thread at a time to access a critical region of your code.

+

Usage example:

+
Database database; // this is a critical resource that needs some protection
+
sf::Mutex mutex;
+
+
void thread1()
+
{
+
mutex.lock(); // this call will block the thread if the mutex is already locked by thread2
+
database.write(...);
+
mutex.unlock(); // if thread2 was waiting, it will now be unblocked
+
}
+
+
void thread2()
+
{
+
mutex.lock(); // this call will block the thread if the mutex is already locked by thread1
+
database.write(...);
+
mutex.unlock(); // if thread1 was waiting, it will now be unblocked
+
}
+

Be very careful with mutexes. A bad usage can lead to bad problems, like deadlocks (two threads are waiting for each other and the application is globally stuck).

+

To make the usage of mutexes more robust, particularly in environments where exceptions can be thrown, you should use the helper class sf::Lock to lock/unlock mutexes.

+

SFML mutexes are recursive, which means that you can lock a mutex multiple times in the same thread without creating a deadlock. In this case, the first call to lock() behaves as usual, and the following ones have no effect. However, you must call unlock() exactly as many times as you called lock(). If you don't, the mutex won't be released.

+
See Also
sf::Lock
+ +

Definition at line 47 of file Mutex.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Mutex::Mutex ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + +
sf::Mutex::~Mutex ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void sf::Mutex::lock ()
+
+ +

Lock the mutex.

+

If the mutex is already locked in another thread, this call will block the execution until the mutex is released.

+
See Also
unlock
+ +
+
+ +
+
+ + + + + + + +
void sf::Mutex::unlock ()
+
+ +

Unlock the mutex.

+
See Also
lock
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.png new file mode 100644 index 0000000..6759c64 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Mutex.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable-members.htm new file mode 100644 index 0000000..c3bd5a0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable-members.htm @@ -0,0 +1,56 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::NonCopyable Member List
+
+
+ +

This is the complete list of members for sf::NonCopyable, including all inherited members.

+ + +
NonCopyable()sf::NonCopyableinlineprotected
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.htm new file mode 100644 index 0000000..2a3d75f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.htm @@ -0,0 +1,131 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::NonCopyable Class Reference
+
+
+ +

Utility class that makes any derived class non-copyable. + More...

+ +

#include <NonCopyable.hpp>

+
+Inheritance diagram for sf::NonCopyable:
+
+
+ + +sf::Context +sf::Ftp +sf::Http +sf::Lock +sf::Mutex +sf::RenderTarget +sf::Shader +sf::Socket +sf::Thread +sf::ThreadLocal +sf::Window + +
+ + + + + +

+Protected Member Functions

 NonCopyable ()
 Default constructor. More...
 
+

Detailed Description

+

Utility class that makes any derived class non-copyable.

+

This class makes its instances non-copyable, by explicitely disabling its copy constructor and its assignment operator.

+

To create a non-copyable class, simply inherit from sf::NonCopyable.

+

The type of inheritance (public or private) doesn't matter, the copy constructor and assignment operator are declared private in sf::NonCopyable so they will end up being inaccessible in both cases. Thus you can use a shorter syntax for inheriting from it (see below).

+

Usage example:

+
class MyNonCopyableClass : sf::NonCopyable
+
{
+
...
+
};
+

Deciding whether the instances of a class can be copied or not is a very important design choice. You are strongly encouraged to think about it before writing a class, and to use sf::NonCopyable when necessary to prevent many potential future errors when using it. This is also a very important indication to users of your class.

+ +

Definition at line 41 of file NonCopyable.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
sf::NonCopyable::NonCopyable ()
+
+inlineprotected
+
+ +

Default constructor.

+

Because this class has a copy constructor, the compiler will not automatically generate the default constructor. That's why we must define it explicitely.

+ +

Definition at line 53 of file NonCopyable.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.png new file mode 100644 index 0000000..85b9dd9 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1NonCopyable.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet-members.htm new file mode 100644 index 0000000..4de6d0b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet-members.htm @@ -0,0 +1,95 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Packet Member List
+
+
+ +

This is the complete list of members for sf::Packet, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
append(const void *data, std::size_t sizeInBytes)sf::Packet
clear()sf::Packet
endOfPacket() const sf::Packet
getData() const sf::Packet
getDataSize() const sf::Packet
onReceive(const void *data, std::size_t size)sf::Packetprotectedvirtual
onSend(std::size_t &size)sf::Packetprotectedvirtual
operator BoolType() const sf::Packet
operator<<(bool data)sf::Packet
operator<<(Int8 data) (defined in sf::Packet)sf::Packet
operator<<(Uint8 data) (defined in sf::Packet)sf::Packet
operator<<(Int16 data) (defined in sf::Packet)sf::Packet
operator<<(Uint16 data) (defined in sf::Packet)sf::Packet
operator<<(Int32 data) (defined in sf::Packet)sf::Packet
operator<<(Uint32 data) (defined in sf::Packet)sf::Packet
operator<<(float data) (defined in sf::Packet)sf::Packet
operator<<(double data) (defined in sf::Packet)sf::Packet
operator<<(const char *data) (defined in sf::Packet)sf::Packet
operator<<(const std::string &data) (defined in sf::Packet)sf::Packet
operator<<(const wchar_t *data) (defined in sf::Packet)sf::Packet
operator<<(const std::wstring &data) (defined in sf::Packet)sf::Packet
operator<<(const String &data) (defined in sf::Packet)sf::Packet
operator>>(bool &data)sf::Packet
operator>>(Int8 &data) (defined in sf::Packet)sf::Packet
operator>>(Uint8 &data) (defined in sf::Packet)sf::Packet
operator>>(Int16 &data) (defined in sf::Packet)sf::Packet
operator>>(Uint16 &data) (defined in sf::Packet)sf::Packet
operator>>(Int32 &data) (defined in sf::Packet)sf::Packet
operator>>(Uint32 &data) (defined in sf::Packet)sf::Packet
operator>>(float &data) (defined in sf::Packet)sf::Packet
operator>>(double &data) (defined in sf::Packet)sf::Packet
operator>>(char *data) (defined in sf::Packet)sf::Packet
operator>>(std::string &data) (defined in sf::Packet)sf::Packet
operator>>(wchar_t *data) (defined in sf::Packet)sf::Packet
operator>>(std::wstring &data) (defined in sf::Packet)sf::Packet
operator>>(String &data) (defined in sf::Packet)sf::Packet
Packet()sf::Packet
TcpSocket (defined in sf::Packet)sf::Packetfriend
UdpSocket (defined in sf::Packet)sf::Packetfriend
~Packet()sf::Packetvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet.htm new file mode 100644 index 0000000..0b39b55 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Packet.htm @@ -0,0 +1,597 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Utility class to build blocks of data to transfer over the network. + More...

+ +

#include <Packet.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Packet ()
 Default constructor. More...
 
virtual ~Packet ()
 Virtual destructor. More...
 
void append (const void *data, std::size_t sizeInBytes)
 Append data to the end of the packet. More...
 
void clear ()
 Clear the packet. More...
 
const void * getData () const
 Get a pointer to the data contained in the packet. More...
 
std::size_t getDataSize () const
 Get the size of the data contained in the packet. More...
 
bool endOfPacket () const
 Tell if the reading position has reached the end of the packet. More...
 
 operator BoolType () const
 Test the validity of the packet, for reading. More...
 
Packetoperator>> (bool &data)
 Overloads of operator >> to read data from the packet. More...
 
+Packetoperator>> (Int8 &data)
 
+Packetoperator>> (Uint8 &data)
 
+Packetoperator>> (Int16 &data)
 
+Packetoperator>> (Uint16 &data)
 
+Packetoperator>> (Int32 &data)
 
+Packetoperator>> (Uint32 &data)
 
+Packetoperator>> (float &data)
 
+Packetoperator>> (double &data)
 
+Packetoperator>> (char *data)
 
+Packetoperator>> (std::string &data)
 
+Packetoperator>> (wchar_t *data)
 
+Packetoperator>> (std::wstring &data)
 
+Packetoperator>> (String &data)
 
Packetoperator<< (bool data)
 Overloads of operator << to write data into the packet. More...
 
+Packetoperator<< (Int8 data)
 
+Packetoperator<< (Uint8 data)
 
+Packetoperator<< (Int16 data)
 
+Packetoperator<< (Uint16 data)
 
+Packetoperator<< (Int32 data)
 
+Packetoperator<< (Uint32 data)
 
+Packetoperator<< (float data)
 
+Packetoperator<< (double data)
 
+Packetoperator<< (const char *data)
 
+Packetoperator<< (const std::string &data)
 
+Packetoperator<< (const wchar_t *data)
 
+Packetoperator<< (const std::wstring &data)
 
+Packetoperator<< (const String &data)
 
+ + + + + + + +

+Protected Member Functions

virtual const void * onSend (std::size_t &size)
 Called before the packet is sent over the network. More...
 
virtual void onReceive (const void *data, std::size_t size)
 Called after the packet is received over the network. More...
 
+ + + + + +

+Friends

+class TcpSocket
 
+class UdpSocket
 
+

Detailed Description

+

Utility class to build blocks of data to transfer over the network.

+

Packets provide a safe and easy way to serialize data, in order to send it over the network using sockets (sf::TcpSocket, sf::UdpSocket).

+

Packets solve 2 fundamental problems that arise when transfering data over the network:

+
    +
  • data is interpreted correctly according to the endianness
  • +
  • the bounds of the packet are preserved (one send == one receive)
  • +
+

The sf::Packet class provides both input and output modes. It is designed to follow the behaviour of standard C++ streams, using operators >> and << to extract and insert data.

+

It is recommended to use only fixed-size types (like sf::Int32, etc.), to avoid possible differences between the sender and the receiver. Indeed, the native C++ types may have different sizes on two platforms and your data may be corrupted if that happens.

+

Usage example:

+
sf::Uint32 x = 24;
+
std::string s = "hello";
+
double d = 5.89;
+
+
// Group the variables to send into a packet
+
sf::Packet packet;
+
packet << x << s << d;
+
+
// Send it over the network (socket is a valid sf::TcpSocket)
+
socket.send(packet);
+
+
-----------------------------------------------------------------
+
+
// Receive the packet at the other end
+
sf::Packet packet;
+
socket.receive(packet);
+
+
// Extract the variables contained in the packet
+
sf::Uint32 x;
+
std::string s;
+
double d;
+
if (packet >> x >> s >> d)
+
{
+
// Data extracted successfully...
+
}
+

Packets have built-in operator >> and << overloads for standard types:

+
    +
  • bool
  • +
  • fixed-size integer types (sf::Int8/16/32, sf::Uint8/16/32)
  • +
  • floating point numbers (float, double)
  • +
  • string types (char*, wchar_t*, std::string, std::wstring, sf::String)
  • +
+

Like standard streams, it is also possible to define your own overloads of operators >> and << in order to handle your custom types.

+
struct MyStruct
+
{
+
float number;
+
sf::Int8 integer;
+
std::string str;
+
};
+
+
sf::Packet& operator <<(sf::Packet& packet, const MyStruct& m)
+
{
+
return packet << m.number << m.integer << m.str;
+
}
+
+
sf::Packet& operator >>(sf::Packet& packet, MyStruct& m)
+
{
+
return packet >> m.number >> m.integer >> m.str;
+
}
+

Packets also provide an extra feature that allows to apply custom transformations to the data before it is sent, and after it is received. This is typically used to handle automatic compression or encryption of the data. This is achieved by inheriting from sf::Packet, and overriding the onSend and onReceive functions.

+

Here is an example:

+
class ZipPacket : public sf::Packet
+
{
+
virtual const void* onSend(std::size_t& size)
+
{
+
const void* srcData = getData();
+
std::size_t srcSize = getDataSize();
+
+
return MySuperZipFunction(srcData, srcSize, &size);
+
}
+
+
virtual void onReceive(const void* data, std::size_t size)
+
{
+
std::size_t dstSize;
+
const void* dstData = MySuperUnzipFunction(data, size, &dstSize);
+
+
append(dstData, dstSize);
+
}
+
};
+
+
// Use like regular packets:
+
ZipPacket packet;
+
packet << x << s << d;
+
...
+
See Also
sf::TcpSocket, sf::UdpSocket
+ +

Definition at line 47 of file Packet.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Packet::Packet ()
+
+ +

Default constructor.

+

Creates an empty packet.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Packet::~Packet ()
+
+virtual
+
+ +

Virtual destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Packet::append (const void * data,
std::size_t sizeInBytes 
)
+
+ +

Append data to the end of the packet.

+
Parameters
+ + + +
dataPointer to the sequence of bytes to append
sizeInBytesNumber of bytes to append
+
+
+
See Also
clear
+ +
+
+ +
+
+ + + + + + + +
void sf::Packet::clear ()
+
+ +

Clear the packet.

+

After calling Clear, the packet is empty.

+
See Also
append
+ +
+
+ +
+
+ + + + + + + +
bool sf::Packet::endOfPacket () const
+
+ +

Tell if the reading position has reached the end of the packet.

+

This function is useful to know if there is some data left to be read, without actually reading it.

+
Returns
True if all data was read, false otherwise
+
See Also
operator bool
+ +
+
+ +
+
+ + + + + + + +
const void* sf::Packet::getData () const
+
+ +

Get a pointer to the data contained in the packet.

+

Warning: the returned pointer may become invalid after you append data to the packet, therefore it should never be stored. The return pointer is NULL if the packet is empty.

+
Returns
Pointer to the data
+
See Also
getDataSize
+ +
+
+ +
+
+ + + + + + + +
std::size_t sf::Packet::getDataSize () const
+
+ +

Get the size of the data contained in the packet.

+

This function returns the number of bytes pointed to by what getData returns.

+
Returns
Data size, in bytes
+
See Also
getData
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual void sf::Packet::onReceive (const void * data,
std::size_t size 
)
+
+protectedvirtual
+
+ +

Called after the packet is received over the network.

+

This function can be defined by derived classes to transform the data after it is received; this can be used for uncompression, decryption, etc. The function receives a pointer to the received data, and must fill the packet with the transformed bytes. The default implementation fills the packet directly without transforming the data.

+
Parameters
+ + + +
dataPointer to the received bytes
sizeNumber of bytes
+
+
+
See Also
onSend
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual const void* sf::Packet::onSend (std::size_t & size)
+
+protectedvirtual
+
+ +

Called before the packet is sent over the network.

+

This function can be defined by derived classes to transform the data before it is sent; this can be used for compression, encryption, etc. The function must return a pointer to the modified data, as well as the number of bytes pointed. The default implementation provides the packet's data without transforming it.

+
Parameters
+ + +
sizeVariable to fill with the size of data to send
+
+
+
Returns
Pointer to the array of bytes to send
+
See Also
onReceive
+ +
+
+ +
+
+ + + + + + + +
sf::Packet::operator BoolType () const
+
+ +

Test the validity of the packet, for reading.

+

This operator allows to test the packet as a boolean variable, to check if a reading operation was successful.

+

A packet will be in an invalid state if it has no more data to read.

+

This behaviour is the same as standard C++ streams.

+

Usage example:

+
float x;
+
packet >> x;
+
if (packet)
+
{
+
// ok, x was extracted successfully
+
}
+
+
// -- or --
+
+
float x;
+
if (packet >> x)
+
{
+
// ok, x was extracted successfully
+
}
+

Don't focus on the return type, it's equivalent to bool but it disallows unwanted implicit conversions to integer or pointer types.

+
Returns
True if last data extraction from packet was successful
+
See Also
endOfPacket
+ +
+
+ +
+
+ + + + + + + + +
Packet& sf::Packet::operator<< (bool data)
+
+ +

Overloads of operator << to write data into the packet.

+ +
+
+ +
+
+ + + + + + + + +
Packet& sf::Packet::operator>> (bool & data)
+
+ +

Overloads of operator >> to read data from the packet.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect-members.htm new file mode 100644 index 0000000..4cde9a6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect-members.htm @@ -0,0 +1,73 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Rect< T > Member List
+
+
+ +

This is the complete list of members for sf::Rect< T >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + +
contains(T x, T y) const sf::Rect< T >
contains(const Vector2< T > &point) const sf::Rect< T >
heightsf::Rect< T >
intersects(const Rect< T > &rectangle) const sf::Rect< T >
intersects(const Rect< T > &rectangle, Rect< T > &intersection) const sf::Rect< T >
leftsf::Rect< T >
operator!=(const Rect< T > &left, const Rect< T > &right)sf::Rect< T >related
operator==(const Rect< T > &left, const Rect< T > &right)sf::Rect< T >related
Rect()sf::Rect< T >
Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight)sf::Rect< T >
Rect(const Vector2< T > &position, const Vector2< T > &size)sf::Rect< T >
Rect(const Rect< U > &rectangle)sf::Rect< T >explicit
Rect() (defined in sf::Rect< T >)sf::Rect< T >
Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) (defined in sf::Rect< T >)sf::Rect< T >
Rect(const Vector2< T > &position, const Vector2< T > &size) (defined in sf::Rect< T >)sf::Rect< T >
Rect(const Rect< U > &rectangle) (defined in sf::Rect< T >)sf::Rect< T >
topsf::Rect< T >
widthsf::Rect< T >
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect.htm new file mode 100644 index 0000000..2e67e2e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Rect.htm @@ -0,0 +1,626 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Utility class for manipulating 2D axis aligned rectangles. + More...

+ +

#include <Rect.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Rect ()
 Default constructor. More...
 
 Rect (T rectLeft, T rectTop, T rectWidth, T rectHeight)
 Construct the rectangle from its coordinates. More...
 
 Rect (const Vector2< T > &position, const Vector2< T > &size)
 Construct the rectangle from position and size. More...
 
template<typename U >
 Rect (const Rect< U > &rectangle)
 Construct the rectangle from another type of rectangle. More...
 
bool contains (T x, T y) const
 Check if a point is inside the rectangle's area. More...
 
bool contains (const Vector2< T > &point) const
 Check if a point is inside the rectangle's area. More...
 
bool intersects (const Rect< T > &rectangle) const
 Check the intersection between two rectangles. More...
 
bool intersects (const Rect< T > &rectangle, Rect< T > &intersection) const
 Check the intersection between two rectangles. More...
 
+template<typename T >
 Rect (T rectLeft, T rectTop, T rectWidth, T rectHeight)
 
+template<typename T >
 Rect (const Vector2< T > &position, const Vector2< T > &size)
 
+template<typename U >
 Rect (const Rect< U > &rectangle)
 
+ + + + + + + + + + + + + +

+Public Attributes

left
 Left coordinate of the rectangle. More...
 
top
 Top coordinate of the rectangle. More...
 
width
 Width of the rectangle. More...
 
height
 Height of the rectangle. More...
 
+ + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
template<typename T >
bool operator== (const Rect< T > &left, const Rect< T > &right)
 Overload of binary operator ==. More...
 
template<typename T >
bool operator!= (const Rect< T > &left, const Rect< T > &right)
 Overload of binary operator !=. More...
 
+

Detailed Description

+

template<typename T>
+class sf::Rect< T >

+ +

Utility class for manipulating 2D axis aligned rectangles.

+

A rectangle is defined by its top-left corner and its size.

+

It is a very simple class defined for convenience, so its member variables (left, top, width and height) are public and can be accessed directly, just like the vector classes (Vector2 and Vector3).

+

To keep things simple, sf::Rect doesn't define functions to emulate the properties that are not directly members (such as right, bottom, center, etc.), it rather only provides intersection functions.

+

sf::Rect uses the usual rules for its boundaries:

+
    +
  • The left and top edges are included in the rectangle's area
  • +
  • The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area
  • +
+

This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1) don't intersect.

+

sf::Rect is a template and may be used with any numeric type, but for simplicity the instanciations used by SFML are typedefed:

+
    +
  • sf::Rect<int> is sf::IntRect
  • +
  • sf::Rect<float> is sf::FloatRect
  • +
+

So that you don't have to care about the template syntax.

+

Usage example:

+
// Define a rectangle, located at (0, 0) with a size of 20x5
+
sf::IntRect r1(0, 0, 20, 5);
+
+
// Define another rectangle, located at (4, 2) with a size of 18x10
+
sf::Vector2i position(4, 2);
+
sf::Vector2i size(18, 10);
+
sf::IntRect r2(position, size);
+
+
// Test intersections with the point (3, 1)
+
bool b1 = r1.contains(3, 1); // true
+
bool b2 = r2.contains(3, 1); // false
+
+
// Test the intersection between r1 and r2
+
sf::IntRect result;
+
bool b3 = r1.intersects(r2, result); // true
+
// result == (4, 2, 16, 3)
+
+

Definition at line 42 of file Rect.hpp.

+

Constructor & Destructor Documentation

+ +
+
+
+template<typename T>
+ + + + + + + +
sf::Rect< T >::Rect ()
+
+ +

Default constructor.

+

Creates an empty rectangle (it is equivalent to calling Rect(0, 0, 0, 0)).

+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::Rect< T >::Rect (rectLeft,
rectTop,
rectWidth,
rectHeight 
)
+
+ +

Construct the rectangle from its coordinates.

+

Be careful, the last two parameters are the width and height, not the right and bottom coordinates!

+
Parameters
+ + + + + +
rectLeftLeft coordinate of the rectangle
rectTopTop coordinate of the rectangle
rectWidthWidth of the rectangle
rectHeightHeight of the rectangle
+
+
+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + +
sf::Rect< T >::Rect (const Vector2< T > & position,
const Vector2< T > & size 
)
+
+ +

Construct the rectangle from position and size.

+

Be careful, the last parameter is the size, not the bottom-right corner!

+
Parameters
+ + + +
positionPosition of the top-left corner of the rectangle
sizeSize of the rectangle
+
+
+ +
+
+ +
+
+
+template<typename T>
+
+template<typename U >
+ + + + + +
+ + + + + + + + +
sf::Rect< T >::Rect (const Rect< U > & rectangle)
+
+explicit
+
+ +

Construct the rectangle from another type of rectangle.

+

This constructor doesn't replace the copy constructor, it's called only when U != T. A call to this constructor will fail to compile if U is not convertible to T.

+
Parameters
+ + +
rectangleRectangle to convert
+
+
+ +
+
+

Member Function Documentation

+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + +
bool sf::Rect< T >::contains (x,
y 
) const
+
+ +

Check if a point is inside the rectangle's area.

+
Parameters
+ + + +
xX coordinate of the point to test
yY coordinate of the point to test
+
+
+
Returns
True if the point is inside, false otherwise
+
See Also
intersects
+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + +
bool sf::Rect< T >::contains (const Vector2< T > & point) const
+
+ +

Check if a point is inside the rectangle's area.

+
Parameters
+ + +
pointPoint to test
+
+
+
Returns
True if the point is inside, false otherwise
+
See Also
intersects
+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + +
bool sf::Rect< T >::intersects (const Rect< T > & rectangle) const
+
+ +

Check the intersection between two rectangles.

+
Parameters
+ + +
rectangleRectangle to test
+
+
+
Returns
True if rectangles overlap, false otherwise
+
See Also
contains
+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + +
bool sf::Rect< T >::intersects (const Rect< T > & rectangle,
Rect< T > & intersection 
) const
+
+ +

Check the intersection between two rectangles.

+

This overload returns the overlapped rectangle in the intersection parameter.

+
Parameters
+ + + +
rectangleRectangle to test
intersectionRectangle to be filled with the intersection
+
+
+
Returns
True if rectangles overlap, false otherwise
+
See Also
contains
+ +
+
+

Friends And Related Function Documentation

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Rect< T > & left,
const Rect< T > & right 
)
+
+related
+
+ +

Overload of binary operator !=.

+

This operator compares strict difference between two rectangles.

+
Parameters
+ + + +
leftLeft operand (a rectangle)
rightRight operand (a rectangle)
+
+
+
Returns
True if left is not equal to right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Rect< T > & left,
const Rect< T > & right 
)
+
+related
+
+ +

Overload of binary operator ==.

+

This operator compares strict equality between two rectangles.

+
Parameters
+ + + +
leftLeft operand (a rectangle)
rightRight operand (a rectangle)
+
+
+
Returns
True if left is equal to right
+ +
+
+

Member Data Documentation

+ +
+
+
+template<typename T>
+ + + + +
T sf::Rect< T >::height
+
+ +

Height of the rectangle.

+ +

Definition at line 154 of file Rect.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Rect< T >::left
+
+ +

Left coordinate of the rectangle.

+ +

Definition at line 151 of file Rect.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Rect< T >::top
+
+ +

Top coordinate of the rectangle.

+ +

Definition at line 152 of file Rect.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Rect< T >::width
+
+ +

Width of the rectangle.

+ +

Definition at line 153 of file Rect.hpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape-members.htm new file mode 100644 index 0000000..f1a473c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape-members.htm @@ -0,0 +1,96 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::RectangleShape Member List
+
+
+ +

This is the complete list of members for sf::RectangleShape, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getFillColor() const sf::Shape
getGlobalBounds() const sf::Shape
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Shape
getOrigin() const sf::Transformable
getOutlineColor() const sf::Shape
getOutlineThickness() const sf::Shape
getPoint(unsigned int index) const sf::RectangleShapevirtual
getPointCount() const sf::RectangleShapevirtual
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getSize() const sf::RectangleShape
getTexture() const sf::Shape
getTextureRect() const sf::Shape
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
RectangleShape(const Vector2f &size=Vector2f(0, 0))sf::RectangleShapeexplicit
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setFillColor(const Color &color)sf::Shape
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setOutlineColor(const Color &color)sf::Shape
setOutlineThickness(float thickness)sf::Shape
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setSize(const Vector2f &size)sf::RectangleShape
setTexture(const Texture *texture, bool resetRect=false)sf::Shape
setTextureRect(const IntRect &rect)sf::Shape
Shape()sf::Shapeprotected
Transformable()sf::Transformable
update()sf::Shapeprotected
~Drawable()sf::Drawableinlinevirtual
~Shape()sf::Shapevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.htm new file mode 100644 index 0000000..29ef091 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.htm @@ -0,0 +1,1376 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized shape representing a rectangle. + More...

+ +

#include <RectangleShape.hpp>

+
+Inheritance diagram for sf::RectangleShape:
+
+
+ + +sf::Shape +sf::Drawable +sf::Transformable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 RectangleShape (const Vector2f &size=Vector2f(0, 0))
 Default constructor. More...
 
void setSize (const Vector2f &size)
 Set the size of the rectangle. More...
 
const Vector2fgetSize () const
 Get the size of the rectangle. More...
 
virtual unsigned int getPointCount () const
 Get the number of points defining the shape. More...
 
virtual Vector2f getPoint (unsigned int index) const
 Get a point of the shape. More...
 
void setTexture (const Texture *texture, bool resetRect=false)
 Change the source texture of the shape. More...
 
void setTextureRect (const IntRect &rect)
 Set the sub-rectangle of the texture that the shape will display. More...
 
void setFillColor (const Color &color)
 Set the fill color of the shape. More...
 
void setOutlineColor (const Color &color)
 Set the outline color of the shape. More...
 
void setOutlineThickness (float thickness)
 Set the thickness of the shape's outline. More...
 
const TexturegetTexture () const
 Get the source texture of the shape. More...
 
const IntRectgetTextureRect () const
 Get the sub-rectangle of the texture displayed by the shape. More...
 
const ColorgetFillColor () const
 Get the fill color of the shape. More...
 
const ColorgetOutlineColor () const
 Get the outline color of the shape. More...
 
float getOutlineThickness () const
 Get the outline thickness of the shape. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+ + + + +

+Protected Member Functions

void update ()
 Recompute the internal geometry of the shape. More...
 
+

Detailed Description

+

Specialized shape representing a rectangle.

+

This class inherits all the functions of sf::Transformable (position, rotation, scale, bounds, ...) as well as the functions of sf::Shape (outline, color, texture, ...).

+

Usage example:

+
+
rectangle.setSize(sf::Vector2f(100, 50));
+ +
rectangle.setOutlineThickness(5);
+
rectangle.setPosition(10, 20);
+
...
+
window.draw(rectangle);
+
See Also
sf::Shape, sf::CircleShape, sf::ConvexShape
+ +

Definition at line 41 of file RectangleShape.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
sf::RectangleShape::RectangleShape (const Vector2fsize = Vector2f(0, 0))
+
+explicit
+
+ +

Default constructor.

+
Parameters
+ + +
sizeSize of the rectangle
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getFillColor () const
+
+inherited
+
+ +

Get the fill color of the shape.

+
Returns
Fill color of the shape
+
See Also
setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getGlobalBounds () const
+
+inherited
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
FloatRect sf::Shape::getLocalBounds () const
+
+inherited
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Color& sf::Shape::getOutlineColor () const
+
+inherited
+
+ +

Get the outline color of the shape.

+
Returns
Outline color of the shape
+
See Also
setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Shape::getOutlineThickness () const
+
+inherited
+
+ +

Get the outline thickness of the shape.

+
Returns
Outline thickness of the shape
+
See Also
setOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual Vector2f sf::RectangleShape::getPoint (unsigned int index) const
+
+virtual
+
+ +

Get a point of the shape.

+

The result is undefined if index is out of the valid range.

+
Parameters
+ + +
indexIndex of the point to get, in range [0 .. getPointCount() - 1]
+
+
+
Returns
Index-th point of the shape
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual unsigned int sf::RectangleShape::getPointCount () const
+
+virtual
+
+ +

Get the number of points defining the shape.

+
Returns
Number of points of the shape
+ +

Implements sf::Shape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + +
const Vector2f& sf::RectangleShape::getSize () const
+
+ +

Get the size of the rectangle.

+
Returns
Size of the rectangle
+
See Also
setSize
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Texture* sf::Shape::getTexture () const
+
+inherited
+
+ +

Get the source texture of the shape.

+

If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

+
Returns
Pointer to the shape's texture
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const IntRect& sf::Shape::getTextureRect () const
+
+inherited
+
+ +

Get the sub-rectangle of the texture displayed by the shape.

+
Returns
Texture rectangle of the shape
+
See Also
setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setFillColor (const Colorcolor)
+
+inherited
+
+ +

Set the fill color of the shape.

+

This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sf::Color::Transparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.

+
Parameters
+ + +
colorNew color of the shape
+
+
+
See Also
getFillColor, setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineColor (const Colorcolor)
+
+inherited
+
+ +

Set the outline color of the shape.

+

By default, the shape's outline color is opaque white.

+
Parameters
+ + +
colorNew outline color of the shape
+
+
+
See Also
getOutlineColor, setFillColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setOutlineThickness (float thickness)
+
+inherited
+
+ +

Set the thickness of the shape's outline.

+

Note that negative values are allowed (so that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

+
Parameters
+ + +
thicknessNew outline thickness
+
+
+
See Also
getOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::RectangleShape::setSize (const Vector2fsize)
+
+ +

Set the size of the rectangle.

+
Parameters
+ + +
sizeNew size of the rectangle
+
+
+
See Also
getSize
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Shape::setTexture (const Texturetexture,
bool resetRect = false 
)
+
+inherited
+
+ +

Change the source texture of the shape.

+

The texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the shape tries to use it, the behaviour is undefined. texture can be NULL to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

+
Parameters
+ + + +
textureNew texture
resetRectShould the texture rect be reset to the size of the new texture?
+
+
+
See Also
getTexture, setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Shape::setTextureRect (const IntRectrect)
+
+inherited
+
+ +

Set the sub-rectangle of the texture that the shape will display.

+

The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.

+
Parameters
+ + +
rectRectangle defining the region of the texture to display
+
+
+
See Also
getTextureRect, setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Shape::update ()
+
+protectedinherited
+
+ +

Recompute the internal geometry of the shape.

+

This function must be called by the derived class everytime the shape's points change (ie. the result of either getPointCount or getPoint is different).

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.png new file mode 100644 index 0000000..59630c6 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RectangleShape.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates-members.htm new file mode 100644 index 0000000..bec98f0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates-members.htm @@ -0,0 +1,66 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::RenderStates Member List
+
+
+ +

This is the complete list of members for sf::RenderStates, including all inherited members.

+ + + + + + + + + + + + +
blendModesf::RenderStates
Defaultsf::RenderStatesstatic
RenderStates()sf::RenderStates
RenderStates(BlendMode theBlendMode)sf::RenderStates
RenderStates(const Transform &theTransform)sf::RenderStates
RenderStates(const Texture *theTexture)sf::RenderStates
RenderStates(const Shader *theShader)sf::RenderStates
RenderStates(BlendMode theBlendMode, const Transform &theTransform, const Texture *theTexture, const Shader *theShader)sf::RenderStates
shadersf::RenderStates
texturesf::RenderStates
transformsf::RenderStates
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates.htm new file mode 100644 index 0000000..1423b31 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderStates.htm @@ -0,0 +1,386 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Define the states used for drawing to a RenderTarget. + More...

+ +

#include <RenderStates.hpp>

+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 RenderStates ()
 Default constructor. More...
 
 RenderStates (BlendMode theBlendMode)
 Construct a default set of render states with a custom blend mode. More...
 
 RenderStates (const Transform &theTransform)
 Construct a default set of render states with a custom transform. More...
 
 RenderStates (const Texture *theTexture)
 Construct a default set of render states with a custom texture. More...
 
 RenderStates (const Shader *theShader)
 Construct a default set of render states with a custom shader. More...
 
 RenderStates (BlendMode theBlendMode, const Transform &theTransform, const Texture *theTexture, const Shader *theShader)
 Construct a set of render states with all its attributes. More...
 
+ + + + + + + + + + + + + +

+Public Attributes

BlendMode blendMode
 Blending mode. More...
 
Transform transform
 Transform. More...
 
const Texturetexture
 Texture. More...
 
const Shadershader
 Shader. More...
 
+ + + + +

+Static Public Attributes

static const RenderStates Default
 Special instance holding the default render states. More...
 
+

Detailed Description

+

Define the states used for drawing to a RenderTarget.

+

There are four global states that can be applied to the drawn objects:

+
    +
  • the blend mode: how pixels of the object are blended with the background
  • +
  • the transform: how the object is positioned/rotated/scaled
  • +
  • the texture: what image is mapped to the object
  • +
  • the shader: what custom effect is applied to the object
  • +
+

High-level objects such as sprites or text force some of these states when they are drawn. For example, a sprite will set its own texture, so that you don't have to care about it when drawing the sprite.

+

The transform is a special case: sprites, texts and shapes (and it's a good idea to do it with your own drawable classes too) combine their transform with the one that is passed in the RenderStates structure. So that you can use a "global" transform on top of each object's transform.

+

Most objects, especially high-level drawables, can be drawn directly without defining render states explicitely – the default set of states is ok in most cases.

+
window.Draw(sprite);
+

If you want to use a single specific render state, for example a shader, you can pass it directly to the Draw function: sf::RenderStates has an implicit one-argument constructor for each state.

+
window.draw(sprite, shader);
+

When you're inside the Draw function of a drawable object (inherited from sf::Drawable), you can either pass the render states unmodified, or change some of them. For example, a transformable object will combine the current transform with its own transform. A sprite will set its texture. Etc.

+
See Also
sf::RenderTarget, sf::Drawable
+ +

Definition at line 45 of file RenderStates.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::RenderStates::RenderStates ()
+
+ +

Default constructor.

+

Constructing a default set of render states is equivalent to using sf::RenderStates::Default. The default set defines:

+
    +
  • the BlendAlpha blend mode
  • +
  • the identity transform
  • +
  • a null texture
  • +
  • a null shader
  • +
+ +
+
+ +
+
+ + + + + + + + +
sf::RenderStates::RenderStates (BlendMode theBlendMode)
+
+ +

Construct a default set of render states with a custom blend mode.

+
Parameters
+ + +
theBlendModeBlend mode to use
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::RenderStates::RenderStates (const TransformtheTransform)
+
+ +

Construct a default set of render states with a custom transform.

+
Parameters
+ + +
theTransformTransform to use
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::RenderStates::RenderStates (const TexturetheTexture)
+
+ +

Construct a default set of render states with a custom texture.

+
Parameters
+ + +
theTextureTexture to use
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::RenderStates::RenderStates (const ShadertheShader)
+
+ +

Construct a default set of render states with a custom shader.

+
Parameters
+ + +
theShaderShader to use
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::RenderStates::RenderStates (BlendMode theBlendMode,
const TransformtheTransform,
const TexturetheTexture,
const ShadertheShader 
)
+
+ +

Construct a set of render states with all its attributes.

+
Parameters
+ + + + + +
theBlendModeBlend mode to use
theTransformTransform to use
theTextureTexture to use
theShaderShader to use
+
+
+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
BlendMode sf::RenderStates::blendMode
+
+ +

Blending mode.

+ +

Definition at line 115 of file RenderStates.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
const RenderStates sf::RenderStates::Default
+
+static
+
+ +

Special instance holding the default render states.

+ +

Definition at line 110 of file RenderStates.hpp.

+ +
+
+ +
+
+ + + + +
const Shader* sf::RenderStates::shader
+
+ +

Shader.

+ +

Definition at line 118 of file RenderStates.hpp.

+ +
+
+ +
+
+ + + + +
const Texture* sf::RenderStates::texture
+
+ +

Texture.

+ +

Definition at line 117 of file RenderStates.hpp.

+ +
+
+ +
+
+ + + + +
Transform sf::RenderStates::transform
+
+ +

Transform.

+ +

Definition at line 116 of file RenderStates.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget-members.htm new file mode 100644 index 0000000..1e5de97 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget-members.htm @@ -0,0 +1,74 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::RenderTarget Member List
+
+
+ +

This is the complete list of members for sf::RenderTarget, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
clear(const Color &color=Color(0, 0, 0, 255))sf::RenderTarget
draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)sf::RenderTarget
draw(const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)sf::RenderTarget
getDefaultView() const sf::RenderTarget
getSize() const =0sf::RenderTargetpure virtual
getView() const sf::RenderTarget
getViewport(const View &view) const sf::RenderTarget
initialize()sf::RenderTargetprotected
mapCoordsToPixel(const Vector2f &point) const sf::RenderTarget
mapCoordsToPixel(const Vector2f &point, const View &view) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point, const View &view) const sf::RenderTarget
NonCopyable()sf::NonCopyableinlineprivate
popGLStates()sf::RenderTarget
pushGLStates()sf::RenderTarget
RenderTarget()sf::RenderTargetprotected
resetGLStates()sf::RenderTarget
setView(const View &view)sf::RenderTarget
~RenderTarget()sf::RenderTargetvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.htm new file mode 100644 index 0000000..483780a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.htm @@ -0,0 +1,665 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::RenderTarget Class Referenceabstract
+
+
+ +

Base class for all render targets (window, texture, ...) + More...

+ +

#include <RenderTarget.hpp>

+
+Inheritance diagram for sf::RenderTarget:
+
+
+ + +sf::NonCopyable +sf::RenderTexture +sf::RenderWindow + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

virtual ~RenderTarget ()
 Destructor. More...
 
void clear (const Color &color=Color(0, 0, 0, 255))
 Clear the entire target with a single color. More...
 
void setView (const View &view)
 Change the current active view. More...
 
const ViewgetView () const
 Get the view currently in use in the render target. More...
 
const ViewgetDefaultView () const
 Get the default view of the render target. More...
 
IntRect getViewport (const View &view) const
 Get the viewport of a view, applied to this render target. More...
 
Vector2f mapPixelToCoords (const Vector2i &point) const
 Convert a point from target coordinates to world coordinates, using the current view. More...
 
Vector2f mapPixelToCoords (const Vector2i &point, const View &view) const
 Convert a point from target coordinates to world coordinates. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point) const
 Convert a point from world coordinates to target coordinates, using the current view. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point, const View &view) const
 Convert a point from world coordinates to target coordinates. More...
 
void draw (const Drawable &drawable, const RenderStates &states=RenderStates::Default)
 Draw a drawable object to the render-target. More...
 
void draw (const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)
 Draw primitives defined by an array of vertices. More...
 
virtual Vector2u getSize () const =0
 Return the size of the rendering region of the target. More...
 
void pushGLStates ()
 Save the current OpenGL render states and matrices. More...
 
void popGLStates ()
 Restore the previously saved OpenGL render states and matrices. More...
 
void resetGLStates ()
 Reset the internal OpenGL states so that the target is ready for drawing. More...
 
+ + + + + + + +

+Protected Member Functions

 RenderTarget ()
 Default constructor. More...
 
void initialize ()
 Performs the common initialization step after creation. More...
 
+

Detailed Description

+

Base class for all render targets (window, texture, ...)

+

sf::RenderTarget defines the common behaviour of all the 2D render targets usable in the graphics module.

+

It makes it possible to draw 2D entities like sprites, shapes, text without using any OpenGL command directly.

+

A sf::RenderTarget is also able to use views (sf::View), which are a kind of 2D cameras. With views you can globally scroll, rotate or zoom everything that is drawn, without having to transform every single entity. See the documentation of sf::View for more details and sample pieces of code about this class.

+

On top of that, render targets are still able to render direct OpenGL stuff. It is even possible to mix together OpenGL calls and regular SFML drawing commands. When doing so, make sure that OpenGL states are not messed up by calling the pushGLStates/popGLStates functions.

+
See Also
sf::RenderWindow, sf::RenderTexture, sf::View
+ +

Definition at line 51 of file RenderTarget.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::RenderTarget::~RenderTarget ()
+
+virtual
+
+ +

Destructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::RenderTarget::RenderTarget ()
+
+protected
+
+ +

Default constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void sf::RenderTarget::clear (const Colorcolor = Color(0, 0, 0, 255))
+
+ +

Clear the entire target with a single color.

+

This function is usually called once every frame, to clear the previous contents of the target.

+
Parameters
+ + +
colorFill color to use to clear the render target
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Drawabledrawable,
const RenderStatesstates = RenderStates::Default 
)
+
+ +

Draw a drawable object to the render-target.

+
Parameters
+ + + +
drawableObject to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Vertexvertices,
unsigned int vertexCount,
PrimitiveType type,
const RenderStatesstates = RenderStates::Default 
)
+
+ +

Draw primitives defined by an array of vertices.

+
Parameters
+ + + + + +
verticesPointer to the vertices
vertexCountNumber of vertices in the array
typeType of primitives to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + + + +
const View& sf::RenderTarget::getDefaultView () const
+
+ +

Get the default view of the render target.

+

The default view has the initial size of the render target, and never changes after the target has been created.

+
Returns
The default view of the render target
+
See Also
setView, getView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual Vector2u sf::RenderTarget::getSize () const
+
+pure virtual
+
+ +

Return the size of the rendering region of the target.

+
Returns
Size in pixels
+ +

Implemented in sf::RenderTexture, and sf::RenderWindow.

+ +
+
+ +
+
+ + + + + + + +
const View& sf::RenderTarget::getView () const
+
+ +

Get the view currently in use in the render target.

+
Returns
The view object that is currently used
+
See Also
setView, getDefaultView
+ +
+
+ +
+
+ + + + + + + + +
IntRect sf::RenderTarget::getViewport (const Viewview) const
+
+ +

Get the viewport of a view, applied to this render target.

+

The viewport is defined in the view as a ratio, this function simply applies this ratio to the current dimensions of the render target to calculate the pixels rectangle that the viewport actually covers in the target.

+
Parameters
+ + +
viewThe view for which we want to compute the viewport
+
+
+
Returns
Viewport rectangle, expressed in pixels
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::initialize ()
+
+protected
+
+ +

Performs the common initialization step after creation.

+

The derived classes must call this function after the target is created and ready for drawing.

+ +
+
+ +
+
+ + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint) const
+
+ +

Convert a point from world coordinates to target coordinates, using the current view.

+

This function is an overload of the mapCoordsToPixel function that implicitely uses the current view. It is equivalent to:

+
target.mapCoordsToPixel(point, target.getView());
+
Parameters
+ + +
pointPoint to convert
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint,
const Viewview 
) const
+
+ +

Convert a point from world coordinates to target coordinates.

+

This function finds the pixel of the render-target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-target – if the view is translated by (140, 25).

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPoint to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint) const
+
+ +

Convert a point from target coordinates to world coordinates, using the current view.

+

This function is an overload of the mapPixelToCoords function that implicitely uses the current view. It is equivalent to:

+
target.mapPixelToCoords(point, target.getView());
+
Parameters
+ + +
pointPixel to convert
+
+
+
Returns
The converted point, in "world" coordinates
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint,
const Viewview 
) const
+
+ +

Convert a point from target coordinates to world coordinates.

+

This function finds the 2D position that matches the given pixel of the render-target. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (10, 50) in your render-target may map to the point (150, 75) in your 2D world – if the view is translated by (140, 25).

+

For render-windows, this function is typically used to find which point (or object) is located below the mouse cursor.

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPixel to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in "world" units
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + + + +
void sf::RenderTarget::popGLStates ()
+
+ +

Restore the previously saved OpenGL render states and matrices.

+

See the description of pushGLStates to get a detailed description of these functions.

+
See Also
pushGLStates
+ +
+
+ +
+
+ + + + + + + +
void sf::RenderTarget::pushGLStates ()
+
+ +

Save the current OpenGL render states and matrices.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with PopGLStates, it ensures that:

+
    +
  • SFML's internal states are not messed up by your OpenGL code
  • +
  • your OpenGL states are not modified by a call to a SFML function
  • +
+

More specifically, it must be used around code that calls Draw functions. Example:

+
// OpenGL code here...
+
window.pushGLStates();
+
window.draw(...);
+
window.draw(...);
+
window.popGLStates();
+
// OpenGL code here...
+

Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the ResetGLStates function if you do so.

+
See Also
popGLStates
+ +
+
+ +
+
+ + + + + + + +
void sf::RenderTarget::resetGLStates ()
+
+ +

Reset the internal OpenGL states so that the target is ready for drawing.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent draw() calls will work as expected.

+

Example:

+
// OpenGL code here...
+
glPushAttrib(...);
+
window.resetGLStates();
+
window.draw(...);
+
window.draw(...);
+
glPopAttrib(...);
+
// OpenGL code here...
+
+
+
+ +
+
+ + + + + + + + +
void sf::RenderTarget::setView (const Viewview)
+
+ +

Change the current active view.

+

The view is like a 2D camera, it controls which part of the 2D scene is visible, and how it is viewed in the render-target. The new view will affect everything that is drawn, until another view is set. The render target keeps its own copy of the view object, so it is not necessary to keep the original one alive after calling this function. To restore the original view of the target, you can pass the result of getDefaultView() to this function.

+
Parameters
+ + +
viewNew view to use
+
+
+
See Also
getView, getDefaultView
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.png new file mode 100644 index 0000000..3f29acb Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTarget.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture-members.htm new file mode 100644 index 0000000..4d08b44 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture-members.htm @@ -0,0 +1,83 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::RenderTexture Member List
+
+
+ +

This is the complete list of members for sf::RenderTexture, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
clear(const Color &color=Color(0, 0, 0, 255))sf::RenderTarget
create(unsigned int width, unsigned int height, bool depthBuffer=false)sf::RenderTexture
display()sf::RenderTexture
draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)sf::RenderTarget
draw(const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)sf::RenderTarget
getDefaultView() const sf::RenderTarget
getSize() const sf::RenderTexturevirtual
getTexture() const sf::RenderTexture
getView() const sf::RenderTarget
getViewport(const View &view) const sf::RenderTarget
initialize()sf::RenderTargetprotected
isRepeated() const sf::RenderTexture
isSmooth() const sf::RenderTexture
mapCoordsToPixel(const Vector2f &point) const sf::RenderTarget
mapCoordsToPixel(const Vector2f &point, const View &view) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point, const View &view) const sf::RenderTarget
popGLStates()sf::RenderTarget
pushGLStates()sf::RenderTarget
RenderTarget()sf::RenderTargetprotected
RenderTexture()sf::RenderTexture
resetGLStates()sf::RenderTarget
setActive(bool active=true)sf::RenderTexture
setRepeated(bool repeated)sf::RenderTexture
setSmooth(bool smooth)sf::RenderTexture
setView(const View &view)sf::RenderTarget
~RenderTarget()sf::RenderTargetvirtual
~RenderTexture()sf::RenderTexturevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.htm new file mode 100644 index 0000000..ac65bb3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.htm @@ -0,0 +1,1033 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Target for off-screen 2D rendering into a texture. + More...

+ +

#include <RenderTexture.hpp>

+
+Inheritance diagram for sf::RenderTexture:
+
+
+ + +sf::RenderTarget +sf::NonCopyable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 RenderTexture ()
 Default constructor. More...
 
virtual ~RenderTexture ()
 Destructor. More...
 
bool create (unsigned int width, unsigned int height, bool depthBuffer=false)
 Create the render-texture. More...
 
void setSmooth (bool smooth)
 Enable or disable texture smoothing. More...
 
bool isSmooth () const
 Tell whether the smooth filtering is enabled or not. More...
 
void setRepeated (bool repeated)
 Enable or disable texture repeating. More...
 
bool isRepeated () const
 Tell whether the texture is repeated or not. More...
 
bool setActive (bool active=true)
 Activate of deactivate the render-texture for rendering. More...
 
void display ()
 Update the contents of the target texture. More...
 
virtual Vector2u getSize () const
 Return the size of the rendering region of the texture. More...
 
const TexturegetTexture () const
 Get a read-only reference to the target texture. More...
 
void clear (const Color &color=Color(0, 0, 0, 255))
 Clear the entire target with a single color. More...
 
void setView (const View &view)
 Change the current active view. More...
 
const ViewgetView () const
 Get the view currently in use in the render target. More...
 
const ViewgetDefaultView () const
 Get the default view of the render target. More...
 
IntRect getViewport (const View &view) const
 Get the viewport of a view, applied to this render target. More...
 
Vector2f mapPixelToCoords (const Vector2i &point) const
 Convert a point from target coordinates to world coordinates, using the current view. More...
 
Vector2f mapPixelToCoords (const Vector2i &point, const View &view) const
 Convert a point from target coordinates to world coordinates. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point) const
 Convert a point from world coordinates to target coordinates, using the current view. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point, const View &view) const
 Convert a point from world coordinates to target coordinates. More...
 
void draw (const Drawable &drawable, const RenderStates &states=RenderStates::Default)
 Draw a drawable object to the render-target. More...
 
void draw (const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)
 Draw primitives defined by an array of vertices. More...
 
void pushGLStates ()
 Save the current OpenGL render states and matrices. More...
 
void popGLStates ()
 Restore the previously saved OpenGL render states and matrices. More...
 
void resetGLStates ()
 Reset the internal OpenGL states so that the target is ready for drawing. More...
 
+ + + + +

+Protected Member Functions

void initialize ()
 Performs the common initialization step after creation. More...
 
+

Detailed Description

+

Target for off-screen 2D rendering into a texture.

+

sf::RenderTexture is the little brother of sf::RenderWindow.

+

It implements the same 2D drawing and OpenGL-related functions (see their base class sf::RenderTarget for more details), the difference is that the result is stored in an off-screen texture rather than being show in a window.

+

Rendering to a texture can be useful in a variety of situations:

+
    +
  • precomputing a complex static texture (like a level's background from multiple tiles)
  • +
  • applying post-effects to the whole scene with shaders
  • +
  • creating a sprite from a 3D object rendered with OpenGL
  • +
  • etc.
  • +
+

Usage example:

+
// Create a new render-window
+
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
+
+
// Create a new render-texture
+ +
if (!texture.create(500, 500))
+
return -1;
+
+
// The main loop
+
while (window.isOpen())
+
{
+
// Event processing
+
// ...
+
+
// Clear the whole texture with red color
+ +
+
// Draw stuff to the texture
+
texture.draw(sprite); // sprite is a sf::Sprite
+
texture.draw(shape); // shape is a sf::Shape
+
texture.draw(text); // text is a sf::Text
+
+
// We're done drawing to the texture
+
texture.display();
+
+
// Now we start rendering to the window, clear it first
+
window.clear();
+
+
// Draw the texture
+
sf::Sprite sprite(texture.getTexture());
+
window.draw(sprite);
+
+
// End the current frame and display its contents on screen
+
window.display();
+
}
+

Like sf::RenderWindow, sf::RenderTexture is still able to render direct OpenGL stuff. It is even possible to mix together OpenGL calls and regular SFML drawing commands. If you need a depth buffer for 3D rendering, don't forget to request it when calling RenderTexture::create.

+
See Also
sf::RenderTarget, sf::RenderWindow, sf::View, sf::Texture
+ +

Definition at line 47 of file RenderTexture.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::RenderTexture::RenderTexture ()
+
+ +

Default constructor.

+

Constructs an empty, invalid render-texture. You must call create to have a valid render-texture.

+
See Also
create
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::RenderTexture::~RenderTexture ()
+
+virtual
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
void sf::RenderTarget::clear (const Colorcolor = Color(0, 0, 0, 255))
+
+inherited
+
+ +

Clear the entire target with a single color.

+

This function is usually called once every frame, to clear the previous contents of the target.

+
Parameters
+ + +
colorFill color to use to clear the render target
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool sf::RenderTexture::create (unsigned int width,
unsigned int height,
bool depthBuffer = false 
)
+
+ +

Create the render-texture.

+

Before calling this function, the render-texture is in an invalid state, thus it is mandatory to call it before doing anything with the render-texture. The last parameter, depthBuffer, is useful if you want to use the render-texture for 3D OpenGL rendering that requires a depth-buffer. Otherwise it is unnecessary, and you should leave this parameter to false (which is its default value).

+
Parameters
+ + + + +
widthWidth of the render-texture
heightHeight of the render-texture
depthBufferDo you want this render-texture to have a depth buffer?
+
+
+
Returns
True if creation has been successful
+ +
+
+ +
+
+ + + + + + + +
void sf::RenderTexture::display ()
+
+ +

Update the contents of the target texture.

+

This function updates the target texture with what has been drawn so far. Like for windows, calling this function is mandatory at the end of rendering. Not calling it may leave the texture in an undefined state.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Drawabledrawable,
const RenderStatesstates = RenderStates::Default 
)
+
+inherited
+
+ +

Draw a drawable object to the render-target.

+
Parameters
+ + + +
drawableObject to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Vertexvertices,
unsigned int vertexCount,
PrimitiveType type,
const RenderStatesstates = RenderStates::Default 
)
+
+inherited
+
+ +

Draw primitives defined by an array of vertices.

+
Parameters
+ + + + + +
verticesPointer to the vertices
vertexCountNumber of vertices in the array
typeType of primitives to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const View& sf::RenderTarget::getDefaultView () const
+
+inherited
+
+ +

Get the default view of the render target.

+

The default view has the initial size of the render target, and never changes after the target has been created.

+
Returns
The default view of the render target
+
See Also
setView, getView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual Vector2u sf::RenderTexture::getSize () const
+
+virtual
+
+ +

Return the size of the rendering region of the texture.

+

The returned value is the size that you passed to the create function.

+
Returns
Size in pixels
+ +

Implements sf::RenderTarget.

+ +
+
+ +
+
+ + + + + + + +
const Texture& sf::RenderTexture::getTexture () const
+
+ +

Get a read-only reference to the target texture.

+

After drawing to the render-texture and calling Display, you can retrieve the updated texture using this function, and draw it using a sprite (for example). The internal sf::Texture of a render-texture is always the same instance, so that it is possible to call this function once and keep a reference to the texture even after it is modified.

+
Returns
Const reference to the texture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const View& sf::RenderTarget::getView () const
+
+inherited
+
+ +

Get the view currently in use in the render target.

+
Returns
The view object that is currently used
+
See Also
setView, getDefaultView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
IntRect sf::RenderTarget::getViewport (const Viewview) const
+
+inherited
+
+ +

Get the viewport of a view, applied to this render target.

+

The viewport is defined in the view as a ratio, this function simply applies this ratio to the current dimensions of the render target to calculate the pixels rectangle that the viewport actually covers in the target.

+
Parameters
+ + +
viewThe view for which we want to compute the viewport
+
+
+
Returns
Viewport rectangle, expressed in pixels
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::initialize ()
+
+protectedinherited
+
+ +

Performs the common initialization step after creation.

+

The derived classes must call this function after the target is created and ready for drawing.

+ +
+
+ +
+
+ + + + + + + +
bool sf::RenderTexture::isRepeated () const
+
+ +

Tell whether the texture is repeated or not.

+
Returns
True if texture is repeated
+
See Also
setRepeated
+ +
+
+ +
+
+ + + + + + + +
bool sf::RenderTexture::isSmooth () const
+
+ +

Tell whether the smooth filtering is enabled or not.

+
Returns
True if texture smoothing is enabled
+
See Also
setSmooth
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint) const
+
+inherited
+
+ +

Convert a point from world coordinates to target coordinates, using the current view.

+

This function is an overload of the mapCoordsToPixel function that implicitely uses the current view. It is equivalent to:

+
target.mapCoordsToPixel(point, target.getView());
+
Parameters
+ + +
pointPoint to convert
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint,
const Viewview 
) const
+
+inherited
+
+ +

Convert a point from world coordinates to target coordinates.

+

This function finds the pixel of the render-target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-target – if the view is translated by (140, 25).

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPoint to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint) const
+
+inherited
+
+ +

Convert a point from target coordinates to world coordinates, using the current view.

+

This function is an overload of the mapPixelToCoords function that implicitely uses the current view. It is equivalent to:

+
target.mapPixelToCoords(point, target.getView());
+
Parameters
+ + +
pointPixel to convert
+
+
+
Returns
The converted point, in "world" coordinates
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint,
const Viewview 
) const
+
+inherited
+
+ +

Convert a point from target coordinates to world coordinates.

+

This function finds the 2D position that matches the given pixel of the render-target. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (10, 50) in your render-target may map to the point (150, 75) in your 2D world – if the view is translated by (140, 25).

+

For render-windows, this function is typically used to find which point (or object) is located below the mouse cursor.

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPixel to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in "world" units
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::popGLStates ()
+
+inherited
+
+ +

Restore the previously saved OpenGL render states and matrices.

+

See the description of pushGLStates to get a detailed description of these functions.

+
See Also
pushGLStates
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::pushGLStates ()
+
+inherited
+
+ +

Save the current OpenGL render states and matrices.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with PopGLStates, it ensures that:

+
    +
  • SFML's internal states are not messed up by your OpenGL code
  • +
  • your OpenGL states are not modified by a call to a SFML function
  • +
+

More specifically, it must be used around code that calls Draw functions. Example:

+
// OpenGL code here...
+
window.pushGLStates();
+
window.draw(...);
+
window.draw(...);
+
window.popGLStates();
+
// OpenGL code here...
+

Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the ResetGLStates function if you do so.

+
See Also
popGLStates
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::resetGLStates ()
+
+inherited
+
+ +

Reset the internal OpenGL states so that the target is ready for drawing.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent draw() calls will work as expected.

+

Example:

+
// OpenGL code here...
+
glPushAttrib(...);
+
window.resetGLStates();
+
window.draw(...);
+
window.draw(...);
+
glPopAttrib(...);
+
// OpenGL code here...
+
+
+
+ +
+
+ + + + + + + + +
bool sf::RenderTexture::setActive (bool active = true)
+
+ +

Activate of deactivate the render-texture for rendering.

+

This function makes the render-texture's context current for future OpenGL rendering operations (so you shouldn't care about it if you're not doing direct OpenGL stuff). Only one context can be current in a thread, so if you want to draw OpenGL geometry to another render target (like a RenderWindow) don't forget to activate it again.

+
Parameters
+ + +
activeTrue to activate, false to deactivate
+
+
+
Returns
True if operation was successful, false otherwise
+ +
+
+ +
+
+ + + + + + + + +
void sf::RenderTexture::setRepeated (bool repeated)
+
+ +

Enable or disable texture repeating.

+

This function is similar to Texture::setRepeated. This parameter is disabled by default.

+
Parameters
+ + +
repeatedTrue to enable repeating, false to disable it
+
+
+
See Also
isRepeated
+ +
+
+ +
+
+ + + + + + + + +
void sf::RenderTexture::setSmooth (bool smooth)
+
+ +

Enable or disable texture smoothing.

+

This function is similar to Texture::setSmooth. This parameter is disabled by default.

+
Parameters
+ + +
smoothTrue to enable smoothing, false to disable it
+
+
+
See Also
isSmooth
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::RenderTarget::setView (const Viewview)
+
+inherited
+
+ +

Change the current active view.

+

The view is like a 2D camera, it controls which part of the 2D scene is visible, and how it is viewed in the render-target. The new view will affect everything that is drawn, until another view is set. The render target keeps its own copy of the view object, so it is not necessary to keep the original one alive after calling this function. To restore the original view of the target, you can pass the result of getDefaultView() to this function.

+
Parameters
+ + +
viewNew view to use
+
+
+
See Also
getView, getDefaultView
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.png new file mode 100644 index 0000000..6ac1289 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderTexture.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow-members.htm new file mode 100644 index 0000000..b4d0ec2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow-members.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::RenderWindow Member List
+
+
+ +

This is the complete list of members for sf::RenderWindow, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
capture() const sf::RenderWindow
clear(const Color &color=Color(0, 0, 0, 255))sf::RenderTarget
close()sf::Window
create(VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())sf::Window
create(WindowHandle handle, const ContextSettings &settings=ContextSettings())sf::Window
display()sf::Window
draw(const Drawable &drawable, const RenderStates &states=RenderStates::Default)sf::RenderTarget
draw(const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)sf::RenderTarget
getDefaultView() const sf::RenderTarget
getPosition() const sf::Window
getSettings() const sf::Window
getSize() const sf::RenderWindowvirtual
getSystemHandle() const sf::Window
getView() const sf::RenderTarget
getViewport(const View &view) const sf::RenderTarget
initialize()sf::RenderTargetprotected
isOpen() const sf::Window
mapCoordsToPixel(const Vector2f &point) const sf::RenderTarget
mapCoordsToPixel(const Vector2f &point, const View &view) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point) const sf::RenderTarget
mapPixelToCoords(const Vector2i &point, const View &view) const sf::RenderTarget
NonCopyable()sf::NonCopyableinlineprotected
onCreate()sf::RenderWindowprotectedvirtual
onResize()sf::RenderWindowprotectedvirtual
pollEvent(Event &event)sf::Window
popGLStates()sf::RenderTarget
pushGLStates()sf::RenderTarget
RenderTarget()sf::RenderTargetprotected
RenderWindow()sf::RenderWindow
RenderWindow(VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())sf::RenderWindow
RenderWindow(WindowHandle handle, const ContextSettings &settings=ContextSettings())sf::RenderWindowexplicit
resetGLStates()sf::RenderTarget
setActive(bool active=true) const sf::Window
setFramerateLimit(unsigned int limit)sf::Window
setIcon(unsigned int width, unsigned int height, const Uint8 *pixels)sf::Window
setJoystickThreshold(float threshold)sf::Window
setKeyRepeatEnabled(bool enabled)sf::Window
setMouseCursorVisible(bool visible)sf::Window
setPosition(const Vector2i &position)sf::Window
setSize(const Vector2u size)sf::Window
setTitle(const String &title)sf::Window
setVerticalSyncEnabled(bool enabled)sf::Window
setView(const View &view)sf::RenderTarget
setVisible(bool visible)sf::Window
waitEvent(Event &event)sf::Window
Window()sf::Window
Window(VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())sf::Window
Window(WindowHandle handle, const ContextSettings &settings=ContextSettings())sf::Windowexplicit
~RenderTarget()sf::RenderTargetvirtual
~RenderWindow()sf::RenderWindowvirtual
~Window()sf::Windowvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.htm new file mode 100644 index 0000000..0feaf83 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.htm @@ -0,0 +1,1819 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Window that can serve as a target for 2D drawing. + More...

+ +

#include <RenderWindow.hpp>

+
+Inheritance diagram for sf::RenderWindow:
+
+
+ + +sf::Window +sf::RenderTarget +sf::GlResource +sf::NonCopyable +sf::NonCopyable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 RenderWindow ()
 Default constructor. More...
 
 RenderWindow (VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())
 Construct a new window. More...
 
 RenderWindow (WindowHandle handle, const ContextSettings &settings=ContextSettings())
 Construct the window from an existing control. More...
 
virtual ~RenderWindow ()
 Destructor. More...
 
virtual Vector2u getSize () const
 Get the size of the rendering region of the window. More...
 
Image capture () const
 Copy the current contents of the window to an image. More...
 
void create (VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())
 Create (or recreate) the window. More...
 
void create (WindowHandle handle, const ContextSettings &settings=ContextSettings())
 Create (or recreate) the window from an existing control. More...
 
void close ()
 Close the window and destroy all the attached resources. More...
 
bool isOpen () const
 Tell whether or not the window is open. More...
 
const ContextSettingsgetSettings () const
 Get the settings of the OpenGL context of the window. More...
 
bool pollEvent (Event &event)
 Pop the event on top of the event queue, if any, and return it. More...
 
bool waitEvent (Event &event)
 Wait for an event and return it. More...
 
Vector2i getPosition () const
 Get the position of the window. More...
 
void setPosition (const Vector2i &position)
 Change the position of the window on screen. More...
 
void setSize (const Vector2u size)
 Change the size of the rendering region of the window. More...
 
void setTitle (const String &title)
 Change the title of the window. More...
 
void setIcon (unsigned int width, unsigned int height, const Uint8 *pixels)
 Change the window's icon. More...
 
void setVisible (bool visible)
 Show or hide the window. More...
 
void setVerticalSyncEnabled (bool enabled)
 Enable or disable vertical synchronization. More...
 
void setMouseCursorVisible (bool visible)
 Show or hide the mouse cursor. More...
 
void setKeyRepeatEnabled (bool enabled)
 Enable or disable automatic key-repeat. More...
 
void setFramerateLimit (unsigned int limit)
 Limit the framerate to a maximum fixed frequency. More...
 
void setJoystickThreshold (float threshold)
 Change the joystick threshold. More...
 
bool setActive (bool active=true) const
 Activate or deactivate the window as the current target for OpenGL rendering. More...
 
void display ()
 Display on screen what has been rendered to the window so far. More...
 
WindowHandle getSystemHandle () const
 Get the OS-specific handle of the window. More...
 
void clear (const Color &color=Color(0, 0, 0, 255))
 Clear the entire target with a single color. More...
 
void setView (const View &view)
 Change the current active view. More...
 
const ViewgetView () const
 Get the view currently in use in the render target. More...
 
const ViewgetDefaultView () const
 Get the default view of the render target. More...
 
IntRect getViewport (const View &view) const
 Get the viewport of a view, applied to this render target. More...
 
Vector2f mapPixelToCoords (const Vector2i &point) const
 Convert a point from target coordinates to world coordinates, using the current view. More...
 
Vector2f mapPixelToCoords (const Vector2i &point, const View &view) const
 Convert a point from target coordinates to world coordinates. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point) const
 Convert a point from world coordinates to target coordinates, using the current view. More...
 
Vector2i mapCoordsToPixel (const Vector2f &point, const View &view) const
 Convert a point from world coordinates to target coordinates. More...
 
void draw (const Drawable &drawable, const RenderStates &states=RenderStates::Default)
 Draw a drawable object to the render-target. More...
 
void draw (const Vertex *vertices, unsigned int vertexCount, PrimitiveType type, const RenderStates &states=RenderStates::Default)
 Draw primitives defined by an array of vertices. More...
 
void pushGLStates ()
 Save the current OpenGL render states and matrices. More...
 
void popGLStates ()
 Restore the previously saved OpenGL render states and matrices. More...
 
void resetGLStates ()
 Reset the internal OpenGL states so that the target is ready for drawing. More...
 
+ + + + + + + + + + +

+Protected Member Functions

virtual void onCreate ()
 Function called after the window has been created. More...
 
virtual void onResize ()
 Function called after the window has been resized. More...
 
void initialize ()
 Performs the common initialization step after creation. More...
 
+

Detailed Description

+

Window that can serve as a target for 2D drawing.

+

sf::RenderWindow is the main class of the Graphics module.

+

It defines an OS window that can be painted using the other classes of the graphics module.

+

sf::RenderWindow is derived from sf::Window, thus it inherits all its features: events, window management, OpenGL rendering, etc. See the documentation of sf::Window for a more complete description of all these features, as well as code examples.

+

On top of that, sf::RenderWindow adds more features related to 2D drawing with the graphics module (see its base class sf::RenderTarget for more details). Here is a typical rendering and event loop with a sf::RenderWindow:

+
// Declare and create a new render-window
+
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
+
+
// Limit the framerate to 60 frames per second (this step is optional)
+
window.setFramerateLimit(60);
+
+
// The main loop - ends as soon as the window is closed
+
while (window.isOpen())
+
{
+
// Event processing
+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// Request for closing the window
+
if (event.type == sf::Event::Closed)
+
window.close();
+
}
+
+
// Clear the whole window before rendering a new frame
+
window.clear();
+
+
// Draw some graphical entities
+
window.draw(sprite);
+
window.draw(circle);
+
window.draw(text);
+
+
// End the current frame and display its contents on screen
+
window.display();
+
}
+

Like sf::Window, sf::RenderWindow is still able to render direct OpenGL stuff. It is even possible to mix together OpenGL calls and regular SFML drawing commands.

+
// Create the render window
+
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL");
+
+
// Create a sprite and a text to display
+
sf::Sprite sprite;
+
sf::Text text;
+
...
+
+
// Perform OpenGL initializations
+
glMatrixMode(GL_PROJECTION);
+
...
+
+
// Start the rendering loop
+
while (window.isOpen())
+
{
+
// Process events
+
...
+
+
// Draw a background sprite
+
window.pushGLStates();
+
window.draw(sprite);
+
window.popGLStates();
+
+
// Draw a 3D object using OpenGL
+
glBegin(GL_QUADS);
+
glVertex3f(...);
+
...
+
glEnd();
+
+
// Draw text on top of the 3D object
+
window.pushGLStates();
+
window.draw(text);
+
window.popGLStates();
+
+
// Finally, display the rendered frame on screen
+
window.display();
+
}
+
See Also
sf::Window, sf::RenderTarget, sf::RenderTexture, sf::View
+ +

Definition at line 44 of file RenderWindow.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::RenderWindow::RenderWindow ()
+
+ +

Default constructor.

+

This constructor doesn't actually create the window, use the other constructors or call "create" to do so.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::RenderWindow::RenderWindow (VideoMode mode,
const Stringtitle,
Uint32 style = Style::Default,
const ContextSettingssettings = ContextSettings() 
)
+
+ +

Construct a new window.

+

This constructor creates the window with the size and pixel depth defined in mode. An optional style can be passed to customize the look and behaviour of the window (borders, title bar, resizable, closable, ...).

+

The fourth parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc. You shouldn't care about these parameters for a regular usage of the graphics module.

+
Parameters
+ + + + + +
modeVideo mode to use (defines the width, height and depth of the rendering area of the window)
titleTitle of the window
styleWindow style
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
sf::RenderWindow::RenderWindow (WindowHandle handle,
const ContextSettingssettings = ContextSettings() 
)
+
+explicit
+
+ +

Construct the window from an existing control.

+

Use this constructor if you want to create an SFML rendering area into an already existing control.

+

The fourth parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc. You shouldn't care about these parameters for a regular usage of the graphics module.

+
Parameters
+ + + +
handlePlatform-specific handle of the control
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::RenderWindow::~RenderWindow ()
+
+virtual
+
+ +

Destructor.

+

Closes the window and free all the resources attached to it.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
Image sf::RenderWindow::capture () const
+
+ +

Copy the current contents of the window to an image.

+

This is a slow operation, whose main purpose is to make screenshots of the application. If you want to update an image with the contents of the window and then use it for drawing, you should rather use a sf::Texture and its update(Window&) function. You can also draw things directly to a texture with the sf::RenderTexture class.

+
Returns
Image containing the captured contents
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::RenderTarget::clear (const Colorcolor = Color(0, 0, 0, 255))
+
+inherited
+
+ +

Clear the entire target with a single color.

+

This function is usually called once every frame, to clear the previous contents of the target.

+
Parameters
+ + +
colorFill color to use to clear the render target
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Window::close ()
+
+inherited
+
+ +

Close the window and destroy all the attached resources.

+

After calling this function, the sf::Window instance remains valid and you can call create() to recreate the window. All other functions such as pollEvent() or display() will still work (i.e. you don't have to test isOpen() every time), and will have no effect on closed windows.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Window::create (VideoMode mode,
const Stringtitle,
Uint32 style = Style::Default,
const ContextSettingssettings = ContextSettings() 
)
+
+inherited
+
+ +

Create (or recreate) the window.

+

If the window was already created, it closes it first. If style contains Style::Fullscreen, then mode must be a valid video mode.

+
Parameters
+ + + + + +
modeVideo mode to use (defines the width, height and depth of the rendering area of the window)
titleTitle of the window
styleWindow style
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Window::create (WindowHandle handle,
const ContextSettingssettings = ContextSettings() 
)
+
+inherited
+
+ +

Create (or recreate) the window from an existing control.

+

Use this function if you want to create an OpenGL rendering area into an already existing control. If the window was already created, it closes it first.

+
Parameters
+ + + +
handlePlatform-specific handle of the control
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Window::display ()
+
+inherited
+
+ +

Display on screen what has been rendered to the window so far.

+

This function is typically called after all OpenGL rendering has been done for the current frame, in order to show it on screen.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Drawabledrawable,
const RenderStatesstates = RenderStates::Default 
)
+
+inherited
+
+ +

Draw a drawable object to the render-target.

+
Parameters
+ + + +
drawableObject to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::RenderTarget::draw (const Vertexvertices,
unsigned int vertexCount,
PrimitiveType type,
const RenderStatesstates = RenderStates::Default 
)
+
+inherited
+
+ +

Draw primitives defined by an array of vertices.

+
Parameters
+ + + + + +
verticesPointer to the vertices
vertexCountNumber of vertices in the array
typeType of primitives to draw
statesRender states to use for drawing
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const View& sf::RenderTarget::getDefaultView () const
+
+inherited
+
+ +

Get the default view of the render target.

+

The default view has the initial size of the render target, and never changes after the target has been created.

+
Returns
The default view of the render target
+
See Also
setView, getView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Vector2i sf::Window::getPosition () const
+
+inherited
+
+ +

Get the position of the window.

+
Returns
Position of the window, in pixels
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const ContextSettings& sf::Window::getSettings () const
+
+inherited
+
+ +

Get the settings of the OpenGL context of the window.

+

Note that these settings may be different from what was passed to the constructor or the create() function, if one or more settings were not supported. In this case, SFML chose the closest match.

+
Returns
Structure containing the OpenGL context settings
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual Vector2u sf::RenderWindow::getSize () const
+
+virtual
+
+ +

Get the size of the rendering region of the window.

+

The size doesn't include the titlebar and borders of the window.

+
Returns
Size in pixels
+ +

Implements sf::RenderTarget.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
WindowHandle sf::Window::getSystemHandle () const
+
+inherited
+
+ +

Get the OS-specific handle of the window.

+

The type of the returned handle is sf::WindowHandle, which is a typedef to the handle type defined by the OS. You shouldn't need to use this function, unless you have very specific stuff to implement that SFML doesn't support, or implement a temporary workaround until a bug is fixed.

+
Returns
System handle of the window
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const View& sf::RenderTarget::getView () const
+
+inherited
+
+ +

Get the view currently in use in the render target.

+
Returns
The view object that is currently used
+
See Also
setView, getDefaultView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
IntRect sf::RenderTarget::getViewport (const Viewview) const
+
+inherited
+
+ +

Get the viewport of a view, applied to this render target.

+

The viewport is defined in the view as a ratio, this function simply applies this ratio to the current dimensions of the render target to calculate the pixels rectangle that the viewport actually covers in the target.

+
Parameters
+ + +
viewThe view for which we want to compute the viewport
+
+
+
Returns
Viewport rectangle, expressed in pixels
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::initialize ()
+
+protectedinherited
+
+ +

Performs the common initialization step after creation.

+

The derived classes must call this function after the target is created and ready for drawing.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Window::isOpen () const
+
+inherited
+
+ +

Tell whether or not the window is open.

+

This function returns whether or not the window exists. Note that a hidden window (setVisible(false)) is open (therefore this function would return true).

+
Returns
True if the window is open, false if it has been closed
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint) const
+
+inherited
+
+ +

Convert a point from world coordinates to target coordinates, using the current view.

+

This function is an overload of the mapCoordsToPixel function that implicitely uses the current view. It is equivalent to:

+
target.mapCoordsToPixel(point, target.getView());
+
Parameters
+ + +
pointPoint to convert
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2i sf::RenderTarget::mapCoordsToPixel (const Vector2fpoint,
const Viewview 
) const
+
+inherited
+
+ +

Convert a point from world coordinates to target coordinates.

+

This function finds the pixel of the render-target that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-target – if the view is translated by (140, 25).

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPoint to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in target coordinates (pixels)
+
See Also
mapPixelToCoords
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint) const
+
+inherited
+
+ +

Convert a point from target coordinates to world coordinates, using the current view.

+

This function is an overload of the mapPixelToCoords function that implicitely uses the current view. It is equivalent to:

+
target.mapPixelToCoords(point, target.getView());
+
Parameters
+ + +
pointPixel to convert
+
+
+
Returns
The converted point, in "world" coordinates
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2f sf::RenderTarget::mapPixelToCoords (const Vector2ipoint,
const Viewview 
) const
+
+inherited
+
+ +

Convert a point from target coordinates to world coordinates.

+

This function finds the 2D position that matches the given pixel of the render-target. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

+

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-target, this assertion is not true anymore, ie. a point located at (10, 50) in your render-target may map to the point (150, 75) in your 2D world – if the view is translated by (140, 25).

+

For render-windows, this function is typically used to find which point (or object) is located below the mouse cursor.

+

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-target.

+
Parameters
+ + + +
pointPixel to convert
viewThe view to use for converting the point
+
+
+
Returns
The converted point, in "world" units
+
See Also
mapCoordsToPixel
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::RenderWindow::onCreate ()
+
+protectedvirtual
+
+ +

Function called after the window has been created.

+

This function is called so that derived classes can perform their own specific initialization as soon as the window is created.

+ +

Reimplemented from sf::Window.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::RenderWindow::onResize ()
+
+protectedvirtual
+
+ +

Function called after the window has been resized.

+

This function is called so that derived classes can perform custom actions when the size of the window changes.

+ +

Reimplemented from sf::Window.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
bool sf::Window::pollEvent (Eventevent)
+
+inherited
+
+ +

Pop the event on top of the event queue, if any, and return it.

+

This function is not blocking: if there's no pending event then it will return false and leave event unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event.

+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// process event...
+
}
+
Parameters
+ + +
eventEvent to be returned
+
+
+
Returns
True if an event was returned, or false if the event queue was empty
+
See Also
waitEvent
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::popGLStates ()
+
+inherited
+
+ +

Restore the previously saved OpenGL render states and matrices.

+

See the description of pushGLStates to get a detailed description of these functions.

+
See Also
pushGLStates
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::pushGLStates ()
+
+inherited
+
+ +

Save the current OpenGL render states and matrices.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with PopGLStates, it ensures that:

+
    +
  • SFML's internal states are not messed up by your OpenGL code
  • +
  • your OpenGL states are not modified by a call to a SFML function
  • +
+

More specifically, it must be used around code that calls Draw functions. Example:

+
// OpenGL code here...
+
window.pushGLStates();
+
window.draw(...);
+
window.draw(...);
+
window.popGLStates();
+
// OpenGL code here...
+

Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the ResetGLStates function if you do so.

+
See Also
popGLStates
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::RenderTarget::resetGLStates ()
+
+inherited
+
+ +

Reset the internal OpenGL states so that the target is ready for drawing.

+

This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent draw() calls will work as expected.

+

Example:

+
// OpenGL code here...
+
glPushAttrib(...);
+
window.resetGLStates();
+
window.draw(...);
+
window.draw(...);
+
glPopAttrib(...);
+
// OpenGL code here...
+
+
+
+ +
+
+ + + + + +
+ + + + + + + + +
bool sf::Window::setActive (bool active = true) const
+
+inherited
+
+ +

Activate or deactivate the window as the current target for OpenGL rendering.

+

A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated.

+
Parameters
+ + +
activeTrue to activate, false to deactivate
+
+
+
Returns
True if operation was successful, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setFramerateLimit (unsigned int limit)
+
+inherited
+
+ +

Limit the framerate to a maximum fixed frequency.

+

If a limit is set, the window will use a small delay after each call to display() to ensure that the current frame lasted long enough to match the framerate limit. SFML will try to match the given limit as much as it can, but since it internally uses sf::sleep, whose precision depends on the underlying OS, the results may be a little unprecise as well (for example, you can get 65 FPS when requesting 60).

+
Parameters
+ + +
limitFramerate limit, in frames per seconds (use 0 to disable limit)
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Window::setIcon (unsigned int width,
unsigned int height,
const Uint8 * pixels 
)
+
+inherited
+
+ +

Change the window's icon.

+

pixels must be an array of width x height pixels in 32-bits RGBA format.

+

The OS default icon is used by default.

+
Parameters
+ + + + +
widthIcon's width, in pixels
heightIcon's height, in pixels
pixelsPointer to the array of pixels in memory
+
+
+
See Also
setTitle
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setJoystickThreshold (float threshold)
+
+inherited
+
+ +

Change the joystick threshold.

+

The joystick threshold is the value below which no JoystickMoved event will be generated.

+

The threshold value is 0.1 by default.

+
Parameters
+ + +
thresholdNew threshold, in the range [0, 100]
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setKeyRepeatEnabled (bool enabled)
+
+inherited
+
+ +

Enable or disable automatic key-repeat.

+

If key repeat is enabled, you will receive repeated KeyPressed events while keeping a key pressed. If it is disabled, you will only get a single event when the key is pressed.

+

Key repeat is enabled by default.

+
Parameters
+ + +
enabledTrue to enable, false to disable
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setMouseCursorVisible (bool visible)
+
+inherited
+
+ +

Show or hide the mouse cursor.

+

The mouse cursor is visible by default.

+
Parameters
+ + +
visibleTrue to show the mouse cursor, false to hide it
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setPosition (const Vector2iposition)
+
+inherited
+
+ +

Change the position of the window on screen.

+

This function only works for top-level windows (i.e. it will be ignored for windows created from the handle of a child window/control).

+
Parameters
+ + +
positionNew position, in pixels
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setSize (const Vector2u size)
+
+inherited
+
+ +

Change the size of the rendering region of the window.

+
Parameters
+ + +
sizeNew size, in pixels
+
+
+
See Also
getSize
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setTitle (const Stringtitle)
+
+inherited
+
+ +

Change the title of the window.

+
Parameters
+ + +
titleNew title
+
+
+
See Also
setIcon
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setVerticalSyncEnabled (bool enabled)
+
+inherited
+
+ +

Enable or disable vertical synchronization.

+

Activating vertical synchronization will limit the number of frames displayed to the refresh rate of the monitor. This can avoid some visual artifacts, and limit the framerate to a good value (but not constant across different computers).

+

Vertical synchronization is disabled by default.

+
Parameters
+ + +
enabledTrue to enable v-sync, false to deactivate it
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::RenderTarget::setView (const Viewview)
+
+inherited
+
+ +

Change the current active view.

+

The view is like a 2D camera, it controls which part of the 2D scene is visible, and how it is viewed in the render-target. The new view will affect everything that is drawn, until another view is set. The render target keeps its own copy of the view object, so it is not necessary to keep the original one alive after calling this function. To restore the original view of the target, you can pass the result of getDefaultView() to this function.

+
Parameters
+ + +
viewNew view to use
+
+
+
See Also
getView, getDefaultView
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Window::setVisible (bool visible)
+
+inherited
+
+ +

Show or hide the window.

+

The window is shown by default.

+
Parameters
+ + +
visibleTrue to show the window, false to hide it
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
bool sf::Window::waitEvent (Eventevent)
+
+inherited
+
+ +

Wait for an event and return it.

+

This function is blocking: if there's no pending event then it will wait until an event is received. After this function returns (and no error occured), the event object is always valid and filled properly. This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread sleep as long as no new event is received.

+
sf::Event event;
+
if (window.waitEvent(event))
+
{
+
// process event...
+
}
+
Parameters
+ + +
eventEvent to be returned
+
+
+
Returns
False if any error occured
+
See Also
pollEvent
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.png new file mode 100644 index 0000000..80a23b7 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1RenderWindow.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader-members.htm new file mode 100644 index 0000000..ee343cc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader-members.htm @@ -0,0 +1,83 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Shader Member List
+
+
+ +

This is the complete list of members for sf::Shader, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bind(const Shader *shader)sf::Shaderstatic
CurrentTexture (defined in sf::Shader)sf::Shaderstatic
ensureGlContext()sf::GlResourceprivatestatic
Fragment enum valuesf::Shader
GlResource()sf::GlResourceprivate
isAvailable()sf::Shaderstatic
loadFromFile(const std::string &filename, Type type)sf::Shader
loadFromFile(const std::string &vertexShaderFilename, const std::string &fragmentShaderFilename)sf::Shader
loadFromMemory(const std::string &shader, Type type)sf::Shader
loadFromMemory(const std::string &vertexShader, const std::string &fragmentShader)sf::Shader
loadFromStream(InputStream &stream, Type type)sf::Shader
loadFromStream(InputStream &vertexShaderStream, InputStream &fragmentShaderStream)sf::Shader
NonCopyable()sf::NonCopyableinlineprivate
setParameter(const std::string &name, float x)sf::Shader
setParameter(const std::string &name, float x, float y)sf::Shader
setParameter(const std::string &name, float x, float y, float z)sf::Shader
setParameter(const std::string &name, float x, float y, float z, float w)sf::Shader
setParameter(const std::string &name, const Vector2f &vector)sf::Shader
setParameter(const std::string &name, const Vector3f &vector)sf::Shader
setParameter(const std::string &name, const Color &color)sf::Shader
setParameter(const std::string &name, const sf::Transform &transform)sf::Shader
setParameter(const std::string &name, const Texture &texture)sf::Shader
setParameter(const std::string &name, CurrentTextureType)sf::Shader
Shader()sf::Shader
Type enum namesf::Shader
Vertex enum valuesf::Shader
~GlResource()sf::GlResourceprivate
~Shader()sf::Shader
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.htm new file mode 100644 index 0000000..6676a1e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.htm @@ -0,0 +1,1017 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Shader class (vertex and fragment) + More...

+ +

#include <Shader.hpp>

+
+Inheritance diagram for sf::Shader:
+
+
+ + +sf::GlResource +sf::NonCopyable + +
+ + + + + +

+Classes

struct  CurrentTextureType
 Special type/value that can be passed to setParameter, and that represents the texture of the object being drawn. More...
 
+ + + + +

+Public Types

enum  Type {
+  Vertex, +
+  Fragment +
+ }
 Types of shaders. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Shader ()
 Default constructor. More...
 
 ~Shader ()
 Destructor. More...
 
bool loadFromFile (const std::string &filename, Type type)
 Load either the vertex or fragment shader from a file. More...
 
bool loadFromFile (const std::string &vertexShaderFilename, const std::string &fragmentShaderFilename)
 Load both the vertex and fragment shaders from files. More...
 
bool loadFromMemory (const std::string &shader, Type type)
 Load either the vertex or fragment shader from a source code in memory. More...
 
bool loadFromMemory (const std::string &vertexShader, const std::string &fragmentShader)
 Load both the vertex and fragment shaders from source codes in memory. More...
 
bool loadFromStream (InputStream &stream, Type type)
 Load either the vertex or fragment shader from a custom stream. More...
 
bool loadFromStream (InputStream &vertexShaderStream, InputStream &fragmentShaderStream)
 Load both the vertex and fragment shaders from custom streams. More...
 
void setParameter (const std::string &name, float x)
 Change a float parameter of the shader. More...
 
void setParameter (const std::string &name, float x, float y)
 Change a 2-components vector parameter of the shader. More...
 
void setParameter (const std::string &name, float x, float y, float z)
 Change a 3-components vector parameter of the shader. More...
 
void setParameter (const std::string &name, float x, float y, float z, float w)
 Change a 4-components vector parameter of the shader. More...
 
void setParameter (const std::string &name, const Vector2f &vector)
 Change a 2-components vector parameter of the shader. More...
 
void setParameter (const std::string &name, const Vector3f &vector)
 Change a 3-components vector parameter of the shader. More...
 
void setParameter (const std::string &name, const Color &color)
 Change a color parameter of the shader. More...
 
void setParameter (const std::string &name, const sf::Transform &transform)
 Change a matrix parameter of the shader. More...
 
void setParameter (const std::string &name, const Texture &texture)
 Change a texture parameter of the shader. More...
 
void setParameter (const std::string &name, CurrentTextureType)
 Change a texture parameter of the shader. More...
 
+ + + + + + + +

+Static Public Member Functions

static void bind (const Shader *shader)
 Bind a shader for rendering. More...
 
static bool isAvailable ()
 Tell whether or not the system supports shaders. More...
 
+ + + +

+Static Public Attributes

+static CurrentTextureType CurrentTexture
 
+ + + + +

+Static Private Member Functions

static void ensureGlContext ()
 Make sure that a valid OpenGL context exists in the current thread. More...
 
+

Detailed Description

+

Shader class (vertex and fragment)

+

Shaders are programs written using a specific language, executed directly by the graphics card and allowing to apply real-time operations to the rendered entities.

+

There are two kinds of shaders:

+
    +
  • Vertex shaders, that process vertices
  • +
  • Fragment (pixel) shaders, that process pixels
  • +
+

A sf::Shader can be composed of either a vertex shader alone, a fragment shader alone, or both combined (see the variants of the load functions).

+

Shaders are written in GLSL, which is a C-like language dedicated to OpenGL shaders. You'll probably need to learn its basics before writing your own shaders for SFML.

+

Like any C/C++ program, a shader has its own variables that you can set from your C++ application. sf::Shader handles 5 different types of variables:

+
    +
  • floats
  • +
  • vectors (2, 3 or 4 components)
  • +
  • colors
  • +
  • textures
  • +
  • transforms (matrices)
  • +
+

The value of the variables can be changed at any time with the various overloads of the setParameter function:

+
shader.setParameter("offset", 2.f);
+
shader.setParameter("point", 0.5f, 0.8f, 0.3f);
+
shader.setParameter("color", sf::Color(128, 50, 255));
+
shader.setParameter("matrix", transform); // transform is a sf::Transform
+
shader.setParameter("overlay", texture); // texture is a sf::Texture
+
shader.setParameter("texture", sf::Shader::CurrentTexture);
+

The special Shader::CurrentTexture argument maps the given texture variable to the current texture of the object being drawn (which cannot be known in advance).

+

To apply a shader to a drawable, you must pass it as an additional parameter to the Draw function:

+
window.draw(sprite, &shader);
+

... which is in fact just a shortcut for this:

+
+
states.shader = &shader;
+
window.draw(sprite, states);
+

In the code above we pass a pointer to the shader, because it may be null (which means "no shader").

+

Shaders can be used on any drawable, but some combinations are not interesting. For example, using a vertex shader on a sf::Sprite is limited because there are only 4 vertices, the sprite would have to be subdivided in order to apply wave effects. Another bad example is a fragment shader with sf::Text: the texture of the text is not the actual text that you see on screen, it is a big texture containing all the characters of the font in an arbitrary order; thus, texture lookups on pixels other than the current one may not give you the expected result.

+

Shaders can also be used to apply global post-effects to the current contents of the target (like the old sf::PostFx class in SFML 1). This can be done in two different ways:

+
    +
  • draw everything to a sf::RenderTexture, then draw it to the main target using the shader
  • +
  • draw everything directly to the main target, then use sf::Texture::update(Window&) to copy its contents to a texture and draw it to the main target using the shader
  • +
+

The first technique is more optimized because it doesn't involve retrieving the target's pixels to system memory, but the second one doesn't impact the rendering process and can be easily inserted anywhere without impacting all the code.

+

Like sf::Texture that can be used as a raw OpenGL texture, sf::Shader can also be used directly as a raw shader for custom OpenGL geometry.

+
+
... render OpenGL geometry ...
+
sf::Shader::bind(NULL);
+
+

Definition at line 51 of file Shader.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Shader::Type
+
+ +

Types of shaders.

+ + + +
Enumerator
Vertex  +

Vertex shader.

+
Fragment  +

Fragment (pixel) shader.

+
+ +

Definition at line 59 of file Shader.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Shader::Shader ()
+
+ +

Default constructor.

+

This constructor creates an invalid shader.

+ +
+
+ +
+
+ + + + + + + +
sf::Shader::~Shader ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
static void sf::Shader::bind (const Shadershader)
+
+static
+
+ +

Bind a shader for rendering.

+

This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sf::Shader with OpenGL code.

+
sf::Shader s1, s2;
+
...
+
sf::Shader::bind(&s1);
+
// draw OpenGL stuff that use s1...
+ +
// draw OpenGL stuff that use s2...
+ +
// draw OpenGL stuff that use no shader...
+
Parameters
+ + +
shaderShader to bind, can be null to use no shader
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static bool sf::Shader::isAvailable ()
+
+static
+
+ +

Tell whether or not the system supports shaders.

+

This function should always be called before using the shader features. If it returns false, then any attempt to use sf::Shader will fail.

+
Returns
True if shaders are supported, false otherwise
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromFile (const std::string & filename,
Type type 
)
+
+ +

Load either the vertex or fragment shader from a file.

+

This function loads a single shader, either vertex or fragment, identified by the second argument. The source must be a text file containing a valid shader in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
filenamePath of the vertex or fragment shader file to load
typeType of shader (vertex or fragment)
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromMemory, loadFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromFile (const std::string & vertexShaderFilename,
const std::string & fragmentShaderFilename 
)
+
+ +

Load both the vertex and fragment shaders from files.

+

This function loads both the vertex and the fragment shaders. If one of them fails to load, the shader is left empty (the valid shader is unloaded). The sources must be text files containing valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
vertexShaderFilenamePath of the vertex shader file to load
fragmentShaderFilenamePath of the fragment shader file to load
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromMemory, loadFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromMemory (const std::string & shader,
Type type 
)
+
+ +

Load either the vertex or fragment shader from a source code in memory.

+

This function loads a single shader, either vertex or fragment, identified by the second argument. The source code must be a valid shader in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
shaderString containing the source code of the shader
typeType of shader (vertex or fragment)
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromMemory (const std::string & vertexShader,
const std::string & fragmentShader 
)
+
+ +

Load both the vertex and fragment shaders from source codes in memory.

+

This function loads both the vertex and the fragment shaders. If one of them fails to load, the shader is left empty (the valid shader is unloaded). The sources must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
vertexShaderString containing the source code of the vertex shader
fragmentShaderString containing the source code of the fragment shader
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromStream
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromStream (InputStreamstream,
Type type 
)
+
+ +

Load either the vertex or fragment shader from a custom stream.

+

This function loads a single shader, either vertex or fragment, identified by the second argument. The source code must be a valid shader in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
streamSource stream to read from
typeType of shader (vertex or fragment)
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Shader::loadFromStream (InputStreamvertexShaderStream,
InputStreamfragmentShaderStream 
)
+
+ +

Load both the vertex and fragment shaders from custom streams.

+

This function loads both the vertex and the fragment shaders. If one of them fails to load, the shader is left empty (the valid shader is unloaded). The source codes must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.

+
Parameters
+ + + +
vertexShaderStreamSource stream to read the vertex shader from
fragmentShaderStreamSource stream to read the fragment shader from
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
float x 
)
+
+ +

Change a float parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a float (float GLSL type).

+

Example:

+
uniform float myparam; // this is the variable in the shader
+
shader.setParameter("myparam", 5.2f);
+
Parameters
+ + + +
nameName of the parameter in the shader
xValue to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
float x,
float y 
)
+
+ +

Change a 2-components vector parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2x1 vector (vec2 GLSL type).

+

Example:

+
uniform vec2 myparam; // this is the variable in the shader
+
shader.setParameter("myparam", 5.2f, 6.0f);
+
Parameters
+ + + + +
nameName of the parameter in the shader
xFirst component of the value to assign
ySecond component of the value to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
float x,
float y,
float z 
)
+
+ +

Change a 3-components vector parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 3x1 vector (vec3 GLSL type).

+

Example:

+
uniform vec3 myparam; // this is the variable in the shader
+
shader.setParameter("myparam", 5.2f, 6.0f, -8.1f);
+
Parameters
+ + + + + +
nameName of the parameter in the shader
xFirst component of the value to assign
ySecond component of the value to assign
zThird component of the value to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
float x,
float y,
float z,
float w 
)
+
+ +

Change a 4-components vector parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 4x1 vector (vec4 GLSL type).

+

Example:

+
uniform vec4 myparam; // this is the variable in the shader
+
shader.setParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f);
+
Parameters
+ + + + + + +
nameName of the parameter in the shader
xFirst component of the value to assign
ySecond component of the value to assign
zThird component of the value to assign
wFourth component of the value to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
const Vector2fvector 
)
+
+ +

Change a 2-components vector parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2x1 vector (vec2 GLSL type).

+

Example:

+
uniform vec2 myparam; // this is the variable in the shader
+
shader.setParameter("myparam", sf::Vector2f(5.2f, 6.0f));
+
Parameters
+ + + +
nameName of the parameter in the shader
vectorVector to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
const Vector3fvector 
)
+
+ +

Change a 3-components vector parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 3x1 vector (vec3 GLSL type).

+

Example:

+
uniform vec3 myparam; // this is the variable in the shader
+
shader.setParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f));
+
Parameters
+ + + +
nameName of the parameter in the shader
vectorVector to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
const Colorcolor 
)
+
+ +

Change a color parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 4x1 vector (vec4 GLSL type).

+

It is important to note that the components of the color are normalized before being passed to the shader. Therefore, they are converted from range [0 .. 255] to range [0 .. 1]. For example, a sf::Color(255, 125, 0, 255) will be transformed to a vec4(1.0, 0.5, 0.0, 1.0) in the shader.

+

Example:

+
uniform vec4 color; // this is the variable in the shader
+
shader.setParameter("color", sf::Color(255, 128, 0, 255));
+
Parameters
+ + + +
nameName of the parameter in the shader
colorColor to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
const sf::Transformtransform 
)
+
+ +

Change a matrix parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 4x4 matrix (mat4 GLSL type).

+

Example:

+
uniform mat4 matrix; // this is the variable in the shader
+
sf::Transform transform;
+
transform.translate(5, 10);
+
shader.setParameter("matrix", transform);
+
Parameters
+ + + +
nameName of the parameter in the shader
transformTransform to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
const Texturetexture 
)
+
+ +

Change a texture parameter of the shader.

+

name is the name of the variable to change in the shader. The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).

+

Example:

+
uniform sampler2D the_texture; // this is the variable in the shader
+
sf::Texture texture;
+
...
+
shader.setParameter("the_texture", texture);
+

It is important to note that texture must remain alive as long as the shader uses it, no copy is made internally.

+

To use the texture of the object being draw, which cannot be known in advance, you can pass the special value sf::Shader::CurrentTexture:

+
shader.setParameter("the_texture", sf::Shader::CurrentTexture).
+
Parameters
+ + + +
nameName of the texture in the shader
textureTexture to assign
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shader::setParameter (const std::string & name,
CurrentTextureType  
)
+
+ +

Change a texture parameter of the shader.

+

This overload maps a shader texture variable to the texture of the object being drawn, which cannot be known in advance. The second argument must be sf::Shader::CurrentTexture. The corresponding parameter in the shader must be a 2D texture (sampler2D GLSL type).

+

Example:

+
uniform sampler2D current; // this is the variable in the shader
+
shader.setParameter("current", sf::Shader::CurrentTexture);
+
Parameters
+ + +
nameName of the texture in the shader
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.png new file mode 100644 index 0000000..52135c6 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shader.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape-members.htm new file mode 100644 index 0000000..a194f03 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape-members.htm @@ -0,0 +1,93 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Shape Member List
+
+
+ +

This is the complete list of members for sf::Shape, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getFillColor() const sf::Shape
getGlobalBounds() const sf::Shape
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Shape
getOrigin() const sf::Transformable
getOutlineColor() const sf::Shape
getOutlineThickness() const sf::Shape
getPoint(unsigned int index) const =0sf::Shapepure virtual
getPointCount() const =0sf::Shapepure virtual
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getTexture() const sf::Shape
getTextureRect() const sf::Shape
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setFillColor(const Color &color)sf::Shape
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setOutlineColor(const Color &color)sf::Shape
setOutlineThickness(float thickness)sf::Shape
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setTexture(const Texture *texture, bool resetRect=false)sf::Shape
setTextureRect(const IntRect &rect)sf::Shape
Shape()sf::Shapeprotected
Transformable()sf::Transformable
update()sf::Shapeprotected
~Drawable()sf::Drawableinlinevirtual
~Shape()sf::Shapevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.htm new file mode 100644 index 0000000..a2344c0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.htm @@ -0,0 +1,1267 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Base class for textured shapes with outline. + More...

+ +

#include <Shape.hpp>

+
+Inheritance diagram for sf::Shape:
+
+
+ + +sf::Drawable +sf::Transformable +sf::CircleShape +sf::ConvexShape +sf::RectangleShape + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

virtual ~Shape ()
 Virtual destructor. More...
 
void setTexture (const Texture *texture, bool resetRect=false)
 Change the source texture of the shape. More...
 
void setTextureRect (const IntRect &rect)
 Set the sub-rectangle of the texture that the shape will display. More...
 
void setFillColor (const Color &color)
 Set the fill color of the shape. More...
 
void setOutlineColor (const Color &color)
 Set the outline color of the shape. More...
 
void setOutlineThickness (float thickness)
 Set the thickness of the shape's outline. More...
 
const TexturegetTexture () const
 Get the source texture of the shape. More...
 
const IntRectgetTextureRect () const
 Get the sub-rectangle of the texture displayed by the shape. More...
 
const ColorgetFillColor () const
 Get the fill color of the shape. More...
 
const ColorgetOutlineColor () const
 Get the outline color of the shape. More...
 
float getOutlineThickness () const
 Get the outline thickness of the shape. More...
 
virtual unsigned int getPointCount () const =0
 Get the total number of points of the shape. More...
 
virtual Vector2f getPoint (unsigned int index) const =0
 Get a point of the shape. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+ + + + + + + +

+Protected Member Functions

 Shape ()
 Default constructor. More...
 
void update ()
 Recompute the internal geometry of the shape. More...
 
+

Detailed Description

+

Base class for textured shapes with outline.

+

sf::Shape is a drawable class that allows to define and display a custom convex shape on a render target.

+

It's only an abstract base, it needs to be specialized for concrete types of shapes (circle, rectangle, convex polygon, star, ...).

+

In addition to the attributes provided by the specialized shape classes, a shape always has the following attributes:

+
    +
  • a texture
  • +
  • a texture rectangle
  • +
  • a fill color
  • +
  • an outline color
  • +
  • an outline thickness
  • +
+

Each feature is optional, and can be disabled easily:

+
    +
  • the texture can be null
  • +
  • the fill/outline colors can be sf::Color::Transparent
  • +
  • the outline thickness can be zero
  • +
+

You can write your own derived shape class, there are only two virtual functions to override:

+
    +
  • getPointCount must return the number of points of the shape
  • +
  • getPoint must return the points of the shape
  • +
+
See Also
sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable
+ +

Definition at line 44 of file Shape.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Shape::~Shape ()
+
+virtual
+
+ +

Virtual destructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::Shape::Shape ()
+
+protected
+
+ +

Default constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const Color& sf::Shape::getFillColor () const
+
+ +

Get the fill color of the shape.

+
Returns
Fill color of the shape
+
See Also
setFillColor
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Shape::getGlobalBounds () const
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Shape::getLocalBounds () const
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + + + +
const Color& sf::Shape::getOutlineColor () const
+
+ +

Get the outline color of the shape.

+
Returns
Outline color of the shape
+
See Also
setOutlineColor
+ +
+
+ +
+
+ + + + + + + +
float sf::Shape::getOutlineThickness () const
+
+ +

Get the outline thickness of the shape.

+
Returns
Outline thickness of the shape
+
See Also
setOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual Vector2f sf::Shape::getPoint (unsigned int index) const
+
+pure virtual
+
+ +

Get a point of the shape.

+

The result is undefined if index is out of the valid range.

+
Parameters
+ + +
indexIndex of the point to get, in range [0 .. getPointCount() - 1]
+
+
+
Returns
Index-th point of the shape
+
See Also
getPointCount
+ +

Implemented in sf::ConvexShape, sf::CircleShape, and sf::RectangleShape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual unsigned int sf::Shape::getPointCount () const
+
+pure virtual
+
+ +

Get the total number of points of the shape.

+
Returns
Number of points of the shape
+
See Also
getPoint
+ +

Implemented in sf::CircleShape, sf::RectangleShape, and sf::ConvexShape.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + +
const Texture* sf::Shape::getTexture () const
+
+ +

Get the source texture of the shape.

+

If the shape has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

+
Returns
Pointer to the shape's texture
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + + + +
const IntRect& sf::Shape::getTextureRect () const
+
+ +

Get the sub-rectangle of the texture displayed by the shape.

+
Returns
Texture rectangle of the shape
+
See Also
setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Shape::setFillColor (const Colorcolor)
+
+ +

Set the fill color of the shape.

+

This color is modulated (multiplied) with the shape's texture if any. It can be used to colorize the shape, or change its global opacity. You can use sf::Color::Transparent to make the inside of the shape transparent, and have the outline alone. By default, the shape's fill color is opaque white.

+
Parameters
+ + +
colorNew color of the shape
+
+
+
See Also
getFillColor, setOutlineColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + + + + +
void sf::Shape::setOutlineColor (const Colorcolor)
+
+ +

Set the outline color of the shape.

+

By default, the shape's outline color is opaque white.

+
Parameters
+ + +
colorNew outline color of the shape
+
+
+
See Also
getOutlineColor, setFillColor
+ +
+
+ +
+
+ + + + + + + + +
void sf::Shape::setOutlineThickness (float thickness)
+
+ +

Set the thickness of the shape's outline.

+

Note that negative values are allowed (so that the outline expands towards the center of the shape), and using zero disables the outline. By default, the outline thickness is 0.

+
Parameters
+ + +
thicknessNew outline thickness
+
+
+
See Also
getOutlineThickness
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Shape::setTexture (const Texturetexture,
bool resetRect = false 
)
+
+ +

Change the source texture of the shape.

+

The texture argument refers to a texture that must exist as long as the shape uses it. Indeed, the shape doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the shape tries to use it, the behaviour is undefined. texture can be NULL to disable texturing. If resetRect is true, the TextureRect property of the shape is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

+
Parameters
+ + + +
textureNew texture
resetRectShould the texture rect be reset to the size of the new texture?
+
+
+
See Also
getTexture, setTextureRect
+ +
+
+ +
+
+ + + + + + + + +
void sf::Shape::setTextureRect (const IntRectrect)
+
+ +

Set the sub-rectangle of the texture that the shape will display.

+

The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.

+
Parameters
+ + +
rectRectangle defining the region of the texture to display
+
+
+
See Also
getTextureRect, setTexture
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Shape::update ()
+
+protected
+
+ +

Recompute the internal geometry of the shape.

+

This function must be called by the derived class everytime the shape's points change (ie. the result of either getPointCount or getPoint is different).

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.png new file mode 100644 index 0000000..83c20e7 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Shape.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket-members.htm new file mode 100644 index 0000000..8616685 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket-members.htm @@ -0,0 +1,74 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Socket Member List
+
+
+ +

This is the complete list of members for sf::Socket, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
AnyPort enum valuesf::Socket
close()sf::Socketprotected
create()sf::Socketprotected
create(SocketHandle handle)sf::Socketprotected
Disconnected enum valuesf::Socket
Done enum valuesf::Socket
Error enum valuesf::Socket
getHandle() const sf::Socketprotected
isBlocking() const sf::Socket
NonCopyable()sf::NonCopyableinlineprivate
NotReady enum valuesf::Socket
setBlocking(bool blocking)sf::Socket
Socket(Type type)sf::Socketprotected
SocketSelector (defined in sf::Socket)sf::Socketfriend
Status enum namesf::Socket
Tcp enum valuesf::Socketprotected
Type enum namesf::Socketprotected
Udp enum valuesf::Socketprotected
~Socket()sf::Socketvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.htm new file mode 100644 index 0000000..20dae8d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.htm @@ -0,0 +1,457 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Base class for all the socket types. + More...

+ +

#include <Socket.hpp>

+
+Inheritance diagram for sf::Socket:
+
+
+ + +sf::NonCopyable +sf::TcpListener +sf::TcpSocket +sf::UdpSocket + +
+ + + + + + + + +

+Public Types

enum  Status {
+  Done, +
+  NotReady, +
+  Disconnected, +
+  Error +
+ }
 Status codes that may be returned by socket functions. More...
 
enum  { AnyPort = 0 + }
 Some special values used by sockets. More...
 
+ + + + + + + + + + +

+Public Member Functions

virtual ~Socket ()
 Destructor. More...
 
void setBlocking (bool blocking)
 Set the blocking state of the socket. More...
 
bool isBlocking () const
 Tell whether the socket is in blocking or non-blocking mode. More...
 
+ + + + +

+Protected Types

enum  Type {
+  Tcp, +
+  Udp +
+ }
 Types of protocols that the socket can use. More...
 
+ + + + + + + + + + + + + + + + +

+Protected Member Functions

 Socket (Type type)
 Default constructor. More...
 
SocketHandle getHandle () const
 Return the internal handle of the socket. More...
 
void create ()
 Create the internal representation of the socket. More...
 
void create (SocketHandle handle)
 Create the internal representation of the socket from a socket handle. More...
 
void close ()
 Close the socket gracefully. More...
 
+ + + +

+Friends

+class SocketSelector
 
+

Detailed Description

+

Base class for all the socket types.

+

This class mainly defines internal stuff to be used by derived classes.

+

The only public features that it defines, and which is therefore common to all the socket classes, is the blocking state. All sockets can be set as blocking or non-blocking.

+

In blocking mode, socket functions will hang until the operation completes, which means that the entire program (well, in fact the current thread if you use multiple ones) will be stuck waiting for your socket operation to complete.

+

In non-blocking mode, all the socket functions will return immediately. If the socket is not ready to complete the requested operation, the function simply returns the proper status code (Socket::NotReady).

+

The default mode, which is blocking, is the one that is generally used, in combination with threads or selectors. The non-blocking mode is rather used in real-time applications that run an endless loop that can poll the socket often enough, and cannot afford blocking this loop.

+
See Also
sf::TcpListener, sf::TcpSocket, sf::UdpSocket
+ +

Definition at line 45 of file Socket.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
anonymous enum
+
+ +

Some special values used by sockets.

+ + +
Enumerator
AnyPort  +

Special value that tells the system to pick any available port.

+
+ +

Definition at line 65 of file Socket.hpp.

+ +
+
+ +
+
+ + + + +
enum sf::Socket::Status
+
+ +

Status codes that may be returned by socket functions.

+ + + + + +
Enumerator
Done  +

The socket has sent / received the data.

+
NotReady  +

The socket is not ready to send / receive data yet.

+
Disconnected  +

The TCP socket has been disconnected.

+
Error  +

An unexpected error happened.

+
+ +

Definition at line 53 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Type
+
+protected
+
+ +

Types of protocols that the socket can use.

+ + + +
Enumerator
Tcp  +

TCP protocol.

+
Udp  +

UDP protocol.

+
+ +

Definition at line 113 of file Socket.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Socket::~Socket ()
+
+virtual
+
+ +

Destructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
sf::Socket::Socket (Type type)
+
+protected
+
+ +

Default constructor.

+

This constructor can only be accessed by derived classes.

+
Parameters
+ + +
typeType of the socket (TCP or UDP)
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::close ()
+
+protected
+
+ +

Close the socket gracefully.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::create ()
+
+protected
+
+ +

Create the internal representation of the socket.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::create (SocketHandle handle)
+
+protected
+
+ +

Create the internal representation of the socket from a socket handle.

+

This function can only be accessed by derived classes.

+
Parameters
+ + +
handleOS-specific handle of the socket to wrap
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
SocketHandle sf::Socket::getHandle () const
+
+protected
+
+ +

Return the internal handle of the socket.

+

The returned handle may be invalid if the socket was not created yet (or already destroyed). This function can only be accessed by derived classes.

+
Returns
The internal (OS-specific) handle of the socket
+ +
+
+ +
+
+ + + + + + + +
bool sf::Socket::isBlocking () const
+
+ +

Tell whether the socket is in blocking or non-blocking mode.

+
Returns
True if the socket is blocking, false otherwise
+
See Also
setBlocking
+ +
+
+ +
+
+ + + + + + + + +
void sf::Socket::setBlocking (bool blocking)
+
+ +

Set the blocking state of the socket.

+

In blocking mode, calls will not return until they have completed their task. For example, a call to Receive in blocking mode won't return until some data was actually received. In non-blocking mode, calls will always return immediately, using the return code to signal whether there was data available or not. By default, all sockets are blocking.

+
Parameters
+ + +
blockingTrue to set the socket as blocking, false for non-blocking
+
+
+
See Also
isBlocking
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.png new file mode 100644 index 0000000..4143c15 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Socket.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector-members.htm new file mode 100644 index 0000000..d92cfff --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector-members.htm @@ -0,0 +1,64 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SocketSelector Member List
+
+
+ +

This is the complete list of members for sf::SocketSelector, including all inherited members.

+ + + + + + + + + + +
add(Socket &socket)sf::SocketSelector
clear()sf::SocketSelector
isReady(Socket &socket) const sf::SocketSelector
operator=(const SocketSelector &right)sf::SocketSelector
remove(Socket &socket)sf::SocketSelector
SocketSelector()sf::SocketSelector
SocketSelector(const SocketSelector &copy)sf::SocketSelector
wait(Time timeout=Time::Zero)sf::SocketSelector
~SocketSelector()sf::SocketSelector
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector.htm new file mode 100644 index 0000000..95b5797 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SocketSelector.htm @@ -0,0 +1,383 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::SocketSelector Class Reference
+
+
+ +

Multiplexer that allows to read from multiple sockets. + More...

+ +

#include <SocketSelector.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 SocketSelector ()
 Default constructor. More...
 
 SocketSelector (const SocketSelector &copy)
 Copy constructor. More...
 
 ~SocketSelector ()
 Destructor. More...
 
void add (Socket &socket)
 Add a new socket to the selector. More...
 
void remove (Socket &socket)
 Remove a socket from the selector. More...
 
void clear ()
 Remove all the sockets stored in the selector. More...
 
bool wait (Time timeout=Time::Zero)
 Wait until one or more sockets are ready to receive. More...
 
bool isReady (Socket &socket) const
 Test a socket to know if it is ready to receive data. More...
 
SocketSelectoroperator= (const SocketSelector &right)
 Overload of assignment operator. More...
 
+

Detailed Description

+

Multiplexer that allows to read from multiple sockets.

+

Socket selectors provide a way to wait until some data is available on a set of sockets, instead of just one.

+

This is convenient when you have multiple sockets that may possibly receive data, but you don't know which one will be ready first. In particular, it avoids to use a thread for each socket; with selectors, a single thread can handle all the sockets.

+

All types of sockets can be used in a selector:

+ +

A selector doesn't store its own copies of the sockets (socket classes are not copyable anyway), it simply keeps a reference to the original sockets that you pass to the "add" function. Therefore, you can't use the selector as a socket container, you must store them oustide and make sure that they are alive as long as they are used in the selector.

+

Using a selector is simple:

+
    +
  • populate the selector with all the sockets that you want to observe
  • +
  • make it wait until there is data available on any of the sockets
  • +
  • test each socket to find out which ones are ready
  • +
+

Usage example:

+
// Create a socket to listen to new connections
+
sf::TcpListener listener;
+
listener.listen(55001);
+
+
// Create a list to store the future clients
+
std::list<sf::TcpSocket*> clients;
+
+
// Create a selector
+ +
+
// Add the listener to the selector
+
selector.add(listener);
+
+
// Endless loop that waits for new connections
+
while (running)
+
{
+
// Make the selector wait for data on any socket
+
if (selector.wait())
+
{
+
// Test the listener
+
if (selector.isReady(listener))
+
{
+
// The listener is ready: there is a pending connection
+ +
if (listener.accept(*client) == sf::Socket::Done)
+
{
+
// Add the new client to the clients list
+
clients.push_back(client);
+
+
// Add the new client to the selector so that we will
+
// be notified when he sends something
+
selector.add(*client);
+
}
+
else
+
{
+
// Error, we won't get a new connection, delete the socket
+
delete client;
+
}
+
}
+
else
+
{
+
// The listener socket is not ready, test all other sockets (the clients)
+
for (std::list<sf::TcpSocket*>::iterator it = clients.begin(); it != clients.end(); ++it)
+
{
+
sf::TcpSocket& client = **it;
+
if (selector.isReady(client))
+
{
+
// The client has sent some data, we can receive it
+
sf::Packet packet;
+
if (client.receive(packet) == sf::Socket::Done)
+
{
+
...
+
}
+
}
+
}
+
}
+
}
+
}
+
See Also
sf::Socket
+ +

Definition at line 43 of file SocketSelector.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::SocketSelector::SocketSelector ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + + +
sf::SocketSelector::SocketSelector (const SocketSelectorcopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::SocketSelector::~SocketSelector ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void sf::SocketSelector::add (Socketsocket)
+
+ +

Add a new socket to the selector.

+

This function keeps a weak reference to the socket, so you have to make sure that the socket is not destroyed while it is stored in the selector. This function does nothing if the socket is not valid.

+
Parameters
+ + +
socketReference to the socket to add
+
+
+
See Also
remove, clear
+ +
+
+ +
+
+ + + + + + + +
void sf::SocketSelector::clear ()
+
+ +

Remove all the sockets stored in the selector.

+

This function doesn't destroy any instance, it simply removes all the references that the selector has to external sockets.

+
See Also
add, remove
+ +
+
+ +
+
+ + + + + + + + +
bool sf::SocketSelector::isReady (Socketsocket) const
+
+ +

Test a socket to know if it is ready to receive data.

+

This function must be used after a call to Wait, to know which sockets are ready to receive data. If a socket is ready, a call to receive will never block because we know that there is data available to read. Note that if this function returns true for a TcpListener, this means that it is ready to accept a new connection.

+
Parameters
+ + +
socketSocket to test
+
+
+
Returns
True if the socket is ready to read, false otherwise
+
See Also
isReady
+ +
+
+ +
+
+ + + + + + + + +
SocketSelector& sf::SocketSelector::operator= (const SocketSelectorright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + + +
void sf::SocketSelector::remove (Socketsocket)
+
+ +

Remove a socket from the selector.

+

This function doesn't destroy the socket, it simply removes the reference that the selector has to it.

+
Parameters
+ + +
socketReference to the socket to remove
+
+
+
See Also
add, clear
+ +
+
+ +
+
+ + + + + + + + +
bool sf::SocketSelector::wait (Time timeout = Time::Zero)
+
+ +

Wait until one or more sockets are ready to receive.

+

This function returns as soon as at least one socket has some data available to be received. To know which sockets are ready, use the isReady function. If you use a timeout and no socket is ready before the timeout is over, the function returns false.

+
Parameters
+ + +
timeoutMaximum time to wait, (use Time::Zero for infinity)
+
+
+
Returns
True if there are sockets ready, false otherwise
+
See Also
isReady
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound-members.htm new file mode 100644 index 0000000..89720cc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound-members.htm @@ -0,0 +1,92 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Sound Member List
+
+
+ +

This is the complete list of members for sf::Sound, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getAttenuation() const sf::SoundSource
getBuffer() const sf::Sound
getLoop() const sf::Sound
getMinDistance() const sf::SoundSource
getPitch() const sf::SoundSource
getPlayingOffset() const sf::Sound
getPosition() const sf::SoundSource
getStatus() const sf::Sound
getVolume() const sf::SoundSource
isRelativeToListener() const sf::SoundSource
m_sourcesf::SoundSourceprotected
operator=(const Sound &right)sf::Sound
pause()sf::Sound
Paused enum valuesf::SoundSource
play()sf::Sound
Playing enum valuesf::SoundSource
resetBuffer()sf::Sound
setAttenuation(float attenuation)sf::SoundSource
setBuffer(const SoundBuffer &buffer)sf::Sound
setLoop(bool loop)sf::Sound
setMinDistance(float distance)sf::SoundSource
setPitch(float pitch)sf::SoundSource
setPlayingOffset(Time timeOffset)sf::Sound
setPosition(float x, float y, float z)sf::SoundSource
setPosition(const Vector3f &position)sf::SoundSource
setRelativeToListener(bool relative)sf::SoundSource
setVolume(float volume)sf::SoundSource
Sound()sf::Sound
Sound(const SoundBuffer &buffer)sf::Soundexplicit
Sound(const Sound &copy)sf::Sound
SoundSource(const SoundSource &copy)sf::SoundSource
SoundSource()sf::SoundSourceprotected
Status enum namesf::SoundSource
stop()sf::Sound
Stopped enum valuesf::SoundSource
~Sound()sf::Sound
~SoundSource()sf::SoundSourcevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.htm new file mode 100644 index 0000000..9db2235 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.htm @@ -0,0 +1,1029 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Regular sound that can be played in the audio environment. + More...

+ +

#include <Sound.hpp>

+
+Inheritance diagram for sf::Sound:
+
+
+ + +sf::SoundSource + +
+ + + + + +

+Public Types

enum  Status {
+  Stopped, +
+  Paused, +
+  Playing +
+ }
 Enumeration of the sound source states. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Sound ()
 Default constructor. More...
 
 Sound (const SoundBuffer &buffer)
 Construct the sound with a buffer. More...
 
 Sound (const Sound &copy)
 Copy constructor. More...
 
 ~Sound ()
 Destructor. More...
 
void play ()
 Start or resume playing the sound. More...
 
void pause ()
 Pause the sound. More...
 
void stop ()
 stop playing the sound More...
 
void setBuffer (const SoundBuffer &buffer)
 Set the source buffer containing the audio data to play. More...
 
void setLoop (bool loop)
 Set whether or not the sound should loop after reaching the end. More...
 
void setPlayingOffset (Time timeOffset)
 Change the current playing position of the sound. More...
 
const SoundBuffergetBuffer () const
 Get the audio buffer attached to the sound. More...
 
bool getLoop () const
 Tell whether or not the sound is in loop mode. More...
 
Time getPlayingOffset () const
 Get the current playing position of the sound. More...
 
Status getStatus () const
 Get the current status of the sound (stopped, paused, playing) More...
 
Soundoperator= (const Sound &right)
 Overload of assignment operator. More...
 
void resetBuffer ()
 Reset the internal buffer of the sound. More...
 
void setPitch (float pitch)
 Set the pitch of the sound. More...
 
void setVolume (float volume)
 Set the volume of the sound. More...
 
void setPosition (float x, float y, float z)
 Set the 3D position of the sound in the audio scene. More...
 
void setPosition (const Vector3f &position)
 Set the 3D position of the sound in the audio scene. More...
 
void setRelativeToListener (bool relative)
 Make the sound's position relative to the listener or absolute. More...
 
void setMinDistance (float distance)
 Set the minimum distance of the sound. More...
 
void setAttenuation (float attenuation)
 Set the attenuation factor of the sound. More...
 
float getPitch () const
 Get the pitch of the sound. More...
 
float getVolume () const
 Get the volume of the sound. More...
 
Vector3f getPosition () const
 Get the 3D position of the sound in the audio scene. More...
 
bool isRelativeToListener () const
 Tell whether the sound's position is relative to the listener or is absolute. More...
 
float getMinDistance () const
 Get the minimum distance of the sound. More...
 
float getAttenuation () const
 Get the attenuation factor of the sound. More...
 
+ + + + +

+Protected Attributes

unsigned int m_source
 OpenAL source identifier. More...
 
+

Detailed Description

+

Regular sound that can be played in the audio environment.

+

sf::Sound is the class to use to play sounds.

+

It provides:

+
    +
  • Control (play, pause, stop)
  • +
  • Ability to modify output parameters in real-time (pitch, volume, ...)
  • +
  • 3D spatial features (position, attenuation, ...).
  • +
+

sf::Sound is perfect for playing short sounds that can fit in memory and require no latency, like foot steps or gun shots. For longer sounds, like background musics or long speeches, rather see sf::Music (which is based on streaming).

+

In order to work, a sound must be given a buffer of audio data to play. Audio data (samples) is stored in sf::SoundBuffer, and attached to a sound with the setBuffer() function. The buffer object attached to a sound must remain alive as long as the sound uses it. Note that multiple sounds can use the same sound buffer at the same time.

+

Usage example:

+
+
buffer.loadFromFile("sound.wav");
+
+
sf::Sound sound;
+
sound.setBuffer(buffer);
+
sound.play();
+
See Also
sf::SoundBuffer, sf::Music
+ +

Definition at line 45 of file Sound.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
enum sf::SoundSource::Status
+
+inherited
+
+ +

Enumeration of the sound source states.

+ + + + +
Enumerator
Stopped  +

Sound is not playing.

+
Paused  +

Sound is paused.

+
Playing  +

Sound is playing.

+
+ +

Definition at line 49 of file SoundSource.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Sound::Sound ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
sf::Sound::Sound (const SoundBufferbuffer)
+
+explicit
+
+ +

Construct the sound with a buffer.

+
Parameters
+ + +
bufferSound buffer containing the audio data to play with the sound
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::Sound::Sound (const Soundcopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::Sound::~Sound ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getAttenuation () const
+
+inherited
+
+ +

Get the attenuation factor of the sound.

+
Returns
Attenuation factor of the sound
+
See Also
setAttenuation, getMinDistance
+ +
+
+ +
+
+ + + + + + + +
const SoundBuffer* sf::Sound::getBuffer () const
+
+ +

Get the audio buffer attached to the sound.

+
Returns
Sound buffer attached to the sound (can be NULL)
+ +
+
+ +
+
+ + + + + + + +
bool sf::Sound::getLoop () const
+
+ +

Tell whether or not the sound is in loop mode.

+
Returns
True if the sound is looping, false otherwise
+
See Also
setLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getMinDistance () const
+
+inherited
+
+ +

Get the minimum distance of the sound.

+
Returns
Minimum distance of the sound
+
See Also
setMinDistance, getAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getPitch () const
+
+inherited
+
+ +

Get the pitch of the sound.

+
Returns
Pitch of the sound
+
See Also
setPitch
+ +
+
+ +
+
+ + + + + + + +
Time sf::Sound::getPlayingOffset () const
+
+ +

Get the current playing position of the sound.

+
Returns
Current playing position, from the beginning of the sound
+
See Also
setPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Vector3f sf::SoundSource::getPosition () const
+
+inherited
+
+ +

Get the 3D position of the sound in the audio scene.

+
Returns
Position of the sound
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + +
Status sf::Sound::getStatus () const
+
+ +

Get the current status of the sound (stopped, paused, playing)

+
Returns
Current status of the sound
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getVolume () const
+
+inherited
+
+ +

Get the volume of the sound.

+
Returns
Volume of the sound, in the range [0, 100]
+
See Also
setVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::SoundSource::isRelativeToListener () const
+
+inherited
+
+ +

Tell whether the sound's position is relative to the listener or is absolute.

+
Returns
True if the position is relative, false if it's absolute
+
See Also
setRelativeToListener
+ +
+
+ +
+
+ + + + + + + + +
Sound& sf::Sound::operator= (const Soundright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + +
void sf::Sound::pause ()
+
+ +

Pause the sound.

+

This function pauses the sound if it was playing, otherwise (sound already paused or stopped) it has no effect.

+
See Also
play, stop
+ +
+
+ +
+
+ + + + + + + +
void sf::Sound::play ()
+
+ +

Start or resume playing the sound.

+

This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the sound is played.

+
See Also
pause, stop
+ +
+
+ +
+
+ + + + + + + +
void sf::Sound::resetBuffer ()
+
+ +

Reset the internal buffer of the sound.

+

This function is for internal use only, you don't have to use it. It is called by the sf::SoundBuffer that this sound uses, when it is destroyed in order to prevent the sound from using a dead buffer.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setAttenuation (float attenuation)
+
+inherited
+
+ +

Set the attenuation factor of the sound.

+

The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.

+
Parameters
+ + +
attenuationNew attenuation factor of the sound
+
+
+
See Also
getAttenuation, setMinDistance
+ +
+
+ +
+
+ + + + + + + + +
void sf::Sound::setBuffer (const SoundBufferbuffer)
+
+ +

Set the source buffer containing the audio data to play.

+

It is important to note that the sound buffer is not copied, thus the sf::SoundBuffer instance must remain alive as long as it is attached to the sound.

+
Parameters
+ + +
bufferSound buffer to attach to the sound
+
+
+
See Also
getBuffer
+ +
+
+ +
+
+ + + + + + + + +
void sf::Sound::setLoop (bool loop)
+
+ +

Set whether or not the sound should loop after reaching the end.

+

If set, the sound will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for sound is false.

+
Parameters
+ + +
loopTrue to play in loop, false to play once
+
+
+
See Also
getLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setMinDistance (float distance)
+
+inherited
+
+ +

Set the minimum distance of the sound.

+

The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head +of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.

+
Parameters
+ + +
distanceNew minimum distance of the sound
+
+
+
See Also
getMinDistance, setAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPitch (float pitch)
+
+inherited
+
+ +

Set the pitch of the sound.

+

The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1.

+
Parameters
+ + +
pitchNew pitch to apply to the sound
+
+
+
See Also
getPitch
+ +
+
+ +
+
+ + + + + + + + +
void sf::Sound::setPlayingOffset (Time timeOffset)
+
+ +

Change the current playing position of the sound.

+

The playing position can be changed when the sound is either paused or playing.

+
Parameters
+ + +
timeOffsetNew playing position, from the beginning of the sound
+
+
+
See Also
getPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::SoundSource::setPosition (float x,
float y,
float z 
)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + + + +
xX coordinate of the position of the sound in the scene
yY coordinate of the position of the sound in the scene
zZ coordinate of the position of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPosition (const Vector3fposition)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + +
positionPosition of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setRelativeToListener (bool relative)
+
+inherited
+
+ +

Make the sound's position relative to the listener or absolute.

+

Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute).

+
Parameters
+ + +
relativeTrue to set the position relative, false to set it absolute
+
+
+
See Also
isRelativeToListener
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setVolume (float volume)
+
+inherited
+
+ +

Set the volume of the sound.

+

The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100.

+
Parameters
+ + +
volumeVolume of the sound
+
+
+
See Also
getVolume
+ +
+
+ +
+
+ + + + + + + +
void sf::Sound::stop ()
+
+ +

stop playing the sound

+

This function stops the sound if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause()).

+
See Also
play, pause
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
unsigned int sf::SoundSource::m_source
+
+protectedinherited
+
+ +

OpenAL source identifier.

+ +

Definition at line 263 of file SoundSource.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.png new file mode 100644 index 0000000..f15f952 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sound.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer-members.htm new file mode 100644 index 0000000..029e570 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer-members.htm @@ -0,0 +1,70 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundBuffer Member List
+
+
+ +

This is the complete list of members for sf::SoundBuffer, including all inherited members.

+ + + + + + + + + + + + + + + + +
getChannelCount() const sf::SoundBuffer
getDuration() const sf::SoundBuffer
getSampleCount() const sf::SoundBuffer
getSampleRate() const sf::SoundBuffer
getSamples() const sf::SoundBuffer
loadFromFile(const std::string &filename)sf::SoundBuffer
loadFromMemory(const void *data, std::size_t sizeInBytes)sf::SoundBuffer
loadFromSamples(const Int16 *samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate)sf::SoundBuffer
loadFromStream(InputStream &stream)sf::SoundBuffer
operator=(const SoundBuffer &right)sf::SoundBuffer
saveToFile(const std::string &filename) const sf::SoundBuffer
Sound (defined in sf::SoundBuffer)sf::SoundBufferfriend
SoundBuffer()sf::SoundBuffer
SoundBuffer(const SoundBuffer &copy)sf::SoundBuffer
~SoundBuffer()sf::SoundBuffer
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer.htm new file mode 100644 index 0000000..f7f7eee --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBuffer.htm @@ -0,0 +1,505 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::SoundBuffer Class Reference
+
+
+ +

Storage for audio samples defining a sound. + More...

+ +

#include <SoundBuffer.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 SoundBuffer ()
 Default constructor. More...
 
 SoundBuffer (const SoundBuffer &copy)
 Copy constructor. More...
 
 ~SoundBuffer ()
 Destructor. More...
 
bool loadFromFile (const std::string &filename)
 Load the sound buffer from a file. More...
 
bool loadFromMemory (const void *data, std::size_t sizeInBytes)
 Load the sound buffer from a file in memory. More...
 
bool loadFromStream (InputStream &stream)
 Load the sound buffer from a custom stream. More...
 
bool loadFromSamples (const Int16 *samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate)
 Load the sound buffer from an array of audio samples. More...
 
bool saveToFile (const std::string &filename) const
 Save the sound buffer to an audio file. More...
 
const Int16 * getSamples () const
 Get the array of audio samples stored in the buffer. More...
 
std::size_t getSampleCount () const
 Get the number of samples stored in the buffer. More...
 
unsigned int getSampleRate () const
 Get the sample rate of the sound. More...
 
unsigned int getChannelCount () const
 Get the number of channels used by the sound. More...
 
Time getDuration () const
 Get the total duration of the sound. More...
 
SoundBufferoperator= (const SoundBuffer &right)
 Overload of assignment operator. More...
 
+ + + +

+Friends

+class Sound
 
+

Detailed Description

+

Storage for audio samples defining a sound.

+

A sound buffer holds the data of a sound, which is an array of audio samples.

+

A sample is a 16 bits signed integer that defines the amplitude of the sound at a given time. The sound is then restituted by playing these samples at a high rate (for example, 44100 samples per second is the standard rate used for playing CDs). In short, audio samples are like texture pixels, and a sf::SoundBuffer is similar to a sf::Texture.

+

A sound buffer can be loaded from a file (see loadFromFile() for the complete list of supported formats), from memory, from a custom stream (see sf::InputStream) or directly from an array of samples. It can also be saved back to a file.

+

Sound buffers alone are not very useful: they hold the audio data but cannot be played. To do so, you need to use the sf::Sound class, which provides functions to play/pause/stop the sound as well as changing the way it is outputted (volume, pitch, 3D position, ...). This separation allows more flexibility and better performances: indeed a sf::SoundBuffer is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a sf::Sound is a lightweight object, which can use the audio data of a sound buffer and change the way it is played without actually modifying that data. Note that it is also possible to bind several sf::Sound instances to the same sf::SoundBuffer.

+

It is important to note that the sf::Sound instance doesn't copy the buffer that it uses, it only keeps a reference to it. Thus, a sf::SoundBuffer must not be destructed while it is used by a sf::Sound (i.e. never write a function that uses a local sf::SoundBuffer instance for loading a sound).

+

Usage example:

+
// Declare a new sound buffer
+ +
+
// Load it from a file
+
if (!buffer.loadFromFile("sound.wav"))
+
{
+
// error...
+
}
+
+
// Create a sound source and bind it to the buffer
+
sf::Sound sound1;
+
sound1.setBuffer(buffer);
+
+
// Play the sound
+
sound1.play();
+
+
// Create another sound source bound to the same buffer
+
sf::Sound sound2;
+
sound2.setBuffer(buffer);
+
+
// Play it with a higher pitch -- the first sound remains unchanged
+
sound2.setPitch(2);
+
sound2.play();
+
See Also
sf::Sound, sf::SoundBufferRecorder
+ +

Definition at line 52 of file SoundBuffer.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::SoundBuffer::SoundBuffer ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + + +
sf::SoundBuffer::SoundBuffer (const SoundBuffercopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::SoundBuffer::~SoundBuffer ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
unsigned int sf::SoundBuffer::getChannelCount () const
+
+ +

Get the number of channels used by the sound.

+

If the sound is mono then the number of channels will be 1, 2 for stereo, etc.

+
Returns
Number of channels
+
See Also
getSampleRate, getDuration
+ +
+
+ +
+
+ + + + + + + +
Time sf::SoundBuffer::getDuration () const
+
+ +

Get the total duration of the sound.

+
Returns
Sound duration
+
See Also
getSampleRate, getChannelCount
+ +
+
+ +
+
+ + + + + + + +
std::size_t sf::SoundBuffer::getSampleCount () const
+
+ +

Get the number of samples stored in the buffer.

+

The array of samples can be accessed with the getSamples() function.

+
Returns
Number of samples
+
See Also
getSamples
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::SoundBuffer::getSampleRate () const
+
+ +

Get the sample rate of the sound.

+

The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).

+
Returns
Sample rate (number of samples per second)
+
See Also
getChannelCount, getDuration
+ +
+
+ +
+
+ + + + + + + +
const Int16* sf::SoundBuffer::getSamples () const
+
+ +

Get the array of audio samples stored in the buffer.

+

The format of the returned samples is 16 bits signed integer (sf::Int16). The total number of samples in this array is given by the getSampleCount() function.

+
Returns
Read-only pointer to the array of sound samples
+
See Also
getSampleCount
+ +
+
+ +
+
+ + + + + + + + +
bool sf::SoundBuffer::loadFromFile (const std::string & filename)
+
+ +

Load the sound buffer from a file.

+

Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.

+
Parameters
+ + +
filenamePath of the sound file to load
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromMemory, loadFromStream, loadFromSamples, saveToFile
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::SoundBuffer::loadFromMemory (const void * data,
std::size_t sizeInBytes 
)
+
+ +

Load the sound buffer from a file in memory.

+

Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.

+
Parameters
+ + + +
dataPointer to the file data in memory
sizeInBytesSize of the data to load, in bytes
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromStream, loadFromSamples
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool sf::SoundBuffer::loadFromSamples (const Int16 * samples,
std::size_t sampleCount,
unsigned int channelCount,
unsigned int sampleRate 
)
+
+ +

Load the sound buffer from an array of audio samples.

+

The assumed format of the audio samples is 16 bits signed integer (sf::Int16).

+
Parameters
+ + + + + +
samplesPointer to the array of samples in memory
sampleCountNumber of samples in the array
channelCountNumber of channels (1 = mono, 2 = stereo, ...)
sampleRateSample rate (number of samples to play per second)
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory, saveToFile
+ +
+
+ +
+
+ + + + + + + + +
bool sf::SoundBuffer::loadFromStream (InputStreamstream)
+
+ +

Load the sound buffer from a custom stream.

+

Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.

+
Parameters
+ + +
streamSource stream to read from
+
+
+
Returns
True if loading succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory, loadFromSamples
+ +
+
+ +
+
+ + + + + + + + +
SoundBuffer& sf::SoundBuffer::operator= (const SoundBufferright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + + +
bool sf::SoundBuffer::saveToFile (const std::string & filename) const
+
+ +

Save the sound buffer to an audio file.

+

Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.

+
Parameters
+ + +
filenamePath of the sound file to write
+
+
+
Returns
True if saving succeeded, false if it failed
+
See Also
loadFromFile, loadFromMemory, loadFromSamples
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder-members.htm new file mode 100644 index 0000000..1d17e81 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder-members.htm @@ -0,0 +1,65 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundBufferRecorder Member List
+
+
+ +

This is the complete list of members for sf::SoundBufferRecorder, including all inherited members.

+ + + + + + + + + + + +
getBuffer() const sf::SoundBufferRecorder
getSampleRate() const sf::SoundRecorder
isAvailable()sf::SoundRecorderstatic
onProcessSamples(const Int16 *samples, std::size_t sampleCount)sf::SoundBufferRecorderprotectedvirtual
onStart()sf::SoundBufferRecorderprotectedvirtual
onStop()sf::SoundBufferRecorderprotectedvirtual
SoundRecorder()sf::SoundRecorderprotected
start(unsigned int sampleRate=44100)sf::SoundRecorder
stop()sf::SoundRecorder
~SoundRecorder()sf::SoundRecordervirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.htm new file mode 100644 index 0000000..054fea5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.htm @@ -0,0 +1,366 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized SoundRecorder which stores the captured audio data into a sound buffer. + More...

+ +

#include <SoundBufferRecorder.hpp>

+
+Inheritance diagram for sf::SoundBufferRecorder:
+
+
+ + +sf::SoundRecorder + +
+ + + + + + + + + + + + + + +

+Public Member Functions

const SoundBuffergetBuffer () const
 Get the sound buffer containing the captured audio data. More...
 
void start (unsigned int sampleRate=44100)
 Start the capture. More...
 
void stop ()
 Stop the capture. More...
 
unsigned int getSampleRate () const
 Get the sample rate. More...
 
+ + + + +

+Static Public Member Functions

static bool isAvailable ()
 Check if the system supports audio capture. More...
 
+ + + + + + + + + + +

+Protected Member Functions

virtual bool onStart ()
 Start capturing audio data. More...
 
virtual bool onProcessSamples (const Int16 *samples, std::size_t sampleCount)
 Process a new chunk of recorded samples. More...
 
virtual void onStop ()
 Stop capturing audio data. More...
 
+

Detailed Description

+

Specialized SoundRecorder which stores the captured audio data into a sound buffer.

+

sf::SoundBufferRecorder allows to access a recorded sound through a sf::SoundBuffer, so that it can be played, saved to a file, etc.

+

It has the same simple interface as its base class (start(), stop()) and adds a function to retrieve the recorded sound buffer (getBuffer()).

+

As usual, don't forget to call the isAvailable() function before using this class (see sf::SoundRecorder for more details about this).

+

Usage example:

+
+
{
+
// Record some audio data
+ +
recorder.start();
+
...
+
recorder.stop();
+
+
// Get the buffer containing the captured audio data
+
const sf::SoundBuffer& buffer = recorder.getBuffer();
+
+
// Save it to a file (for example...)
+
buffer.saveToFile("my_record.ogg");
+
}
+
See Also
sf::SoundRecorder
+ +

Definition at line 44 of file SoundBufferRecorder.hpp.

+

Member Function Documentation

+ +
+
+ + + + + + + +
const SoundBuffer& sf::SoundBufferRecorder::getBuffer () const
+
+ +

Get the sound buffer containing the captured audio data.

+

The sound buffer is valid only after the capture has ended. This function provides a read-only access to the internal sound buffer, but it can be copied if you need to make any modification to it.

+
Returns
Read-only access to the sound buffer
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
unsigned int sf::SoundRecorder::getSampleRate () const
+
+inherited
+
+ +

Get the sample rate.

+

The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).

+
Returns
Sample rate, in samples per second
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static bool sf::SoundRecorder::isAvailable ()
+
+staticinherited
+
+ +

Check if the system supports audio capture.

+

This function should always be called before using the audio capture features. If it returns false, then any attempt to use sf::SoundRecorder or one of its derived classes will fail.

+
Returns
True if audio capture is supported, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual bool sf::SoundBufferRecorder::onProcessSamples (const Int16 * samples,
std::size_t sampleCount 
)
+
+protectedvirtual
+
+ +

Process a new chunk of recorded samples.

+
Parameters
+ + + +
samplesPointer to the new chunk of recorded samples
sampleCountNumber of samples pointed by samples
+
+
+
Returns
True to continue the capture, or false to stop it
+ +

Implements sf::SoundRecorder.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual bool sf::SoundBufferRecorder::onStart ()
+
+protectedvirtual
+
+ +

Start capturing audio data.

+
Returns
True to start the capture, or false to abort it
+ +

Reimplemented from sf::SoundRecorder.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::SoundBufferRecorder::onStop ()
+
+protectedvirtual
+
+ +

Stop capturing audio data.

+ +

Reimplemented from sf::SoundRecorder.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundRecorder::start (unsigned int sampleRate = 44100)
+
+inherited
+
+ +

Start the capture.

+

The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.

+
Parameters
+ + +
sampleRateDesired capture rate, in number of samples per second
+
+
+
See Also
stop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::SoundRecorder::stop ()
+
+inherited
+
+ +

Stop the capture.

+
See Also
start
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.png new file mode 100644 index 0000000..d5253a4 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundBufferRecorder.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder-members.htm new file mode 100644 index 0000000..3597247 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder-members.htm @@ -0,0 +1,64 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundRecorder Member List
+
+
+ +

This is the complete list of members for sf::SoundRecorder, including all inherited members.

+ + + + + + + + + + +
getSampleRate() const sf::SoundRecorder
isAvailable()sf::SoundRecorderstatic
onProcessSamples(const Int16 *samples, std::size_t sampleCount)=0sf::SoundRecorderprotectedpure virtual
onStart()sf::SoundRecorderprotectedvirtual
onStop()sf::SoundRecorderprotectedvirtual
SoundRecorder()sf::SoundRecorderprotected
start(unsigned int sampleRate=44100)sf::SoundRecorder
stop()sf::SoundRecorder
~SoundRecorder()sf::SoundRecordervirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.htm new file mode 100644 index 0000000..f350c83 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.htm @@ -0,0 +1,412 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Abstract base class for capturing sound data. + More...

+ +

#include <SoundRecorder.hpp>

+
+Inheritance diagram for sf::SoundRecorder:
+
+
+ + +sf::SoundBufferRecorder + +
+ + + + + + + + + + + + + + +

+Public Member Functions

virtual ~SoundRecorder ()
 destructor More...
 
void start (unsigned int sampleRate=44100)
 Start the capture. More...
 
void stop ()
 Stop the capture. More...
 
unsigned int getSampleRate () const
 Get the sample rate. More...
 
+ + + + +

+Static Public Member Functions

static bool isAvailable ()
 Check if the system supports audio capture. More...
 
+ + + + + + + + + + + + + +

+Protected Member Functions

 SoundRecorder ()
 Default constructor. More...
 
virtual bool onStart ()
 Start capturing audio data. More...
 
virtual bool onProcessSamples (const Int16 *samples, std::size_t sampleCount)=0
 Process a new chunk of recorded samples. More...
 
virtual void onStop ()
 Stop capturing audio data. More...
 
+

Detailed Description

+

Abstract base class for capturing sound data.

+

sf::SoundBuffer provides a simple interface to access the audio recording capabilities of the computer (the microphone).

+

As an abstract base class, it only cares about capturing sound samples, the task of making something useful with them is left to the derived class. Note that SFML provides a built-in specialization for saving the captured data to a sound buffer (see sf::SoundBufferRecorder).

+

A derived class has only one virtual function to override:

+
    +
  • onProcessSamples provides the new chunks of audio samples while the capture happens
  • +
+

Moreover, two additionnal virtual functions can be overriden as well if necessary:

+
    +
  • onStart is called before the capture happens, to perform custom initializations
  • +
  • onStop is called after the capture ends, to perform custom cleanup
  • +
+

The audio capture feature may not be supported or activated on every platform, thus it is recommended to check its availability with the isAvailable() function. If it returns false, then any attempt to use an audio recorder will fail.

+

It is important to note that the audio capture happens in a separate thread, so that it doesn't block the rest of the program. In particular, the onProcessSamples and onStop virtual functions (but not onStart) will be called from this separate thread. It is important to keep this in mind, because you may have to take care of synchronization issues if you share data between threads.

+

Usage example:

+
class CustomRecorder : public sf::SoundRecorder
+
{
+
virtual bool onStart() // optional
+
{
+
// Initialize whatever has to be done before the capture starts
+
...
+
+
// Return true to start playing
+
return true;
+
}
+
+
virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount)
+
{
+
// Do something with the new chunk of samples (store them, send them, ...)
+
...
+
+
// Return true to continue playing
+
return true;
+
}
+
+
virtual void onStop() // optional
+
{
+
// Clean up whatever has to be done after the capture ends
+
...
+
}
+
}
+
+
// Usage
+
if (CustomRecorder::isAvailable())
+
{
+
CustomRecorder recorder;
+
recorder.start();
+
...
+
recorder.stop();
+
}
+
See Also
sf::SoundBufferRecorder
+ +

Definition at line 42 of file SoundRecorder.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::SoundRecorder::~SoundRecorder ()
+
+virtual
+
+ +

destructor

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::SoundRecorder::SoundRecorder ()
+
+protected
+
+ +

Default constructor.

+

This constructor is only meant to be called by derived classes.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
unsigned int sf::SoundRecorder::getSampleRate () const
+
+ +

Get the sample rate.

+

The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).

+
Returns
Sample rate, in samples per second
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static bool sf::SoundRecorder::isAvailable ()
+
+static
+
+ +

Check if the system supports audio capture.

+

This function should always be called before using the audio capture features. If it returns false, then any attempt to use sf::SoundRecorder or one of its derived classes will fail.

+
Returns
True if audio capture is supported, false otherwise
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
virtual bool sf::SoundRecorder::onProcessSamples (const Int16 * samples,
std::size_t sampleCount 
)
+
+protectedpure virtual
+
+ +

Process a new chunk of recorded samples.

+

This virtual function is called every time a new chunk of recorded data is available. The derived class can then do whatever it wants with it (storing it, playing it, sending it over the network, etc.).

+
Parameters
+ + + +
samplesPointer to the new chunk of recorded samples
sampleCountNumber of samples pointed by samples
+
+
+
Returns
True to continue the capture, or false to stop it
+ +

Implemented in sf::SoundBufferRecorder.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual bool sf::SoundRecorder::onStart ()
+
+protectedvirtual
+
+ +

Start capturing audio data.

+

This virtual function may be overriden by a derived class if something has to be done every time a new capture starts. If not, this function can be ignored; the default implementation does nothing.

+
Returns
True to start the capture, or false to abort it
+ +

Reimplemented in sf::SoundBufferRecorder.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::SoundRecorder::onStop ()
+
+protectedvirtual
+
+ +

Stop capturing audio data.

+

This virtual function may be overriden by a derived class if something has to be done every time the capture ends. If not, this function can be ignored; the default implementation does nothing.

+ +

Reimplemented in sf::SoundBufferRecorder.

+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundRecorder::start (unsigned int sampleRate = 44100)
+
+ +

Start the capture.

+

The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.

+
Parameters
+ + +
sampleRateDesired capture rate, in number of samples per second
+
+
+
See Also
stop
+ +
+
+ +
+
+ + + + + + + +
void sf::SoundRecorder::stop ()
+
+ +

Stop the capture.

+
See Also
start
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.png new file mode 100644 index 0000000..a2b89f6 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundRecorder.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource-members.htm new file mode 100644 index 0000000..1ccd3f5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource-members.htm @@ -0,0 +1,77 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundSource Member List
+
+
+ +

This is the complete list of members for sf::SoundSource, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + +
getAttenuation() const sf::SoundSource
getMinDistance() const sf::SoundSource
getPitch() const sf::SoundSource
getPosition() const sf::SoundSource
getStatus() const sf::SoundSourceprotected
getVolume() const sf::SoundSource
isRelativeToListener() const sf::SoundSource
m_sourcesf::SoundSourceprotected
Paused enum valuesf::SoundSource
Playing enum valuesf::SoundSource
setAttenuation(float attenuation)sf::SoundSource
setMinDistance(float distance)sf::SoundSource
setPitch(float pitch)sf::SoundSource
setPosition(float x, float y, float z)sf::SoundSource
setPosition(const Vector3f &position)sf::SoundSource
setRelativeToListener(bool relative)sf::SoundSource
setVolume(float volume)sf::SoundSource
SoundSource(const SoundSource &copy)sf::SoundSource
SoundSource()sf::SoundSourceprotected
Status enum namesf::SoundSource
Stopped enum valuesf::SoundSource
~SoundSource()sf::SoundSourcevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.htm new file mode 100644 index 0000000..00f06bf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.htm @@ -0,0 +1,632 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Base class defining a sound's properties. + More...

+ +

#include <SoundSource.hpp>

+
+Inheritance diagram for sf::SoundSource:
+
+
+ + +sf::Sound +sf::SoundStream +sf::Music + +
+ + + + + +

+Public Types

enum  Status {
+  Stopped, +
+  Paused, +
+  Playing +
+ }
 Enumeration of the sound source states. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 SoundSource (const SoundSource &copy)
 Copy constructor. More...
 
virtual ~SoundSource ()
 Destructor. More...
 
void setPitch (float pitch)
 Set the pitch of the sound. More...
 
void setVolume (float volume)
 Set the volume of the sound. More...
 
void setPosition (float x, float y, float z)
 Set the 3D position of the sound in the audio scene. More...
 
void setPosition (const Vector3f &position)
 Set the 3D position of the sound in the audio scene. More...
 
void setRelativeToListener (bool relative)
 Make the sound's position relative to the listener or absolute. More...
 
void setMinDistance (float distance)
 Set the minimum distance of the sound. More...
 
void setAttenuation (float attenuation)
 Set the attenuation factor of the sound. More...
 
float getPitch () const
 Get the pitch of the sound. More...
 
float getVolume () const
 Get the volume of the sound. More...
 
Vector3f getPosition () const
 Get the 3D position of the sound in the audio scene. More...
 
bool isRelativeToListener () const
 Tell whether the sound's position is relative to the listener or is absolute. More...
 
float getMinDistance () const
 Get the minimum distance of the sound. More...
 
float getAttenuation () const
 Get the attenuation factor of the sound. More...
 
+ + + + + + + +

+Protected Member Functions

 SoundSource ()
 Default constructor. More...
 
Status getStatus () const
 Get the current status of the sound (stopped, paused, playing) More...
 
+ + + + +

+Protected Attributes

unsigned int m_source
 OpenAL source identifier. More...
 
+

Detailed Description

+

Base class defining a sound's properties.

+

sf::SoundSource is not meant to be used directly, it only serves as a common base for all audio objects that can live in the audio environment.

+

It defines several properties for the sound: pitch, volume, position, attenuation, etc. All of them can be changed at any time with no impact on performances.

+
See Also
sf::Sound, sf::SoundStream
+ +

Definition at line 41 of file SoundSource.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::SoundSource::Status
+
+ +

Enumeration of the sound source states.

+ + + + +
Enumerator
Stopped  +

Sound is not playing.

+
Paused  +

Sound is paused.

+
Playing  +

Sound is playing.

+
+ +

Definition at line 49 of file SoundSource.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
sf::SoundSource::SoundSource (const SoundSourcecopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::SoundSource::~SoundSource ()
+
+virtual
+
+ +

Destructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::SoundSource::SoundSource ()
+
+protected
+
+ +

Default constructor.

+

This constructor is meant ot be called by derived classes only.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
float sf::SoundSource::getAttenuation () const
+
+ +

Get the attenuation factor of the sound.

+
Returns
Attenuation factor of the sound
+
See Also
setAttenuation, getMinDistance
+ +
+
+ +
+
+ + + + + + + +
float sf::SoundSource::getMinDistance () const
+
+ +

Get the minimum distance of the sound.

+
Returns
Minimum distance of the sound
+
See Also
setMinDistance, getAttenuation
+ +
+
+ +
+
+ + + + + + + +
float sf::SoundSource::getPitch () const
+
+ +

Get the pitch of the sound.

+
Returns
Pitch of the sound
+
See Also
setPitch
+ +
+
+ +
+
+ + + + + + + +
Vector3f sf::SoundSource::getPosition () const
+
+ +

Get the 3D position of the sound in the audio scene.

+
Returns
Position of the sound
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Status sf::SoundSource::getStatus () const
+
+protected
+
+ +

Get the current status of the sound (stopped, paused, playing)

+
Returns
Current status of the sound
+ +
+
+ +
+
+ + + + + + + +
float sf::SoundSource::getVolume () const
+
+ +

Get the volume of the sound.

+
Returns
Volume of the sound, in the range [0, 100]
+
See Also
setVolume
+ +
+
+ +
+
+ + + + + + + +
bool sf::SoundSource::isRelativeToListener () const
+
+ +

Tell whether the sound's position is relative to the listener or is absolute.

+
Returns
True if the position is relative, false if it's absolute
+
See Also
setRelativeToListener
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setAttenuation (float attenuation)
+
+ +

Set the attenuation factor of the sound.

+

The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.

+
Parameters
+ + +
attenuationNew attenuation factor of the sound
+
+
+
See Also
getAttenuation, setMinDistance
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setMinDistance (float distance)
+
+ +

Set the minimum distance of the sound.

+

The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head +of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.

+
Parameters
+ + +
distanceNew minimum distance of the sound
+
+
+
See Also
getMinDistance, setAttenuation
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setPitch (float pitch)
+
+ +

Set the pitch of the sound.

+

The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1.

+
Parameters
+ + +
pitchNew pitch to apply to the sound
+
+
+
See Also
getPitch
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::SoundSource::setPosition (float x,
float y,
float z 
)
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + + + +
xX coordinate of the position of the sound in the scene
yY coordinate of the position of the sound in the scene
zZ coordinate of the position of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setPosition (const Vector3fposition)
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + +
positionPosition of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setRelativeToListener (bool relative)
+
+ +

Make the sound's position relative to the listener or absolute.

+

Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute).

+
Parameters
+ + +
relativeTrue to set the position relative, false to set it absolute
+
+
+
See Also
isRelativeToListener
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundSource::setVolume (float volume)
+
+ +

Set the volume of the sound.

+

The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100.

+
Parameters
+ + +
volumeVolume of the sound
+
+
+
See Also
getVolume
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
unsigned int sf::SoundSource::m_source
+
+protected
+
+ +

OpenAL source identifier.

+ +

Definition at line 263 of file SoundSource.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.png new file mode 100644 index 0000000..0adefcd Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundSource.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream-members.htm new file mode 100644 index 0000000..f11c73b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream-members.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundStream Member List
+
+
+ +

This is the complete list of members for sf::SoundStream, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getAttenuation() const sf::SoundSource
getChannelCount() const sf::SoundStream
getLoop() const sf::SoundStream
getMinDistance() const sf::SoundSource
getPitch() const sf::SoundSource
getPlayingOffset() const sf::SoundStream
getPosition() const sf::SoundSource
getSampleRate() const sf::SoundStream
getStatus() const sf::SoundStream
getVolume() const sf::SoundSource
initialize(unsigned int channelCount, unsigned int sampleRate)sf::SoundStreamprotected
isRelativeToListener() const sf::SoundSource
m_sourcesf::SoundSourceprotected
onGetData(Chunk &data)=0sf::SoundStreamprotectedpure virtual
onSeek(Time timeOffset)=0sf::SoundStreamprotectedpure virtual
pause()sf::SoundStream
Paused enum valuesf::SoundSource
play()sf::SoundStream
Playing enum valuesf::SoundSource
setAttenuation(float attenuation)sf::SoundSource
setLoop(bool loop)sf::SoundStream
setMinDistance(float distance)sf::SoundSource
setPitch(float pitch)sf::SoundSource
setPlayingOffset(Time timeOffset)sf::SoundStream
setPosition(float x, float y, float z)sf::SoundSource
setPosition(const Vector3f &position)sf::SoundSource
setRelativeToListener(bool relative)sf::SoundSource
setVolume(float volume)sf::SoundSource
SoundSource(const SoundSource &copy)sf::SoundSource
SoundSource()sf::SoundSourceprotected
SoundStream()sf::SoundStreamprotected
Status enum namesf::SoundSource
stop()sf::SoundStream
Stopped enum valuesf::SoundSource
~SoundSource()sf::SoundSourcevirtual
~SoundStream()sf::SoundStreamvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.htm new file mode 100644 index 0000000..ac0acb5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.htm @@ -0,0 +1,1098 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Abstract base class for streamed audio sources. + More...

+ +

#include <SoundStream.hpp>

+
+Inheritance diagram for sf::SoundStream:
+
+
+ + +sf::SoundSource +sf::Music + +
+ + + + + +

+Classes

struct  Chunk
 Structure defining a chunk of audio data to stream. More...
 
+ + + + +

+Public Types

enum  Status {
+  Stopped, +
+  Paused, +
+  Playing +
+ }
 Enumeration of the sound source states. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

virtual ~SoundStream ()
 Destructor. More...
 
void play ()
 Start or resume playing the audio stream. More...
 
void pause ()
 Pause the audio stream. More...
 
void stop ()
 Stop playing the audio stream. More...
 
unsigned int getChannelCount () const
 Return the number of channels of the stream. More...
 
unsigned int getSampleRate () const
 Get the stream sample rate of the stream. More...
 
Status getStatus () const
 Get the current status of the stream (stopped, paused, playing) More...
 
void setPlayingOffset (Time timeOffset)
 Change the current playing position of the stream. More...
 
Time getPlayingOffset () const
 Get the current playing position of the stream. More...
 
void setLoop (bool loop)
 Set whether or not the stream should loop after reaching the end. More...
 
bool getLoop () const
 Tell whether or not the stream is in loop mode. More...
 
void setPitch (float pitch)
 Set the pitch of the sound. More...
 
void setVolume (float volume)
 Set the volume of the sound. More...
 
void setPosition (float x, float y, float z)
 Set the 3D position of the sound in the audio scene. More...
 
void setPosition (const Vector3f &position)
 Set the 3D position of the sound in the audio scene. More...
 
void setRelativeToListener (bool relative)
 Make the sound's position relative to the listener or absolute. More...
 
void setMinDistance (float distance)
 Set the minimum distance of the sound. More...
 
void setAttenuation (float attenuation)
 Set the attenuation factor of the sound. More...
 
float getPitch () const
 Get the pitch of the sound. More...
 
float getVolume () const
 Get the volume of the sound. More...
 
Vector3f getPosition () const
 Get the 3D position of the sound in the audio scene. More...
 
bool isRelativeToListener () const
 Tell whether the sound's position is relative to the listener or is absolute. More...
 
float getMinDistance () const
 Get the minimum distance of the sound. More...
 
float getAttenuation () const
 Get the attenuation factor of the sound. More...
 
+ + + + + + + + + + + + + +

+Protected Member Functions

 SoundStream ()
 Default constructor. More...
 
void initialize (unsigned int channelCount, unsigned int sampleRate)
 Define the audio stream parameters. More...
 
virtual bool onGetData (Chunk &data)=0
 Request a new chunk of audio samples from the stream source. More...
 
virtual void onSeek (Time timeOffset)=0
 Change the current playing position in the stream source. More...
 
+ + + + +

+Protected Attributes

unsigned int m_source
 OpenAL source identifier. More...
 
+

Detailed Description

+

Abstract base class for streamed audio sources.

+

Unlike audio buffers (see sf::SoundBuffer), audio streams are never completely loaded in memory.

+

Instead, the audio data is acquired continuously while the stream is playing. This behaviour allows to play a sound with no loading delay, and keeps the memory consumption very low.

+

Sound sources that need to be streamed are usually big files (compressed audio musics that would eat hundreds of MB in memory) or files that would take a lot of time to be received (sounds played over the network).

+

sf::SoundStream is a base class that doesn't care about the stream source, which is left to the derived class. SFML provides a built-in specialization for big files (see sf::Music). No network stream source is provided, but you can write your own by combining this class with the network module.

+

A derived class has to override two virtual functions:

+
    +
  • onGetData fills a new chunk of audio data to be played
  • +
  • onSeek changes the current playing position in the source
  • +
+

It is important to note that each SoundStream is played in its own separate thread, so that the streaming loop doesn't block the rest of the program. In particular, the OnGetData and OnSeek virtual functions may sometimes be called from this separate thread. It is important to keep this in mind, because you may have to take care of synchronization issues if you share data between threads.

+

Usage example:

+
class CustomStream : public sf::SoundStream
+
{
+
public :
+
+
bool open(const std::string& location)
+
{
+
// Open the source and get audio settings
+
...
+
unsigned int channelCount = ...;
+
unsigned int sampleRate = ...;
+
+
// Initialize the stream -- important!
+
initialize(channelCount, sampleRate);
+
}
+
+
private :
+
+
virtual bool onGetData(Chunk& data)
+
{
+
// Fill the chunk with audio data from the stream source
+
data.samples = ...;
+
data.sampleCount = ...;
+
+
// Return true to continue playing
+
return true;
+
}
+
+
virtual void onSeek(Uint32 timeOffset)
+
{
+
// Change the current position in the stream source
+
...
+
}
+
}
+
+
// Usage
+
CustomStream stream;
+
stream.open("path/to/stream");
+
stream.play();
+
See Also
sf::Music
+ +

Definition at line 44 of file SoundStream.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
enum sf::SoundSource::Status
+
+inherited
+
+ +

Enumeration of the sound source states.

+ + + + +
Enumerator
Stopped  +

Sound is not playing.

+
Paused  +

Sound is paused.

+
Playing  +

Sound is playing.

+
+ +

Definition at line 49 of file SoundSource.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::SoundStream::~SoundStream ()
+
+virtual
+
+ +

Destructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
sf::SoundStream::SoundStream ()
+
+protected
+
+ +

Default constructor.

+

This constructor is only meant to be called by derived classes.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getAttenuation () const
+
+inherited
+
+ +

Get the attenuation factor of the sound.

+
Returns
Attenuation factor of the sound
+
See Also
setAttenuation, getMinDistance
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::SoundStream::getChannelCount () const
+
+ +

Return the number of channels of the stream.

+

1 channel means a mono sound, 2 means stereo, etc.

+
Returns
Number of channels
+ +
+
+ +
+
+ + + + + + + +
bool sf::SoundStream::getLoop () const
+
+ +

Tell whether or not the stream is in loop mode.

+
Returns
True if the stream is looping, false otherwise
+
See Also
setLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getMinDistance () const
+
+inherited
+
+ +

Get the minimum distance of the sound.

+
Returns
Minimum distance of the sound
+
See Also
setMinDistance, getAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getPitch () const
+
+inherited
+
+ +

Get the pitch of the sound.

+
Returns
Pitch of the sound
+
See Also
setPitch
+ +
+
+ +
+
+ + + + + + + +
Time sf::SoundStream::getPlayingOffset () const
+
+ +

Get the current playing position of the stream.

+
Returns
Current playing position, from the beginning of the stream
+
See Also
setPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
Vector3f sf::SoundSource::getPosition () const
+
+inherited
+
+ +

Get the 3D position of the sound in the audio scene.

+
Returns
Position of the sound
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::SoundStream::getSampleRate () const
+
+ +

Get the stream sample rate of the stream.

+

The sample rate is the number of audio samples played per second. The higher, the better the quality.

+
Returns
Sample rate, in number of samples per second
+ +
+
+ +
+
+ + + + + + + +
Status sf::SoundStream::getStatus () const
+
+ +

Get the current status of the stream (stopped, paused, playing)

+
Returns
Current status
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::SoundSource::getVolume () const
+
+inherited
+
+ +

Get the volume of the sound.

+
Returns
Volume of the sound, in the range [0, 100]
+
See Also
setVolume
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::SoundStream::initialize (unsigned int channelCount,
unsigned int sampleRate 
)
+
+protected
+
+ +

Define the audio stream parameters.

+

This function must be called by derived classes as soon as they know the audio settings of the stream to play. Any attempt to manipulate the stream (play(), ...) before calling this function will fail. It can be called multiple times if the settings of the audio stream change, but only when the stream is stopped.

+
Parameters
+ + + +
channelCountNumber of channels of the stream
sampleRateSample rate, in samples per second
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::SoundSource::isRelativeToListener () const
+
+inherited
+
+ +

Tell whether the sound's position is relative to the listener or is absolute.

+
Returns
True if the position is relative, false if it's absolute
+
See Also
setRelativeToListener
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual bool sf::SoundStream::onGetData (Chunkdata)
+
+protectedpure virtual
+
+ +

Request a new chunk of audio samples from the stream source.

+

This function must be overriden by derived classes to provide the audio samples to play. It is called continuously by the streaming loop, in a separate thread. The source can choose to stop the streaming loop at any time, by returning false to the caller.

+
Parameters
+ + +
dataChunk of data to fill
+
+
+
Returns
True to continue playback, false to stop
+ +

Implemented in sf::Music.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
virtual void sf::SoundStream::onSeek (Time timeOffset)
+
+protectedpure virtual
+
+ +

Change the current playing position in the stream source.

+

This function must be overriden by derived classes to allow random seeking into the stream source.

+
Parameters
+ + +
timeOffsetNew playing position, relative to the beginning of the stream
+
+
+ +

Implemented in sf::Music.

+ +
+
+ +
+
+ + + + + + + +
void sf::SoundStream::pause ()
+
+ +

Pause the audio stream.

+

This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect.

+
See Also
play, stop
+ +
+
+ +
+
+ + + + + + + +
void sf::SoundStream::play ()
+
+ +

Start or resume playing the audio stream.

+

This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the stream is played.

+
See Also
pause, stop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setAttenuation (float attenuation)
+
+inherited
+
+ +

Set the attenuation factor of the sound.

+

The attenuation is a multiplicative factor which makes the sound more or less loud according to its distance from the listener. An attenuation of 0 will produce a non-attenuated sound, i.e. its volume will always be the same whether it is heard from near or from far. On the other hand, an attenuation value such as 100 will make the sound fade out very quickly as it gets further from the listener. The default value of the attenuation is 1.

+
Parameters
+ + +
attenuationNew attenuation factor of the sound
+
+
+
See Also
getAttenuation, setMinDistance
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundStream::setLoop (bool loop)
+
+ +

Set whether or not the stream should loop after reaching the end.

+

If set, the stream will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for streams is false.

+
Parameters
+ + +
loopTrue to play in loop, false to play once
+
+
+
See Also
getLoop
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setMinDistance (float distance)
+
+inherited
+
+ +

Set the minimum distance of the sound.

+

The "minimum distance" of a sound is the maximum distance at which it is heard at its maximum volume. Further than the minimum distance, it will start to fade out according to its attenuation factor. A value of 0 ("inside the head +of the listener") is an invalid value and is forbidden. The default value of the minimum distance is 1.

+
Parameters
+ + +
distanceNew minimum distance of the sound
+
+
+
See Also
getMinDistance, setAttenuation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPitch (float pitch)
+
+inherited
+
+ +

Set the pitch of the sound.

+

The pitch represents the perceived fundamental frequency of a sound; thus you can make a sound more acute or grave by changing its pitch. A side effect of changing the pitch is to modify the playing speed of the sound as well. The default value for the pitch is 1.

+
Parameters
+ + +
pitchNew pitch to apply to the sound
+
+
+
See Also
getPitch
+ +
+
+ +
+
+ + + + + + + + +
void sf::SoundStream::setPlayingOffset (Time timeOffset)
+
+ +

Change the current playing position of the stream.

+

The playing position can be changed when the stream is either paused or playing.

+
Parameters
+ + +
timeOffsetNew playing position, from the beginning of the stream
+
+
+
See Also
getPlayingOffset
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::SoundSource::setPosition (float x,
float y,
float z 
)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + + + +
xX coordinate of the position of the sound in the scene
yY coordinate of the position of the sound in the scene
zZ coordinate of the position of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setPosition (const Vector3fposition)
+
+inherited
+
+ +

Set the 3D position of the sound in the audio scene.

+

Only sounds with one channel (mono sounds) can be spatialized. The default position of a sound is (0, 0, 0).

+
Parameters
+ + +
positionPosition of the sound in the scene
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setRelativeToListener (bool relative)
+
+inherited
+
+ +

Make the sound's position relative to the listener or absolute.

+

Making a sound relative to the listener will ensure that it will always be played the same way regardless the position of the listener. This can be useful for non-spatialized sounds, sounds that are produced by the listener, or sounds attached to it. The default value is false (position is absolute).

+
Parameters
+ + +
relativeTrue to set the position relative, false to set it absolute
+
+
+
See Also
isRelativeToListener
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::SoundSource::setVolume (float volume)
+
+inherited
+
+ +

Set the volume of the sound.

+

The volume is a value between 0 (mute) and 100 (full volume). The default value for the volume is 100.

+
Parameters
+ + +
volumeVolume of the sound
+
+
+
See Also
getVolume
+ +
+
+ +
+
+ + + + + + + +
void sf::SoundStream::stop ()
+
+ +

Stop playing the audio stream.

+

This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause()).

+
See Also
play, pause
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
unsigned int sf::SoundSource::m_source
+
+protectedinherited
+
+ +

OpenAL source identifier.

+ +

Definition at line 263 of file SoundSource.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.png new file mode 100644 index 0000000..6e10d25 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1SoundStream.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite-members.htm new file mode 100644 index 0000000..7d04758 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite-members.htm @@ -0,0 +1,87 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Sprite Member List
+
+
+ +

This is the complete list of members for sf::Sprite, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
getColor() const sf::Sprite
getGlobalBounds() const sf::Sprite
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Sprite
getOrigin() const sf::Transformable
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getTexture() const sf::Sprite
getTextureRect() const sf::Sprite
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setColor(const Color &color)sf::Sprite
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setTexture(const Texture &texture, bool resetRect=false)sf::Sprite
setTextureRect(const IntRect &rectangle)sf::Sprite
Sprite()sf::Sprite
Sprite(const Texture &texture)sf::Spriteexplicit
Sprite(const Texture &texture, const IntRect &rectangle)sf::Sprite
Transformable()sf::Transformable
~Drawable()sf::Drawableinlinevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.htm new file mode 100644 index 0000000..a6414ac --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.htm @@ -0,0 +1,1095 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Sprite Class Reference
+
+
+ +

Drawable representation of a texture, with its own transformations, color, etc. + More...

+ +

#include <Sprite.hpp>

+
+Inheritance diagram for sf::Sprite:
+
+
+ + +sf::Drawable +sf::Transformable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Sprite ()
 Default constructor. More...
 
 Sprite (const Texture &texture)
 Construct the sprite from a source texture. More...
 
 Sprite (const Texture &texture, const IntRect &rectangle)
 Construct the sprite from a sub-rectangle of a source texture. More...
 
void setTexture (const Texture &texture, bool resetRect=false)
 Change the source texture of the sprite. More...
 
void setTextureRect (const IntRect &rectangle)
 Set the sub-rectangle of the texture that the sprite will display. More...
 
void setColor (const Color &color)
 Set the global color of the sprite. More...
 
const TexturegetTexture () const
 Get the source texture of the sprite. More...
 
const IntRectgetTextureRect () const
 Get the sub-rectangle of the texture displayed by the sprite. More...
 
const ColorgetColor () const
 Get the global color of the sprite. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+

Detailed Description

+

Drawable representation of a texture, with its own transformations, color, etc.

+

sf::Sprite is a drawable class that allows to easily display a texture (or a part of it) on a render target.

+

It inherits all the functions from sf::Transformable: position, rotation, scale, origin. It also adds sprite-specific properties such as the texture to use, the part of it to display, and some convenience functions to change the overall color of the sprite, or to get its bounding rectangle.

+

sf::Sprite works in combination with the sf::Texture class, which loads and provides the pixel data of a given texture.

+

The separation of sf::Sprite and sf::Texture allows more flexibility and better performances: indeed a sf::Texture is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a sf::Sprite is a lightweight object which can use the pixel data of a sf::Texture and draw it with its own transformation/color/blending attributes.

+

It is important to note that the sf::Sprite instance doesn't copy the texture that it uses, it only keeps a reference to it. Thus, a sf::Texture must not be destroyed while it is used by a sf::Sprite (i.e. never write a function that uses a local sf::Texture instance for creating a sprite).

+

Usage example:

+
// Declare and load a texture
+
sf::Texture texture;
+
texture.loadFromFile("texture.png");
+
+
// Create a sprite
+
sf::Sprite sprite;
+
sprite.setTexture(texture);
+
sprite.setTextureRect(sf::IntRect(10, 10, 50, 30));
+
sprite.setColor(sf::Color(255, 255, 255, 200));
+
sprite.setPosition(100, 25);
+
+
// Draw it
+
window.draw(sprite);
+
See Also
sf::Texture, sf::Transformable
+ +

Definition at line 47 of file Sprite.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Sprite::Sprite ()
+
+ +

Default constructor.

+

Creates an empty sprite with no source texture.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
sf::Sprite::Sprite (const Texturetexture)
+
+explicit
+
+ +

Construct the sprite from a source texture.

+
Parameters
+ + +
textureSource texture
+
+
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::Sprite::Sprite (const Texturetexture,
const IntRectrectangle 
)
+
+ +

Construct the sprite from a sub-rectangle of a source texture.

+
Parameters
+ + + +
textureSource texture
rectangleSub-rectangle of the texture to assign to the sprite
+
+
+
See Also
setTexture, setTextureRect
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const Color& sf::Sprite::getColor () const
+
+ +

Get the global color of the sprite.

+
Returns
Global color of the sprite
+
See Also
setColor
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Sprite::getGlobalBounds () const
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Sprite::getLocalBounds () const
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + +
const Texture* sf::Sprite::getTexture () const
+
+ +

Get the source texture of the sprite.

+

If the sprite has no source texture, a NULL pointer is returned. The returned pointer is const, which means that you can't modify the texture when you retrieve it with this function.

+
Returns
Pointer to the sprite's texture
+
See Also
setTexture
+ +
+
+ +
+
+ + + + + + + +
const IntRect& sf::Sprite::getTextureRect () const
+
+ +

Get the sub-rectangle of the texture displayed by the sprite.

+
Returns
Texture rectangle of the sprite
+
See Also
setTextureRect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Sprite::setColor (const Colorcolor)
+
+ +

Set the global color of the sprite.

+

This color is modulated (multiplied) with the sprite's texture. It can be used to colorize the sprite, or change its global opacity. By default, the sprite's color is opaque white.

+
Parameters
+ + +
colorNew color of the sprite
+
+
+
See Also
getColor
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Sprite::setTexture (const Texturetexture,
bool resetRect = false 
)
+
+ +

Change the source texture of the sprite.

+

The texture argument refers to a texture that must exist as long as the sprite uses it. Indeed, the sprite doesn't store its own copy of the texture, but rather keeps a pointer to the one that you passed to this function. If the source texture is destroyed and the sprite tries to use it, the behaviour is undefined. If resetRect is true, the TextureRect property of the sprite is automatically adjusted to the size of the new texture. If it is false, the texture rect is left unchanged.

+
Parameters
+ + + +
textureNew texture
resetRectShould the texture rect be reset to the size of the new texture?
+
+
+
See Also
getTexture, setTextureRect
+ +
+
+ +
+
+ + + + + + + + +
void sf::Sprite::setTextureRect (const IntRectrectangle)
+
+ +

Set the sub-rectangle of the texture that the sprite will display.

+

The texture rect is useful when you don't want to display the whole texture, but rather a part of it. By default, the texture rect covers the entire texture.

+
Parameters
+ + +
rectangleRectangle defining the region of the texture to display
+
+
+
See Also
getTextureRect, setTexture
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.png new file mode 100644 index 0000000..c4407da Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Sprite.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String-members.htm new file mode 100644 index 0000000..45f53d6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String-members.htm @@ -0,0 +1,97 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::String Member List
+
+
+ +

This is the complete list of members for sf::String, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
begin()sf::String
begin() const sf::String
clear()sf::String
ConstIterator typedefsf::String
end()sf::String
end() const sf::String
erase(std::size_t position, std::size_t count=1)sf::String
find(const String &str, std::size_t start=0) const sf::String
getData() const sf::String
getSize() const sf::String
insert(std::size_t position, const String &str)sf::String
InvalidPossf::Stringstatic
isEmpty() const sf::String
Iterator typedefsf::String
operator std::string() const sf::String
operator std::wstring() const sf::String
operator!=(const String &left, const String &right)sf::Stringrelated
operator+(const String &left, const String &right)sf::Stringrelated
operator+=(const String &right)sf::String
operator< (defined in sf::String)sf::Stringfriend
operator<(const String &left, const String &right)sf::Stringrelated
operator<=(const String &left, const String &right)sf::Stringrelated
operator=(const String &right)sf::String
operator== (defined in sf::String)sf::Stringfriend
operator==(const String &left, const String &right)sf::Stringrelated
operator>(const String &left, const String &right)sf::Stringrelated
operator>=(const String &left, const String &right)sf::Stringrelated
operator[](std::size_t index) const sf::String
operator[](std::size_t index)sf::String
String()sf::String
String(char ansiChar, const std::locale &locale=std::locale())sf::String
String(wchar_t wideChar)sf::String
String(Uint32 utf32Char)sf::String
String(const char *ansiString, const std::locale &locale=std::locale())sf::String
String(const std::string &ansiString, const std::locale &locale=std::locale())sf::String
String(const wchar_t *wideString)sf::String
String(const std::wstring &wideString)sf::String
String(const Uint32 *utf32String)sf::String
String(const std::basic_string< Uint32 > &utf32String)sf::String
String(const String &copy)sf::String
toAnsiString(const std::locale &locale=std::locale()) const sf::String
toWideString() const sf::String
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String.htm new file mode 100644 index 0000000..03bc651 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1String.htm @@ -0,0 +1,1351 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Utility string class that automatically handles conversions between types and encodings. + More...

+ +

#include <String.hpp>

+ + + + + + + + +

+Public Types

typedef std::basic_string
+< Uint32 >::iterator 
Iterator
 Iterator type. More...
 
typedef std::basic_string
+< Uint32 >::const_iterator 
ConstIterator
 Constant iterator type. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 String ()
 Default constructor. More...
 
 String (char ansiChar, const std::locale &locale=std::locale())
 Construct from a single ANSI character and a locale. More...
 
 String (wchar_t wideChar)
 Construct from single wide character. More...
 
 String (Uint32 utf32Char)
 Construct from single UTF-32 character. More...
 
 String (const char *ansiString, const std::locale &locale=std::locale())
 Construct from a null-terminated C-style ANSI string and a locale. More...
 
 String (const std::string &ansiString, const std::locale &locale=std::locale())
 Construct from an ANSI string and a locale. More...
 
 String (const wchar_t *wideString)
 Construct from null-terminated C-style wide string. More...
 
 String (const std::wstring &wideString)
 Construct from a wide string. More...
 
 String (const Uint32 *utf32String)
 Construct from a null-terminated C-style UTF-32 string. More...
 
 String (const std::basic_string< Uint32 > &utf32String)
 Construct from an UTF-32 string. More...
 
 String (const String &copy)
 Copy constructor. More...
 
 operator std::string () const
 Implicit cast operator to std::string (ANSI string) More...
 
 operator std::wstring () const
 Implicit cast operator to std::wstring (wide string) More...
 
std::string toAnsiString (const std::locale &locale=std::locale()) const
 Convert the unicode string to an ANSI string. More...
 
std::wstring toWideString () const
 Convert the unicode string to a wide string. More...
 
Stringoperator= (const String &right)
 Overload of assignment operator. More...
 
Stringoperator+= (const String &right)
 Overload of += operator to append an UTF-32 string. More...
 
Uint32 operator[] (std::size_t index) const
 Overload of [] operator to access a character by its position. More...
 
Uint32 & operator[] (std::size_t index)
 Overload of [] operator to access a character by its position. More...
 
void clear ()
 Clear the string. More...
 
std::size_t getSize () const
 Get the size of the string. More...
 
bool isEmpty () const
 Check whether the string is empty or not. More...
 
void erase (std::size_t position, std::size_t count=1)
 Erase one or more characters from the string. More...
 
void insert (std::size_t position, const String &str)
 Insert one or more characters into the string. More...
 
std::size_t find (const String &str, std::size_t start=0) const
 Find a sequence of one or more characters in the string. More...
 
const Uint32 * getData () const
 Get a pointer to the C-style array of characters. More...
 
Iterator begin ()
 Return an iterator to the beginning of the string. More...
 
ConstIterator begin () const
 Return an iterator to the beginning of the string. More...
 
Iterator end ()
 Return an iterator to the beginning of the string. More...
 
ConstIterator end () const
 Return an iterator to the beginning of the string. More...
 
+ + + + +

+Static Public Attributes

static const std::size_t InvalidPos
 Represents an invalid position in the string. More...
 
+ + + + + +

+Friends

+bool operator== (const String &left, const String &right)
 
+bool operator< (const String &left, const String &right)
 
+ + + + + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
bool operator== (const String &left, const String &right)
 Overload of == operator to compare two UTF-32 strings. More...
 
bool operator!= (const String &left, const String &right)
 Overload of != operator to compare two UTF-32 strings. More...
 
bool operator< (const String &left, const String &right)
 Overload of < operator to compare two UTF-32 strings. More...
 
bool operator> (const String &left, const String &right)
 Overload of > operator to compare two UTF-32 strings. More...
 
bool operator<= (const String &left, const String &right)
 Overload of <= operator to compare two UTF-32 strings. More...
 
bool operator>= (const String &left, const String &right)
 Overload of >= operator to compare two UTF-32 strings. More...
 
String operator+ (const String &left, const String &right)
 Overload of binary + operator to concatenate two strings. More...
 
+

Detailed Description

+

Utility string class that automatically handles conversions between types and encodings.

+

sf::String is a utility string class defined mainly for convenience.

+

It is a Unicode string (implemented using UTF-32), thus it can store any character in the world (european, chinese, arabic, hebrew, etc.).

+

It automatically handles conversions from/to ANSI and wide strings, so that you can work with standard string classes and still be compatible with functions taking a sf::String.

+
+
+
std::string s1 = s; // automatically converted to ANSI string
+
std::wstring s2 = s; // automatically converted to wide string
+
s = "hello"; // automatically converted from ANSI string
+
s = L"hello"; // automatically converted from wide string
+
s += 'a'; // automatically converted from ANSI string
+
s += L'a'; // automatically converted from wide string
+

Conversions involving ANSI strings use the default user locale. However it is possible to use a custom locale if necessary:

+
std::locale locale;
+ +
...
+
std::string s1 = s.toAnsiString(locale);
+
s = sf::String("hello", locale);
+

sf::String defines the most important functions of the standard std::string class: removing, random access, iterating, appending, comparing, etc. However it is a simple class provided for convenience, and you may have to consider using a more optimized class if your program requires complex string handling. The automatic conversion functions will then take care of converting your string to sf::String whenever SFML requires it.

+

Please note that SFML also defines a low-level, generic interface for Unicode handling, see the sf::Utf classes.

+ +

Definition at line 43 of file String.hpp.

+

Member Typedef Documentation

+ +
+
+ + + + +
typedef std::basic_string<Uint32>::const_iterator sf::String::ConstIterator
+
+ +

Constant iterator type.

+ +

Definition at line 51 of file String.hpp.

+ +
+
+ +
+
+ + + + +
typedef std::basic_string<Uint32>::iterator sf::String::Iterator
+
+ +

Iterator type.

+ +

Definition at line 50 of file String.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::String::String ()
+
+ +

Default constructor.

+

This constructor creates an empty string.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::String::String (char ansiChar,
const std::locale & locale = std::locale() 
)
+
+ +

Construct from a single ANSI character and a locale.

+

The source character is converted to UTF-32 according to the given locale.

+
Parameters
+ + + +
ansiCharANSI character to convert
localeLocale to use for conversion
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (wchar_t wideChar)
+
+ +

Construct from single wide character.

+
Parameters
+ + +
wideCharWide character to convert
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (Uint32 utf32Char)
+
+ +

Construct from single UTF-32 character.

+
Parameters
+ + +
utf32CharUTF-32 character to convert
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::String::String (const char * ansiString,
const std::locale & locale = std::locale() 
)
+
+ +

Construct from a null-terminated C-style ANSI string and a locale.

+

The source string is converted to UTF-32 according to the given locale.

+
Parameters
+ + + +
ansiStringANSI string to convert
localeLocale to use for conversion
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::String::String (const std::string & ansiString,
const std::locale & locale = std::locale() 
)
+
+ +

Construct from an ANSI string and a locale.

+

The source string is converted to UTF-32 according to the given locale.

+
Parameters
+ + + +
ansiStringANSI string to convert
localeLocale to use for conversion
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (const wchar_t * wideString)
+
+ +

Construct from null-terminated C-style wide string.

+
Parameters
+ + +
wideStringWide string to convert
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (const std::wstring & wideString)
+
+ +

Construct from a wide string.

+
Parameters
+ + +
wideStringWide string to convert
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (const Uint32 * utf32String)
+
+ +

Construct from a null-terminated C-style UTF-32 string.

+
Parameters
+ + +
utf32StringUTF-32 string to assign
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (const std::basic_string< Uint32 > & utf32String)
+
+ +

Construct from an UTF-32 string.

+
Parameters
+ + +
utf32StringUTF-32 string to assign
+
+
+ +
+
+ +
+
+ + + + + + + + +
sf::String::String (const Stringcopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyInstance to copy
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
Iterator sf::String::begin ()
+
+ +

Return an iterator to the beginning of the string.

+
Returns
Read-write iterator to the beginning of the string characters
+
See Also
end
+ +
+
+ +
+
+ + + + + + + +
ConstIterator sf::String::begin () const
+
+ +

Return an iterator to the beginning of the string.

+
Returns
Read-only iterator to the beginning of the string characters
+
See Also
end
+ +
+
+ +
+
+ + + + + + + +
void sf::String::clear ()
+
+ +

Clear the string.

+

This function removes all the characters from the string.

+
See Also
isEmpty, erase
+ +
+
+ +
+
+ + + + + + + +
Iterator sf::String::end ()
+
+ +

Return an iterator to the beginning of the string.

+

The end iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed.

+
Returns
Read-write iterator to the end of the string characters
+
See Also
begin
+ +
+
+ +
+
+ + + + + + + +
ConstIterator sf::String::end () const
+
+ +

Return an iterator to the beginning of the string.

+

The end iterator refers to 1 position past the last character; thus it represents an invalid character and should never be accessed.

+
Returns
Read-only iterator to the end of the string characters
+
See Also
begin
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::String::erase (std::size_t position,
std::size_t count = 1 
)
+
+ +

Erase one or more characters from the string.

+

This function removes a sequence of count characters starting from position.

+
Parameters
+ + + +
positionPosition of the first character to erase
countNumber of characters to erase
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
std::size_t sf::String::find (const Stringstr,
std::size_t start = 0 
) const
+
+ +

Find a sequence of one or more characters in the string.

+

This function searches for the characters of str into the string, starting from start.

+
Parameters
+ + + +
strCharacters to find
startWhere to begin searching
+
+
+
Returns
Position of str in the string, or String::InvalidPos if not found
+ +
+
+ +
+
+ + + + + + + +
const Uint32* sf::String::getData () const
+
+ +

Get a pointer to the C-style array of characters.

+

This functions provides a read-only access to a null-terminated C-style representation of the string. The returned pointer is temporary and is meant only for immediate use, thus it is not recommended to store it.

+
Returns
Read-only pointer to the array of characters
+ +
+
+ +
+
+ + + + + + + +
std::size_t sf::String::getSize () const
+
+ +

Get the size of the string.

+
Returns
Number of characters in the string
+
See Also
isEmpty
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::String::insert (std::size_t position,
const Stringstr 
)
+
+ +

Insert one or more characters into the string.

+

This function inserts the characters of str into the string, starting from position.

+
Parameters
+ + + +
positionPosition of insertion
strCharacters to insert
+
+
+ +
+
+ +
+
+ + + + + + + +
bool sf::String::isEmpty () const
+
+ +

Check whether the string is empty or not.

+
Returns
True if the string is empty (i.e. contains no character)
+
See Also
clear, getSize
+ +
+
+ +
+
+ + + + + + + +
sf::String::operator std::string () const
+
+ +

Implicit cast operator to std::string (ANSI string)

+

The current global locale is used for conversion. If you want to explicitely specify a locale, see toAnsiString. Characters that do not fit in the target encoding are discarded from the returned string. This operator is defined for convenience, and is equivalent to calling toAnsiString().

+
Returns
Converted ANSI string
+
See Also
toAnsiString, operator std::wstring
+ +
+
+ +
+
+ + + + + + + +
sf::String::operator std::wstring () const
+
+ +

Implicit cast operator to std::wstring (wide string)

+

Characters that do not fit in the target encoding are discarded from the returned string. This operator is defined for convenience, and is equivalent to calling toWideString().

+
Returns
Converted wide string
+
See Also
toWideString, operator std::string
+ +
+
+ +
+
+ + + + + + + + +
String& sf::String::operator+= (const Stringright)
+
+ +

Overload of += operator to append an UTF-32 string.

+
Parameters
+ + +
rightString to append
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + + +
String& sf::String::operator= (const Stringright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + + +
Uint32 sf::String::operator[] (std::size_t index) const
+
+ +

Overload of [] operator to access a character by its position.

+

This function provides read-only access to characters. Note: this function doesn't throw if index is out of range.

+
Parameters
+ + +
indexIndex of the character to get
+
+
+
Returns
Character at position index
+ +
+
+ +
+
+ + + + + + + + +
Uint32& sf::String::operator[] (std::size_t index)
+
+ +

Overload of [] operator to access a character by its position.

+

This function provides read and write access to characters. Note: this function doesn't throw if index is out of range.

+
Parameters
+ + +
indexIndex of the character to get
+
+
+
Returns
Reference to the character at position index
+ +
+
+ +
+
+ + + + + + + + +
std::string sf::String::toAnsiString (const std::locale & locale = std::locale()) const
+
+ +

Convert the unicode string to an ANSI string.

+

The UTF-32 string is converted to an ANSI string in the encoding defined by locale. Characters that do not fit in the target encoding are discarded from the returned string.

+
Parameters
+ + +
localeLocale to use for conversion
+
+
+
Returns
Converted ANSI string
+
See Also
toWideString, operator std::string
+ +
+
+ +
+
+ + + + + + + +
std::wstring sf::String::toWideString () const
+
+ +

Convert the unicode string to a wide string.

+

Characters that do not fit in the target encoding are discarded from the returned string.

+
Returns
Converted wide string
+
See Also
toAnsiString, operator std::wstring
+ +
+
+

Friends And Related Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of != operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if both strings are different
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
String operator+ (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of binary + operator to concatenate two strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
Concatenated string
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator< (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of < operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if left is alphabetically lesser than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator<= (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of <= operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if left is alphabetically lesser or equal than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of == operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if both strings are equal
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator> (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of > operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if left is alphabetically greater than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator>= (const Stringleft,
const Stringright 
)
+
+related
+
+ +

Overload of >= operator to compare two UTF-32 strings.

+
Parameters
+ + + +
leftLeft operand (a string)
rightRight operand (a string)
+
+
+
Returns
True if left is alphabetically greater or equal than right
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
const std::size_t sf::String::InvalidPos
+
+static
+
+ +

Represents an invalid position in the string.

+ +

Definition at line 56 of file String.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener-members.htm new file mode 100644 index 0000000..3ea9473 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener-members.htm @@ -0,0 +1,76 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::TcpListener Member List
+
+
+ +

This is the complete list of members for sf::TcpListener, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + +
accept(TcpSocket &socket)sf::TcpListener
AnyPort enum valuesf::Socket
close()sf::TcpListener
create()sf::Socketprotected
create(SocketHandle handle)sf::Socketprotected
Disconnected enum valuesf::Socket
Done enum valuesf::Socket
Error enum valuesf::Socket
getHandle() const sf::Socketprotected
getLocalPort() const sf::TcpListener
isBlocking() const sf::Socket
listen(unsigned short port)sf::TcpListener
NotReady enum valuesf::Socket
setBlocking(bool blocking)sf::Socket
Socket(Type type)sf::Socketprotected
Status enum namesf::Socket
Tcp enum valuesf::Socketprotected
TcpListener()sf::TcpListener
Type enum namesf::Socketprotected
Udp enum valuesf::Socketprotected
~Socket()sf::Socketvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.htm new file mode 100644 index 0000000..450ec69 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.htm @@ -0,0 +1,529 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Socket that listens to new TCP connections. + More...

+ +

#include <TcpListener.hpp>

+
+Inheritance diagram for sf::TcpListener:
+
+
+ + +sf::Socket +sf::NonCopyable + +
+ + + + + + + + +

+Public Types

enum  Status {
+  Done, +
+  NotReady, +
+  Disconnected, +
+  Error +
+ }
 Status codes that may be returned by socket functions. More...
 
enum  { AnyPort = 0 + }
 Some special values used by sockets. More...
 
+ + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 TcpListener ()
 Default constructor. More...
 
unsigned short getLocalPort () const
 Get the port to which the socket is bound locally. More...
 
Status listen (unsigned short port)
 Start listening for connections. More...
 
void close ()
 Stop listening and close the socket. More...
 
Status accept (TcpSocket &socket)
 Accept a new connection. More...
 
void setBlocking (bool blocking)
 Set the blocking state of the socket. More...
 
bool isBlocking () const
 Tell whether the socket is in blocking or non-blocking mode. More...
 
+ + + + +

+Protected Types

enum  Type {
+  Tcp, +
+  Udp +
+ }
 Types of protocols that the socket can use. More...
 
+ + + + + + + + + + +

+Protected Member Functions

SocketHandle getHandle () const
 Return the internal handle of the socket. More...
 
void create ()
 Create the internal representation of the socket. More...
 
void create (SocketHandle handle)
 Create the internal representation of the socket from a socket handle. More...
 
+

Detailed Description

+

Socket that listens to new TCP connections.

+

A listener socket is a special type of socket that listens to a given port and waits for connections on that port.

+

This is all it can do.

+

When a new connection is received, you must call accept and the listener returns a new instance of sf::TcpSocket that is properly initialized and can be used to communicate with the new client.

+

Listener sockets are specific to the TCP protocol, UDP sockets are connectionless and can therefore communicate directly. As a consequence, a listener socket will always return the new connections as sf::TcpSocket instances.

+

A listener is automatically closed on destruction, like all other types of socket. However if you want to stop listening before the socket is destroyed, you can call its close() function.

+

Usage example:

+
// Create a listener socket and make it wait for new
+
// connections on port 55001
+
sf::TcpListener listener;
+
listener.listen(55001);
+
+
// Endless loop that waits for new connections
+
while (running)
+
{
+
sf::TcpSocket client;
+
if (listener.accept(client) == sf::Socket::Done)
+
{
+
// A new client just connected!
+
std::cout << "New connection received from " << client.getRemoteAddress() << std::endl;
+
doSomethingWith(client);
+
}
+
}
+
See Also
sf::TcpSocket, sf::Socket
+ +

Definition at line 43 of file TcpListener.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
anonymous enum
+
+inherited
+
+ +

Some special values used by sockets.

+ + +
Enumerator
AnyPort  +

Special value that tells the system to pick any available port.

+
+ +

Definition at line 65 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Status
+
+inherited
+
+ +

Status codes that may be returned by socket functions.

+ + + + + +
Enumerator
Done  +

The socket has sent / received the data.

+
NotReady  +

The socket is not ready to send / receive data yet.

+
Disconnected  +

The TCP socket has been disconnected.

+
Error  +

An unexpected error happened.

+
+ +

Definition at line 53 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Type
+
+protectedinherited
+
+ +

Types of protocols that the socket can use.

+ + + +
Enumerator
Tcp  +

TCP protocol.

+
Udp  +

UDP protocol.

+
+ +

Definition at line 113 of file Socket.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::TcpListener::TcpListener ()
+
+ +

Default constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Status sf::TcpListener::accept (TcpSocketsocket)
+
+ +

Accept a new connection.

+

If the socket is in blocking mode, this function will not return until a connection is actually received.

+
Parameters
+ + +
socketSocket that will hold the new connection
+
+
+
Returns
Status code
+
See Also
listen
+ +
+
+ +
+
+ + + + + + + +
void sf::TcpListener::close ()
+
+ +

Stop listening and close the socket.

+

This function gracefully stops the listener. If the socket is not listening, this function has no effect.

+
See Also
listen
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::create ()
+
+protectedinherited
+
+ +

Create the internal representation of the socket.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::create (SocketHandle handle)
+
+protectedinherited
+
+ +

Create the internal representation of the socket from a socket handle.

+

This function can only be accessed by derived classes.

+
Parameters
+ + +
handleOS-specific handle of the socket to wrap
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
SocketHandle sf::Socket::getHandle () const
+
+protectedinherited
+
+ +

Return the internal handle of the socket.

+

The returned handle may be invalid if the socket was not created yet (or already destroyed). This function can only be accessed by derived classes.

+
Returns
The internal (OS-specific) handle of the socket
+ +
+
+ +
+
+ + + + + + + +
unsigned short sf::TcpListener::getLocalPort () const
+
+ +

Get the port to which the socket is bound locally.

+

If the socket is not listening to a port, this function returns 0.

+
Returns
Port to which the socket is bound
+
See Also
listen
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Socket::isBlocking () const
+
+inherited
+
+ +

Tell whether the socket is in blocking or non-blocking mode.

+
Returns
True if the socket is blocking, false otherwise
+
See Also
setBlocking
+ +
+
+ +
+
+ + + + + + + + +
Status sf::TcpListener::listen (unsigned short port)
+
+ +

Start listening for connections.

+

This functions makes the socket listen to the specified port, waiting for new connections. If the socket was previously listening to another port, it will be stopped first and bound to the new port.

+
Parameters
+ + +
portPort to listen for new connections
+
+
+
Returns
Status code
+
See Also
accept, close
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::setBlocking (bool blocking)
+
+inherited
+
+ +

Set the blocking state of the socket.

+

In blocking mode, calls will not return until they have completed their task. For example, a call to Receive in blocking mode won't return until some data was actually received. In non-blocking mode, calls will always return immediately, using the return code to signal whether there was data available or not. By default, all sockets are blocking.

+
Parameters
+ + +
blockingTrue to set the socket as blocking, false for non-blocking
+
+
+
See Also
isBlocking
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.png new file mode 100644 index 0000000..3ae34e9 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpListener.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket-members.htm new file mode 100644 index 0000000..ad855e4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket-members.htm @@ -0,0 +1,83 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::TcpSocket Member List
+
+
+ +

This is the complete list of members for sf::TcpSocket, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AnyPort enum valuesf::Socket
close()sf::Socketprotected
connect(const IpAddress &remoteAddress, unsigned short remotePort, Time timeout=Time::Zero)sf::TcpSocket
create()sf::Socketprotected
create(SocketHandle handle)sf::Socketprotected
disconnect()sf::TcpSocket
Disconnected enum valuesf::Socket
Done enum valuesf::Socket
Error enum valuesf::Socket
getHandle() const sf::Socketprotected
getLocalPort() const sf::TcpSocket
getRemoteAddress() const sf::TcpSocket
getRemotePort() const sf::TcpSocket
isBlocking() const sf::Socket
NotReady enum valuesf::Socket
receive(void *data, std::size_t size, std::size_t &received)sf::TcpSocket
receive(Packet &packet)sf::TcpSocket
send(const void *data, std::size_t size)sf::TcpSocket
send(Packet &packet)sf::TcpSocket
setBlocking(bool blocking)sf::Socket
Socket(Type type)sf::Socketprotected
Status enum namesf::Socket
Tcp enum valuesf::Socketprotected
TcpListener (defined in sf::TcpSocket)sf::TcpSocketfriend
TcpSocket()sf::TcpSocket
Type enum namesf::Socketprotected
Udp enum valuesf::Socketprotected
~Socket()sf::Socketvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.htm new file mode 100644 index 0000000..d42be95 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.htm @@ -0,0 +1,771 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized socket using the TCP protocol. + More...

+ +

#include <TcpSocket.hpp>

+
+Inheritance diagram for sf::TcpSocket:
+
+
+ + +sf::Socket +sf::NonCopyable + +
+ + + + + + + + +

+Public Types

enum  Status {
+  Done, +
+  NotReady, +
+  Disconnected, +
+  Error +
+ }
 Status codes that may be returned by socket functions. More...
 
enum  { AnyPort = 0 + }
 Some special values used by sockets. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 TcpSocket ()
 Default constructor. More...
 
unsigned short getLocalPort () const
 Get the port to which the socket is bound locally. More...
 
IpAddress getRemoteAddress () const
 Get the address of the connected peer. More...
 
unsigned short getRemotePort () const
 Get the port of the connected peer to which the socket is connected. More...
 
Status connect (const IpAddress &remoteAddress, unsigned short remotePort, Time timeout=Time::Zero)
 Connect the socket to a remote peer. More...
 
void disconnect ()
 Disconnect the socket from its remote peer. More...
 
Status send (const void *data, std::size_t size)
 Send raw data to the remote peer. More...
 
Status receive (void *data, std::size_t size, std::size_t &received)
 Receive raw data from the remote peer. More...
 
Status send (Packet &packet)
 Send a formatted packet of data to the remote peer. More...
 
Status receive (Packet &packet)
 Receive a formatted packet of data from the remote peer. More...
 
void setBlocking (bool blocking)
 Set the blocking state of the socket. More...
 
bool isBlocking () const
 Tell whether the socket is in blocking or non-blocking mode. More...
 
+ + + + +

+Protected Types

enum  Type {
+  Tcp, +
+  Udp +
+ }
 Types of protocols that the socket can use. More...
 
+ + + + + + + + + + + + + +

+Protected Member Functions

SocketHandle getHandle () const
 Return the internal handle of the socket. More...
 
void create ()
 Create the internal representation of the socket. More...
 
void create (SocketHandle handle)
 Create the internal representation of the socket from a socket handle. More...
 
void close ()
 Close the socket gracefully. More...
 
+ + + +

+Friends

+class TcpListener
 
+

Detailed Description

+

Specialized socket using the TCP protocol.

+

TCP is a connected protocol, which means that a TCP socket can only communicate with the host it is connected to.

+

It can't send or receive anything if it is not connected.

+

The TCP protocol is reliable but adds a slight overhead. It ensures that your data will always be received in order and without errors (no data corrupted, lost or duplicated).

+

When a socket is connected to a remote host, you can retrieve informations about this host with the getRemoteAddress and getRemotePort functions. You can also get the local port to which the socket is bound (which is automatically chosen when the socket is connected), with the getLocalPort function.

+

Sending and receiving data can use either the low-level or the high-level functions. The low-level functions process a raw sequence of bytes, and cannot ensure that one call to Send will exactly match one call to Receive at the other end of the socket.

+

The high-level interface uses packets (see sf::Packet), which are easier to use and provide more safety regarding the data that is exchanged. You can look at the sf::Packet class to get more details about how they work.

+

The socket is automatically disconnected when it is destroyed, but if you want to explicitely close the connection while the socket instance is still alive, you can call disconnect.

+

Usage example:

+
// ----- The client -----
+
+
// Create a socket and connect it to 192.168.1.50 on port 55001
+ +
socket.connect("192.168.1.50", 55001);
+
+
// Send a message to the connected host
+
std::string message = "Hi, I am a client";
+
socket.send(message.c_str(), message.size() + 1);
+
+
// Receive an answer from the server
+
char buffer[1024];
+
std::size_t received = 0;
+
socket.receive(buffer, sizeof(buffer), received);
+
std::cout << "The server said: " << buffer << std::endl;
+
+
// ----- The server -----
+
+
// Create a listener to wait for incoming connections on port 55001
+
sf::TcpListener listener;
+
listener.listen(55001);
+
+
// Wait for a connection
+ +
listener.accept(socket);
+
std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl;
+
+
// Receive a message from the client
+
char buffer[1024];
+
std::size_t received = 0;
+
socket.receive(buffer, sizeof(buffer), received);
+
std::cout << "The client said: " << buffer << std::endl;
+
+
// Send an answer
+
std::string message = "Welcome, client";
+
socket.send(message.c_str(), message.size() + 1);
+
See Also
sf::Socket, sf::UdpSocket, sf::Packet
+ +

Definition at line 46 of file TcpSocket.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
anonymous enum
+
+inherited
+
+ +

Some special values used by sockets.

+ + +
Enumerator
AnyPort  +

Special value that tells the system to pick any available port.

+
+ +

Definition at line 65 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Status
+
+inherited
+
+ +

Status codes that may be returned by socket functions.

+ + + + + +
Enumerator
Done  +

The socket has sent / received the data.

+
NotReady  +

The socket is not ready to send / receive data yet.

+
Disconnected  +

The TCP socket has been disconnected.

+
Error  +

An unexpected error happened.

+
+ +

Definition at line 53 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Type
+
+protectedinherited
+
+ +

Types of protocols that the socket can use.

+ + + +
Enumerator
Tcp  +

TCP protocol.

+
Udp  +

UDP protocol.

+
+ +

Definition at line 113 of file Socket.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::TcpSocket::TcpSocket ()
+
+ +

Default constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::close ()
+
+protectedinherited
+
+ +

Close the socket gracefully.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::TcpSocket::connect (const IpAddressremoteAddress,
unsigned short remotePort,
Time timeout = Time::Zero 
)
+
+ +

Connect the socket to a remote peer.

+

In blocking mode, this function may take a while, especially if the remote peer is not reachable. The last parameter allows you to stop trying to connect after a given timeout. If the socket was previously connected, it is first disconnected.

+
Parameters
+ + + + +
remoteAddressAddress of the remote peer
remotePortPort of the remote peer
timeoutOptional maximum time to wait
+
+
+
Returns
Status code
+
See Also
disconnect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::create ()
+
+protectedinherited
+
+ +

Create the internal representation of the socket.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::create (SocketHandle handle)
+
+protectedinherited
+
+ +

Create the internal representation of the socket from a socket handle.

+

This function can only be accessed by derived classes.

+
Parameters
+ + +
handleOS-specific handle of the socket to wrap
+
+
+ +
+
+ +
+
+ + + + + + + +
void sf::TcpSocket::disconnect ()
+
+ +

Disconnect the socket from its remote peer.

+

This function gracefully closes the connection. If the socket is not connected, this function has no effect.

+
See Also
connect
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
SocketHandle sf::Socket::getHandle () const
+
+protectedinherited
+
+ +

Return the internal handle of the socket.

+

The returned handle may be invalid if the socket was not created yet (or already destroyed). This function can only be accessed by derived classes.

+
Returns
The internal (OS-specific) handle of the socket
+ +
+
+ +
+
+ + + + + + + +
unsigned short sf::TcpSocket::getLocalPort () const
+
+ +

Get the port to which the socket is bound locally.

+

If the socket is not connected, this function returns 0.

+
Returns
Port to which the socket is bound
+
See Also
connect, getRemotePort
+ +
+
+ +
+
+ + + + + + + +
IpAddress sf::TcpSocket::getRemoteAddress () const
+
+ +

Get the address of the connected peer.

+

It the socket is not connected, this function returns sf::IpAddress::None.

+
Returns
Address of the remote peer
+
See Also
getRemotePort
+ +
+
+ +
+
+ + + + + + + +
unsigned short sf::TcpSocket::getRemotePort () const
+
+ +

Get the port of the connected peer to which the socket is connected.

+

If the socket is not connected, this function returns 0.

+
Returns
Remote port to which the socket is connected
+
See Also
getRemoteAddress
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Socket::isBlocking () const
+
+inherited
+
+ +

Tell whether the socket is in blocking or non-blocking mode.

+
Returns
True if the socket is blocking, false otherwise
+
See Also
setBlocking
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::TcpSocket::receive (void * data,
std::size_t size,
std::size_t & received 
)
+
+ +

Receive raw data from the remote peer.

+

In blocking mode, this function will wait until some bytes are actually received. This function will fail if the socket is not connected.

+
Parameters
+ + + + +
dataPointer to the array to fill with the received bytes
sizeMaximum number of bytes that can be received
receivedThis variable is filled with the actual number of bytes received
+
+
+
Returns
Status code
+
See Also
send
+ +
+
+ +
+
+ + + + + + + + +
Status sf::TcpSocket::receive (Packetpacket)
+
+ +

Receive a formatted packet of data from the remote peer.

+

In blocking mode, this function will wait until the whole packet has been received. This function will fail if the socket is not connected.

+
Parameters
+ + +
packetPacket to fill with the received data
+
+
+
Returns
Status code
+
See Also
send
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Status sf::TcpSocket::send (const void * data,
std::size_t size 
)
+
+ +

Send raw data to the remote peer.

+

This function will fail if the socket is not connected.

+
Parameters
+ + + +
dataPointer to the sequence of bytes to send
sizeNumber of bytes to send
+
+
+
Returns
Status code
+
See Also
receive
+ +
+
+ +
+
+ + + + + + + + +
Status sf::TcpSocket::send (Packetpacket)
+
+ +

Send a formatted packet of data to the remote peer.

+

This function will fail if the socket is not connected.

+
Parameters
+ + +
packetPacket to send
+
+
+
Returns
Status code
+
See Also
receive
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::setBlocking (bool blocking)
+
+inherited
+
+ +

Set the blocking state of the socket.

+

In blocking mode, calls will not return until they have completed their task. For example, a call to Receive in blocking mode won't return until some data was actually received. In non-blocking mode, calls will always return immediately, using the return code to signal whether there was data available or not. By default, all sockets are blocking.

+
Parameters
+ + +
blockingTrue to set the socket as blocking, false for non-blocking
+
+
+
See Also
isBlocking
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.png new file mode 100644 index 0000000..ed81a9a Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1TcpSocket.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text-members.htm new file mode 100644 index 0000000..075ff29 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text-members.htm @@ -0,0 +1,96 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Text Member List
+
+
+ +

This is the complete list of members for sf::Text, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bold enum valuesf::Text
findCharacterPos(std::size_t index) const sf::Text
getCharacterSize() const sf::Text
getColor() const sf::Text
getFont() const sf::Text
getGlobalBounds() const sf::Text
getInverseTransform() const sf::Transformable
getLocalBounds() const sf::Text
getOrigin() const sf::Transformable
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getString() const sf::Text
getStyle() const sf::Text
getTransform() const sf::Transformable
Italic enum valuesf::Text
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
Regular enum valuesf::Text
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setCharacterSize(unsigned int size)sf::Text
setColor(const Color &color)sf::Text
setFont(const Font &font)sf::Text
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
setString(const String &string)sf::Text
setStyle(Uint32 style)sf::Text
Style enum namesf::Text
Text()sf::Text
Text(const String &string, const Font &font, unsigned int characterSize=30)sf::Text
Transformable()sf::Transformable
Underlined enum valuesf::Text
~Drawable()sf::Drawableinlinevirtual
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.htm new file mode 100644 index 0000000..483c1d6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.htm @@ -0,0 +1,1240 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Graphical text that can be drawn to a render target. + More...

+ +

#include <Text.hpp>

+
+Inheritance diagram for sf::Text:
+
+
+ + +sf::Drawable +sf::Transformable + +
+ + + + + +

+Public Types

enum  Style {
+  Regular = 0, +
+  Bold = 1 << 0, +
+  Italic = 1 << 1, +
+  Underlined = 1 << 2 +
+ }
 Enumeration of the string drawing styles. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Text ()
 Default constructor. More...
 
 Text (const String &string, const Font &font, unsigned int characterSize=30)
 Construct the text from a string, font and size. More...
 
void setString (const String &string)
 Set the text's string. More...
 
void setFont (const Font &font)
 Set the text's font. More...
 
void setCharacterSize (unsigned int size)
 Set the character size. More...
 
void setStyle (Uint32 style)
 Set the text's style. More...
 
void setColor (const Color &color)
 Set the global color of the text. More...
 
const StringgetString () const
 Get the text's string. More...
 
const FontgetFont () const
 Get the text's font. More...
 
unsigned int getCharacterSize () const
 Get the character size. More...
 
Uint32 getStyle () const
 Get the text's style. More...
 
const ColorgetColor () const
 Get the global color of the text. More...
 
Vector2f findCharacterPos (std::size_t index) const
 Return the position of the index-th character. More...
 
FloatRect getLocalBounds () const
 Get the local bounding rectangle of the entity. More...
 
FloatRect getGlobalBounds () const
 Get the global bounding rectangle of the entity. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+

Detailed Description

+

Graphical text that can be drawn to a render target.

+

sf::Text is a drawable class that allows to easily display some text with custom style and color on a render target.

+

It inherits all the functions from sf::Transformable: position, rotation, scale, origin. It also adds text-specific properties such as the font to use, the character size, the font style (bold, italic, underlined), the global color and the text to display of course. It also provides convenience functions to calculate the graphical size of the text, or to get the global position of a given character.

+

sf::Text works in combination with the sf::Font class, which loads and provides the glyphs (visual characters) of a given font.

+

The separation of sf::Font and sf::Text allows more flexibility and better performances: indeed a sf::Font is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a sf::Text is a lightweight object which can combine the glyphs data and metrics of a sf::Font to display any text on a render target.

+

It is important to note that the sf::Text instance doesn't copy the font that it uses, it only keeps a reference to it. Thus, a sf::Font must not be destructed while it is used by a sf::Text (i.e. never write a function that uses a local sf::Font instance for creating a text).

+

Usage example:

+
// Declare and load a font
+
sf::Font font;
+
font.loadFromFile("arial.ttf");
+
+
// Create a text
+
sf::Text text("hello", font);
+ + + +
+
// Draw it
+
window.draw(text);
+
See Also
sf::Font, sf::Transformable
+ +

Definition at line 48 of file Text.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Text::Style
+
+ +

Enumeration of the string drawing styles.

+ + + + + +
Enumerator
Regular  +

Regular characters, no style.

+
Bold  +

Bold characters.

+
Italic  +

Italic characters.

+
Underlined  +

Underlined characters.

+
+ +

Definition at line 56 of file Text.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Text::Text ()
+
+ +

Default constructor.

+

Creates an empty text.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::Text::Text (const Stringstring,
const Fontfont,
unsigned int characterSize = 30 
)
+
+ +

Construct the text from a string, font and size.

+
Parameters
+ + + + +
stringText assigned to the string
fontFont used to draw the string
characterSizeBase size of characters, in pixels
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Vector2f sf::Text::findCharacterPos (std::size_t index) const
+
+ +

Return the position of the index-th character.

+

This function computes the visual position of a character from its index in the string. The returned position is in global coordinates (translation, rotation, scale and origin are applied). If index is out of range, the position of the end of the string is returned.

+
Parameters
+ + +
indexIndex of the character
+
+
+
Returns
Position of the character
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::Text::getCharacterSize () const
+
+ +

Get the character size.

+
Returns
Size of the characters, in pixels
+
See Also
setCharacterSize
+ +
+
+ +
+
+ + + + + + + +
const Color& sf::Text::getColor () const
+
+ +

Get the global color of the text.

+
Returns
Global color of the text
+
See Also
setColor
+ +
+
+ +
+
+ + + + + + + +
const Font* sf::Text::getFont () const
+
+ +

Get the text's font.

+

If the text has no font attached, a NULL pointer is returned. The returned reference is const, which means that you cannot modify the font when you get it from this function.

+
Returns
Pointer to the text's font
+
See Also
setFont
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Text::getGlobalBounds () const
+
+ +

Get the global bounding rectangle of the entity.

+

The returned rectangle is in global coordinates, which means that it takes in account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the sprite in the global 2D world's coordinate system.

+
Returns
Global bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+inherited
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::Text::getLocalBounds () const
+
+ +

Get the local bounding rectangle of the entity.

+

The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.

+
Returns
Local bounding rectangle of the entity
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+inherited
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+inherited
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+inherited
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+inherited
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + +
const String& sf::Text::getString () const
+
+ +

Get the text's string.

+

The returned string is a sf::String, which can automatically be converted to standard string types. So, the following lines of code are all valid:

+
sf::String s1 = text.getString();
+
std::string s2 = text.getString();
+
std::wstring s3 = text.getString();
+
Returns
Text's string
+
See Also
setString
+ +
+
+ +
+
+ + + + + + + +
Uint32 sf::Text::getStyle () const
+
+ +

Get the text's style.

+
Returns
Text's style
+
See Also
setStyle
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+inherited
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+inherited
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+inherited
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+inherited
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Text::setCharacterSize (unsigned int size)
+
+ +

Set the character size.

+

The default size is 30.

+
Parameters
+ + +
sizeNew character size, in pixels
+
+
+
See Also
getCharacterSize
+ +
+
+ +
+
+ + + + + + + + +
void sf::Text::setColor (const Colorcolor)
+
+ +

Set the global color of the text.

+

By default, the text's color is opaque white.

+
Parameters
+ + +
colorNew color of the text
+
+
+
See Also
getColor
+ +
+
+ +
+
+ + + + + + + + +
void sf::Text::setFont (const Fontfont)
+
+ +

Set the text's font.

+

The font argument refers to a font that must exist as long as the text uses it. Indeed, the text doesn't store its own copy of the font, but rather keeps a pointer to the one that you passed to this function. If the font is destroyed and the text tries to use it, the behaviour is undefined.

+
Parameters
+ + +
fontNew font
+
+
+
See Also
getFont
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+inherited
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+inherited
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+inherited
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+inherited
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Text::setString (const Stringstring)
+
+ +

Set the text's string.

+

The string argument is a sf::String, which can automatically be constructed from standard string types. So, the following calls are all valid:

+
text.setString("hello");
+
text.setString(L"hello");
+
text.setString(std::string("hello"));
+
text.setString(std::wstring(L"hello"));
+

A text's string is empty by default.

+
Parameters
+ + +
stringNew string
+
+
+
See Also
getString
+ +
+
+ +
+
+ + + + + + + + +
void sf::Text::setStyle (Uint32 style)
+
+ +

Set the text's style.

+

You can pass a combination of one or more styles, for example sf::Text::Bold | sf::Text::Italic. The default style is sf::Text::Regular.

+
Parameters
+ + +
styleNew style
+
+
+
See Also
getStyle
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.png new file mode 100644 index 0000000..582905f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Text.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture-members.htm new file mode 100644 index 0000000..7f188ef --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture-members.htm @@ -0,0 +1,86 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Texture Member List
+
+
+ +

This is the complete list of members for sf::Texture, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bind(const Texture *texture, CoordinateType coordinateType=Normalized)sf::Texturestatic
CoordinateType enum namesf::Texture
copyToImage() const sf::Texture
create(unsigned int width, unsigned int height)sf::Texture
ensureGlContext()sf::GlResourceprivatestatic
getMaximumSize()sf::Texturestatic
getSize() const sf::Texture
GlResource()sf::GlResourceprivate
isRepeated() const sf::Texture
isSmooth() const sf::Texture
loadFromFile(const std::string &filename, const IntRect &area=IntRect())sf::Texture
loadFromImage(const Image &image, const IntRect &area=IntRect())sf::Texture
loadFromMemory(const void *data, std::size_t size, const IntRect &area=IntRect())sf::Texture
loadFromStream(sf::InputStream &stream, const IntRect &area=IntRect())sf::Texture
Normalized enum valuesf::Texture
operator=(const Texture &right)sf::Texture
Pixels enum valuesf::Texture
RenderTarget (defined in sf::Texture)sf::Texturefriend
RenderTexture (defined in sf::Texture)sf::Texturefriend
setRepeated(bool repeated)sf::Texture
setSmooth(bool smooth)sf::Texture
Texture()sf::Texture
Texture(const Texture &copy)sf::Texture
update(const Uint8 *pixels)sf::Texture
update(const Uint8 *pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y)sf::Texture
update(const Image &image)sf::Texture
update(const Image &image, unsigned int x, unsigned int y)sf::Texture
update(const Window &window)sf::Texture
update(const Window &window, unsigned int x, unsigned int y)sf::Texture
~GlResource()sf::GlResourceprivate
~Texture()sf::Texture
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.htm new file mode 100644 index 0000000..8ff84b9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.htm @@ -0,0 +1,996 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Image living on the graphics card that can be used for drawing. + More...

+ +

#include <Texture.hpp>

+
+Inheritance diagram for sf::Texture:
+
+
+ + +sf::GlResource + +
+ + + + + +

+Public Types

enum  CoordinateType {
+  Normalized, +
+  Pixels +
+ }
 Types of texture coordinates that can be used for rendering. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Texture ()
 Default constructor. More...
 
 Texture (const Texture &copy)
 Copy constructor. More...
 
 ~Texture ()
 Destructor. More...
 
bool create (unsigned int width, unsigned int height)
 Create the texture. More...
 
bool loadFromFile (const std::string &filename, const IntRect &area=IntRect())
 Load the texture from a file on disk. More...
 
bool loadFromMemory (const void *data, std::size_t size, const IntRect &area=IntRect())
 Load the texture from a file in memory. More...
 
bool loadFromStream (sf::InputStream &stream, const IntRect &area=IntRect())
 Load the texture from a custom stream. More...
 
bool loadFromImage (const Image &image, const IntRect &area=IntRect())
 Load the texture from an image. More...
 
Vector2u getSize () const
 Return the size of the texture. More...
 
Image copyToImage () const
 Copy the texture pixels to an image. More...
 
void update (const Uint8 *pixels)
 Update the whole texture from an array of pixels. More...
 
void update (const Uint8 *pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y)
 Update a part of the texture from an array of pixels. More...
 
void update (const Image &image)
 Update the texture from an image. More...
 
void update (const Image &image, unsigned int x, unsigned int y)
 Update a part of the texture from an image. More...
 
void update (const Window &window)
 Update the texture from the contents of a window. More...
 
void update (const Window &window, unsigned int x, unsigned int y)
 Update a part of the texture from the contents of a window. More...
 
void setSmooth (bool smooth)
 Enable or disable the smooth filter. More...
 
bool isSmooth () const
 Tell whether the smooth filter is enabled or not. More...
 
void setRepeated (bool repeated)
 Enable or disable repeating. More...
 
bool isRepeated () const
 Tell whether the texture is repeated or not. More...
 
Textureoperator= (const Texture &right)
 Overload of assignment operator. More...
 
+ + + + + + + +

+Static Public Member Functions

static void bind (const Texture *texture, CoordinateType coordinateType=Normalized)
 Bind a texture for rendering. More...
 
static unsigned int getMaximumSize ()
 Get the maximum texture size allowed. More...
 
+ + + + +

+Static Private Member Functions

static void ensureGlContext ()
 Make sure that a valid OpenGL context exists in the current thread. More...
 
+ + + + + +

+Friends

+class RenderTexture
 
+class RenderTarget
 
+

Detailed Description

+

Image living on the graphics card that can be used for drawing.

+

sf::Texture stores pixels that can be drawn, with a sprite for example.

+

A texture lives in the graphics card memory, therefore it is very fast to draw a texture to a render target, or copy a render target to a texture (the graphics card can access both directly).

+

Being stored in the graphics card memory has some drawbacks. A texture cannot be manipulated as freely as a sf::Image, you need to prepare the pixels first and then upload them to the texture in a single operation (see Texture::update).

+

sf::Texture makes it easy to convert from/to sf::Image, but keep in mind that these calls require transfers between the graphics card and the central memory, therefore they are slow operations.

+

A texture can be loaded from an image, but also directly from a file/memory/stream. The necessary shortcuts are defined so that you don't need an image first for the most common cases. However, if you want to perform some modifications on the pixels before creating the final texture, you can load your file to a sf::Image, do whatever you need with the pixels, and then call Texture::loadFromImage.

+

Since they live in the graphics card memory, the pixels of a texture cannot be accessed without a slow copy first. And they cannot be accessed individually. Therefore, if you need to read the texture's pixels (like for pixel-perfect collisions), it is recommended to store the collision information separately, for example in an array of booleans.

+

Like sf::Image, sf::Texture can handle a unique internal representation of pixels, which is RGBA 32 bits. This means that a pixel must be composed of 8 bits red, green, blue and alpha channels – just like a sf::Color.

+

Usage example:

+
// This example shows the most common use of sf::Texture:
+
// drawing a sprite
+
+
// Load a texture from a file
+
sf::Texture texture;
+
if (!texture.loadFromFile("texture.png"))
+
return -1;
+
+
// Assign it to a sprite
+
sf::Sprite sprite;
+
sprite.setTexture(texture);
+
+
// Draw the textured sprite
+
window.draw(sprite);
+
// This example shows another common use of sf::Texture:
+
// streaming real-time data, like video frames
+
+
// Create an empty texture
+
sf::Texture texture;
+
if (!texture.create(640, 480))
+
return -1;
+
+
// Create a sprite that will display the texture
+
sf::Sprite sprite(texture);
+
+
while (...) // the main loop
+
{
+
...
+
+
// update the texture
+
sf::Uint8* pixels = ...; // get a fresh chunk of pixels (the next frame of a movie, for example)
+
texture.update(pixels);
+
+
// draw it
+
window.draw(sprite);
+
+
...
+
}
+

Like sf::Shader that can be used as a raw OpenGL shader, sf::Texture can also be used directly as a raw texture for custom OpenGL geometry.

+
+
... render OpenGL geometry ...
+
sf::Texture::bind(NULL);
+
See Also
sf::Sprite, sf::Image, sf::RenderTexture
+ +

Definition at line 47 of file Texture.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum sf::Texture::CoordinateType
+
+ +

Types of texture coordinates that can be used for rendering.

+ + + +
Enumerator
Normalized  +

Texture coordinates in range [0 .. 1].

+
Pixels  +

Texture coordinates in range [0 .. size].

+
+ +

Definition at line 55 of file Texture.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Texture::Texture ()
+
+ +

Default constructor.

+

Creates an empty texture.

+ +
+
+ +
+
+ + + + + + + + +
sf::Texture::Texture (const Texturecopy)
+
+ +

Copy constructor.

+
Parameters
+ + +
copyinstance to copy
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::Texture::~Texture ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static void sf::Texture::bind (const Texturetexture,
CoordinateType coordinateType = Normalized 
)
+
+static
+
+ +

Bind a texture for rendering.

+

This function is not part of the graphics API, it mustn't be used when drawing SFML entities. It must be used only if you mix sf::Texture with OpenGL code.

+
sf::Texture t1, t2;
+
...
+
sf::Texture::bind(&t1);
+
// draw OpenGL stuff that use t1...
+ +
// draw OpenGL stuff that use t2...
+ +
// draw OpenGL stuff that use no texture...
+

The coordinateType argument controls how texture coordinates will be interpreted. If Normalized (the default), they must be in range [0 .. 1], which is the default way of handling texture coordinates with OpenGL. If Pixels, they must be given in pixels (range [0 .. size]). This mode is used internally by the graphics classes of SFML, it makes the definition of texture coordinates more intuitive for the high-level API, users don't need to compute normalized values.

+
Parameters
+ + + +
texturePointer to the texture to bind, can be null to use no texture
coordinateTypeType of texture coordinates to use
+
+
+ +
+
+ +
+
+ + + + + + + +
Image sf::Texture::copyToImage () const
+
+ +

Copy the texture pixels to an image.

+

This function performs a slow operation that downloads the texture's pixels from the graphics card and copies them to a new image, potentially applying transformations to pixels if necessary (texture may be padded or flipped).

+
Returns
Image containing the texture's pixels
+
See Also
loadFromImage
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Texture::create (unsigned int width,
unsigned int height 
)
+
+ +

Create the texture.

+

If this function fails, the texture is left unchanged.

+
Parameters
+ + + +
widthWidth of the texture
heightHeight of the texture
+
+
+
Returns
True if creation was successful
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static unsigned int sf::Texture::getMaximumSize ()
+
+static
+
+ +

Get the maximum texture size allowed.

+

This maximum size is defined by the graphics driver. You can expect a value of 512 pixels for low-end graphics card, and up to 8192 pixels or more for newer hardware.

+
Returns
Maximum size allowed for textures, in pixels
+ +
+
+ +
+
+ + + + + + + +
Vector2u sf::Texture::getSize () const
+
+ +

Return the size of the texture.

+
Returns
Size in pixels
+ +
+
+ +
+
+ + + + + + + +
bool sf::Texture::isRepeated () const
+
+ +

Tell whether the texture is repeated or not.

+
Returns
True if repeat mode is enabled, false if it is disabled
+
See Also
setRepeated
+ +
+
+ +
+
+ + + + + + + +
bool sf::Texture::isSmooth () const
+
+ +

Tell whether the smooth filter is enabled or not.

+
Returns
True if smoothing is enabled, false if it is disabled
+
See Also
setSmooth
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Texture::loadFromFile (const std::string & filename,
const IntRectarea = IntRect() 
)
+
+ +

Load the texture from a file on disk.

+

This function is a shortcut for the following code:

+
sf::Image image;
+
image.loadFromFile(filename);
+
texture.loadFromImage(image, area);
+

The area argument can be used to load only a sub-rectangle of the whole image. If you want the entire image then leave the default value (which is an empty IntRect). If the area rectangle crosses the bounds of the image, it is adjusted to fit the image size.

+

The maximum size for a texture depends on the graphics driver and can be retrieved with the getMaximumSize function.

+

If this function fails, the texture is left unchanged.

+
Parameters
+ + + +
filenamePath of the image file to load
areaArea of the image to load
+
+
+
Returns
True if loading was successful
+
See Also
loadFromMemory, loadFromStream, loadFromImage
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Texture::loadFromImage (const Imageimage,
const IntRectarea = IntRect() 
)
+
+ +

Load the texture from an image.

+

The area argument can be used to load only a sub-rectangle of the whole image. If you want the entire image then leave the default value (which is an empty IntRect). If the area rectangle crosses the bounds of the image, it is adjusted to fit the image size.

+

The maximum size for a texture depends on the graphics driver and can be retrieved with the getMaximumSize function.

+

If this function fails, the texture is left unchanged.

+
Parameters
+ + + +
imageImage to load into the texture
areaArea of the image to load
+
+
+
Returns
True if loading was successful
+
See Also
loadFromFile, loadFromMemory
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool sf::Texture::loadFromMemory (const void * data,
std::size_t size,
const IntRectarea = IntRect() 
)
+
+ +

Load the texture from a file in memory.

+

This function is a shortcut for the following code:

+
sf::Image image;
+
image.loadFromMemory(data, size);
+
texture.loadFromImage(image, area);
+

The area argument can be used to load only a sub-rectangle of the whole image. If you want the entire image then leave the default value (which is an empty IntRect). If the area rectangle crosses the bounds of the image, it is adjusted to fit the image size.

+

The maximum size for a texture depends on the graphics driver and can be retrieved with the getMaximumSize function.

+

If this function fails, the texture is left unchanged.

+
Parameters
+ + + + +
dataPointer to the file data in memory
sizeSize of the data to load, in bytes
areaArea of the image to load
+
+
+
Returns
True if loading was successful
+
See Also
loadFromFile, loadFromStream, loadFromImage
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool sf::Texture::loadFromStream (sf::InputStreamstream,
const IntRectarea = IntRect() 
)
+
+ +

Load the texture from a custom stream.

+

This function is a shortcut for the following code:

+
sf::Image image;
+
image.loadFromStream(stream);
+
texture.loadFromImage(image, area);
+

The area argument can be used to load only a sub-rectangle of the whole image. If you want the entire image then leave the default value (which is an empty IntRect). If the area rectangle crosses the bounds of the image, it is adjusted to fit the image size.

+

The maximum size for a texture depends on the graphics driver and can be retrieved with the getMaximumSize function.

+

If this function fails, the texture is left unchanged.

+
Parameters
+ + + +
streamSource stream to read from
areaArea of the image to load
+
+
+
Returns
True if loading was successful
+
See Also
loadFromFile, loadFromMemory, loadFromImage
+ +
+
+ +
+
+ + + + + + + + +
Texture& sf::Texture::operator= (const Textureright)
+
+ +

Overload of assignment operator.

+
Parameters
+ + +
rightInstance to assign
+
+
+
Returns
Reference to self
+ +
+
+ +
+
+ + + + + + + + +
void sf::Texture::setRepeated (bool repeated)
+
+ +

Enable or disable repeating.

+

Repeating is involved when using texture coordinates outside the texture rectangle [0, 0, width, height]. In this case, if repeat mode is enabled, the whole texture will be repeated as many times as needed to reach the coordinate (for example, if the X texture coordinate is 3 * width, the texture will be repeated 3 times). If repeat mode is disabled, the "extra space" will instead be filled with border pixels. Warning: on very old graphics cards, white pixels may appear when the texture is repeated. With such cards, repeat mode can be used reliably only if the texture has power-of-two dimensions (such as 256x128). Repeating is disabled by default.

+
Parameters
+ + +
repeatedTrue to repeat the texture, false to disable repeating
+
+
+
See Also
isRepeated
+ +
+
+ +
+
+ + + + + + + + +
void sf::Texture::setSmooth (bool smooth)
+
+ +

Enable or disable the smooth filter.

+

When the filter is activated, the texture appears smoother so that pixels are less noticeable. However if you want the texture to look exactly the same as its source file, you should leave it disabled. The smooth filter is disabled by default.

+
Parameters
+ + +
smoothTrue to enable smoothing, false to disable it
+
+
+
See Also
isSmooth
+ +
+
+ +
+
+ + + + + + + + +
void sf::Texture::update (const Uint8 * pixels)
+
+ +

Update the whole texture from an array of pixels.

+

The pixel array is assumed to have the same size as the area rectangle, and to contain 32-bits RGBA pixels.

+

No additional check is performed on the size of the pixel array, passing invalid arguments will lead to an undefined behaviour.

+

This function does nothing if pixels is null or if the texture was not previously created.

+
Parameters
+ + +
pixelsArray of pixels to copy to the texture
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Texture::update (const Uint8 * pixels,
unsigned int width,
unsigned int height,
unsigned int x,
unsigned int y 
)
+
+ +

Update a part of the texture from an array of pixels.

+

The size of the pixel array must match the width and height arguments, and it must contain 32-bits RGBA pixels.

+

No additional check is performed on the size of the pixel array or the bounds of the area to update, passing invalid arguments will lead to an undefined behaviour.

+

This function does nothing if pixels is null or if the texture was not previously created.

+
Parameters
+ + + + + + +
pixelsArray of pixels to copy to the texture
widthWidth of the pixel region contained in pixels
heightHeight of the pixel region contained in pixels
xX offset in the texture where to copy the source pixels
yY offset in the texture where to copy the source pixels
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Texture::update (const Imageimage)
+
+ +

Update the texture from an image.

+

Although the source image can be smaller than the texture, this function is usually used for updating the whole texture. The other overload, which has (x, y) additional arguments, is more convenient for updating a sub-area of the texture.

+

No additional check is performed on the size of the image, passing an image bigger than the texture will lead to an undefined behaviour.

+

This function does nothing if the texture was not previously created.

+
Parameters
+ + +
imageImage to copy to the texture
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Texture::update (const Imageimage,
unsigned int x,
unsigned int y 
)
+
+ +

Update a part of the texture from an image.

+

No additional check is performed on the size of the image, passing an invalid combination of image size and offset will lead to an undefined behaviour.

+

This function does nothing if the texture was not previously created.

+
Parameters
+ + + + +
imageImage to copy to the texture
xX offset in the texture where to copy the source image
yY offset in the texture where to copy the source image
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Texture::update (const Windowwindow)
+
+ +

Update the texture from the contents of a window.

+

Although the source window can be smaller than the texture, this function is usually used for updating the whole texture. The other overload, which has (x, y) additional arguments, is more convenient for updating a sub-area of the texture.

+

No additional check is performed on the size of the window, passing a window bigger than the texture will lead to an undefined behaviour.

+

This function does nothing if either the texture or the window was not previously created.

+
Parameters
+ + +
windowWindow to copy to the texture
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Texture::update (const Windowwindow,
unsigned int x,
unsigned int y 
)
+
+ +

Update a part of the texture from the contents of a window.

+

No additional check is performed on the size of the window, passing an invalid combination of window size and offset will lead to an undefined behaviour.

+

This function does nothing if either the texture or the window was not previously created.

+
Parameters
+ + + + +
windowWindow to copy to the texture
xX offset in the texture where to copy the source window
yY offset in the texture where to copy the source window
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.png new file mode 100644 index 0000000..91a912f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Texture.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread-members.htm new file mode 100644 index 0000000..df1d053 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread-members.htm @@ -0,0 +1,66 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Thread Member List
+
+
+ +

This is the complete list of members for sf::Thread, including all inherited members.

+ + + + + + + + + + + + +
launch()sf::Thread
NonCopyable()sf::NonCopyableinlineprivate
terminate()sf::Thread
Thread(F function)sf::Thread
Thread(F function, A argument)sf::Thread
Thread(void(C::*function)(), C *object)sf::Thread
Thread(F functor) (defined in sf::Thread)sf::Thread
Thread(F function, A argument) (defined in sf::Thread)sf::Thread
Thread(void(C::*function)(), C *object) (defined in sf::Thread)sf::Thread
wait()sf::Thread
~Thread()sf::Thread
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.htm new file mode 100644 index 0000000..525f47f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.htm @@ -0,0 +1,371 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Thread Class Reference
+
+
+ +

Utility class to manipulate threads. + More...

+ +

#include <Thread.hpp>

+
+Inheritance diagram for sf::Thread:
+
+
+ + +sf::NonCopyable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

template<typename F >
 Thread (F function)
 Construct the thread from a functor with no argument. More...
 
template<typename F , typename A >
 Thread (F function, A argument)
 Construct the thread from a functor with an argument. More...
 
template<typename C >
 Thread (void(C::*function)(), C *object)
 Construct the thread from a member function and an object. More...
 
 ~Thread ()
 Destructor. More...
 
void launch ()
 Run the thread. More...
 
void wait ()
 Wait until the thread finishes. More...
 
void terminate ()
 Terminate the thread. More...
 
+template<typename F >
 Thread (F functor)
 
+template<typename F , typename A >
 Thread (F function, A argument)
 
+template<typename C >
 Thread (void(C::*function)(), C *object)
 
+

Detailed Description

+

Utility class to manipulate threads.

+

Threads provide a way to run multiple parts of the code in parallel.

+

When you launch a new thread, the execution is split and both the new thread and the caller run in parallel.

+

To use a sf::Thread, you construct it directly with the function to execute as the entry point of the thread. sf::Thread has multiple template constructors, which means that you can use several types of entry points:

+
    +
  • non-member functions with no argument
  • +
  • non-member functions with one argument of any type
  • +
  • functors with no argument (this one is particularly useful for compatibility with boost/std::bind)
  • +
  • functors with one argument of any type
  • +
  • member functions from any class with no argument
  • +
+

The function argument, if any, is copied in the sf::Thread instance, as well as the functor (if the corresponding constructor is used). Class instances, however, are passed by pointer so you must make sure that the object won't be destroyed while the thread is still using it.

+

The thread ends when its function is terminated. If the owner sf::Thread instance is destroyed before the thread is finished, the destructor will wait (see wait())

+

Usage examples:

+
// example 1: non member function with one argument
+
+
void threadFunc(int argument)
+
{
+
...
+
}
+
+
sf::Thread thread(&threadFunc, 5);
+
thread.launch(); // start the thread (internally calls threadFunc(5))
+
// example 2: member function
+
+
class Task
+
{
+
public :
+
void run()
+
{
+
...
+
}
+
};
+
+
Task task;
+
sf::Thread thread(&Task::run, &task);
+
thread.launch(); // start the thread (internally calls task.run())
+
// example 3: functor
+
+
struct Task
+
{
+
void operator()()
+
{
+
...
+
}
+
};
+
+
sf::Thread thread(Task());
+
thread.launch(); // start the thread (internally calls operator() on the Task instance)
+

Creating parallel threads of execution can be dangerous: all threads inside the same process share the same memory space, which means that you may end up accessing the same variable from multiple threads at the same time. To prevent this kind of situations, you can use mutexes (see sf::Mutex).

+
See Also
sf::Mutex
+ +

Definition at line 48 of file Thread.hpp.

+

Constructor & Destructor Documentation

+ +
+
+
+template<typename F >
+ + + + + + + + +
sf::Thread::Thread (function)
+
+ +

Construct the thread from a functor with no argument.

+

This constructor works for function objects, as well as free function.

+

Use this constructor for this kind of function:

+
void function();
+
+
// --- or ----
+
+
struct Functor
+
{
+
void operator()();
+
};
+

Note: this does not run the thread, use Launch().

+
Parameters
+ + +
functionFunctor or free function to use as the entry point of the thread
+
+
+ +
+
+ +
+
+
+template<typename F , typename A >
+ + + + + + + + + + + + + + + + + + +
sf::Thread::Thread (function,
argument 
)
+
+ +

Construct the thread from a functor with an argument.

+

This constructor works for function objects, as well as free function. It is a template, which means that the argument can have any type (int, std::string, void*, Toto, ...).

+

Use this constructor for this kind of function:

+
void function(int arg);
+
+
// --- or ----
+
+
struct Functor
+
{
+
void operator()(std::string arg);
+
};
+

Note: this does not run the thread, use Launch().

+
Parameters
+ + + +
functionFunctor or free function to use as the entry point of the thread
argumentargument to forward to the function
+
+
+ +
+
+ +
+
+
+template<typename C >
+ + + + + + + + + + + + + + + + + + +
sf::Thread::Thread (void(C::*)() function,
C * object 
)
+
+ +

Construct the thread from a member function and an object.

+

This constructor is template, which means that you can use it with any class. Use this constructor for this kind of function:

+
class MyClass
+
{
+
public :
+
+
void function();
+
};
+

Note: this does not run the thread, use Launch().

+
Parameters
+ + + +
functionEntry point of the thread
objectPointer to the object to use
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::Thread::~Thread ()
+
+ +

Destructor.

+

This destructor calls Wait(), so that the internal thread cannot survive after its sf::Thread instance is destroyed.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void sf::Thread::launch ()
+
+ +

Run the thread.

+

This function starts the entry point passed to the thread's constructor, and returns immediately. After this function returns, the thread's function is running in parallel to the calling code.

+ +
+
+ +
+
+ + + + + + + +
void sf::Thread::terminate ()
+
+ +

Terminate the thread.

+

This function immediately stops the thread, without waiting for its function to finish. Terminating a thread with this function is not safe, and can lead to local variables not being destroyed on some operating systems. You should rather try to make the thread function terminate by itself.

+ +
+
+ +
+
+ + + + + + + +
void sf::Thread::wait ()
+
+ +

Wait until the thread finishes.

+

This function will block the execution until the thread's function ends. Warning: if the thread function never ends, the calling thread will block forever. If this function is called from its owner thread, it returns without doing anything.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.png new file mode 100644 index 0000000..598a561 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Thread.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal-members.htm new file mode 100644 index 0000000..b94997f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal-members.htm @@ -0,0 +1,60 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::ThreadLocal Member List
+
+
+ +

This is the complete list of members for sf::ThreadLocal, including all inherited members.

+ + + + + + +
getValue() const sf::ThreadLocal
NonCopyable()sf::NonCopyableinlineprivate
setValue(void *value)sf::ThreadLocal
ThreadLocal(void *value=NULL)sf::ThreadLocal
~ThreadLocal()sf::ThreadLocal
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.htm new file mode 100644 index 0000000..d9fa7e2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.htm @@ -0,0 +1,180 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::ThreadLocal Class Reference
+
+
+ +

Defines variables with thread-local storage. + More...

+ +

#include <ThreadLocal.hpp>

+
+Inheritance diagram for sf::ThreadLocal:
+
+
+ + +sf::NonCopyable +sf::ThreadLocalPtr< T > + +
+ + + + + + + + + + + + + + +

+Public Member Functions

 ThreadLocal (void *value=NULL)
 Default constructor. More...
 
 ~ThreadLocal ()
 Destructor. More...
 
void setValue (void *value)
 Set the thread-specific value of the variable. More...
 
void * getValue () const
 Retrieve the thread-specific value of the variable. More...
 
+

Detailed Description

+

Defines variables with thread-local storage.

+

This class manipulates void* parameters and thus is not appropriate for strongly-typed variables.

+

You should rather use the sf::ThreadLocalPtr template class.

+ +

Definition at line 47 of file ThreadLocal.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
sf::ThreadLocal::ThreadLocal (void * value = NULL)
+
+ +

Default constructor.

+
Parameters
+ + +
valueOptional value to initalize the variable
+
+
+ +
+
+ +
+
+ + + + + + + +
sf::ThreadLocal::~ThreadLocal ()
+
+ +

Destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void* sf::ThreadLocal::getValue () const
+
+ +

Retrieve the thread-specific value of the variable.

+
Returns
Value of the variable for the current thread
+ +
+
+ +
+
+ + + + + + + + +
void sf::ThreadLocal::setValue (void * value)
+
+ +

Set the thread-specific value of the variable.

+
Parameters
+ + +
valueValue of the variable for the current thread
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.png new file mode 100644 index 0000000..02924d2 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocal.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr-members.htm new file mode 100644 index 0000000..5a5a4fa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr-members.htm @@ -0,0 +1,65 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::ThreadLocalPtr< T > Member List
+
+
+ +

This is the complete list of members for sf::ThreadLocalPtr< T >, including all inherited members.

+ + + + + + + + + + + +
getValue() const sf::ThreadLocalprivate
operator T *() const sf::ThreadLocalPtr< T >
operator*() const sf::ThreadLocalPtr< T >
operator->() const sf::ThreadLocalPtr< T >
operator=(T *value)sf::ThreadLocalPtr< T >
operator=(const ThreadLocalPtr< T > &right)sf::ThreadLocalPtr< T >
setValue(void *value)sf::ThreadLocalprivate
ThreadLocal(void *value=NULL)sf::ThreadLocalprivate
ThreadLocalPtr(T *value=NULL)sf::ThreadLocalPtr< T >
~ThreadLocal()sf::ThreadLocalprivate
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.htm new file mode 100644 index 0000000..52cdcb5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.htm @@ -0,0 +1,299 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::ThreadLocalPtr< T > Class Template Reference
+
+
+ +

Pointer to a thread-local variable. + More...

+ +

#include <ThreadLocalPtr.hpp>

+
+Inheritance diagram for sf::ThreadLocalPtr< T >:
+
+
+ + +sf::ThreadLocal + +
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 ThreadLocalPtr (T *value=NULL)
 Default constructor. More...
 
T & operator* () const
 Overload of unary operator *. More...
 
T * operator-> () const
 Overload of operator -> More...
 
 operator T * () const
 Cast operator to implicitely convert the pointer to its raw pointer type (T*) More...
 
ThreadLocalPtr< T > & operator= (T *value)
 Assignment operator for a raw pointer parameter. More...
 
ThreadLocalPtr< T > & operator= (const ThreadLocalPtr< T > &right)
 Assignment operator for a ThreadLocalPtr parameter. More...
 
+ + + + + + + +

+Private Member Functions

void setValue (void *value)
 Set the thread-specific value of the variable. More...
 
void * getValue () const
 Retrieve the thread-specific value of the variable. More...
 
+

Detailed Description

+

template<typename T>
+class sf::ThreadLocalPtr< T >

+ +

Pointer to a thread-local variable.

+

sf::ThreadLocalPtr is a type-safe wrapper for storing pointers to thread-local variables.

+

A thread-local variable holds a different value for each different thread, unlike normal variable that are shared.

+

Its usage is completely transparent, so that it is similar to manipulating the raw pointer directly (like any smart pointer).

+

Usage example:

+
MyClass object1;
+
MyClass object2;
+ +
+
void thread1()
+
{
+
objectPtr = &object1; // doesn't impact thread2
+
...
+
}
+
+
void thread2()
+
{
+
objectPtr = &object2; // doesn't impact thread1
+
...
+
}
+
+
int main()
+
{
+
// Create and launch the two threads
+
sf::Thread t1(&thread1);
+
sf::Thread t2(&thread2);
+
t1.launch();
+
t2.launch();
+
+
return 0;
+
}
+

ThreadLocalPtr is designed for internal use; however you can use it if you feel like it fits well your implementation.

+ +

Definition at line 41 of file ThreadLocalPtr.hpp.

+

Constructor & Destructor Documentation

+ +
+
+
+template<typename T >
+ + + + + + + + +
sf::ThreadLocalPtr< T >::ThreadLocalPtr (T * value = NULL)
+
+ +

Default constructor.

+
Parameters
+ + +
valueOptional value to initalize the variable
+
+
+ +

Definition at line 30 of file ThreadLocalPtr.inl.

+ +
+
+

Member Function Documentation

+ +
+
+
+template<typename T >
+ + + + + + + +
sf::ThreadLocalPtr< T >::operator T * () const
+
+ +

Cast operator to implicitely convert the pointer to its raw pointer type (T*)

+
Returns
Pointer to the actual object
+ +

Definition at line 54 of file ThreadLocalPtr.inl.

+ +
+
+ +
+
+
+template<typename T >
+ + + + + + + +
T & sf::ThreadLocalPtr< T >::operator* () const
+
+ +

Overload of unary operator *.

+

Like raw pointers, applying the * operator returns a reference to the pointed object.

+
Returns
Reference to the pointed object
+ +

Definition at line 38 of file ThreadLocalPtr.inl.

+ +
+
+ +
+
+
+template<typename T >
+ + + + + + + +
T * sf::ThreadLocalPtr< T >::operator-> () const
+
+ +

Overload of operator ->

+

Like raw pointers, applying the -> operator returns the pointed object.

+
Returns
Pointed object
+ +

Definition at line 46 of file ThreadLocalPtr.inl.

+ +
+
+ +
+
+
+template<typename T >
+ + + + + + + + +
ThreadLocalPtr< T > & sf::ThreadLocalPtr< T >::operator= (T * value)
+
+ +

Assignment operator for a raw pointer parameter.

+
Parameters
+ + +
valuePointer to assign
+
+
+
Returns
Reference to self
+ +

Definition at line 62 of file ThreadLocalPtr.inl.

+ +
+
+ +
+
+
+template<typename T >
+ + + + + + + + +
ThreadLocalPtr< T > & sf::ThreadLocalPtr< T >::operator= (const ThreadLocalPtr< T > & right)
+
+ +

Assignment operator for a ThreadLocalPtr parameter.

+
Parameters
+ + +
rightThreadLocalPtr to assign
+
+
+
Returns
Reference to self
+ +

Definition at line 71 of file ThreadLocalPtr.inl.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.png new file mode 100644 index 0000000..1796db7 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1ThreadLocalPtr.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time-members.htm new file mode 100644 index 0000000..5ed07cd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time-members.htm @@ -0,0 +1,87 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Time Member List
+
+
+ +

This is the complete list of members for sf::Time, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
asMicroseconds() const sf::Time
asMilliseconds() const sf::Time
asSeconds() const sf::Time
microseconds (defined in sf::Time)sf::Timefriend
microseconds(Int64 amount)sf::Timerelated
milliseconds (defined in sf::Time)sf::Timefriend
milliseconds(Int32 amount)sf::Timerelated
operator!=(Time left, Time right)sf::Timerelated
operator*(Time left, float right)sf::Timerelated
operator*(Time left, Int64 right)sf::Timerelated
operator*(float left, Time right)sf::Timerelated
operator*(Int64 left, Time right)sf::Timerelated
operator*=(Time &left, float right)sf::Timerelated
operator*=(Time &left, Int64 right)sf::Timerelated
operator+(Time left, Time right)sf::Timerelated
operator+=(Time &left, Time right)sf::Timerelated
operator-(Time right)sf::Timerelated
operator-(Time left, Time right)sf::Timerelated
operator-=(Time &left, Time right)sf::Timerelated
operator/(Time left, float right)sf::Timerelated
operator/(Time left, Int64 right)sf::Timerelated
operator/=(Time &left, float right)sf::Timerelated
operator/=(Time &left, Int64 right)sf::Timerelated
operator<(Time left, Time right)sf::Timerelated
operator<=(Time left, Time right)sf::Timerelated
operator==(Time left, Time right)sf::Timerelated
operator>(Time left, Time right)sf::Timerelated
operator>=(Time left, Time right)sf::Timerelated
seconds (defined in sf::Time)sf::Timefriend
seconds(float amount)sf::Timerelated
Time()sf::Time
Zerosf::Timestatic
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time.htm new file mode 100644 index 0000000..9b6faa8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Time.htm @@ -0,0 +1,1320 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Represents a time value. + More...

+ +

#include <Time.hpp>

+ + + + + + + + + + + + + + +

+Public Member Functions

 Time ()
 Default constructor. More...
 
float asSeconds () const
 Return the time value as a number of seconds. More...
 
Int32 asMilliseconds () const
 Return the time value as a number of milliseconds. More...
 
Int64 asMicroseconds () const
 Return the time value as a number of microseconds. More...
 
+ + + + +

+Static Public Attributes

static const Time Zero
 Predefined "zero" time value. More...
 
+ + + + + + + +

+Friends

+Time seconds (float)
 
+Time milliseconds (Int32)
 
+Time microseconds (Int64)
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
Time seconds (float amount)
 Construct a time value from a number of seconds. More...
 
Time milliseconds (Int32 amount)
 Construct a time value from a number of milliseconds. More...
 
Time microseconds (Int64 amount)
 Construct a time value from a number of microseconds. More...
 
bool operator== (Time left, Time right)
 Overload of == operator to compare two time values. More...
 
bool operator!= (Time left, Time right)
 Overload of != operator to compare two time values. More...
 
bool operator< (Time left, Time right)
 Overload of < operator to compare two time values. More...
 
bool operator> (Time left, Time right)
 Overload of > operator to compare two time values. More...
 
bool operator<= (Time left, Time right)
 Overload of <= operator to compare two time values. More...
 
bool operator>= (Time left, Time right)
 Overload of >= operator to compare two time values. More...
 
Time operator- (Time right)
 Overload of unary - operator to negate a time value. More...
 
Time operator+ (Time left, Time right)
 Overload of binary + operator to add two time values. More...
 
Timeoperator+= (Time &left, Time right)
 Overload of binary += operator to add/assign two time values. More...
 
Time operator- (Time left, Time right)
 Overload of binary - operator to subtract two time values. More...
 
Timeoperator-= (Time &left, Time right)
 Overload of binary -= operator to subtract/assign two time values. More...
 
Time operator* (Time left, float right)
 Overload of binary * operator to scale a time value. More...
 
Time operator* (Time left, Int64 right)
 Overload of binary * operator to scale a time value. More...
 
Time operator* (float left, Time right)
 Overload of binary * operator to scale a time value. More...
 
Time operator* (Int64 left, Time right)
 Overload of binary * operator to scale a time value. More...
 
Timeoperator*= (Time &left, float right)
 Overload of binary *= operator to scale/assign a time value. More...
 
Timeoperator*= (Time &left, Int64 right)
 Overload of binary *= operator to scale/assign a time value. More...
 
Time operator/ (Time left, float right)
 Overload of binary / operator to scale a time value. More...
 
Time operator/ (Time left, Int64 right)
 Overload of binary / operator to scale a time value. More...
 
Timeoperator/= (Time &left, float right)
 Overload of binary /= operator to scale/assign a time value. More...
 
Timeoperator/= (Time &left, Int64 right)
 Overload of binary /= operator to scale/assign a time value. More...
 
+

Detailed Description

+

Represents a time value.

+

sf::Time encapsulates a time value in a flexible way.

+

It allows to define a time value either as a number of seconds, milliseconds or microseconds. It also works the other way round: you can read a time value as either a number of seconds, milliseconds or microseconds.

+

By using such a flexible interface, the API doesn't impose any fixed type or resolution for time values, and let the user choose its own favorite representation.

+

Time values support the usual mathematical operations: you can add or subtract two times, multiply or divide a time by a number, compare two times, etc.

+

Since they represent a time span and not an absolute time value, times can also be negative.

+

Usage example:

+
sf::Time t1 = sf::seconds(0.1f);
+
Int32 milli = t1.asMilliseconds(); // 100
+
+
sf::Time t2 = sf::milliseconds(30);
+
Int64 micro = t2.asMicroseconds(); // 30000
+
+
sf::Time t3 = sf::microseconds(-800000);
+
float sec = t3.asSeconds(); // -0.8
+
void update(sf::Time elapsed)
+
{
+
position += speed * elapsed.asSeconds();
+
}
+
+
update(sf::milliseconds(100));
+
See Also
sf::Clock
+ +

Definition at line 40 of file Time.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Time::Time ()
+
+ +

Default constructor.

+

Sets the time value to zero.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
Int64 sf::Time::asMicroseconds () const
+
+ +

Return the time value as a number of microseconds.

+
Returns
Time in microseconds
+
See Also
asSeconds, asMilliseconds
+ +
+
+ +
+
+ + + + + + + +
Int32 sf::Time::asMilliseconds () const
+
+ +

Return the time value as a number of milliseconds.

+
Returns
Time in milliseconds
+
See Also
asSeconds, asMicroseconds
+ +
+
+ +
+
+ + + + + + + +
float sf::Time::asSeconds () const
+
+ +

Return the time value as a number of seconds.

+
Returns
Time in seconds
+
See Also
asMilliseconds, asMicroseconds
+ +
+
+

Friends And Related Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + +
Time microseconds (Int64 amount)
+
+related
+
+ +

Construct a time value from a number of microseconds.

+
Parameters
+ + +
amountNumber of microseconds
+
+
+
Returns
Time value constructed from the amount of microseconds
+
See Also
seconds, milliseconds
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Time milliseconds (Int32 amount)
+
+related
+
+ +

Construct a time value from a number of milliseconds.

+
Parameters
+ + +
amountNumber of milliseconds
+
+
+
Returns
Time value constructed from the amount of milliseconds
+
See Also
seconds, microseconds
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (Time left,
Time right 
)
+
+related
+
+ +

Overload of != operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if both time values are different
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator* (Time left,
float right 
)
+
+related
+
+ +

Overload of binary * operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator* (Time left,
Int64 right 
)
+
+related
+
+ +

Overload of binary * operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator* (float left,
Time right 
)
+
+related
+
+ +

Overload of binary * operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a number)
rightRight operand (a time)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator* (Int64 left,
Time right 
)
+
+related
+
+ +

Overload of binary * operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a number)
rightRight operand (a time)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator*= (Timeleft,
float right 
)
+
+related
+
+ +

Overload of binary *= operator to scale/assign a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator*= (Timeleft,
Int64 right 
)
+
+related
+
+ +

Overload of binary *= operator to scale/assign a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left multiplied by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator+ (Time left,
Time right 
)
+
+related
+
+ +

Overload of binary + operator to add two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
Sum of the two times values
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator+= (Timeleft,
Time right 
)
+
+related
+
+ +

Overload of binary += operator to add/assign two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
Sum of the two times values
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Time operator- (Time right)
+
+related
+
+ +

Overload of unary - operator to negate a time value.

+
Parameters
+ + +
rightRight operand (a time)
+
+
+
Returns
Opposite of the time value
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator- (Time left,
Time right 
)
+
+related
+
+ +

Overload of binary - operator to subtract two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
Difference of the two times values
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator-= (Timeleft,
Time right 
)
+
+related
+
+ +

Overload of binary -= operator to subtract/assign two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
Difference of the two times values
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator/ (Time left,
float right 
)
+
+related
+
+ +

Overload of binary / operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left divided by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time operator/ (Time left,
Int64 right 
)
+
+related
+
+ +

Overload of binary / operator to scale a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left divided by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator/= (Timeleft,
float right 
)
+
+related
+
+ +

Overload of binary /= operator to scale/assign a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left divided by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Time & operator/= (Timeleft,
Int64 right 
)
+
+related
+
+ +

Overload of binary /= operator to scale/assign a time value.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a number)
+
+
+
Returns
left divided by right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator< (Time left,
Time right 
)
+
+related
+
+ +

Overload of < operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if left is lesser than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator<= (Time left,
Time right 
)
+
+related
+
+ +

Overload of <= operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if left is lesser or equal than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (Time left,
Time right 
)
+
+related
+
+ +

Overload of == operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if both time values are equal
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator> (Time left,
Time right 
)
+
+related
+
+ +

Overload of > operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if left is greater than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator>= (Time left,
Time right 
)
+
+related
+
+ +

Overload of >= operator to compare two time values.

+
Parameters
+ + + +
leftLeft operand (a time)
rightRight operand (a time)
+
+
+
Returns
True if left is greater or equal than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
Time seconds (float amount)
+
+related
+
+ +

Construct a time value from a number of seconds.

+
Parameters
+ + +
amountNumber of seconds
+
+
+
Returns
Time value constructed from the amount of seconds
+
See Also
milliseconds, microseconds
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
const Time sf::Time::Zero
+
+static
+
+ +

Predefined "zero" time value.

+ +

Definition at line 85 of file Time.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform-members.htm new file mode 100644 index 0000000..11b83f6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform-members.htm @@ -0,0 +1,76 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Transform Member List
+
+
+ +

This is the complete list of members for sf::Transform, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + +
combine(const Transform &transform)sf::Transform
getInverse() const sf::Transform
getMatrix() const sf::Transform
Identitysf::Transformstatic
operator*(const Transform &left, const Transform &right)sf::Transformrelated
operator*(const Transform &left, const Vector2f &right)sf::Transformrelated
operator*=(Transform &left, const Transform &right)sf::Transformrelated
rotate(float angle)sf::Transform
rotate(float angle, float centerX, float centerY)sf::Transform
rotate(float angle, const Vector2f &center)sf::Transform
scale(float scaleX, float scaleY)sf::Transform
scale(float scaleX, float scaleY, float centerX, float centerY)sf::Transform
scale(const Vector2f &factors)sf::Transform
scale(const Vector2f &factors, const Vector2f &center)sf::Transform
Transform()sf::Transform
Transform(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)sf::Transform
transformPoint(float x, float y) const sf::Transform
transformPoint(const Vector2f &point) const sf::Transform
transformRect(const FloatRect &rectangle) const sf::Transform
translate(float x, float y)sf::Transform
translate(const Vector2f &offset)sf::Transform
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform.htm new file mode 100644 index 0000000..ec309aa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transform.htm @@ -0,0 +1,934 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Define a 3x3 transform matrix. + More...

+ +

#include <Transform.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Transform ()
 Default constructor. More...
 
 Transform (float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)
 Construct a transform from a 3x3 matrix. More...
 
const float * getMatrix () const
 Return the transform as a 4x4 matrix. More...
 
Transform getInverse () const
 Return the inverse of the transform. More...
 
Vector2f transformPoint (float x, float y) const
 Transform a 2D point. More...
 
Vector2f transformPoint (const Vector2f &point) const
 Transform a 2D point. More...
 
FloatRect transformRect (const FloatRect &rectangle) const
 Transform a rectangle. More...
 
Transformcombine (const Transform &transform)
 Combine the current transform with another one. More...
 
Transformtranslate (float x, float y)
 Combine the current transform with a translation. More...
 
Transformtranslate (const Vector2f &offset)
 Combine the current transform with a translation. More...
 
Transformrotate (float angle)
 Combine the current transform with a rotation. More...
 
Transformrotate (float angle, float centerX, float centerY)
 Combine the current transform with a rotation. More...
 
Transformrotate (float angle, const Vector2f &center)
 Combine the current transform with a rotation. More...
 
Transformscale (float scaleX, float scaleY)
 Combine the current transform with a scaling. More...
 
Transformscale (float scaleX, float scaleY, float centerX, float centerY)
 Combine the current transform with a scaling. More...
 
Transformscale (const Vector2f &factors)
 Combine the current transform with a scaling. More...
 
Transformscale (const Vector2f &factors, const Vector2f &center)
 Combine the current transform with a scaling. More...
 
+ + + + +

+Static Public Attributes

static const Transform Identity
 The identity transform (does nothing) More...
 
+ + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
Transform operator* (const Transform &left, const Transform &right)
 Overload of binary operator * to combine two transforms. More...
 
Transformoperator*= (Transform &left, const Transform &right)
 Overload of binary operator *= to combine two transforms. More...
 
Vector2f operator* (const Transform &left, const Vector2f &right)
 Overload of binary operator * to transform a point. More...
 
+

Detailed Description

+

Define a 3x3 transform matrix.

+

A sf::Transform specifies how to translate, rotate, scale, shear, project, whatever things.

+

In mathematical terms, it defines how to transform a coordinate system into another.

+

For example, if you apply a rotation transform to a sprite, the result will be a rotated sprite. And anything that is transformed by this rotation transform will be rotated the same way, according to its initial position.

+

Transforms are typically used for drawing. But they can also be used for any computation that requires to transform points between the local and global coordinate systems of an entity (like collision detection).

+

Example:

+
// define a translation transform
+
sf::Transform translation;
+
translation.translate(20, 50);
+
+
// define a rotation transform
+
sf::Transform rotation;
+
rotation.rotate(45);
+
+
// combine them
+
sf::Transform transform = translation * rotation;
+
+
// use the result to transform stuff...
+
sf::Vector2f point = transform.transformPoint(10, 20);
+
sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100));
+
See Also
sf::Transformable, sf::RenderStates
+ +

Definition at line 42 of file Transform.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Transform::Transform ()
+
+ +

Default constructor.

+

Creates an identity transform (a transform that does nothing).

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::Transform::Transform (float a00,
float a01,
float a02,
float a10,
float a11,
float a12,
float a20,
float a21,
float a22 
)
+
+ +

Construct a transform from a 3x3 matrix.

+
Parameters
+ + + + + + + + + + +
a00Element (0, 0) of the matrix
a01Element (0, 1) of the matrix
a02Element (0, 2) of the matrix
a10Element (1, 0) of the matrix
a11Element (1, 1) of the matrix
a12Element (1, 2) of the matrix
a20Element (2, 0) of the matrix
a21Element (2, 1) of the matrix
a22Element (2, 2) of the matrix
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Transform& sf::Transform::combine (const Transformtransform)
+
+ +

Combine the current transform with another one.

+

The result is a transform that is equivalent to applying *this followed by transform. Mathematically, it is equivalent to a matrix multiplication.

+
Parameters
+ + +
transformTransform to combine with this transform
+
+
+
Returns
Reference to *this
+ +
+
+ +
+
+ + + + + + + +
Transform sf::Transform::getInverse () const
+
+ +

Return the inverse of the transform.

+

If the inverse cannot be computed, an identity transform is returned.

+
Returns
A new transform which is the inverse of self
+ +
+
+ +
+
+ + + + + + + +
const float* sf::Transform::getMatrix () const
+
+ +

Return the transform as a 4x4 matrix.

+

This function returns a pointer to an array of 16 floats containing the transform elements as a 4x4 matrix, which is directly compatible with OpenGL functions.

+
sf::Transform transform = ...;
+
glLoadMatrixf(transform.getMatrix());
+
Returns
Pointer to a 4x4 matrix
+ +
+
+ +
+
+ + + + + + + + +
Transform& sf::Transform::rotate (float angle)
+
+ +

Combine the current transform with a rotation.

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.rotate(90).translate(50, 20);
+
Parameters
+ + +
angleRotation angle, in degrees
+
+
+
Returns
Reference to *this
+
See Also
translate, scale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::rotate (float angle,
float centerX,
float centerY 
)
+
+ +

Combine the current transform with a rotation.

+

The center of rotation is provided for convenience as a second argument, so that you can build rotations around arbitrary points more easily (and efficiently) than the usual translate(-center).rotate(angle).translate(center).

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.rotate(90, 8, 3).translate(50, 20);
+
Parameters
+ + + + +
angleRotation angle, in degrees
centerXX coordinate of the center of rotation
centerYY coordinate of the center of rotation
+
+
+
Returns
Reference to *this
+
See Also
translate, scale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::rotate (float angle,
const Vector2fcenter 
)
+
+ +

Combine the current transform with a rotation.

+

The center of rotation is provided for convenience as a second argument, so that you can build rotations around arbitrary points more easily (and efficiently) than the usual translate(-center).rotate(angle).translate(center).

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.rotate(90, sf::Vector2f(8, 3)).translate(sf::Vector2f(50, 20));
+
Parameters
+ + + +
angleRotation angle, in degrees
centerCenter of rotation
+
+
+
Returns
Reference to *this
+
See Also
translate, scale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::scale (float scaleX,
float scaleY 
)
+
+ +

Combine the current transform with a scaling.

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.scale(2, 1).rotate(45);
+
Parameters
+ + + +
scaleXScaling factor on the X axis
scaleYScaling factor on the Y axis
+
+
+
Returns
Reference to *this
+
See Also
translate, rotate
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::scale (float scaleX,
float scaleY,
float centerX,
float centerY 
)
+
+ +

Combine the current transform with a scaling.

+

The center of scaling is provided for convenience as a second argument, so that you can build scaling around arbitrary points more easily (and efficiently) than the usual translate(-center).scale(factors).translate(center).

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.scale(2, 1, 8, 3).rotate(45);
+
Parameters
+ + + + + +
scaleXScaling factor on X axis
scaleYScaling factor on Y axis
centerXX coordinate of the center of scaling
centerYY coordinate of the center of scaling
+
+
+
Returns
Reference to *this
+
See Also
translate, rotate
+ +
+
+ +
+
+ + + + + + + + +
Transform& sf::Transform::scale (const Vector2ffactors)
+
+ +

Combine the current transform with a scaling.

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.scale(sf::Vector2f(2, 1)).rotate(45);
+
Parameters
+ + +
factorsScaling factors
+
+
+
Returns
Reference to *this
+
See Also
translate, rotate
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::scale (const Vector2ffactors,
const Vector2fcenter 
)
+
+ +

Combine the current transform with a scaling.

+

The center of scaling is provided for convenience as a second argument, so that you can build scaling around arbitrary points more easily (and efficiently) than the usual translate(-center).scale(factors).translate(center).

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).rotate(45);
+
Parameters
+ + + +
factorsScaling factors
centerCenter of scaling
+
+
+
Returns
Reference to *this
+
See Also
translate, rotate
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Vector2f sf::Transform::transformPoint (float x,
float y 
) const
+
+ +

Transform a 2D point.

+
Parameters
+ + + +
xX coordinate of the point to transform
yY coordinate of the point to transform
+
+
+
Returns
Transformed point
+ +
+
+ +
+
+ + + + + + + + +
Vector2f sf::Transform::transformPoint (const Vector2fpoint) const
+
+ +

Transform a 2D point.

+
Parameters
+ + +
pointPoint to transform
+
+
+
Returns
Transformed point
+ +
+
+ +
+
+ + + + + + + + +
FloatRect sf::Transform::transformRect (const FloatRectrectangle) const
+
+ +

Transform a rectangle.

+

Since SFML doesn't provide support for oriented rectangles, the result of this function is always an axis-aligned rectangle. Which means that if the transform contains a rotation, the bounding rectangle of the transformed rectangle is returned.

+
Parameters
+ + +
rectangleRectangle to transform
+
+
+
Returns
Transformed rectangle
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
Transform& sf::Transform::translate (float x,
float y 
)
+
+ +

Combine the current transform with a translation.

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.translate(100, 200).rotate(45);
+
Parameters
+ + + +
xOffset to apply on X axis
yOffset to apply on Y axis
+
+
+
Returns
Reference to *this
+
See Also
rotate, scale
+ +
+
+ +
+
+ + + + + + + + +
Transform& sf::Transform::translate (const Vector2foffset)
+
+ +

Combine the current transform with a translation.

+

This function returns a reference to *this, so that calls can be chained.

+
sf::Transform transform;
+
transform.translate(sf::Vector2f(100, 200)).rotate(45);
+
Parameters
+ + +
offsetTranslation offset to apply
+
+
+
Returns
Reference to *this
+
See Also
rotate, scale
+ +
+
+

Friends And Related Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Transform operator* (const Transformleft,
const Transformright 
)
+
+related
+
+ +

Overload of binary operator * to combine two transforms.

+

This call is equivalent to calling Transform(left).combine(right).

+
Parameters
+ + + +
leftLeft operand (the first transform)
rightRight operand (the second transform)
+
+
+
Returns
New combined transform
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2f operator* (const Transformleft,
const Vector2fright 
)
+
+related
+
+ +

Overload of binary operator * to transform a point.

+

This call is equivalent to calling left.transformPoint(right).

+
Parameters
+ + + +
leftLeft operand (the transform)
rightRight operand (the point to transform)
+
+
+
Returns
New transformed point
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Transform & operator*= (Transformleft,
const Transformright 
)
+
+related
+
+ +

Overload of binary operator *= to combine two transforms.

+

This call is equivalent to calling left.combine(right).

+
Parameters
+ + + +
leftLeft operand (the first transform)
rightRight operand (the second transform)
+
+
+
Returns
The combined transform
+ +
+
+

Member Data Documentation

+ +
+
+ + + + + +
+ + + + +
const Transform sf::Transform::Identity
+
+static
+
+ +

The identity transform (does nothing)

+ +

Definition at line 354 of file Transform.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable-members.htm new file mode 100644 index 0000000..7456797 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable-members.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Transformable Member List
+
+
+ +

This is the complete list of members for sf::Transformable, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
getInverseTransform() const sf::Transformable
getOrigin() const sf::Transformable
getPosition() const sf::Transformable
getRotation() const sf::Transformable
getScale() const sf::Transformable
getTransform() const sf::Transformable
move(float offsetX, float offsetY)sf::Transformable
move(const Vector2f &offset)sf::Transformable
rotate(float angle)sf::Transformable
scale(float factorX, float factorY)sf::Transformable
scale(const Vector2f &factor)sf::Transformable
setOrigin(float x, float y)sf::Transformable
setOrigin(const Vector2f &origin)sf::Transformable
setPosition(float x, float y)sf::Transformable
setPosition(const Vector2f &position)sf::Transformable
setRotation(float angle)sf::Transformable
setScale(float factorX, float factorY)sf::Transformable
setScale(const Vector2f &factors)sf::Transformable
Transformable()sf::Transformable
~Transformable()sf::Transformablevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.htm new file mode 100644 index 0000000..f5f16cc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.htm @@ -0,0 +1,715 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Transformable Class Reference
+
+
+ +

Decomposed transform defined by a position, a rotation and a scale. + More...

+ +

#include <Transformable.hpp>

+
+Inheritance diagram for sf::Transformable:
+
+
+ + +sf::Shape +sf::Sprite +sf::Text +sf::CircleShape +sf::ConvexShape +sf::RectangleShape + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Transformable ()
 Default constructor. More...
 
virtual ~Transformable ()
 Virtual destructor. More...
 
void setPosition (float x, float y)
 set the position of the object More...
 
void setPosition (const Vector2f &position)
 set the position of the object More...
 
void setRotation (float angle)
 set the orientation of the object More...
 
void setScale (float factorX, float factorY)
 set the scale factors of the object More...
 
void setScale (const Vector2f &factors)
 set the scale factors of the object More...
 
void setOrigin (float x, float y)
 set the local origin of the object More...
 
void setOrigin (const Vector2f &origin)
 set the local origin of the object More...
 
const Vector2fgetPosition () const
 get the position of the object More...
 
float getRotation () const
 get the orientation of the object More...
 
const Vector2fgetScale () const
 get the current scale of the object More...
 
const Vector2fgetOrigin () const
 get the local origin of the object More...
 
void move (float offsetX, float offsetY)
 Move the object by a given offset. More...
 
void move (const Vector2f &offset)
 Move the object by a given offset. More...
 
void rotate (float angle)
 Rotate the object. More...
 
void scale (float factorX, float factorY)
 Scale the object. More...
 
void scale (const Vector2f &factor)
 Scale the object. More...
 
const TransformgetTransform () const
 get the combined transform of the object More...
 
const TransformgetInverseTransform () const
 get the inverse of the combined transform of the object More...
 
+

Detailed Description

+

Decomposed transform defined by a position, a rotation and a scale.

+

This class is provided for convenience, on top of sf::Transform.

+

sf::Transform, as a low-level class, offers a great level of flexibility but it is not always convenient to manage. Indeed, one can easily combine any kind of operation, such as a translation followed by a rotation followed by a scaling, but once the result transform is built, there's no way to go backward and, let's say, change only the rotation without modifying the translation and scaling. The entire transform must be recomputed, which means that you need to retrieve the initial translation and scale factors as well, and combine them the same way you did before updating the rotation. This is a tedious operation, and it requires to store all the individual components of the final transform.

+

That's exactly what sf::Transformable was written for: it hides these variables and the composed transform behind an easy to use interface. You can set or get any of the individual components without worrying about the others. It also provides the composed transform (as a sf::Transform), and keeps it up-to-date.

+

In addition to the position, rotation and scale, sf::Transformable provides an "origin" component, which represents the local origin of the three other components. Let's take an example with a 10x10 pixels sprite. By default, the sprite is positioned/rotated/scaled relatively to its top-left corner, because it is the local point (0, 0). But if we change the origin to be (5, 5), the sprite will be positioned/rotated/scaled around its center instead. And if we set the origin to (10, 10), it will be transformed around its bottom-right corner.

+

To keep the sf::Transformable class simple, there's only one origin for all the components. You cannot position the sprite relatively to its top-left corner while rotating it around its center, for example. To do such things, use sf::Transform directly.

+

sf::Transformable can be used as a base class. It is often combined with sf::Drawable – that's what SFML's sprites, texts and shapes do.

+
class MyEntity : public sf::Transformable, public sf::Drawable
+
{
+
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
+
{
+
states.transform *= getTransform();
+
target.draw(..., states);
+
}
+
};
+
+
MyEntity entity;
+
entity.setPosition(10, 20);
+
entity.setRotation(45);
+
window.draw(entity);
+

It can also be used as a member, if you don't want to use its API directly (because you don't need all its functions, or you have different naming conventions for example).

+
class MyEntity
+
{
+
public :
+
void SetPosition(const MyVector& v)
+
{
+
myTransform.setPosition(v.x(), v.y());
+
}
+
+
void Draw(sf::RenderTarget& target) const
+
{
+
target.draw(..., myTransform.getTransform());
+
}
+
+
private :
+
sf::Transformable myTransform;
+
};
+
See Also
sf::Transform
+ +

Definition at line 41 of file Transformable.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Transformable::Transformable ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Transformable::~Transformable ()
+
+virtual
+
+ +

Virtual destructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const Transform& sf::Transformable::getInverseTransform () const
+
+ +

get the inverse of the combined transform of the object

+
Returns
Inverse of the combined transformations applied to the object
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + + + +
const Vector2f& sf::Transformable::getOrigin () const
+
+ +

get the local origin of the object

+
Returns
Current origin
+
See Also
setOrigin
+ +
+
+ +
+
+ + + + + + + +
const Vector2f& sf::Transformable::getPosition () const
+
+ +

get the position of the object

+
Returns
Current position
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + +
float sf::Transformable::getRotation () const
+
+ +

get the orientation of the object

+

The rotation is always in the range [0, 360].

+
Returns
Current rotation, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + + + +
const Vector2f& sf::Transformable::getScale () const
+
+ +

get the current scale of the object

+
Returns
Current scale factors
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + +
const Transform& sf::Transformable::getTransform () const
+
+ +

get the combined transform of the object

+
Returns
Transform combining the position/rotation/scale/origin of the object
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::move (float offsetX,
float offsetY 
)
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f pos = object.getPosition();
+
object.setPosition(pos.x + offsetX, pos.y + offsetY);
+
Parameters
+ + + +
offsetXX offset
offsetYY offset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::move (const Vector2foffset)
+
+ +

Move the object by a given offset.

+

This function adds to the current position of the object, unlike setPosition which overwrites it. Thus, it is equivalent to the following code:

+
object.setPosition(object.getPosition() + offset);
+
Parameters
+ + +
offsetOffset
+
+
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::rotate (float angle)
+
+ +

Rotate the object.

+

This function adds to the current rotation of the object, unlike setRotation which overwrites it. Thus, it is equivalent to the following code:

+
object.setRotation(object.getRotation() + angle);
+
Parameters
+ + +
angleAngle of rotation, in degrees
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::scale (float factorX,
float factorY 
)
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factorX, scale.y * factorY);
+
Parameters
+ + + +
factorXHorizontal scale factor
factorYVertical scale factor
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::scale (const Vector2ffactor)
+
+ +

Scale the object.

+

This function multiplies the current scale of the object, unlike setScale which overwrites it. Thus, it is equivalent to the following code:

+
sf::Vector2f scale = object.getScale();
+
object.setScale(scale.x * factor.x, scale.y * factor.y);
+
Parameters
+ + +
factorScale factors
+
+
+
See Also
setScale
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setOrigin (float x,
float y 
)
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new origin
yY coordinate of the new origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::setOrigin (const Vector2forigin)
+
+ +

set the local origin of the object

+

The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).

+
Parameters
+ + +
originNew origin
+
+
+
See Also
getOrigin
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setPosition (float x,
float y 
)
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + + +
xX coordinate of the new position
yY coordinate of the new position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::setPosition (const Vector2fposition)
+
+ +

set the position of the object

+

This function completely overwrites the previous position. See the move function to apply an offset based on the previous position instead. The default position of a transformable object is (0, 0).

+
Parameters
+ + +
positionNew position
+
+
+
See Also
move, getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::setRotation (float angle)
+
+ +

set the orientation of the object

+

This function completely overwrites the previous rotation. See the rotate function to add an angle based on the previous rotation instead. The default rotation of a transformable object is 0.

+
Parameters
+ + +
angleNew rotation, in degrees
+
+
+
See Also
rotate, getRotation
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Transformable::setScale (float factorX,
float factorY 
)
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + + +
factorXNew horizontal scale factor
factorYNew vertical scale factor
+
+
+
See Also
scale, getScale
+ +
+
+ +
+
+ + + + + + + + +
void sf::Transformable::setScale (const Vector2ffactors)
+
+ +

set the scale factors of the object

+

This function completely overwrites the previous scale. See the scale function to add a factor based on the previous scale instead. The default scale of a transformable object is (1, 1).

+
Parameters
+ + +
factorsNew scale factors
+
+
+
See Also
scale, getScale
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.png new file mode 100644 index 0000000..6865caa Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Transformable.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket-members.htm new file mode 100644 index 0000000..34f43de --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket-members.htm @@ -0,0 +1,81 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::UdpSocket Member List
+
+
+ +

This is the complete list of members for sf::UdpSocket, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
AnyPort enum valuesf::Socket
bind(unsigned short port)sf::UdpSocket
close()sf::Socketprotected
create()sf::Socketprotected
create(SocketHandle handle)sf::Socketprotected
Disconnected enum valuesf::Socket
Done enum valuesf::Socket
Error enum valuesf::Socket
getHandle() const sf::Socketprotected
getLocalPort() const sf::UdpSocket
isBlocking() const sf::Socket
MaxDatagramSize enum valuesf::UdpSocket
NotReady enum valuesf::Socket
receive(void *data, std::size_t size, std::size_t &received, IpAddress &remoteAddress, unsigned short &remotePort)sf::UdpSocket
receive(Packet &packet, IpAddress &remoteAddress, unsigned short &remotePort)sf::UdpSocket
send(const void *data, std::size_t size, const IpAddress &remoteAddress, unsigned short remotePort)sf::UdpSocket
send(Packet &packet, const IpAddress &remoteAddress, unsigned short remotePort)sf::UdpSocket
setBlocking(bool blocking)sf::Socket
Socket(Type type)sf::Socketprotected
Status enum namesf::Socket
Tcp enum valuesf::Socketprotected
Type enum namesf::Socketprotected
Udp enum valuesf::Socketprotected
UdpSocket()sf::UdpSocket
unbind()sf::UdpSocket
~Socket()sf::Socketvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.htm new file mode 100644 index 0000000..08d46cf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.htm @@ -0,0 +1,785 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Specialized socket using the UDP protocol. + More...

+ +

#include <UdpSocket.hpp>

+
+Inheritance diagram for sf::UdpSocket:
+
+
+ + +sf::Socket +sf::NonCopyable + +
+ + + + + + + + + + +

+Public Types

enum  { MaxDatagramSize = 65507 + }
 
enum  Status {
+  Done, +
+  NotReady, +
+  Disconnected, +
+  Error +
+ }
 Status codes that may be returned by socket functions. More...
 
enum  { AnyPort = 0 + }
 Some special values used by sockets. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 UdpSocket ()
 Default constructor. More...
 
unsigned short getLocalPort () const
 Get the port to which the socket is bound locally. More...
 
Status bind (unsigned short port)
 Bind the socket to a specific port. More...
 
void unbind ()
 Unbind the socket from the local port to which it is bound. More...
 
Status send (const void *data, std::size_t size, const IpAddress &remoteAddress, unsigned short remotePort)
 Send raw data to a remote peer. More...
 
Status receive (void *data, std::size_t size, std::size_t &received, IpAddress &remoteAddress, unsigned short &remotePort)
 Receive raw data from a remote peer. More...
 
Status send (Packet &packet, const IpAddress &remoteAddress, unsigned short remotePort)
 Send a formatted packet of data to a remote peer. More...
 
Status receive (Packet &packet, IpAddress &remoteAddress, unsigned short &remotePort)
 Receive a formatted packet of data from a remote peer. More...
 
void setBlocking (bool blocking)
 Set the blocking state of the socket. More...
 
bool isBlocking () const
 Tell whether the socket is in blocking or non-blocking mode. More...
 
+ + + + +

+Protected Types

enum  Type {
+  Tcp, +
+  Udp +
+ }
 Types of protocols that the socket can use. More...
 
+ + + + + + + + + + + + + +

+Protected Member Functions

SocketHandle getHandle () const
 Return the internal handle of the socket. More...
 
void create ()
 Create the internal representation of the socket. More...
 
void create (SocketHandle handle)
 Create the internal representation of the socket from a socket handle. More...
 
void close ()
 Close the socket gracefully. More...
 
+

Detailed Description

+

Specialized socket using the UDP protocol.

+

A UDP socket is a connectionless socket.

+

Instead of connecting once to a remote host, like TCP sockets, it can send to and receive from any host at any time.

+

It is a datagram protocol: bounded blocks of data (datagrams) are transfered over the network rather than a continuous stream of data (TCP). Therefore, one call to send will always match one call to receive (if the datagram is not lost), with the same data that was sent.

+

The UDP protocol is lightweight but unreliable. Unreliable means that datagrams may be duplicated, be lost or arrive reordered. However, if a datagram arrives, its data is guaranteed to be valid.

+

UDP is generally used for real-time communication (audio or video streaming, real-time games, etc.) where speed is crucial and lost data doesn't matter much.

+

Sending and receiving data can use either the low-level or the high-level functions. The low-level functions process a raw sequence of bytes, whereas the high-level interface uses packets (see sf::Packet), which are easier to use and provide more safety regarding the data that is exchanged. You can look at the sf::Packet class to get more details about how they work.

+

It is important to note that UdpSocket is unable to send datagrams bigger than MaxDatagramSize. In this case, it returns an error and doesn't send anything. This applies to both raw data and packets. Indeed, even packets are unable to split and recompose data, due to the unreliability of the protocol (dropped, mixed or duplicated datagrams may lead to a big mess when trying to recompose a packet).

+

If the socket is bound to a port, it is automatically unbound from it when the socket is destroyed. However, you can unbind the socket explicitely with the Unbind function if necessary, to stop receiving messages or make the port available for other sockets.

+

Usage example:

+
// ----- The client -----
+
+
// Create a socket and bind it to the port 55001
+ +
socket.bind(55001);
+
+
// Send a message to 192.168.1.50 on port 55002
+
std::string message = "Hi, I am " + sf::IpAddress::getLocalAddress().toString();
+
socket.send(message.c_str(), message.size() + 1, "192.168.1.50", 55002);
+
+
// Receive an answer (most likely from 192.168.1.50, but could be anyone else)
+
char buffer[1024];
+
std::size_t received = 0;
+ +
unsigned short port;
+
socket.receive(buffer, sizeof(buffer), received, sender, port);
+
std::cout << sender.ToString() << " said: " << buffer << std::endl;
+
+
// ----- The server -----
+
+
// Create a socket and bind it to the port 55002
+ +
socket.bind(55002);
+
+
// Receive a message from anyone
+
char buffer[1024];
+
std::size_t received = 0;
+ +
unsigned short port;
+
socket.receive(buffer, sizeof(buffer), received, sender, port);
+
std::cout << sender.ToString() << " said: " << buffer << std::endl;
+
+
// Send an answer
+
std::string message = "Welcome " + sender.toString();
+
socket.send(message.c_str(), message.size() + 1, sender, port);
+
See Also
sf::Socket, sf::TcpSocket, sf::Packet
+ +

Definition at line 45 of file UdpSocket.hpp.

+

Member Enumeration Documentation

+ +
+
+ + + + + +
+ + + + +
anonymous enum
+
+inherited
+
+ +

Some special values used by sockets.

+ + +
Enumerator
AnyPort  +

Special value that tells the system to pick any available port.

+
+ +

Definition at line 65 of file Socket.hpp.

+ +
+
+ +
+
+ + + + +
anonymous enum
+
+ + +
Enumerator
MaxDatagramSize  +

The maximum number of bytes that can be sent in a single UDP datagram.

+
+ +

Definition at line 52 of file UdpSocket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Status
+
+inherited
+
+ +

Status codes that may be returned by socket functions.

+ + + + + +
Enumerator
Done  +

The socket has sent / received the data.

+
NotReady  +

The socket is not ready to send / receive data yet.

+
Disconnected  +

The TCP socket has been disconnected.

+
Error  +

An unexpected error happened.

+
+ +

Definition at line 53 of file Socket.hpp.

+ +
+
+ +
+
+ + + + + +
+ + + + +
enum sf::Socket::Type
+
+protectedinherited
+
+ +

Types of protocols that the socket can use.

+ + + +
Enumerator
Tcp  +

TCP protocol.

+
Udp  +

UDP protocol.

+
+ +

Definition at line 113 of file Socket.hpp.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::UdpSocket::UdpSocket ()
+
+ +

Default constructor.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
Status sf::UdpSocket::bind (unsigned short port)
+
+ +

Bind the socket to a specific port.

+

Binding the socket to a port is necessary for being able to receive data on that port. You can use the special value Socket::AnyPort to tell the system to automatically pick an available port, and then call getLocalPort to retrieve the chosen port.

+
Parameters
+ + +
portPort to bind the socket to
+
+
+
Returns
Status code
+
See Also
unbind, getLocalPort
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::close ()
+
+protectedinherited
+
+ +

Close the socket gracefully.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
void sf::Socket::create ()
+
+protectedinherited
+
+ +

Create the internal representation of the socket.

+

This function can only be accessed by derived classes.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::create (SocketHandle handle)
+
+protectedinherited
+
+ +

Create the internal representation of the socket from a socket handle.

+

This function can only be accessed by derived classes.

+
Parameters
+ + +
handleOS-specific handle of the socket to wrap
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
SocketHandle sf::Socket::getHandle () const
+
+protectedinherited
+
+ +

Return the internal handle of the socket.

+

The returned handle may be invalid if the socket was not created yet (or already destroyed). This function can only be accessed by derived classes.

+
Returns
The internal (OS-specific) handle of the socket
+ +
+
+ +
+
+ + + + + + + +
unsigned short sf::UdpSocket::getLocalPort () const
+
+ +

Get the port to which the socket is bound locally.

+

If the socket is not bound to a port, this function returns 0.

+
Returns
Port to which the socket is bound
+
See Also
bind
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
bool sf::Socket::isBlocking () const
+
+inherited
+
+ +

Tell whether the socket is in blocking or non-blocking mode.

+
Returns
True if the socket is blocking, false otherwise
+
See Also
setBlocking
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::UdpSocket::receive (void * data,
std::size_t size,
std::size_t & received,
IpAddressremoteAddress,
unsigned short & remotePort 
)
+
+ +

Receive raw data from a remote peer.

+

In blocking mode, this function will wait until some bytes are actually received. Be careful to use a buffer which is large enough for the data that you intend to receive, if it is too small then an error will be returned and all the data will be lost.

+
Parameters
+ + + + + + +
dataPointer to the array to fill with the received bytes
sizeMaximum number of bytes that can be received
receivedThis variable is filled with the actual number of bytes received
remoteAddressAddress of the peer that sent the data
remotePortPort of the peer that sent the data
+
+
+
Returns
Status code
+
See Also
send
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::UdpSocket::receive (Packetpacket,
IpAddressremoteAddress,
unsigned short & remotePort 
)
+
+ +

Receive a formatted packet of data from a remote peer.

+

In blocking mode, this function will wait until the whole packet has been received.

+
Parameters
+ + + + +
packetPacket to fill with the received data
remoteAddressAddress of the peer that sent the data
remotePortPort of the peer that sent the data
+
+
+
Returns
Status code
+
See Also
send
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::UdpSocket::send (const void * data,
std::size_t size,
const IpAddressremoteAddress,
unsigned short remotePort 
)
+
+ +

Send raw data to a remote peer.

+

Make sure that size is not greater than UdpSocket::MaxDatagramSize, otherwise this function will fail and no data will be sent.

+
Parameters
+ + + + + +
dataPointer to the sequence of bytes to send
sizeNumber of bytes to send
remoteAddressAddress of the receiver
remotePortPort of the receiver to send the data to
+
+
+
Returns
Status code
+
See Also
receive
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Status sf::UdpSocket::send (Packetpacket,
const IpAddressremoteAddress,
unsigned short remotePort 
)
+
+ +

Send a formatted packet of data to a remote peer.

+

Make sure that the packet size is not greater than UdpSocket::MaxDatagramSize, otherwise this function will fail and no data will be sent.

+
Parameters
+ + + + +
packetPacket to send
remoteAddressAddress of the receiver
remotePortPort of the receiver to send the data to
+
+
+
Returns
Status code
+
See Also
receive
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
void sf::Socket::setBlocking (bool blocking)
+
+inherited
+
+ +

Set the blocking state of the socket.

+

In blocking mode, calls will not return until they have completed their task. For example, a call to Receive in blocking mode won't return until some data was actually received. In non-blocking mode, calls will always return immediately, using the return code to signal whether there was data available or not. By default, all sockets are blocking.

+
Parameters
+ + +
blockingTrue to set the socket as blocking, false for non-blocking
+
+
+
See Also
isBlocking
+ +
+
+ +
+
+ + + + + + + +
void sf::UdpSocket::unbind ()
+
+ +

Unbind the socket from the local port to which it is bound.

+

The port that the socket was previously using is immediately available after this function is called. If the socket is not bound to a port, this function has no effect.

+
See Also
bind
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.png new file mode 100644 index 0000000..1d089ed Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1UdpSocket.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf.htm new file mode 100644 index 0000000..8ec3459 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Utf< N > Class Template Reference
+
+
+ +

Utility class providing generic functions for UTF conversions. + More...

+ +

#include <Utf.hpp>

+

Detailed Description

+

template<unsigned int N>
+class sf::Utf< N >

+ +

Utility class providing generic functions for UTF conversions.

+

sf::Utf is a low-level, generic interface for counting, iterating, encoding and decoding Unicode characters and strings. It is able to handle ANSI, wide, latin-1, UTF-8, UTF-16 and UTF-32 encodings.

+

sf::Utf<X> functions are all static, these classes are not meant to be instanciated. All the functions are template, so that you can use any character / string type for a given encoding.

+

It has 3 specializations:

+ + +

Definition at line 41 of file Utf.hpp.

+

The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4-members.htm new file mode 100644 index 0000000..1553b78 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4-members.htm @@ -0,0 +1,68 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Utf< 16 > Member List
+
+
+ +

This is the complete list of members for sf::Utf< 16 >, including all inherited members.

+ + + + + + + + + + + + + + +
count(In begin, In end)sf::Utf< 16 >static
decode(In begin, In end, Uint32 &output, Uint32 replacement=0)sf::Utf< 16 >static
encode(Uint32 input, Out output, Uint16 replacement=0)sf::Utf< 16 >static
fromAnsi(In begin, In end, Out output, const std::locale &locale=std::locale())sf::Utf< 16 >static
fromLatin1(In begin, In end, Out output)sf::Utf< 16 >static
fromWide(In begin, In end, Out output)sf::Utf< 16 >static
next(In begin, In end)sf::Utf< 16 >static
toAnsi(In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())sf::Utf< 16 >static
toLatin1(In begin, In end, Out output, char replacement=0)sf::Utf< 16 >static
toUtf16(In begin, In end, Out output)sf::Utf< 16 >static
toUtf32(In begin, In end, Out output)sf::Utf< 16 >static
toUtf8(In begin, In end, Out output)sf::Utf< 16 >static
toWide(In begin, In end, Out output, wchar_t replacement=0)sf::Utf< 16 >static
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4.htm new file mode 100644 index 0000000..a0dbf4f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0116_01_4.htm @@ -0,0 +1,851 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Utf< 16 > Class Template Reference
+
+
+ +

Specialization of the Utf template for UTF-16. + More...

+ +

#include <Utf.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

template<typename In >
static In decode (In begin, In end, Uint32 &output, Uint32 replacement=0)
 Decode a single UTF-16 character. More...
 
template<typename Out >
static Out encode (Uint32 input, Out output, Uint16 replacement=0)
 Encode a single UTF-16 character. More...
 
template<typename In >
static In next (In begin, In end)
 Advance to the next UTF-16 character. More...
 
template<typename In >
static std::size_t count (In begin, In end)
 Count the number of characters of a UTF-16 sequence. More...
 
template<typename In , typename Out >
static Out fromAnsi (In begin, In end, Out output, const std::locale &locale=std::locale())
 Convert an ANSI characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out fromWide (In begin, In end, Out output)
 Convert a wide characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out fromLatin1 (In begin, In end, Out output)
 Convert a latin-1 (ISO-5589-1) characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out toAnsi (In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())
 Convert an UTF-16 characters range to ANSI characters. More...
 
template<typename In , typename Out >
static Out toWide (In begin, In end, Out output, wchar_t replacement=0)
 Convert an UTF-16 characters range to wide characters. More...
 
template<typename In , typename Out >
static Out toLatin1 (In begin, In end, Out output, char replacement=0)
 Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters. More...
 
template<typename In , typename Out >
static Out toUtf8 (In begin, In end, Out output)
 Convert a UTF-16 characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out toUtf16 (In begin, In end, Out output)
 Convert a UTF-16 characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out toUtf32 (In begin, In end, Out output)
 Convert a UTF-16 characters range to UTF-32. More...
 
+

Detailed Description

+

template<>
+class sf::Utf< 16 >

+ +

Specialization of the Utf template for UTF-16.

+ +

Definition at line 255 of file Utf.hpp.

+

Member Function Documentation

+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static std::size_t sf::Utf< 16 >::count (In begin,
In end 
)
+
+static
+
+ +

Count the number of characters of a UTF-16 sequence.

+

This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element, thus the total size can be different from (begin - end).

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static In sf::Utf< 16 >::decode (In begin,
In end,
Uint32 & output,
Uint32 replacement = 0 
)
+
+static
+
+ +

Decode a single UTF-16 character.

+

Decoding a character means finding its unique 32-bits code (called the codepoint) in the Unicode standard.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputCodepoint of the decoded UTF-16 character
replacementReplacement character to use in case the UTF-8 sequence is invalid
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::encode (Uint32 input,
Out output,
Uint16 replacement = 0 
)
+
+static
+
+ +

Encode a single UTF-16 character.

+

Encoding a character means converting a unique 32-bits code (called the codepoint) in the target encoding, UTF-16.

+
Parameters
+ + + + +
inputCodepoint to encode as UTF-16
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to UTF-16 (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::fromAnsi (In begin,
In end,
Out output,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an ANSI characters range to UTF-16.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::fromLatin1 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a latin-1 (ISO-5589-1) characters range to UTF-16.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::fromWide (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a wide characters range to UTF-16.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static In sf::Utf< 16 >::next (In begin,
In end 
)
+
+static
+
+ +

Advance to the next UTF-16 character.

+

This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element.

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toAnsi (In begin,
In end,
Out output,
char replacement = 0,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an UTF-16 characters range to ANSI characters.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to ANSI (use 0 to skip them)
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toLatin1 (In begin,
In end,
Out output,
char replacement = 0 
)
+
+static
+
+ +

Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toUtf16 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-16 characters range to UTF-16.

+

This functions does nothing more than a direct copy; it is defined only to provide the same interface as other specializations of the sf::Utf<> template, and allow generic code to be written on top of it.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toUtf32 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-16 characters range to UTF-32.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toUtf8 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-16 characters range to UTF-8.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 16 >::toWide (In begin,
In end,
Out output,
wchar_t replacement = 0 
)
+
+static
+
+ +

Convert an UTF-16 characters range to wide characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4-members.htm new file mode 100644 index 0000000..1413d14 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4-members.htm @@ -0,0 +1,72 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Utf< 32 > Member List
+
+
+ +

This is the complete list of members for sf::Utf< 32 >, including all inherited members.

+ + + + + + + + + + + + + + + + + + +
count(In begin, In end)sf::Utf< 32 >static
decode(In begin, In end, Uint32 &output, Uint32 replacement=0)sf::Utf< 32 >static
decodeAnsi(In input, const std::locale &locale=std::locale())sf::Utf< 32 >static
decodeWide(In input)sf::Utf< 32 >static
encode(Uint32 input, Out output, Uint32 replacement=0)sf::Utf< 32 >static
encodeAnsi(Uint32 codepoint, Out output, char replacement=0, const std::locale &locale=std::locale())sf::Utf< 32 >static
encodeWide(Uint32 codepoint, Out output, wchar_t replacement=0)sf::Utf< 32 >static
fromAnsi(In begin, In end, Out output, const std::locale &locale=std::locale())sf::Utf< 32 >static
fromLatin1(In begin, In end, Out output)sf::Utf< 32 >static
fromWide(In begin, In end, Out output)sf::Utf< 32 >static
next(In begin, In end)sf::Utf< 32 >static
toAnsi(In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())sf::Utf< 32 >static
toLatin1(In begin, In end, Out output, char replacement=0)sf::Utf< 32 >static
toUtf16(In begin, In end, Out output)sf::Utf< 32 >static
toUtf32(In begin, In end, Out output)sf::Utf< 32 >static
toUtf8(In begin, In end, Out output)sf::Utf< 32 >static
toWide(In begin, In end, Out output, wchar_t replacement=0)sf::Utf< 32 >static
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4.htm new file mode 100644 index 0000000..3194c50 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_0132_01_4.htm @@ -0,0 +1,1065 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Utf< 32 > Class Template Reference
+
+
+ +

Specialization of the Utf template for UTF-32. + More...

+ +

#include <Utf.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

template<typename In >
static In decode (In begin, In end, Uint32 &output, Uint32 replacement=0)
 Decode a single UTF-32 character. More...
 
template<typename Out >
static Out encode (Uint32 input, Out output, Uint32 replacement=0)
 Encode a single UTF-32 character. More...
 
template<typename In >
static In next (In begin, In end)
 Advance to the next UTF-32 character. More...
 
template<typename In >
static std::size_t count (In begin, In end)
 Count the number of characters of a UTF-32 sequence. More...
 
template<typename In , typename Out >
static Out fromAnsi (In begin, In end, Out output, const std::locale &locale=std::locale())
 Convert an ANSI characters range to UTF-32. More...
 
template<typename In , typename Out >
static Out fromWide (In begin, In end, Out output)
 Convert a wide characters range to UTF-32. More...
 
template<typename In , typename Out >
static Out fromLatin1 (In begin, In end, Out output)
 Convert a latin-1 (ISO-5589-1) characters range to UTF-32. More...
 
template<typename In , typename Out >
static Out toAnsi (In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())
 Convert an UTF-32 characters range to ANSI characters. More...
 
template<typename In , typename Out >
static Out toWide (In begin, In end, Out output, wchar_t replacement=0)
 Convert an UTF-32 characters range to wide characters. More...
 
template<typename In , typename Out >
static Out toLatin1 (In begin, In end, Out output, char replacement=0)
 Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters. More...
 
template<typename In , typename Out >
static Out toUtf8 (In begin, In end, Out output)
 Convert a UTF-32 characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out toUtf16 (In begin, In end, Out output)
 Convert a UTF-32 characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out toUtf32 (In begin, In end, Out output)
 Convert a UTF-32 characters range to UTF-32. More...
 
template<typename In >
static Uint32 decodeAnsi (In input, const std::locale &locale=std::locale())
 Decode a single ANSI character to UTF-32. More...
 
template<typename In >
static Uint32 decodeWide (In input)
 Decode a single wide character to UTF-32. More...
 
template<typename Out >
static Out encodeAnsi (Uint32 codepoint, Out output, char replacement=0, const std::locale &locale=std::locale())
 Encode a single UTF-32 character to ANSI. More...
 
template<typename Out >
static Out encodeWide (Uint32 codepoint, Out output, wchar_t replacement=0)
 Encode a single UTF-32 character to wide. More...
 
+

Detailed Description

+

template<>
+class sf::Utf< 32 >

+ +

Specialization of the Utf template for UTF-32.

+ +

Definition at line 462 of file Utf.hpp.

+

Member Function Documentation

+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static std::size_t sf::Utf< 32 >::count (In begin,
In end 
)
+
+static
+
+ +

Count the number of characters of a UTF-32 sequence.

+

This function is trivial for UTF-32, which can store every character in a single storage element.

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static In sf::Utf< 32 >::decode (In begin,
In end,
Uint32 & output,
Uint32 replacement = 0 
)
+
+static
+
+ +

Decode a single UTF-32 character.

+

Decoding a character means finding its unique 32-bits code (called the codepoint) in the Unicode standard. For UTF-32, the character value is the same as the codepoint.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputCodepoint of the decoded UTF-32 character
replacementReplacement character to use in case the UTF-8 sequence is invalid
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static Uint32 sf::Utf< 32 >::decodeAnsi (In input,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Decode a single ANSI character to UTF-32.

+

This function does not exist in other specializations of sf::Utf<>, it is defined for convenience (it is used by several other conversion functions).

+
Parameters
+ + + +
inputInput ANSI character
localeLocale to use for conversion
+
+
+
Returns
Converted character
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + +
static Uint32 sf::Utf< 32 >::decodeWide (In input)
+
+static
+
+ +

Decode a single wide character to UTF-32.

+

This function does not exist in other specializations of sf::Utf<>, it is defined for convenience (it is used by several other conversion functions).

+
Parameters
+ + +
inputInput wide character
+
+
+
Returns
Converted character
+ +
+
+ +
+
+
+template<typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::encode (Uint32 input,
Out output,
Uint32 replacement = 0 
)
+
+static
+
+ +

Encode a single UTF-32 character.

+

Encoding a character means converting a unique 32-bits code (called the codepoint) in the target encoding, UTF-32. For UTF-32, the codepoint is the same as the character value.

+
Parameters
+ + + + +
inputCodepoint to encode as UTF-32
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to UTF-32 (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::encodeAnsi (Uint32 codepoint,
Out output,
char replacement = 0,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Encode a single UTF-32 character to ANSI.

+

This function does not exist in other specializations of sf::Utf<>, it is defined for convenience (it is used by several other conversion functions).

+
Parameters
+ + + + + +
codepointIterator pointing to the beginning of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement if the input character is not convertible to ANSI (use 0 to skip it)
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::encodeWide (Uint32 codepoint,
Out output,
wchar_t replacement = 0 
)
+
+static
+
+ +

Encode a single UTF-32 character to wide.

+

This function does not exist in other specializations of sf::Utf<>, it is defined for convenience (it is used by several other conversion functions).

+
Parameters
+ + + + +
codepointIterator pointing to the beginning of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement if the input character is not convertible to wide (use 0 to skip it)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::fromAnsi (In begin,
In end,
Out output,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an ANSI characters range to UTF-32.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::fromLatin1 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a latin-1 (ISO-5589-1) characters range to UTF-32.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::fromWide (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a wide characters range to UTF-32.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static In sf::Utf< 32 >::next (In begin,
In end 
)
+
+static
+
+ +

Advance to the next UTF-32 character.

+

This function is trivial for UTF-32, which can store every character in a single storage element.

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toAnsi (In begin,
In end,
Out output,
char replacement = 0,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an UTF-32 characters range to ANSI characters.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to ANSI (use 0 to skip them)
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toLatin1 (In begin,
In end,
Out output,
char replacement = 0 
)
+
+static
+
+ +

Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toUtf16 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-32 characters range to UTF-16.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toUtf32 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-32 characters range to UTF-32.

+

This functions does nothing more than a direct copy; it is defined only to provide the same interface as other specializations of the sf::Utf<> template, and allow generic code to be written on top of it.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toUtf8 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-32 characters range to UTF-8.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 32 >::toWide (In begin,
In end,
Out output,
wchar_t replacement = 0 
)
+
+static
+
+ +

Convert an UTF-32 characters range to wide characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4-members.htm new file mode 100644 index 0000000..59f467e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4-members.htm @@ -0,0 +1,68 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Utf< 8 > Member List
+
+
+ +

This is the complete list of members for sf::Utf< 8 >, including all inherited members.

+ + + + + + + + + + + + + + +
count(In begin, In end)sf::Utf< 8 >static
decode(In begin, In end, Uint32 &output, Uint32 replacement=0)sf::Utf< 8 >static
encode(Uint32 input, Out output, Uint8 replacement=0)sf::Utf< 8 >static
fromAnsi(In begin, In end, Out output, const std::locale &locale=std::locale())sf::Utf< 8 >static
fromLatin1(In begin, In end, Out output)sf::Utf< 8 >static
fromWide(In begin, In end, Out output)sf::Utf< 8 >static
next(In begin, In end)sf::Utf< 8 >static
toAnsi(In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())sf::Utf< 8 >static
toLatin1(In begin, In end, Out output, char replacement=0)sf::Utf< 8 >static
toUtf16(In begin, In end, Out output)sf::Utf< 8 >static
toUtf32(In begin, In end, Out output)sf::Utf< 8 >static
toUtf8(In begin, In end, Out output)sf::Utf< 8 >static
toWide(In begin, In end, Out output, wchar_t replacement=0)sf::Utf< 8 >static
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4.htm new file mode 100644 index 0000000..435dd7b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Utf_3_018_01_4.htm @@ -0,0 +1,851 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Utf< 8 > Class Template Reference
+
+
+ +

Specialization of the Utf template for UTF-8. + More...

+ +

#include <Utf.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Static Public Member Functions

template<typename In >
static In decode (In begin, In end, Uint32 &output, Uint32 replacement=0)
 Decode a single UTF-8 character. More...
 
template<typename Out >
static Out encode (Uint32 input, Out output, Uint8 replacement=0)
 Encode a single UTF-8 character. More...
 
template<typename In >
static In next (In begin, In end)
 Advance to the next UTF-8 character. More...
 
template<typename In >
static std::size_t count (In begin, In end)
 Count the number of characters of a UTF-8 sequence. More...
 
template<typename In , typename Out >
static Out fromAnsi (In begin, In end, Out output, const std::locale &locale=std::locale())
 Convert an ANSI characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out fromWide (In begin, In end, Out output)
 Convert a wide characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out fromLatin1 (In begin, In end, Out output)
 Convert a latin-1 (ISO-5589-1) characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out toAnsi (In begin, In end, Out output, char replacement=0, const std::locale &locale=std::locale())
 Convert an UTF-8 characters range to ANSI characters. More...
 
template<typename In , typename Out >
static Out toWide (In begin, In end, Out output, wchar_t replacement=0)
 Convert an UTF-8 characters range to wide characters. More...
 
template<typename In , typename Out >
static Out toLatin1 (In begin, In end, Out output, char replacement=0)
 Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters. More...
 
template<typename In , typename Out >
static Out toUtf8 (In begin, In end, Out output)
 Convert a UTF-8 characters range to UTF-8. More...
 
template<typename In , typename Out >
static Out toUtf16 (In begin, In end, Out output)
 Convert a UTF-8 characters range to UTF-16. More...
 
template<typename In , typename Out >
static Out toUtf32 (In begin, In end, Out output)
 Convert a UTF-8 characters range to UTF-32. More...
 
+

Detailed Description

+

template<>
+class sf::Utf< 8 >

+ +

Specialization of the Utf template for UTF-8.

+ +

Definition at line 48 of file Utf.hpp.

+

Member Function Documentation

+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static std::size_t sf::Utf< 8 >::count (In begin,
In end 
)
+
+static
+
+ +

Count the number of characters of a UTF-8 sequence.

+

This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element, thus the total size can be different from (begin - end).

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static In sf::Utf< 8 >::decode (In begin,
In end,
Uint32 & output,
Uint32 replacement = 0 
)
+
+static
+
+ +

Decode a single UTF-8 character.

+

Decoding a character means finding its unique 32-bits code (called the codepoint) in the Unicode standard.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputCodepoint of the decoded UTF-8 character
replacementReplacement character to use in case the UTF-8 sequence is invalid
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::encode (Uint32 input,
Out output,
Uint8 replacement = 0 
)
+
+static
+
+ +

Encode a single UTF-8 character.

+

Encoding a character means converting a unique 32-bits code (called the codepoint) in the target encoding, UTF-8.

+
Parameters
+ + + + +
inputCodepoint to encode as UTF-8
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to UTF-8 (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::fromAnsi (In begin,
In end,
Out output,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an ANSI characters range to UTF-8.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::fromLatin1 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a latin-1 (ISO-5589-1) characters range to UTF-8.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::fromWide (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a wide characters range to UTF-8.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
static In sf::Utf< 8 >::next (In begin,
In end 
)
+
+static
+
+ +

Advance to the next UTF-8 character.

+

This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element.

+
Parameters
+ + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
+
+
+
Returns
Iterator pointing to one past the last read element of the input sequence
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toAnsi (In begin,
In end,
Out output,
char replacement = 0,
const std::locale & locale = std::locale() 
)
+
+static
+
+ +

Convert an UTF-8 characters range to ANSI characters.

+

The current global locale will be used by default, unless you pass a custom one in the locale parameter.

+
Parameters
+ + + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to ANSI (use 0 to skip them)
localeLocale to use for conversion
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toLatin1 (In begin,
In end,
Out output,
char replacement = 0 
)
+
+static
+
+ +

Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toUtf16 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-8 characters range to UTF-16.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toUtf32 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-8 characters range to UTF-32.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toUtf8 (In begin,
In end,
Out output 
)
+
+static
+
+ +

Convert a UTF-8 characters range to UTF-8.

+

This functions does nothing more than a direct copy; it is defined only to provide the same interface as other specializations of the sf::Utf<> template, and allow generic code to be written on top of it.

+
Parameters
+ + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+ +
+
+
+template<typename In , typename Out >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
static Out sf::Utf< 8 >::toWide (In begin,
In end,
Out output,
wchar_t replacement = 0 
)
+
+static
+
+ +

Convert an UTF-8 characters range to wide characters.

+
Parameters
+ + + + + +
beginIterator pointing to the beginning of the input sequence
endIterator pointing to the end of the input sequence
outputIterator pointing to the beginning of the output sequence
replacementReplacement for characters not convertible to wide (use 0 to skip them)
+
+
+
Returns
Iterator to the end of the output sequence which has been written
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2-members.htm new file mode 100644 index 0000000..56812da --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2-members.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Vector2< T > Member List
+
+
+ +

This is the complete list of members for sf::Vector2< T >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
operator!=(const Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
operator*(const Vector2< T > &left, T right)sf::Vector2< T >related
operator*(T left, const Vector2< T > &right)sf::Vector2< T >related
operator*=(Vector2< T > &left, T right)sf::Vector2< T >related
operator+(const Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
operator+=(Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
operator-(const Vector2< T > &right)sf::Vector2< T >related
operator-(const Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
operator-=(Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
operator/(const Vector2< T > &left, T right)sf::Vector2< T >related
operator/=(Vector2< T > &left, T right)sf::Vector2< T >related
operator==(const Vector2< T > &left, const Vector2< T > &right)sf::Vector2< T >related
Vector2()sf::Vector2< T >
Vector2(T X, T Y)sf::Vector2< T >
Vector2(const Vector2< U > &vector)sf::Vector2< T >explicit
Vector2() (defined in sf::Vector2< T >)sf::Vector2< T >inline
Vector2(T X, T Y) (defined in sf::Vector2< T >)sf::Vector2< T >inline
Vector2(const Vector2< U > &vector) (defined in sf::Vector2< T >)sf::Vector2< T >inline
xsf::Vector2< T >
ysf::Vector2< T >
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2.htm new file mode 100644 index 0000000..8196d43 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector2.htm @@ -0,0 +1,858 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Vector2< T > Class Template Reference
+
+
+ +

Utility template class for manipulating 2-dimensional vectors. + More...

+ +

#include <Vector2.hpp>

+ + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Vector2 ()
 Default constructor. More...
 
 Vector2 (T X, T Y)
 Construct the vector from its coordinates. More...
 
template<typename U >
 Vector2 (const Vector2< U > &vector)
 Construct the vector from another type of vector. More...
 
+template<typename T >
 Vector2 (T X, T Y)
 
+template<typename U >
 Vector2 (const Vector2< U > &vector)
 
+ + + + + + + +

+Public Attributes

x
 X coordinate of the vector. More...
 
y
 Y coordinate of the vector. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
template<typename T >
Vector2< T > operator- (const Vector2< T > &right)
 Overload of unary operator -. More...
 
template<typename T >
Vector2< T > & operator+= (Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator +=. More...
 
template<typename T >
Vector2< T > & operator-= (Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator -=. More...
 
template<typename T >
Vector2< T > operator+ (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator +. More...
 
template<typename T >
Vector2< T > operator- (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator -. More...
 
template<typename T >
Vector2< T > operator* (const Vector2< T > &left, T right)
 Overload of binary operator *. More...
 
template<typename T >
Vector2< T > operator* (T left, const Vector2< T > &right)
 Overload of binary operator *. More...
 
template<typename T >
Vector2< T > & operator*= (Vector2< T > &left, T right)
 Overload of binary operator *=. More...
 
template<typename T >
Vector2< T > operator/ (const Vector2< T > &left, T right)
 Overload of binary operator /. More...
 
template<typename T >
Vector2< T > & operator/= (Vector2< T > &left, T right)
 Overload of binary operator /=. More...
 
template<typename T >
bool operator== (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator ==. More...
 
template<typename T >
bool operator!= (const Vector2< T > &left, const Vector2< T > &right)
 Overload of binary operator !=. More...
 
+

Detailed Description

+

template<typename T>
+class sf::Vector2< T >

+ +

Utility template class for manipulating 2-dimensional vectors.

+

sf::Vector2 is a simple class that defines a mathematical vector with two coordinates (x and y).

+

It can be used to represent anything that has two dimensions: a size, a point, a velocity, etc.

+

The template parameter T is the type of the coordinates. It can be any type that supports arithmetic operations (+, -, /, *) and comparisons (==, !=), for example int or float.

+

You generally don't have to care about the templated form (sf::Vector2<T>), the most common specializations have special typedefs:

+
    +
  • sf::Vector2<float> is sf::Vector2f
  • +
  • sf::Vector2<int> is sf::Vector2i
  • +
  • sf::Vector2<unsigned int> is sf::Vector2u
  • +
+

The sf::Vector2 class has a small and simple interface, its x and y members can be accessed directly (there's no accessor like setX(), getX()) and it contains no mathematical function like dot product, cross product, length, etc.

+

Usage example:

+
sf::Vector2f v1(16.5f, 24.f);
+
v1.x = 18.2f;
+
float y = v1.y;
+
+
sf::Vector2f v2 = v1 * 5.f;
+ +
v3 = v1 + v2;
+
+
bool different = (v2 != v3);
+

Note: for 3-dimensional vectors, see sf::Vector3.

+ +

Definition at line 37 of file Vector2.hpp.

+

Constructor & Destructor Documentation

+ +
+
+
+template<typename T>
+ + + + + + + +
sf::Vector2< T >::Vector2 ()
+
+ +

Default constructor.

+

Creates a Vector2(0, 0).

+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + +
sf::Vector2< T >::Vector2 (X,
Y 
)
+
+ +

Construct the vector from its coordinates.

+
Parameters
+ + + +
XX coordinate
YY coordinate
+
+
+ +
+
+ +
+
+
+template<typename T>
+
+template<typename U >
+ + + + + +
+ + + + + + + + +
sf::Vector2< T >::Vector2 (const Vector2< U > & vector)
+
+explicit
+
+ +

Construct the vector from another type of vector.

+

This constructor doesn't replace the copy constructor, it's called only when U != T. A call to this constructor will fail to compile if U is not convertible to T.

+
Parameters
+ + +
vectorVector to convert
+
+
+ +
+
+

Friends And Related Function Documentation

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator !=.

+

This operator compares strict difference between two vectors.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
True if left is not equal to right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > operator* (const Vector2< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator *.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Memberwise multiplication by right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > operator* (left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator *.

+
Parameters
+ + + +
leftLeft operand (a scalar value)
rightRight operand (a vector)
+
+
+
Returns
Memberwise multiplication by left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > & operator*= (Vector2< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator *=.

+

This operator performs a memberwise multiplication by right, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > operator+ (const Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator +.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Memberwise addition of both vectors
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > & operator+= (Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator +=.

+

This operator performs a memberwise addition of both vectors, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + +
Vector2< T > operator- (const Vector2< T > & right)
+
+related
+
+ +

Overload of unary operator -.

+
Parameters
+ + +
rightVector to negate
+
+
+
Returns
Memberwise opposite of the vector
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > operator- (const Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator -.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Memberwise subtraction of both vectors
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > & operator-= (Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator -=.

+

This operator performs a memberwise subtraction of both vectors, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > operator/ (const Vector2< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator /.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Memberwise division by right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector2< T > & operator/= (Vector2< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator /=.

+

This operator performs a memberwise division by right, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Vector2< T > & left,
const Vector2< T > & right 
)
+
+related
+
+ +

Overload of binary operator ==.

+

This operator compares strict equality between two vectors.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
True if left is equal to right
+ +
+
+

Member Data Documentation

+ +
+
+
+template<typename T>
+ + + + +
T sf::Vector2< T >::x
+
+ +

X coordinate of the vector.

+ +

Definition at line 75 of file Vector2.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Vector2< T >::y
+
+ +

Y coordinate of the vector.

+ +

Definition at line 76 of file Vector2.hpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3-members.htm new file mode 100644 index 0000000..4bd8a6f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3-members.htm @@ -0,0 +1,76 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Vector3< T > Member List
+
+
+ +

This is the complete list of members for sf::Vector3< T >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + +
operator!=(const Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
operator*(const Vector3< T > &left, T right)sf::Vector3< T >related
operator*(T left, const Vector3< T > &right)sf::Vector3< T >related
operator*=(Vector3< T > &left, T right)sf::Vector3< T >related
operator+(const Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
operator+=(Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
operator-(const Vector3< T > &left)sf::Vector3< T >related
operator-(const Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
operator-=(Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
operator/(const Vector3< T > &left, T right)sf::Vector3< T >related
operator/=(Vector3< T > &left, T right)sf::Vector3< T >related
operator==(const Vector3< T > &left, const Vector3< T > &right)sf::Vector3< T >related
Vector3()sf::Vector3< T >
Vector3(T X, T Y, T Z)sf::Vector3< T >
Vector3(const Vector3< U > &vector)sf::Vector3< T >explicit
Vector3() (defined in sf::Vector3< T >)sf::Vector3< T >inline
Vector3(T X, T Y, T Z) (defined in sf::Vector3< T >)sf::Vector3< T >inline
Vector3(const Vector3< U > &vector) (defined in sf::Vector3< T >)sf::Vector3< T >inline
xsf::Vector3< T >
ysf::Vector3< T >
zsf::Vector3< T >
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3.htm new file mode 100644 index 0000000..394f397 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vector3.htm @@ -0,0 +1,886 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Vector3< T > Class Template Reference
+
+
+ +

Utility template class for manipulating 3-dimensional vectors. + More...

+ +

#include <Vector3.hpp>

+ + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Vector3 ()
 Default constructor. More...
 
 Vector3 (T X, T Y, T Z)
 Construct the vector from its coordinates. More...
 
template<typename U >
 Vector3 (const Vector3< U > &vector)
 Construct the vector from another type of vector. More...
 
+template<typename T >
 Vector3 (T X, T Y, T Z)
 
+template<typename U >
 Vector3 (const Vector3< U > &vector)
 
+ + + + + + + + + + +

+Public Attributes

x
 X coordinate of the vector. More...
 
y
 Y coordinate of the vector. More...
 
z
 Z coordinate of the vector. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
template<typename T >
Vector3< T > operator- (const Vector3< T > &left)
 Overload of unary operator -. More...
 
template<typename T >
Vector3< T > & operator+= (Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator +=. More...
 
template<typename T >
Vector3< T > & operator-= (Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator -=. More...
 
template<typename T >
Vector3< T > operator+ (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator +. More...
 
template<typename T >
Vector3< T > operator- (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator -. More...
 
template<typename T >
Vector3< T > operator* (const Vector3< T > &left, T right)
 Overload of binary operator *. More...
 
template<typename T >
Vector3< T > operator* (T left, const Vector3< T > &right)
 Overload of binary operator *. More...
 
template<typename T >
Vector3< T > & operator*= (Vector3< T > &left, T right)
 Overload of binary operator *=. More...
 
template<typename T >
Vector3< T > operator/ (const Vector3< T > &left, T right)
 Overload of binary operator /. More...
 
template<typename T >
Vector3< T > & operator/= (Vector3< T > &left, T right)
 Overload of binary operator /=. More...
 
template<typename T >
bool operator== (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator ==. More...
 
template<typename T >
bool operator!= (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator !=. More...
 
+

Detailed Description

+

template<typename T>
+class sf::Vector3< T >

+ +

Utility template class for manipulating 3-dimensional vectors.

+

sf::Vector3 is a simple class that defines a mathematical vector with three coordinates (x, y and z).

+

It can be used to represent anything that has three dimensions: a size, a point, a velocity, etc.

+

The template parameter T is the type of the coordinates. It can be any type that supports arithmetic operations (+, -, /, *) and comparisons (==, !=), for example int or float.

+

You generally don't have to care about the templated form (sf::Vector3<T>), the most common specializations have special typedefs:

+
    +
  • sf::Vector3<float> is sf::Vector3f
  • +
  • sf::Vector3<int> is sf::Vector3i
  • +
+

The sf::Vector3 class has a small and simple interface, its x and y members can be accessed directly (there's no accessor like setX(), getX()) and it contains no mathematical function like dot product, cross product, length, etc.

+

Usage example:

+
sf::Vector3f v1(16.5f, 24.f, -8.2f);
+
v1.x = 18.2f;
+
float y = v1.y;
+
float z = v1.z;
+
+
sf::Vector3f v2 = v1 * 5.f;
+ +
v3 = v1 + v2;
+
+
bool different = (v2 != v3);
+

Note: for 2-dimensional vectors, see sf::Vector2.

+ +

Definition at line 37 of file Vector3.hpp.

+

Constructor & Destructor Documentation

+ +
+
+
+template<typename T>
+ + + + + + + +
sf::Vector3< T >::Vector3 ()
+
+ +

Default constructor.

+

Creates a Vector3(0, 0, 0).

+ +
+
+ +
+
+
+template<typename T>
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::Vector3< T >::Vector3 (X,
Y,
Z 
)
+
+ +

Construct the vector from its coordinates.

+
Parameters
+ + + + +
XX coordinate
YY coordinate
ZZ coordinate
+
+
+ +
+
+ +
+
+
+template<typename T>
+
+template<typename U >
+ + + + + +
+ + + + + + + + +
sf::Vector3< T >::Vector3 (const Vector3< U > & vector)
+
+explicit
+
+ +

Construct the vector from another type of vector.

+

This constructor doesn't replace the copy constructor, it's called only when U != T. A call to this constructor will fail to compile if U is not convertible to T.

+
Parameters
+ + +
vectorVector to convert
+
+
+ +
+
+

Friends And Related Function Documentation

+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator !=.

+

This operator compares strict difference between two vectors.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
True if left is not equal to right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > operator* (const Vector3< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator *.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Memberwise multiplication by right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > operator* (left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator *.

+
Parameters
+ + + +
leftLeft operand (a scalar value)
rightRight operand (a vector)
+
+
+
Returns
Memberwise multiplication by left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > & operator*= (Vector3< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator *=.

+

This operator performs a memberwise multiplication by right, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > operator+ (const Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator +.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Memberwise addition of both vectors
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > & operator+= (Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator +=.

+

This operator performs a memberwise addition of both vectors, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + +
Vector3< T > operator- (const Vector3< T > & left)
+
+related
+
+ +

Overload of unary operator -.

+
Parameters
+ + +
leftVector to negate
+
+
+
Returns
Memberwise opposite of the vector
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > operator- (const Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator -.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Memberwise subtraction of both vectors
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > & operator-= (Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator -=.

+

This operator performs a memberwise subtraction of both vectors, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > operator/ (const Vector3< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator /.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Memberwise division by right
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Vector3< T > & operator/= (Vector3< T > & left,
right 
)
+
+related
+
+ +

Overload of binary operator /=.

+

This operator performs a memberwise division by right, and assigns the result to left.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a scalar value)
+
+
+
Returns
Reference to left
+ +
+
+ +
+
+
+template<typename T >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const Vector3< T > & left,
const Vector3< T > & right 
)
+
+related
+
+ +

Overload of binary operator ==.

+

This operator compares strict equality between two vectors.

+
Parameters
+ + + +
leftLeft operand (a vector)
rightRight operand (a vector)
+
+
+
Returns
True if left is equal to right
+ +
+
+

Member Data Documentation

+ +
+
+
+template<typename T>
+ + + + +
T sf::Vector3< T >::x
+
+ +

X coordinate of the vector.

+ +

Definition at line 76 of file Vector3.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Vector3< T >::y
+
+ +

Y coordinate of the vector.

+ +

Definition at line 77 of file Vector3.hpp.

+ +
+
+ +
+
+
+template<typename T>
+ + + + +
T sf::Vector3< T >::z
+
+ +

Z coordinate of the vector.

+ +

Definition at line 78 of file Vector3.hpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex-members.htm new file mode 100644 index 0000000..edfc3f9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex-members.htm @@ -0,0 +1,63 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Vertex Member List
+
+
+ +

This is the complete list of members for sf::Vertex, including all inherited members.

+ + + + + + + + + +
colorsf::Vertex
positionsf::Vertex
texCoordssf::Vertex
Vertex()sf::Vertex
Vertex(const Vector2f &thePosition)sf::Vertex
Vertex(const Vector2f &thePosition, const Color &theColor)sf::Vertex
Vertex(const Vector2f &thePosition, const Vector2f &theTexCoords)sf::Vertex
Vertex(const Vector2f &thePosition, const Color &theColor, const Vector2f &theTexCoords)sf::Vertex
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex.htm new file mode 100644 index 0000000..c3abeaf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Vertex.htm @@ -0,0 +1,323 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Define a point with color and texture coordinates. + More...

+ +

#include <Vertex.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Member Functions

 Vertex ()
 Default constructor. More...
 
 Vertex (const Vector2f &thePosition)
 Construct the vertex from its position. More...
 
 Vertex (const Vector2f &thePosition, const Color &theColor)
 Construct the vertex from its position and color. More...
 
 Vertex (const Vector2f &thePosition, const Vector2f &theTexCoords)
 Construct the vertex from its position and texture coordinates. More...
 
 Vertex (const Vector2f &thePosition, const Color &theColor, const Vector2f &theTexCoords)
 Construct the vertex from its position, color and texture coordinates. More...
 
+ + + + + + + + + + +

+Public Attributes

Vector2f position
 2D position of the vertex More...
 
Color color
 Color of the vertex. More...
 
Vector2f texCoords
 Coordinates of the texture's pixel to map to the vertex. More...
 
+

Detailed Description

+

Define a point with color and texture coordinates.

+

A vertex is an improved point.

+

It has a position and other extra attributes that will be used for drawing: in SFML, vertices also have a color and a pair of texture coordinates.

+

The vertex is the building block of drawing. Everything which is visible on screen is made of vertices. They are grouped as 2D primitives (triangles, quads, ...), and these primitives are grouped to create even more complex 2D entities such as sprites, texts, etc.

+

If you use the graphical entities of SFML (sprite, text, shape) you won't have to deal with vertices directly. But if you want to define your own 2D entities, such as tiled maps or particle systems, using vertices will allow you to get maximum performances.

+

Example:

+
// define a 100x100 square, red, with a 10x10 texture mapped on it
+
sf::Vertex vertices[] =
+
{
+ + + + +
};
+
+
// draw it
+
window.draw(vertices, 4, sf::Quads);
+

Note: although texture coordinates are supposed to be an integer amount of pixels, their type is float because of some buggy graphics drivers that are not able to process integer coordinates correctly.

+
See Also
sf::VertexArray
+ +

Definition at line 42 of file Vertex.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Vertex::Vertex ()
+
+ +

Default constructor.

+ +
+
+ +
+
+ + + + + + + + +
sf::Vertex::Vertex (const Vector2fthePosition)
+
+ +

Construct the vertex from its position.

+

The vertex color is white and texture coordinates are (0, 0).

+
Parameters
+ + +
thePositionVertex position
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::Vertex::Vertex (const Vector2fthePosition,
const ColortheColor 
)
+
+ +

Construct the vertex from its position and color.

+

The texture coordinates are (0, 0).

+
Parameters
+ + + +
thePositionVertex position
theColorVertex color
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::Vertex::Vertex (const Vector2fthePosition,
const Vector2ftheTexCoords 
)
+
+ +

Construct the vertex from its position and texture coordinates.

+

The vertex color is white.

+
Parameters
+ + + +
thePositionVertex position
theTexCoordsVertex texture coordinates
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::Vertex::Vertex (const Vector2fthePosition,
const ColortheColor,
const Vector2ftheTexCoords 
)
+
+ +

Construct the vertex from its position, color and texture coordinates.

+
Parameters
+ + + + +
thePositionVertex position
theColorVertex color
theTexCoordsVertex texture coordinates
+
+
+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
Color sf::Vertex::color
+
+ +

Color of the vertex.

+ +

Definition at line 98 of file Vertex.hpp.

+ +
+
+ +
+
+ + + + +
Vector2f sf::Vertex::position
+
+ +

2D position of the vertex

+ +

Definition at line 97 of file Vertex.hpp.

+ +
+
+ +
+
+ + + + +
Vector2f sf::Vertex::texCoords
+
+ +

Coordinates of the texture's pixel to map to the vertex.

+ +

Definition at line 99 of file Vertex.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray-members.htm new file mode 100644 index 0000000..8df2c47 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray-members.htm @@ -0,0 +1,67 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::VertexArray Member List
+
+
+ +

This is the complete list of members for sf::VertexArray, including all inherited members.

+ + + + + + + + + + + + + +
append(const Vertex &vertex)sf::VertexArray
clear()sf::VertexArray
getBounds() const sf::VertexArray
getPrimitiveType() const sf::VertexArray
getVertexCount() const sf::VertexArray
operator[](unsigned int index)sf::VertexArray
operator[](unsigned int index) const sf::VertexArray
resize(unsigned int vertexCount)sf::VertexArray
setPrimitiveType(PrimitiveType type)sf::VertexArray
VertexArray()sf::VertexArray
VertexArray(PrimitiveType type, unsigned int vertexCount=0)sf::VertexArrayexplicit
~Drawable()sf::Drawableinlinevirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.htm new file mode 100644 index 0000000..3d90ca6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.htm @@ -0,0 +1,394 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::VertexArray Class Reference
+
+
+ +

Define a set of one or more 2D primitives. + More...

+ +

#include <VertexArray.hpp>

+
+Inheritance diagram for sf::VertexArray:
+
+
+ + +sf::Drawable + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 VertexArray ()
 Default constructor. More...
 
 VertexArray (PrimitiveType type, unsigned int vertexCount=0)
 Construct the vertex array with a type and an initial number of vertices. More...
 
unsigned int getVertexCount () const
 Return the vertex count. More...
 
Vertexoperator[] (unsigned int index)
 Get a read-write access to a vertex by its index. More...
 
const Vertexoperator[] (unsigned int index) const
 Get a read-only access to a vertex by its index. More...
 
void clear ()
 Clear the vertex array. More...
 
void resize (unsigned int vertexCount)
 Resize the vertex array. More...
 
void append (const Vertex &vertex)
 Add a vertex to the array. More...
 
void setPrimitiveType (PrimitiveType type)
 Set the type of primitives to draw. More...
 
PrimitiveType getPrimitiveType () const
 Get the type of primitives drawn by the vertex array. More...
 
FloatRect getBounds () const
 Compute the bounding rectangle of the vertex array. More...
 
+

Detailed Description

+

Define a set of one or more 2D primitives.

+

sf::VertexArray is a very simple wrapper around a dynamic array of vertices and a primitives type.

+

It inherits sf::Drawable, but unlike other drawables it is not transformable.

+

Example:

+
+
lines[0].position = sf::Vector2f(10, 0);
+
lines[1].position = sf::Vector2f(20, 0);
+
lines[2].position = sf::Vector2f(30, 5);
+
lines[3].position = sf::Vector2f(40, 2);
+
+
window.draw(lines);
+
See Also
sf::Vertex
+ +

Definition at line 45 of file VertexArray.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::VertexArray::VertexArray ()
+
+ +

Default constructor.

+

Creates an empty vertex array.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
sf::VertexArray::VertexArray (PrimitiveType type,
unsigned int vertexCount = 0 
)
+
+explicit
+
+ +

Construct the vertex array with a type and an initial number of vertices.

+
Parameters
+ + + +
typeType of primitives
vertexCountInitial number of vertices in the array
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void sf::VertexArray::append (const Vertexvertex)
+
+ +

Add a vertex to the array.

+
Parameters
+ + +
vertexVertex to add
+
+
+ +
+
+ +
+
+ + + + + + + +
void sf::VertexArray::clear ()
+
+ +

Clear the vertex array.

+

This function removes all the vertices from the array. It doesn't deallocate the corresponding memory, so that adding new vertices after clearing doesn't involve reallocating all the memory.

+ +
+
+ +
+
+ + + + + + + +
FloatRect sf::VertexArray::getBounds () const
+
+ +

Compute the bounding rectangle of the vertex array.

+

This function returns the axis-aligned rectangle that contains all the vertices of the array.

+
Returns
Bounding rectangle of the vertex array
+ +
+
+ +
+
+ + + + + + + +
PrimitiveType sf::VertexArray::getPrimitiveType () const
+
+ +

Get the type of primitives drawn by the vertex array.

+
Returns
Primitive type
+ +
+
+ +
+
+ + + + + + + +
unsigned int sf::VertexArray::getVertexCount () const
+
+ +

Return the vertex count.

+
Returns
Number of vertices in the array
+ +
+
+ +
+
+ + + + + + + + +
Vertex& sf::VertexArray::operator[] (unsigned int index)
+
+ +

Get a read-write access to a vertex by its index.

+

This function doesn't check index, it must be in range [0, getVertexCount() - 1]. The behaviour is undefined otherwise.

+
Parameters
+ + +
indexIndex of the vertex to get
+
+
+
Returns
Reference to the index-th vertex
+
See Also
getVertexCount
+ +
+
+ +
+
+ + + + + + + + +
const Vertex& sf::VertexArray::operator[] (unsigned int index) const
+
+ +

Get a read-only access to a vertex by its index.

+

This function doesn't check index, it must be in range [0, getVertexCount() - 1]. The behaviour is undefined otherwise.

+
Parameters
+ + +
indexIndex of the vertex to get
+
+
+
Returns
Const reference to the index-th vertex
+
See Also
getVertexCount
+ +
+
+ +
+
+ + + + + + + + +
void sf::VertexArray::resize (unsigned int vertexCount)
+
+ +

Resize the vertex array.

+

If vertexCount is greater than the current size, the previous vertices are kept and new (default-constructed) vertices are added. If vertexCount is less than the current size, existing vertices are removed from the array.

+
Parameters
+ + +
vertexCountNew size of the array (number of vertices)
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::VertexArray::setPrimitiveType (PrimitiveType type)
+
+ +

Set the type of primitives to draw.

+

This function defines how the vertices must be interpreted when it's time to draw them:

+
    +
  • As points
  • +
  • As lines
  • +
  • As triangles
  • +
  • As quads The default primitive type is sf::Points.
  • +
+
Parameters
+ + +
typeType of primitive
+
+
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.png new file mode 100644 index 0000000..4fa8145 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VertexArray.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode-members.htm new file mode 100644 index 0000000..ecebe6b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode-members.htm @@ -0,0 +1,69 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::VideoMode Member List
+
+
+ +

This is the complete list of members for sf::VideoMode, including all inherited members.

+ + + + + + + + + + + + + + + +
bitsPerPixelsf::VideoMode
getDesktopMode()sf::VideoModestatic
getFullscreenModes()sf::VideoModestatic
heightsf::VideoMode
isValid() const sf::VideoMode
operator!=(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
operator<(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
operator<=(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
operator==(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
operator>(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
operator>=(const VideoMode &left, const VideoMode &right)sf::VideoModerelated
VideoMode()sf::VideoMode
VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel=32)sf::VideoMode
widthsf::VideoMode
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode.htm new file mode 100644 index 0000000..438e064 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1VideoMode.htm @@ -0,0 +1,596 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

VideoMode defines a video mode (width, height, bpp) + More...

+ +

#include <VideoMode.hpp>

+ + + + + + + + + + + +

+Public Member Functions

 VideoMode ()
 Default constructor. More...
 
 VideoMode (unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel=32)
 Construct the video mode with its attributes. More...
 
bool isValid () const
 Tell whether or not the video mode is valid. More...
 
+ + + + + + + +

+Static Public Member Functions

static VideoMode getDesktopMode ()
 Get the current desktop video mode. More...
 
static const std::vector
+< VideoMode > & 
getFullscreenModes ()
 Retrieve all the video modes supported in fullscreen mode. More...
 
+ + + + + + + + + + +

+Public Attributes

unsigned int width
 Video mode width, in pixels. More...
 
unsigned int height
 Video mode height, in pixels. More...
 
unsigned int bitsPerPixel
 Video mode pixel depth, in bits per pixels. More...
 
+ + + + + + + + + + + + + + + + + + + + +

+Related Functions

(Note that these are not member functions.)

+
bool operator== (const VideoMode &left, const VideoMode &right)
 Overload of == operator to compare two video modes. More...
 
bool operator!= (const VideoMode &left, const VideoMode &right)
 Overload of != operator to compare two video modes. More...
 
bool operator< (const VideoMode &left, const VideoMode &right)
 Overload of < operator to compare video modes. More...
 
bool operator> (const VideoMode &left, const VideoMode &right)
 Overload of > operator to compare video modes. More...
 
bool operator<= (const VideoMode &left, const VideoMode &right)
 Overload of <= operator to compare video modes. More...
 
bool operator>= (const VideoMode &left, const VideoMode &right)
 Overload of >= operator to compare video modes. More...
 
+

Detailed Description

+

VideoMode defines a video mode (width, height, bpp)

+

A video mode is defined by a width and a height (in pixels) and a depth (in bits per pixel).

+

Video modes are used to setup windows (sf::Window) at creation time.

+

The main usage of video modes is for fullscreen mode: indeed you must use one of the valid video modes allowed by the OS (which are defined by what the monitor and the graphics card support), otherwise your window creation will just fail.

+

sf::VideoMode provides a static function for retrieving the list of all the video modes supported by the system: getFullscreenModes().

+

A custom video mode can also be checked directly for fullscreen compatibility with its isValid() function.

+

Additionnally, sf::VideoMode provides a static function to get the mode currently used by the desktop: getDesktopMode(). This allows to build windows with the same size or pixel depth as the current resolution.

+

Usage example:

+
// Display the list of all the video modes available for fullscreen
+
std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
+
for (std::size_t i = 0; i < modes.size(); ++i)
+
{
+
sf::VideoMode mode = modes[i];
+
std::cout << "Mode #" << i << ": "
+
<< mode.width << "x" << mode.height << " - "
+
<< mode.bitsPerPixel << " bpp" << std::endl;
+
}
+
+
// Create a window with the same pixel depth as the desktop
+ +
window.create(sf::VideoMode(1024, 768, desktop.bitsPerPixel), "SFML window");
+
+

Definition at line 41 of file VideoMode.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::VideoMode::VideoMode ()
+
+ +

Default constructor.

+

This constructors initializes all members to 0.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
sf::VideoMode::VideoMode (unsigned int modeWidth,
unsigned int modeHeight,
unsigned int modeBitsPerPixel = 32 
)
+
+ +

Construct the video mode with its attributes.

+
Parameters
+ + + + +
modeWidthWidth in pixels
modeHeightHeight in pixels
modeBitsPerPixelPixel depths in bits per pixel
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + +
+ + + + + + + +
static VideoMode sf::VideoMode::getDesktopMode ()
+
+static
+
+ +

Get the current desktop video mode.

+
Returns
Current desktop video mode
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
static const std::vector<VideoMode>& sf::VideoMode::getFullscreenModes ()
+
+static
+
+ +

Retrieve all the video modes supported in fullscreen mode.

+

When creating a fullscreen window, the video mode is restricted to be compatible with what the graphics driver and monitor support. This function returns the complete list of all video modes that can be used in fullscreen mode. The returned array is sorted from best to worst, so that the first element will always give the best mode (higher width, height and bits-per-pixel).

+
Returns
Array containing all the supported fullscreen modes
+ +
+
+ +
+
+ + + + + + + +
bool sf::VideoMode::isValid () const
+
+ +

Tell whether or not the video mode is valid.

+

The validity of video modes is only relevant when using fullscreen windows; otherwise any video mode can be used with no restriction.

+
Returns
True if the video mode is valid for fullscreen mode
+ +
+
+

Friends And Related Function Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator!= (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of != operator to compare two video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if modes are different
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator< (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of < operator to compare video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if left is lesser than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator<= (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of <= operator to compare video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if left is lesser or equal than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator== (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of == operator to compare two video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if modes are equal
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator> (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of > operator to compare video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if left is greater than right
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool operator>= (const VideoModeleft,
const VideoModeright 
)
+
+related
+
+ +

Overload of >= operator to compare video modes.

+
Parameters
+ + + +
leftLeft operand (a video mode)
rightRight operand (a video mode)
+
+
+
Returns
True if left is greater or equal than right
+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
unsigned int sf::VideoMode::bitsPerPixel
+
+ +

Video mode pixel depth, in bits per pixels.

+ +

Definition at line 104 of file VideoMode.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::VideoMode::height
+
+ +

Video mode height, in pixels.

+ +

Definition at line 103 of file VideoMode.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::VideoMode::width
+
+ +

Video mode width, in pixels.

+ +

Definition at line 102 of file VideoMode.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View-members.htm new file mode 100644 index 0000000..bb4fbeb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View-members.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::View Member List
+
+
+ +

This is the complete list of members for sf::View, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
getCenter() const sf::View
getInverseTransform() const sf::View
getRotation() const sf::View
getSize() const sf::View
getTransform() const sf::View
getViewport() const sf::View
move(float offsetX, float offsetY)sf::View
move(const Vector2f &offset)sf::View
reset(const FloatRect &rectangle)sf::View
rotate(float angle)sf::View
setCenter(float x, float y)sf::View
setCenter(const Vector2f &center)sf::View
setRotation(float angle)sf::View
setSize(float width, float height)sf::View
setSize(const Vector2f &size)sf::View
setViewport(const FloatRect &viewport)sf::View
View()sf::View
View(const FloatRect &rectangle)sf::Viewexplicit
View(const Vector2f &center, const Vector2f &size)sf::View
zoom(float factor)sf::View
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View.htm new file mode 100644 index 0000000..d3b80cb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1View.htm @@ -0,0 +1,681 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::View Class Reference
+
+
+ +

2D camera that defines what region is shown on screen + More...

+ +

#include <View.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 View ()
 Default constructor. More...
 
 View (const FloatRect &rectangle)
 Construct the view from a rectangle. More...
 
 View (const Vector2f &center, const Vector2f &size)
 Construct the view from its center and size. More...
 
void setCenter (float x, float y)
 Set the center of the view. More...
 
void setCenter (const Vector2f &center)
 Set the center of the view. More...
 
void setSize (float width, float height)
 Set the size of the view. More...
 
void setSize (const Vector2f &size)
 Set the size of the view. More...
 
void setRotation (float angle)
 Set the orientation of the view. More...
 
void setViewport (const FloatRect &viewport)
 Set the target viewport. More...
 
void reset (const FloatRect &rectangle)
 Reset the view to the given rectangle. More...
 
const Vector2fgetCenter () const
 Get the center of the view. More...
 
const Vector2fgetSize () const
 Get the size of the view. More...
 
float getRotation () const
 Get the current orientation of the view. More...
 
const FloatRectgetViewport () const
 Get the target viewport rectangle of the view. More...
 
void move (float offsetX, float offsetY)
 Move the view relatively to its current position. More...
 
void move (const Vector2f &offset)
 Move the view relatively to its current position. More...
 
void rotate (float angle)
 Rotate the view relatively to its current orientation. More...
 
void zoom (float factor)
 Resize the view rectangle relatively to its current size. More...
 
const TransformgetTransform () const
 Get the projection transform of the view. More...
 
const TransformgetInverseTransform () const
 Get the inverse projection transform of the view. More...
 
+

Detailed Description

+

2D camera that defines what region is shown on screen

+

sf::View defines a camera in the 2D scene.

+

This is a very powerful concept: you can scroll, rotate or zoom the entire scene without altering the way that your drawable objects are drawn.

+

A view is composed of a source rectangle, which defines what part of the 2D scene is shown, and a target viewport, which defines where the contents of the source rectangle will be displayed on the render target (window or texture).

+

The viewport allows to map the scene to a custom part of the render target, and can be used for split-screen or for displaying a minimap, for example. If the source rectangle has not the same size as the viewport, its contents will be stretched to fit in.

+

To apply a view, you have to assign it to the render target. Then, every objects drawn in this render target will be affected by the view until you use another view.

+

Usage example:

+
+
sf::View view;
+
+
// Initialize the view to a rectangle located at (100, 100) and with a size of 400x200
+
view.reset(sf::FloatRect(100, 100, 400, 200));
+
+
// Rotate it by 45 degrees
+
view.rotate(45);
+
+
// Set its target viewport to be half of the window
+
view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
+
+
// Apply it
+
window.setView(view);
+
+
// Render stuff
+
window.draw(someSprite);
+
+
// Set the default view back
+
window.setView(window.getDefaultView());
+
+
// Render stuff not affected by the view
+
window.draw(someText);
+
See Also
sf::RenderWindow, sf::RenderTexture
+ +

Definition at line 43 of file View.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::View::View ()
+
+ +

Default constructor.

+

This constructor creates a default view of (0, 0, 1000, 1000)

+ +
+
+ +
+
+ + + + + +
+ + + + + + + + +
sf::View::View (const FloatRectrectangle)
+
+explicit
+
+ +

Construct the view from a rectangle.

+
Parameters
+ + +
rectangleRectangle defining the zone to display
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
sf::View::View (const Vector2fcenter,
const Vector2fsize 
)
+
+ +

Construct the view from its center and size.

+
Parameters
+ + + +
centerCenter of the zone to display
sizeSize of zone to display
+
+
+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
const Vector2f& sf::View::getCenter () const
+
+ +

Get the center of the view.

+
Returns
Center of the view
+
See Also
getSize, setCenter
+ +
+
+ +
+
+ + + + + + + +
const Transform& sf::View::getInverseTransform () const
+
+ +

Get the inverse projection transform of the view.

+

This function is meant for internal use only.

+
Returns
Inverse of the projection transform defining the view
+
See Also
getTransform
+ +
+
+ +
+
+ + + + + + + +
float sf::View::getRotation () const
+
+ +

Get the current orientation of the view.

+
Returns
Rotation angle of the view, in degrees
+
See Also
setRotation
+ +
+
+ +
+
+ + + + + + + +
const Vector2f& sf::View::getSize () const
+
+ +

Get the size of the view.

+
Returns
Size of the view
+
See Also
getCenter, setSize
+ +
+
+ +
+
+ + + + + + + +
const Transform& sf::View::getTransform () const
+
+ +

Get the projection transform of the view.

+

This function is meant for internal use only.

+
Returns
Projection transform defining the view
+
See Also
getInverseTransform
+ +
+
+ +
+
+ + + + + + + +
const FloatRect& sf::View::getViewport () const
+
+ +

Get the target viewport rectangle of the view.

+
Returns
Viewport rectangle, expressed as a factor of the target size
+
See Also
setViewport
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::View::move (float offsetX,
float offsetY 
)
+
+ +

Move the view relatively to its current position.

+
Parameters
+ + + +
offsetXX coordinate of the move offset
offsetYY coordinate of the move offset
+
+
+
See Also
setCenter, rotate, zoom
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::move (const Vector2foffset)
+
+ +

Move the view relatively to its current position.

+
Parameters
+ + +
offsetMove offset
+
+
+
See Also
setCenter, rotate, zoom
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::reset (const FloatRectrectangle)
+
+ +

Reset the view to the given rectangle.

+

Note that this function resets the rotation angle to 0.

+
Parameters
+ + +
rectangleRectangle defining the zone to display
+
+
+
See Also
setCenter, setSize, setRotation
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::rotate (float angle)
+
+ +

Rotate the view relatively to its current orientation.

+
Parameters
+ + +
angleAngle to rotate, in degrees
+
+
+
See Also
setRotation, move, zoom
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::View::setCenter (float x,
float y 
)
+
+ +

Set the center of the view.

+
Parameters
+ + + +
xX coordinate of the new center
yY coordinate of the new center
+
+
+
See Also
setSize, getCenter
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::setCenter (const Vector2fcenter)
+
+ +

Set the center of the view.

+
Parameters
+ + +
centerNew center
+
+
+
See Also
setSize, getCenter
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::setRotation (float angle)
+
+ +

Set the orientation of the view.

+

The default rotation of a view is 0 degree.

+
Parameters
+ + +
angleNew angle, in degrees
+
+
+
See Also
getRotation
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::View::setSize (float width,
float height 
)
+
+ +

Set the size of the view.

+
Parameters
+ + + +
widthNew width of the view
heightNew height of the view
+
+
+
See Also
setCenter, getCenter
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::setSize (const Vector2fsize)
+
+ +

Set the size of the view.

+
Parameters
+ + +
sizeNew size
+
+
+
See Also
setCenter, getCenter
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::setViewport (const FloatRectviewport)
+
+ +

Set the target viewport.

+

The viewport is the rectangle into which the contents of the view are displayed, expressed as a factor (between 0 and 1) of the size of the RenderTarget to which the view is applied. For example, a view which takes the left side of the target would be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)). By default, a view has a viewport which covers the entire target.

+
Parameters
+ + +
viewportNew viewport rectangle
+
+
+
See Also
getViewport
+ +
+
+ +
+
+ + + + + + + + +
void sf::View::zoom (float factor)
+
+ +

Resize the view rectangle relatively to its current size.

+

Resizing the view simulates a zoom, as the zone displayed on screen grows or shrinks. factor is a multiplier:

+
    +
  • 1 keeps the size unchanged
  • +
  • > 1 makes the view bigger (objects appear smaller)
  • +
  • < 1 makes the view smaller (objects appear bigger)
  • +
+
Parameters
+ + +
factorZoom factor to apply
+
+
+
See Also
setSize, move, rotate
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window-members.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window-members.htm new file mode 100644 index 0000000..c105692 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window-members.htm @@ -0,0 +1,87 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Window Member List
+
+
+ +

This is the complete list of members for sf::Window, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
close()sf::Window
create(VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())sf::Window
create(WindowHandle handle, const ContextSettings &settings=ContextSettings())sf::Window
display()sf::Window
ensureGlContext()sf::GlResourceprivatestatic
getPosition() const sf::Window
getSettings() const sf::Window
getSize() const sf::Window
getSystemHandle() const sf::Window
GlResource()sf::GlResourceprivate
isOpen() const sf::Window
NonCopyable()sf::NonCopyableinlineprivate
onCreate()sf::Windowprotectedvirtual
onResize()sf::Windowprotectedvirtual
pollEvent(Event &event)sf::Window
setActive(bool active=true) const sf::Window
setFramerateLimit(unsigned int limit)sf::Window
setIcon(unsigned int width, unsigned int height, const Uint8 *pixels)sf::Window
setJoystickThreshold(float threshold)sf::Window
setKeyRepeatEnabled(bool enabled)sf::Window
setMouseCursorVisible(bool visible)sf::Window
setPosition(const Vector2i &position)sf::Window
setSize(const Vector2u size)sf::Window
setTitle(const String &title)sf::Window
setVerticalSyncEnabled(bool enabled)sf::Window
setVisible(bool visible)sf::Window
waitEvent(Event &event)sf::Window
Window()sf::Window
Window(VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())sf::Window
Window(WindowHandle handle, const ContextSettings &settings=ContextSettings())sf::Windowexplicit
~GlResource()sf::GlResourceprivate
~Window()sf::Windowvirtual
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.htm b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.htm new file mode 100644 index 0000000..89f94ca --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.htm @@ -0,0 +1,989 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + + +
+ +

Window that serves as a target for OpenGL rendering. + More...

+ +

#include <Window.hpp>

+
+Inheritance diagram for sf::Window:
+
+
+ + +sf::GlResource +sf::NonCopyable +sf::RenderWindow + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Window ()
 Default constructor. More...
 
 Window (VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())
 Construct a new window. More...
 
 Window (WindowHandle handle, const ContextSettings &settings=ContextSettings())
 Construct the window from an existing control. More...
 
virtual ~Window ()
 Destructor. More...
 
void create (VideoMode mode, const String &title, Uint32 style=Style::Default, const ContextSettings &settings=ContextSettings())
 Create (or recreate) the window. More...
 
void create (WindowHandle handle, const ContextSettings &settings=ContextSettings())
 Create (or recreate) the window from an existing control. More...
 
void close ()
 Close the window and destroy all the attached resources. More...
 
bool isOpen () const
 Tell whether or not the window is open. More...
 
const ContextSettingsgetSettings () const
 Get the settings of the OpenGL context of the window. More...
 
bool pollEvent (Event &event)
 Pop the event on top of the event queue, if any, and return it. More...
 
bool waitEvent (Event &event)
 Wait for an event and return it. More...
 
Vector2i getPosition () const
 Get the position of the window. More...
 
void setPosition (const Vector2i &position)
 Change the position of the window on screen. More...
 
Vector2u getSize () const
 Get the size of the rendering region of the window. More...
 
void setSize (const Vector2u size)
 Change the size of the rendering region of the window. More...
 
void setTitle (const String &title)
 Change the title of the window. More...
 
void setIcon (unsigned int width, unsigned int height, const Uint8 *pixels)
 Change the window's icon. More...
 
void setVisible (bool visible)
 Show or hide the window. More...
 
void setVerticalSyncEnabled (bool enabled)
 Enable or disable vertical synchronization. More...
 
void setMouseCursorVisible (bool visible)
 Show or hide the mouse cursor. More...
 
void setKeyRepeatEnabled (bool enabled)
 Enable or disable automatic key-repeat. More...
 
void setFramerateLimit (unsigned int limit)
 Limit the framerate to a maximum fixed frequency. More...
 
void setJoystickThreshold (float threshold)
 Change the joystick threshold. More...
 
bool setActive (bool active=true) const
 Activate or deactivate the window as the current target for OpenGL rendering. More...
 
void display ()
 Display on screen what has been rendered to the window so far. More...
 
WindowHandle getSystemHandle () const
 Get the OS-specific handle of the window. More...
 
+ + + + + + + +

+Protected Member Functions

virtual void onCreate ()
 Function called after the window has been created. More...
 
virtual void onResize ()
 Function called after the window has been resized. More...
 
+ + + + +

+Static Private Member Functions

static void ensureGlContext ()
 Make sure that a valid OpenGL context exists in the current thread. More...
 
+

Detailed Description

+

Window that serves as a target for OpenGL rendering.

+

sf::Window is the main class of the Window module.

+

It defines an OS window that is able to receive an OpenGL rendering.

+

A sf::Window can create its own new window, or be embedded into an already existing control using the create(handle) function. This can be useful for embedding an OpenGL rendering area into a view which is part of a bigger GUI with existing windows, controls, etc. It can also serve as embedding an OpenGL rendering area into a window created by another (probably richer) GUI library like Qt or wxWidgets.

+

The sf::Window class provides a simple interface for manipulating the window: move, resize, show/hide, control mouse cursor, etc. It also provides event handling through its pollEvent() and waitEvent() functions.

+

Note that OpenGL experts can pass their own parameters (antialiasing level, bits for the depth and stencil buffers, etc.) to the OpenGL context attached to the window, with the sf::ContextSettings structure which is passed as an optional argument when creating the window.

+

Usage example:

+
// Declare and create a new window
+
sf::Window window(sf::VideoMode(800, 600), "SFML window");
+
+
// Limit the framerate to 60 frames per second (this step is optional)
+
window.setFramerateLimit(60);
+
+
// The main loop - ends as soon as the window is closed
+
while (window.isOpen())
+
{
+
// Event processing
+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// Request for closing the window
+
if (event.type == sf::Event::Closed)
+
window.close();
+
}
+
+
// Activate the window for OpenGL rendering
+
window.setActive();
+
+
// OpenGL drawing commands go here...
+
+
// End the current frame and display its contents on screen
+
window.display();
+
}
+
+

Definition at line 57 of file Window/Window.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
sf::Window::Window ()
+
+ +

Default constructor.

+

This constructor doesn't actually create the window, use the other constructors or call "create" to do so.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::Window::Window (VideoMode mode,
const Stringtitle,
Uint32 style = Style::Default,
const ContextSettingssettings = ContextSettings() 
)
+
+ +

Construct a new window.

+

This constructor creates the window with the size and pixel depth defined in mode. An optional style can be passed to customize the look and behaviour of the window (borders, title bar, resizable, closable, ...). If style contains Style::Fullscreen, then mode must be a valid video mode.

+

The fourth parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc.

+
Parameters
+ + + + + +
modeVideo mode to use (defines the width, height and depth of the rendering area of the window)
titleTitle of the window
styleWindow style
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
sf::Window::Window (WindowHandle handle,
const ContextSettingssettings = ContextSettings() 
)
+
+explicit
+
+ +

Construct the window from an existing control.

+

Use this constructor if you want to create an OpenGL rendering area into an already existing control.

+

The second parameter is an optional structure specifying advanced OpenGL context settings such as antialiasing, depth-buffer bits, etc.

+
Parameters
+ + + +
handlePlatform-specific handle of the control
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual sf::Window::~Window ()
+
+virtual
+
+ +

Destructor.

+

Closes the window and free all the resources attached to it.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void sf::Window::close ()
+
+ +

Close the window and destroy all the attached resources.

+

After calling this function, the sf::Window instance remains valid and you can call create() to recreate the window. All other functions such as pollEvent() or display() will still work (i.e. you don't have to test isOpen() every time), and will have no effect on closed windows.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Window::create (VideoMode mode,
const Stringtitle,
Uint32 style = Style::Default,
const ContextSettingssettings = ContextSettings() 
)
+
+ +

Create (or recreate) the window.

+

If the window was already created, it closes it first. If style contains Style::Fullscreen, then mode must be a valid video mode.

+
Parameters
+ + + + + +
modeVideo mode to use (defines the width, height and depth of the rendering area of the window)
titleTitle of the window
styleWindow style
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void sf::Window::create (WindowHandle handle,
const ContextSettingssettings = ContextSettings() 
)
+
+ +

Create (or recreate) the window from an existing control.

+

Use this function if you want to create an OpenGL rendering area into an already existing control. If the window was already created, it closes it first.

+
Parameters
+ + + +
handlePlatform-specific handle of the control
settingsAdditional settings for the underlying OpenGL context
+
+
+ +
+
+ +
+
+ + + + + + + +
void sf::Window::display ()
+
+ +

Display on screen what has been rendered to the window so far.

+

This function is typically called after all OpenGL rendering has been done for the current frame, in order to show it on screen.

+ +
+
+ +
+
+ + + + + + + +
Vector2i sf::Window::getPosition () const
+
+ +

Get the position of the window.

+
Returns
Position of the window, in pixels
+
See Also
setPosition
+ +
+
+ +
+
+ + + + + + + +
const ContextSettings& sf::Window::getSettings () const
+
+ +

Get the settings of the OpenGL context of the window.

+

Note that these settings may be different from what was passed to the constructor or the create() function, if one or more settings were not supported. In this case, SFML chose the closest match.

+
Returns
Structure containing the OpenGL context settings
+ +
+
+ +
+
+ + + + + + + +
Vector2u sf::Window::getSize () const
+
+ +

Get the size of the rendering region of the window.

+

The size doesn't include the titlebar and borders of the window.

+
Returns
Size in pixels
+
See Also
setSize
+ +
+
+ +
+
+ + + + + + + +
WindowHandle sf::Window::getSystemHandle () const
+
+ +

Get the OS-specific handle of the window.

+

The type of the returned handle is sf::WindowHandle, which is a typedef to the handle type defined by the OS. You shouldn't need to use this function, unless you have very specific stuff to implement that SFML doesn't support, or implement a temporary workaround until a bug is fixed.

+
Returns
System handle of the window
+ +
+
+ +
+
+ + + + + + + +
bool sf::Window::isOpen () const
+
+ +

Tell whether or not the window is open.

+

This function returns whether or not the window exists. Note that a hidden window (setVisible(false)) is open (therefore this function would return true).

+
Returns
True if the window is open, false if it has been closed
+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::Window::onCreate ()
+
+protectedvirtual
+
+ +

Function called after the window has been created.

+

This function is called so that derived classes can perform their own specific initialization as soon as the window is created.

+ +

Reimplemented in sf::RenderWindow.

+ +
+
+ +
+
+ + + + + +
+ + + + + + + +
virtual void sf::Window::onResize ()
+
+protectedvirtual
+
+ +

Function called after the window has been resized.

+

This function is called so that derived classes can perform custom actions when the size of the window changes.

+ +

Reimplemented in sf::RenderWindow.

+ +
+
+ +
+
+ + + + + + + + +
bool sf::Window::pollEvent (Eventevent)
+
+ +

Pop the event on top of the event queue, if any, and return it.

+

This function is not blocking: if there's no pending event then it will return false and leave event unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event.

+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// process event...
+
}
+
Parameters
+ + +
eventEvent to be returned
+
+
+
Returns
True if an event was returned, or false if the event queue was empty
+
See Also
waitEvent
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Window::setActive (bool active = true) const
+
+ +

Activate or deactivate the window as the current target for OpenGL rendering.

+

A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated.

+
Parameters
+ + +
activeTrue to activate, false to deactivate
+
+
+
Returns
True if operation was successful, false otherwise
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setFramerateLimit (unsigned int limit)
+
+ +

Limit the framerate to a maximum fixed frequency.

+

If a limit is set, the window will use a small delay after each call to display() to ensure that the current frame lasted long enough to match the framerate limit. SFML will try to match the given limit as much as it can, but since it internally uses sf::sleep, whose precision depends on the underlying OS, the results may be a little unprecise as well (for example, you can get 65 FPS when requesting 60).

+
Parameters
+ + +
limitFramerate limit, in frames per seconds (use 0 to disable limit)
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void sf::Window::setIcon (unsigned int width,
unsigned int height,
const Uint8 * pixels 
)
+
+ +

Change the window's icon.

+

pixels must be an array of width x height pixels in 32-bits RGBA format.

+

The OS default icon is used by default.

+
Parameters
+ + + + +
widthIcon's width, in pixels
heightIcon's height, in pixels
pixelsPointer to the array of pixels in memory
+
+
+
See Also
setTitle
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setJoystickThreshold (float threshold)
+
+ +

Change the joystick threshold.

+

The joystick threshold is the value below which no JoystickMoved event will be generated.

+

The threshold value is 0.1 by default.

+
Parameters
+ + +
thresholdNew threshold, in the range [0, 100]
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setKeyRepeatEnabled (bool enabled)
+
+ +

Enable or disable automatic key-repeat.

+

If key repeat is enabled, you will receive repeated KeyPressed events while keeping a key pressed. If it is disabled, you will only get a single event when the key is pressed.

+

Key repeat is enabled by default.

+
Parameters
+ + +
enabledTrue to enable, false to disable
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setMouseCursorVisible (bool visible)
+
+ +

Show or hide the mouse cursor.

+

The mouse cursor is visible by default.

+
Parameters
+ + +
visibleTrue to show the mouse cursor, false to hide it
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setPosition (const Vector2iposition)
+
+ +

Change the position of the window on screen.

+

This function only works for top-level windows (i.e. it will be ignored for windows created from the handle of a child window/control).

+
Parameters
+ + +
positionNew position, in pixels
+
+
+
See Also
getPosition
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setSize (const Vector2u size)
+
+ +

Change the size of the rendering region of the window.

+
Parameters
+ + +
sizeNew size, in pixels
+
+
+
See Also
getSize
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setTitle (const Stringtitle)
+
+ +

Change the title of the window.

+
Parameters
+ + +
titleNew title
+
+
+
See Also
setIcon
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setVerticalSyncEnabled (bool enabled)
+
+ +

Enable or disable vertical synchronization.

+

Activating vertical synchronization will limit the number of frames displayed to the refresh rate of the monitor. This can avoid some visual artifacts, and limit the framerate to a good value (but not constant across different computers).

+

Vertical synchronization is disabled by default.

+
Parameters
+ + +
enabledTrue to enable v-sync, false to deactivate it
+
+
+ +
+
+ +
+
+ + + + + + + + +
void sf::Window::setVisible (bool visible)
+
+ +

Show or hide the window.

+

The window is shown by default.

+
Parameters
+ + +
visibleTrue to show the window, false to hide it
+
+
+ +
+
+ +
+
+ + + + + + + + +
bool sf::Window::waitEvent (Eventevent)
+
+ +

Wait for an event and return it.

+

This function is blocking: if there's no pending event then it will wait until an event is received. After this function returns (and no error occured), the event object is always valid and filled properly. This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread sleep as long as no new event is received.

+
sf::Event event;
+
if (window.waitEvent(event))
+
{
+
// process event...
+
}
+
Parameters
+ + +
eventEvent to be returned
+
+
+
Returns
False if any error occured
+
See Also
pollEvent
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.png b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.png new file mode 100644 index 0000000..75c9ab3 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/classsf_1_1Window.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/closed.png b/SFML-2.1-osx-clang-universal/doc/html/closed.png new file mode 100644 index 0000000..98cc2c9 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/closed.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_0ccda3a7de18f509ca1da5cc9f800e28.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_0ccda3a7de18f509ca1da5cc9f800e28.htm new file mode 100644 index 0000000..61ec7fe --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_0ccda3a7de18f509ca1da5cc9f800e28.htm @@ -0,0 +1,90 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
System Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  Clock.hpp [code]
 
file  Err.hpp [code]
 
file  System/Export.hpp [code]
 
file  InputStream.hpp [code]
 
file  Lock.hpp [code]
 
file  Mutex.hpp [code]
 
file  NonCopyable.hpp [code]
 
file  Sleep.hpp [code]
 
file  String.hpp [code]
 
file  Thread.hpp [code]
 
file  Thread.inl [code]
 
file  ThreadLocal.hpp [code]
 
file  ThreadLocalPtr.hpp [code]
 
file  ThreadLocalPtr.inl [code]
 
file  Time.hpp [code]
 
file  Utf.hpp [code]
 
file  Utf.inl [code]
 
file  Vector2.hpp [code]
 
file  Vector2.inl [code]
 
file  Vector3.hpp [code]
 
file  Vector3.inl [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_23684cb3154a9a6315b13ddae22451ba.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_23684cb3154a9a6315b13ddae22451ba.htm new file mode 100644 index 0000000..b7bd4f1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_23684cb3154a9a6315b13ddae22451ba.htm @@ -0,0 +1,66 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
Audio Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + +

+Files

file  Audio/Export.hpp [code]
 
file  Listener.hpp [code]
 
file  Music.hpp [code]
 
file  Sound.hpp [code]
 
file  SoundBuffer.hpp [code]
 
file  SoundBufferRecorder.hpp [code]
 
file  SoundRecorder.hpp [code]
 
file  SoundSource.hpp [code]
 
file  SoundStream.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_5b3d798f7f3738805c48f4569d73ec1e.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_5b3d798f7f3738805c48f4569d73ec1e.htm new file mode 100644 index 0000000..5310a78 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_5b3d798f7f3738805c48f4569d73ec1e.htm @@ -0,0 +1,70 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
Network Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  Network/Export.hpp [code]
 
file  Ftp.hpp [code]
 
file  Http.hpp [code]
 
file  IpAddress.hpp [code]
 
file  Packet.hpp [code]
 
file  Socket.hpp [code]
 
file  SocketHandle.hpp [code]
 
file  SocketSelector.hpp [code]
 
file  TcpListener.hpp [code]
 
file  TcpSocket.hpp [code]
 
file  UdpSocket.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_6c7bee9a69c8d4d5a239feb5f32dab30.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_6c7bee9a69c8d4d5a239feb5f32dab30.htm new file mode 100644 index 0000000..41f3c6c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_6c7bee9a69c8d4d5a239feb5f32dab30.htm @@ -0,0 +1,50 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
doc Directory Reference
+
+
+ + + + +

+Files

file  mainpage.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_798ce90c6ecad3595159066965e3fff6.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_798ce90c6ecad3595159066965e3fff6.htm new file mode 100644 index 0000000..c847b36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_798ce90c6ecad3595159066965e3fff6.htm @@ -0,0 +1,72 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
Window Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  Context.hpp [code]
 
file  ContextSettings.hpp [code]
 
file  Event.hpp [code]
 
file  Window/Export.hpp [code]
 
file  GlResource.hpp [code]
 
file  Joystick.hpp [code]
 
file  Keyboard.hpp [code]
 
file  Mouse.hpp [code]
 
file  VideoMode.hpp [code]
 
file  Window/Window.hpp [code]
 
file  WindowHandle.hpp [code]
 
file  WindowStyle.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_b57c126f18dbb5f6d210188b78112323.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_b57c126f18dbb5f6d210188b78112323.htm new file mode 100644 index 0000000..6d84f52 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_b57c126f18dbb5f6d210188b78112323.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
Graphics Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  BlendMode.hpp [code]
 
file  CircleShape.hpp [code]
 
file  Color.hpp [code]
 
file  ConvexShape.hpp [code]
 
file  Drawable.hpp [code]
 
file  Graphics/Export.hpp [code]
 
file  Font.hpp [code]
 
file  Glyph.hpp [code]
 
file  Image.hpp [code]
 
file  PrimitiveType.hpp [code]
 
file  Rect.hpp [code]
 
file  Rect.inl [code]
 
file  RectangleShape.hpp [code]
 
file  RenderStates.hpp [code]
 
file  RenderTarget.hpp [code]
 
file  RenderTexture.hpp [code]
 
file  RenderWindow.hpp [code]
 
file  Shader.hpp [code]
 
file  Shape.hpp [code]
 
file  Sprite.hpp [code]
 
file  Text.hpp [code]
 
file  Texture.hpp [code]
 
file  Transform.hpp [code]
 
file  Transformable.hpp [code]
 
file  Vertex.hpp [code]
 
file  VertexArray.hpp [code]
 
file  View.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_c08fb8d44334911c4cd4ccee54f88f02.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_c08fb8d44334911c4cd4ccee54f88f02.htm new file mode 100644 index 0000000..39edfe9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_c08fb8d44334911c4cd4ccee54f88f02.htm @@ -0,0 +1,50 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
include Directory Reference
+
+
+ + + + +

+Directories

directory  SFML
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/dir_e537a36512cc2fc6f08fd874f83e8f5f.htm b/SFML-2.1-osx-clang-universal/doc/html/dir_e537a36512cc2fc6f08fd874f83e8f5f.htm new file mode 100644 index 0000000..ffcfc09 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dir_e537a36512cc2fc6f08fd874f83e8f5f.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
SFML Directory Reference
+
+
+ + + + + + + + + + + + +

+Directories

directory  Audio
 
directory  Graphics
 
directory  Network
 
directory  System
 
directory  Window
 
+ + + + + + + + + + + + + + + +

+Files

file  Audio.hpp [code]
 
file  Config.hpp [code]
 
file  Graphics.hpp [code]
 
file  Network.hpp [code]
 
file  OpenGL.hpp [code]
 
file  System.hpp [code]
 
file  Window.hpp [code]
 
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/doxygen.css b/SFML-2.1-osx-clang-universal/doc/html/doxygen.css new file mode 100644 index 0000000..d89e3a0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/doxygen.css @@ -0,0 +1,1278 @@ +/* The standard CSS for doxygen */ + +/* @group Heading Levels */ + +div.contents .textblock h1 +{ + text-align: left; + font-size: 20pt; + font-weight: normal; + margin-top: 1.5em; + padding: 0 0 0.4em 0; + border-bottom: 1px solid #999; + border-top-width: 0; + border-left-width: 0; + border-right-width: 0; + background-color: transparent; +} + +h1.groupheader { + font-size: 150%; +} + +.title { + font-size: 20pt; + font-weight: normal; + margin: 10px 2px; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex +{ + margin-bottom: 1em; +} + +div.qindex, div.navtab{ + background-color: #eee; + border: 1px solid #999; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +a.el +{ + padding: 1px; + text-decoration: none; + color: #577E25; +} + +a.el:hover +{ + text-decoration: underline; +} + +pre.fragment { + /*border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%;*/ + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-size: 10pt; + padding: 0.5em 1em; + background-color: #f5f5f5; + border: 1px solid #bbb; + .border-radius(5px); +} + +div.fragment { + /*margin: 0 0 0 5px; + padding: 0.5em 1em; + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-size: 10pt; + background-color: #eef7e3; + border-left: 3px solid #8DC841; + border-right: 0; + border-bottom: 0;*/ + + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-size: 10pt; + padding: 0.5em 1em; + background-color: #f5f5f5; + border: 1px solid #bbb; + .border-radius(5px); +} + +div.line { + min-height: 13px; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; +} + +span.lineno { + padding-right: 4px; + text-align: right; + background-color: #E8E8E8; + white-space: pre; +} + +div.ah { + width: 100%; + background-color: #eee; + font-weight: bold; + color: #000; + margin-bottom: 1px; + margin-top: 1px; + border: solid 1px #999; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + width: 950px; + margin: 0 auto; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +/* @end */ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + display: none; + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + /*box-shadow: 0 0 15px cyan;*/ +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + /*margin-bottom: 10px;*/ + margin-right: 5px; + display: table !important; + width: 100%; +} + +.memname { + font-weight: bold; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #000; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #eee; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; + +} + +.memdoc, dl.reflist dd { + border: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + background-color: #FBFCFD; + background-color: #FFFFFF; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view when not used as main index */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #bbb; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding: 5px 5px 5px 0; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + /*border-left: 1px solid rgba(0,0,0,0.05);*/ +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table table +{ + width: 90%; +} + +.memitem table table +{ + width: auto; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + width: 100%; + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + width: 100%; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath +{ + display: none; +} + +.navpath ul +{ + font-size: 11px; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; + padding: 1px; + text-decoration: none; + color: #577E25; +} + +div.summary a:hover +{ + text-decoration: underline; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + width: 950px; + margin: 2em auto; + border-bottom: 1px solid #999; +} + +dl +{ + padding: 0 0 0 10px; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ +dl.section +{ + margin-left: 0px; + padding-left: 0px; +} + +dl.note +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00D000; +} + +dl.deprecated +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #505050; +} + +dl.todo +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00C0E0; +} + +dl.test +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #3030E0; +} + +dl.bug +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 20px 10px 10px; + width: 200px; +} + +div.toc li { + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* tabs.css */ +.tabs, .tabs2, .tabs3 { + width: 100%; + z-index: 101; + font-size: 11pt; + background-color: #EAF5DB; + border-left: 1px solid #999; + border-right: 1px solid #999; + border-bottom: 1px solid #999; + padding: 0; + margin: 0; +} + +.tabs2 { + font-size: 10pt; +} +.tabs3 { + font-size: 9pt; +} + +#navrow1 .tablist, #navrow2 .tablist, #navrow3 .tablist, #navrow4 .tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + list-style: none; +} + +#navrow1 +{ + border-top: 1px solid #999; + margin-top: 2em; +} + +#navrow1 .tablist a, #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a { + display: block; + margin: 8px 0; + padding: 0 8px; + border-right: 1px solid #bbb; +} + +.tablist li { + margin-bottom: 0 !important; +} + +.tablist li.current a { + font-weight: bold; +} + + + + + +/* SFML css */ +body +{ + font-family: 'Ubuntu', 'Arial', sans-serif; + line-height: 140%; + margin: 0 0 2em 0; + padding: 0; +} + +#banner-container +{ + width: 100%; + margin-top: 25px; + border-top: 2px solid #999; + border-bottom: 2px solid #999; + background-color: rgb(140, 200, 65); +} + +#banner +{ + width: 950px; + height: 60px; + line-height: 54px; + margin: 0 auto; + text-align: center; +} + +#banner #sfml +{ + display: inline; + vertical-align: top; + margin-left: 15px; + color: #fff; + font-size: 50pt; + text-shadow: rgba(0, 0, 0, 0.5) 1px 1px 5px; +} + +#footer-container +{ + clear: both; + width: 100%; + margin-top: 50px; + border-top: 1px solid #999; +} + +#footer +{ + width: 950px; + margin: 10px auto; + text-align: center; + font-size: 10pt; + color: #555; +} + +#footer a +{ + padding: 1px; + text-decoration: none; + color: rgb(70, 100, 30); +} + +#footer a:hover +{ + text-decoration: underline; +} + +div.contents, #content +{ + width: 950px; + margin: 0 auto; + padding: 0; +} + +div.contents h1 +{ + color: #333; + padding: 0.5em 0; + margin-top: 30px; + margin-bottom: 0; + text-align: center; + font-size: 26pt; + font-weight: normal; +} + +div.contents h2 +{ + font-size: 20pt; + font-weight: normal; + margin-top: 1.5em; + padding-bottom: 0.4em; + border-bottom: 1px solid #999; +} + +div.contents h3 +{ + font-size: 16pt; + font-weight: normal; +} + +div.contents p +{ + color: #333; + text-align: justify; +} + +div.contents a, #content a +{ + padding: 1px; + text-decoration: none; + color: rgb(70, 100, 30); +} + +div.contents a:hover, #content a:hover +{ + text-decoration: underline; +} + +div.contents code +{ + font-size: 11pt; + font-family: Consolas, "Liberation Mono", Courier, monospace; +} + +div.contents pre code +{ + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-size: 10pt; + padding: 0.5em 1em; + background-color: #f5f5f5; + border: 1px solid #bbb; +} + +div.contents ul +{ + list-style-type: square; + list-style-position: outside; + margin: 0 0 0 1.5em; + padding: 0; +} + +div.contents ul li +{ + color: #333; + margin: 0 0 0.3em 0; +} + diff --git a/SFML-2.1-osx-clang-universal/doc/html/doxygen.png b/SFML-2.1-osx-clang-universal/doc/html/doxygen.png new file mode 100644 index 0000000..3ff17d8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/doxygen.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/dynsections.js b/SFML-2.1-osx-clang-universal/doc/html/dynsections.js new file mode 100644 index 0000000..ed092c7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/dynsections.js @@ -0,0 +1,97 @@ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} +function toggleLevel(level) +{ + $('table.directory tr').each(function(){ + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + +
+
+
+
File List
+
+
+
Here is a list of all documented files with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
o*Audio.hpp
o*BlendMode.hpp
o*CircleShape.hpp
o*Clock.hpp
o*Color.hpp
o*Config.hpp
o*Context.hpp
o*ContextSettings.hpp
o*ConvexShape.hpp
o*Drawable.hpp
o*Err.hpp
o*Event.hpp
o*Audio/Export.hpp
o*Graphics/Export.hpp
o*Network/Export.hpp
o*System/Export.hpp
o*Window/Export.hpp
o*Font.hpp
o*Ftp.hpp
o*GlResource.hpp
o*Glyph.hpp
o*Graphics.hpp
o*Http.hpp
o*Image.hpp
o*InputStream.hpp
o*IpAddress.hpp
o*Joystick.hpp
o*Keyboard.hpp
o*Listener.hpp
o*Lock.hpp
o*mainpage.hpp
o*Mouse.hpp
o*Music.hpp
o*Mutex.hpp
o*Network.hpp
o*NonCopyable.hpp
o*OpenGL.hpp
o*Packet.hpp
o*PrimitiveType.hpp
o*Rect.hpp
o*Rect.inl
o*RectangleShape.hpp
o*RenderStates.hpp
o*RenderTarget.hpp
o*RenderTexture.hpp
o*RenderWindow.hpp
o*Shader.hpp
o*Shape.hpp
o*Sleep.hpp
o*Socket.hpp
o*SocketHandle.hpp
o*SocketSelector.hpp
o*Sound.hpp
o*SoundBuffer.hpp
o*SoundBufferRecorder.hpp
o*SoundRecorder.hpp
o*SoundSource.hpp
o*SoundStream.hpp
o*Sprite.hpp
o*String.hpp
o*System.hpp
o*TcpListener.hpp
o*TcpSocket.hpp
o*Text.hpp
o*Texture.hpp
o*Thread.hpp
o*Thread.inl
o*ThreadLocal.hpp
o*ThreadLocalPtr.hpp
o*ThreadLocalPtr.inl
o*Time.hpp
o*Transform.hpp
o*Transformable.hpp
o*UdpSocket.hpp
o*Utf.hpp
o*Utf.inl
o*Vector2.hpp
o*Vector2.inl
o*Vector3.hpp
o*Vector3.inl
o*Vertex.hpp
o*VertexArray.hpp
o*VideoMode.hpp
o*View.hpp
o*Window/Window.hpp
o*Window.hpp
o*WindowHandle.hpp
\*WindowStyle.hpp
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2blank.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2blank.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2blank.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2cl.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2cl.png new file mode 100644 index 0000000..132f657 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2cl.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2doc.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2doc.png new file mode 100644 index 0000000..17edabf Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2doc.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2folderclosed.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2folderclosed.png new file mode 100644 index 0000000..bb8ab35 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2folderclosed.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2folderopen.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2folderopen.png new file mode 100644 index 0000000..d6c7f67 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2folderopen.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2lastnode.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2lastnode.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2lastnode.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2link.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2link.png new file mode 100644 index 0000000..17edabf Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2link.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2mlastnode.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2mlastnode.png new file mode 100644 index 0000000..0b63f6d Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2mlastnode.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2mnode.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2mnode.png new file mode 100644 index 0000000..0b63f6d Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2mnode.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2mo.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2mo.png new file mode 100644 index 0000000..4bfb80f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2mo.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2node.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2node.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2node.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2ns.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2ns.png new file mode 100644 index 0000000..72e3d71 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2ns.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2plastnode.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2plastnode.png new file mode 100644 index 0000000..c6ee22f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2plastnode.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2pnode.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2pnode.png new file mode 100644 index 0000000..c6ee22f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2pnode.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2splitbar.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2splitbar.png new file mode 100644 index 0000000..fe895f2 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2splitbar.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/ftv2vertline.png b/SFML-2.1-osx-clang-universal/doc/html/ftv2vertline.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/ftv2vertline.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions.htm b/SFML-2.1-osx-clang-universal/doc/html/functions.htm new file mode 100644 index 0000000..96321cc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions.htm @@ -0,0 +1,144 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- a -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x62.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x62.htm new file mode 100644 index 0000000..ff539f0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x62.htm @@ -0,0 +1,153 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- b -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x63.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x63.htm new file mode 100644 index 0000000..1b7bf9a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x63.htm @@ -0,0 +1,218 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- c -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x64.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x64.htm new file mode 100644 index 0000000..249aff1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x64.htm @@ -0,0 +1,169 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- d -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x65.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x65.htm new file mode 100644 index 0000000..ca7b997 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x65.htm @@ -0,0 +1,136 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- e -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x66.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x66.htm new file mode 100644 index 0000000..d35b427 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x66.htm @@ -0,0 +1,188 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- f -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x67.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x67.htm new file mode 100644 index 0000000..48c5b7a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x67.htm @@ -0,0 +1,390 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- g -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x68.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x68.htm new file mode 100644 index 0000000..31cf7c9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x68.htm @@ -0,0 +1,112 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- h -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x69.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x69.htm new file mode 100644 index 0000000..a631873 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x69.htm @@ -0,0 +1,179 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- i -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6a.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6a.htm new file mode 100644 index 0000000..9b3212d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6a.htm @@ -0,0 +1,121 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- j -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6b.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6b.htm new file mode 100644 index 0000000..98e0e07 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6b.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- k -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6c.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6c.htm new file mode 100644 index 0000000..dda7091 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6c.htm @@ -0,0 +1,172 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- l -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6d.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6d.htm new file mode 100644 index 0000000..4b13a6a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6d.htm @@ -0,0 +1,179 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- m -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6e.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6e.htm new file mode 100644 index 0000000..4bcdca8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6e.htm @@ -0,0 +1,199 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- n -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x6f.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6f.htm new file mode 100644 index 0000000..998712a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x6f.htm @@ -0,0 +1,267 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- o -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x70.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x70.htm new file mode 100644 index 0000000..65e18a8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x70.htm @@ -0,0 +1,164 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- p -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x71.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x71.htm new file mode 100644 index 0000000..43d988d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x71.htm @@ -0,0 +1,95 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- q -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x72.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x72.htm new file mode 100644 index 0000000..85edc33 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x72.htm @@ -0,0 +1,195 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- r -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x73.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x73.htm new file mode 100644 index 0000000..d757212 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x73.htm @@ -0,0 +1,395 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- s -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x74.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x74.htm new file mode 100644 index 0000000..4b5ae2a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x74.htm @@ -0,0 +1,225 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- t -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x75.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x75.htm new file mode 100644 index 0000000..ef24792 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x75.htm @@ -0,0 +1,129 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- u -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x76.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x76.htm new file mode 100644 index 0000000..1a003d5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x76.htm @@ -0,0 +1,116 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- v -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x77.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x77.htm new file mode 100644 index 0000000..6edf39e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x77.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- w -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x78.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x78.htm new file mode 100644 index 0000000..0384558 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x78.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- x -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x79.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x79.htm new file mode 100644 index 0000000..4a0e31d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x79.htm @@ -0,0 +1,105 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- y -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x7a.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x7a.htm new file mode 100644 index 0000000..442eb80 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x7a.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- z -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_0x7e.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_0x7e.htm new file mode 100644 index 0000000..2e1052c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_0x7e.htm @@ -0,0 +1,170 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- ~ -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_enum.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_enum.htm new file mode 100644 index 0000000..b14e9f9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_enum.htm @@ -0,0 +1,90 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval.htm new file mode 100644 index 0000000..28e9d97 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- a -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x62.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x62.htm new file mode 100644 index 0000000..c36387c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x62.htm @@ -0,0 +1,116 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- b -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x63.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x63.htm new file mode 100644 index 0000000..5d2313b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x63.htm @@ -0,0 +1,123 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- c -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x64.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x64.htm new file mode 100644 index 0000000..7fdca36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x64.htm @@ -0,0 +1,124 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- d -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x65.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x65.htm new file mode 100644 index 0000000..f382870 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x65.htm @@ -0,0 +1,109 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- e -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x66.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x66.htm new file mode 100644 index 0000000..806244b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x66.htm @@ -0,0 +1,157 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- f -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x67.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x67.htm new file mode 100644 index 0000000..b68570f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x67.htm @@ -0,0 +1,100 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- g -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x68.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x68.htm new file mode 100644 index 0000000..b1dc523 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x68.htm @@ -0,0 +1,100 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- h -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x69.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x69.htm new file mode 100644 index 0000000..920448d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x69.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- i -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6a.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6a.htm new file mode 100644 index 0000000..5fc28e6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6a.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- j -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6b.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6b.htm new file mode 100644 index 0000000..e64d37c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6b.htm @@ -0,0 +1,100 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- k -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6c.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6c.htm new file mode 100644 index 0000000..b2de5aa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6c.htm @@ -0,0 +1,119 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- l -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6d.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6d.htm new file mode 100644 index 0000000..55f0916 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6d.htm @@ -0,0 +1,130 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- m -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6e.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6e.htm new file mode 100644 index 0000000..6cb8bdd --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6e.htm @@ -0,0 +1,187 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- n -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6f.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6f.htm new file mode 100644 index 0000000..099e197 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x6f.htm @@ -0,0 +1,98 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- o -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x70.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x70.htm new file mode 100644 index 0000000..bd0e861 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x70.htm @@ -0,0 +1,136 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- p -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x71.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x71.htm new file mode 100644 index 0000000..9d8e904 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x71.htm @@ -0,0 +1,94 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- q -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x72.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x72.htm new file mode 100644 index 0000000..1fff682 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x72.htm @@ -0,0 +1,129 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- r -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x73.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x73.htm new file mode 100644 index 0000000..f46fd41 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x73.htm @@ -0,0 +1,124 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x74.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x74.htm new file mode 100644 index 0000000..b950e41 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x74.htm @@ -0,0 +1,106 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- t -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x75.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x75.htm new file mode 100644 index 0000000..8d7e1a7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x75.htm @@ -0,0 +1,107 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- u -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x76.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x76.htm new file mode 100644 index 0000000..c1fd9c9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x76.htm @@ -0,0 +1,98 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- v -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x77.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x77.htm new file mode 100644 index 0000000..9654c91 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x77.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- w -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x78.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x78.htm new file mode 100644 index 0000000..13f4910 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x78.htm @@ -0,0 +1,98 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- x -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x79.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x79.htm new file mode 100644 index 0000000..bc5ab83 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x79.htm @@ -0,0 +1,92 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- y -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x7a.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x7a.htm new file mode 100644 index 0000000..fb3c12b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_eval_0x7a.htm @@ -0,0 +1,92 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- z -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func.htm new file mode 100644 index 0000000..9d3418f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func.htm @@ -0,0 +1,104 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- a -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x62.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x62.htm new file mode 100644 index 0000000..70a260a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x62.htm @@ -0,0 +1,93 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- b -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x63.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x63.htm new file mode 100644 index 0000000..15a2c75 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x63.htm @@ -0,0 +1,157 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- c -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x64.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x64.htm new file mode 100644 index 0000000..74bb7ea --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x64.htm @@ -0,0 +1,120 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- d -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x65.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x65.htm new file mode 100644 index 0000000..830e928 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x65.htm @@ -0,0 +1,108 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- e -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x66.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x66.htm new file mode 100644 index 0000000..6cdfe13 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x66.htm @@ -0,0 +1,115 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- f -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x67.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x67.htm new file mode 100644 index 0000000..d515b7f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x67.htm @@ -0,0 +1,369 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- g -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x68.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x68.htm new file mode 100644 index 0000000..ffad477 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x68.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- h -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x69.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x69.htm new file mode 100644 index 0000000..e48c7fe --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x69.htm @@ -0,0 +1,144 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- i -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6b.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6b.htm new file mode 100644 index 0000000..9e918c3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6b.htm @@ -0,0 +1,88 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- k -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6c.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6c.htm new file mode 100644 index 0000000..6e00712 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6c.htm @@ -0,0 +1,133 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- l -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6d.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6d.htm new file mode 100644 index 0000000..5a68702 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6d.htm @@ -0,0 +1,109 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- m -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6e.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6e.htm new file mode 100644 index 0000000..497283c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6e.htm @@ -0,0 +1,93 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- n -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6f.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6f.htm new file mode 100644 index 0000000..59b7355 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x6f.htm @@ -0,0 +1,251 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- o -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x70.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x70.htm new file mode 100644 index 0000000..fe782cb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x70.htm @@ -0,0 +1,108 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- p -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x72.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x72.htm new file mode 100644 index 0000000..8cf7adb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x72.htm @@ -0,0 +1,145 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- r -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x73.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x73.htm new file mode 100644 index 0000000..27f1cc1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x73.htm @@ -0,0 +1,326 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- s -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x74.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x74.htm new file mode 100644 index 0000000..9daf08e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x74.htm @@ -0,0 +1,172 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- t -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x75.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x75.htm new file mode 100644 index 0000000..052c59d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x75.htm @@ -0,0 +1,103 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- u -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x76.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x76.htm new file mode 100644 index 0000000..e9a4cbb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x76.htm @@ -0,0 +1,103 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- v -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x77.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x77.htm new file mode 100644 index 0000000..d857473 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x77.htm @@ -0,0 +1,95 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- w -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7a.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7a.htm new file mode 100644 index 0000000..1b76624 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7a.htm @@ -0,0 +1,88 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- z -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7e.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7e.htm new file mode 100644 index 0000000..7419059 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_func_0x7e.htm @@ -0,0 +1,166 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- ~ -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_type.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_type.htm new file mode 100644 index 0000000..b8bfc40 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_type.htm @@ -0,0 +1,62 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/functions_vars.htm b/SFML-2.1-osx-clang-universal/doc/html/functions_vars.htm new file mode 100644 index 0000000..9d34bc9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/functions_vars.htm @@ -0,0 +1,377 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + + +
+
+  + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- g -

+ + +

- h -

+ + +

- i -

+ + +

- j -

+ + +

- k -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+ + +

- w -

+ + +

- x -

+ + +

- y -

+ + +

- z -

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/group__audio.htm b/SFML-2.1-osx-clang-universal/doc/html/group__audio.htm new file mode 100644 index 0000000..68c4b58 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/group__audio.htm @@ -0,0 +1,75 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+ +
+
Audio module
+
+
+ +

Sounds, streaming (musics or custom sources), recording, spatialization. +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

class  sf::Listener
 The audio listener is the point in the scene from where all the sounds are heard. More...
 
class  sf::Music
 Streamed music played from an audio file. More...
 
class  sf::Sound
 Regular sound that can be played in the audio environment. More...
 
class  sf::SoundBuffer
 Storage for audio samples defining a sound. More...
 
class  sf::SoundBufferRecorder
 Specialized SoundRecorder which stores the captured audio data into a sound buffer. More...
 
class  sf::SoundRecorder
 Abstract base class for capturing sound data. More...
 
class  sf::SoundSource
 Base class defining a sound's properties. More...
 
class  sf::SoundStream
 Abstract base class for streamed audio sources. More...
 
+

Detailed Description

+

Sounds, streaming (musics or custom sources), recording, spatialization.

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/group__graphics.htm b/SFML-2.1-osx-clang-universal/doc/html/group__graphics.htm new file mode 100644 index 0000000..4174a6c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/group__graphics.htm @@ -0,0 +1,225 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+ +
+
Graphics module
+
+
+ +

2D graphics module: sprites, text, shapes, ... +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

class  sf::CircleShape
 Specialized shape representing a circle. More...
 
class  sf::Color
 Utility class for manpulating RGBA colors. More...
 
class  sf::ConvexShape
 Specialized shape representing a convex polygon. More...
 
class  sf::Drawable
 Abstract base class for objects that can be drawn to a render target. More...
 
class  sf::Font
 Class for loading and manipulating character fonts. More...
 
class  sf::Glyph
 Structure describing a glyph. More...
 
class  sf::Image
 Class for loading, manipulating and saving images. More...
 
class  sf::Rect< T >
 Utility class for manipulating 2D axis aligned rectangles. More...
 
class  sf::RectangleShape
 Specialized shape representing a rectangle. More...
 
class  sf::RenderStates
 Define the states used for drawing to a RenderTarget. More...
 
class  sf::RenderTarget
 Base class for all render targets (window, texture, ...) More...
 
class  sf::RenderTexture
 Target for off-screen 2D rendering into a texture. More...
 
class  sf::RenderWindow
 Window that can serve as a target for 2D drawing. More...
 
class  sf::Shader
 Shader class (vertex and fragment) More...
 
class  sf::Shape
 Base class for textured shapes with outline. More...
 
class  sf::Sprite
 Drawable representation of a texture, with its own transformations, color, etc. More...
 
class  sf::Text
 Graphical text that can be drawn to a render target. More...
 
class  sf::Texture
 Image living on the graphics card that can be used for drawing. More...
 
class  sf::Transform
 Define a 3x3 transform matrix. More...
 
class  sf::Transformable
 Decomposed transform defined by a position, a rotation and a scale. More...
 
class  sf::Vertex
 Define a point with color and texture coordinates. More...
 
class  sf::VertexArray
 Define a set of one or more 2D primitives. More...
 
class  sf::View
 2D camera that defines what region is shown on screen More...
 
+ + + + + + + +

+Enumerations

enum  sf::BlendMode {
+  sf::BlendAlpha, +
+  sf::BlendAdd, +
+  sf::BlendMultiply, +
+  sf::BlendNone +
+ }
 Available blending modes for drawing. More...
 
enum  sf::PrimitiveType {
+  sf::Points, +
+  sf::Lines, +
+  sf::LinesStrip, +
+  sf::Triangles, +
+  sf::TrianglesStrip, +
+  sf::TrianglesFan, +
+  sf::Quads +
+ }
 Types of primitives that a sf::VertexArray can render. More...
 
+

Detailed Description

+

2D graphics module: sprites, text, shapes, ...

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum sf::BlendMode
+
+ +

Available blending modes for drawing.

+ + + + + +
Enumerator
BlendAlpha  +

Pixel = Source * Source.a + Dest * (1 - Source.a)

+
BlendAdd  +

Pixel = Source + Dest.

+
BlendMultiply  +

Pixel = Source * Dest.

+
BlendNone  +

Pixel = Source.

+
+ +

Definition at line 35 of file BlendMode.hpp.

+ +
+
+ +
+
+ + + + +
enum sf::PrimitiveType
+
+ +

Types of primitives that a sf::VertexArray can render.

+

Points and lines have no area, therefore their thickness will always be 1 pixel, regarldess the current transform and view.

+ + + + + + + + +
Enumerator
Points  +

List of individual points.

+
Lines  +

List of individual lines.

+
LinesStrip  +

List of connected lines, a point uses the previous point to form a line.

+
Triangles  +

List of individual triangles.

+
TrianglesStrip  +

List of connected triangles, a point uses the two previous points to form a triangle.

+
TrianglesFan  +

List of connected triangles, a point uses the common center and the previous point to form a triangle.

+
Quads  +

List of individual quads.

+
+ +

Definition at line 39 of file PrimitiveType.hpp.

+ +
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/group__network.htm b/SFML-2.1-osx-clang-universal/doc/html/group__network.htm new file mode 100644 index 0000000..3493121 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/group__network.htm @@ -0,0 +1,78 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+ +
+
Network module
+
+
+ +

Socket-based communication, utilities and higher-level network protocols (HTTP, FTP). +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

class  sf::Ftp
 A FTP client. More...
 
class  sf::Http
 A HTTP client. More...
 
class  sf::IpAddress
 Encapsulate an IPv4 network address. More...
 
class  sf::Packet
 Utility class to build blocks of data to transfer over the network. More...
 
class  sf::Socket
 Base class for all the socket types. More...
 
class  sf::SocketSelector
 Multiplexer that allows to read from multiple sockets. More...
 
class  sf::TcpListener
 Socket that listens to new TCP connections. More...
 
class  sf::TcpSocket
 Specialized socket using the TCP protocol. More...
 
class  sf::UdpSocket
 Specialized socket using the UDP protocol. More...
 
+

Detailed Description

+

Socket-based communication, utilities and higher-level network protocols (HTTP, FTP).

+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/group__system.htm b/SFML-2.1-osx-clang-universal/doc/html/group__system.htm new file mode 100644 index 0000000..d51c741 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/group__system.htm @@ -0,0 +1,157 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+ +
+
System module
+
+
+ +

Base module of SFML, defining various utilities. +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

class  sf::Clock
 Utility class that measures the elapsed time. More...
 
class  sf::InputStream
 Abstract class for custom file input streams. More...
 
class  sf::Lock
 Automatic wrapper for locking and unlocking mutexes. More...
 
class  sf::Mutex
 Blocks concurrent access to shared resources from multiple threads. More...
 
class  sf::NonCopyable
 Utility class that makes any derived class non-copyable. More...
 
class  sf::String
 Utility string class that automatically handles conversions between types and encodings. More...
 
class  sf::Thread
 Utility class to manipulate threads. More...
 
class  sf::ThreadLocal
 Defines variables with thread-local storage. More...
 
class  sf::ThreadLocalPtr< T >
 Pointer to a thread-local variable. More...
 
class  sf::Time
 Represents a time value. More...
 
class  sf::Utf< N >
 Utility class providing generic functions for UTF conversions. More...
 
class  sf::Vector2< T >
 Utility template class for manipulating 2-dimensional vectors. More...
 
class  sf::Vector3< T >
 Utility template class for manipulating 3-dimensional vectors. More...
 
+ + + + + + + +

+Functions

void sf::sleep (Time duration)
 Make the current thread sleep for a given duration. More...
 
std::ostream & sf::err ()
 Standard stream used by SFML to output warnings and errors. More...
 
+

Detailed Description

+

Base module of SFML, defining various utilities.

+

It provides vector classes, unicode strings and conversion functions, threads and mutexes, timing classes.

+

Function Documentation

+ +
+
+ + + + + + + +
sf::err ()
+
+ +

Standard stream used by SFML to output warnings and errors.

+

By default, sf::err() outputs to the same location as std::cerr, (-> the stderr descriptor) which is the console if there's one available.

+

It is a standard std::ostream instance, so it supports all the insertion operations defined by the STL (operator <<, manipulators, etc.).

+

sf::err() can be redirected to write to another output, independantly of std::cerr, by using the rdbuf() function provided by the std::ostream class.

+

Example:

+
// Redirect to a file
+
std::ofstream file("sfml-log.txt");
+
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
+
+
// Redirect to nothing
+
sf::err().rdbuf(NULL);
+
+
// Restore the original output
+
sf::err().rdbuf(previous);
+
+
+
+ +
+
+ + + + + + + + +
void sf::sleep (Time duration)
+
+ +

Make the current thread sleep for a given duration.

+

sf::sleep is the best way to block a program or one of its threads, as it doesn't consume any CPU power.

+
Parameters
+ + +
durationTime to sleep
+
+
+ +
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/group__window.htm b/SFML-2.1-osx-clang-universal/doc/html/group__window.htm new file mode 100644 index 0000000..5c628d7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/group__window.htm @@ -0,0 +1,135 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+ +
+
Window module
+
+
+ +

Provides OpenGL-based windows, and abstractions for events and input handling. +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Classes

class  sf::Context
 Class holding a valid drawing context. More...
 
class  sf::ContextSettings
 Structure defining the settings of the OpenGL context attached to a window. More...
 
class  sf::Event
 Defines a system event and its parameters. More...
 
class  sf::GlResource
 Base class for classes that require an OpenGL context. More...
 
class  sf::Joystick
 Give access to the real-time state of the joysticks. More...
 
class  sf::Keyboard
 Give access to the real-time state of the keyboard. More...
 
class  sf::Mouse
 Give access to the real-time state of the mouse. More...
 
class  sf::VideoMode
 VideoMode defines a video mode (width, height, bpp) More...
 
class  sf::Window
 Window that serves as a target for OpenGL rendering. More...
 
+ + + + +

+Enumerations

enum  {
+  sf::Style::None = 0, +
+  sf::Style::Titlebar = 1 << 0, +
+  sf::Style::Resize = 1 << 1, +
+  sf::Style::Close = 1 << 2, +
+  sf::Style::Fullscreen = 1 << 3, +
+  sf::Style::Default = Titlebar | Resize | Close +
+ }
 Enumeration of the window styles. More...
 
+

Detailed Description

+

Provides OpenGL-based windows, and abstractions for events and input handling.

+

Enumeration Type Documentation

+ +
+
+ + + + +
anonymous enum
+
+ +

Enumeration of the window styles.

+ + + + + + + +
Enumerator
None  +

No border / title bar (this flag and all others are mutually exclusive)

+
Titlebar  +

Title bar + fixed border.

+
Resize  +

Titlebar + resizable border + maximize button.

+
Close  +

Titlebar + close button.

+
Fullscreen  +

Fullscreen mode (this flag and all others are mutually exclusive)

+
Default  +

Default window style.

+
+ +

Definition at line 38 of file WindowStyle.hpp.

+ +
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/hierarchy.htm b/SFML-2.1-osx-clang-universal/doc/html/hierarchy.htm new file mode 100644 index 0000000..6cdd432 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/hierarchy.htm @@ -0,0 +1,144 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
Class Hierarchy
+
+
+
This inheritance list is sorted roughly, but not completely, alphabetically:
+
[detail level 123]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
oCsf::SoundStream::ChunkStructure defining a chunk of audio data to stream
oCsf::ClockUtility class that measures the elapsed time
oCsf::ColorUtility class for manpulating RGBA colors
oCsf::ContextSettingsStructure defining the settings of the OpenGL context attached to a window
oCsf::Shader::CurrentTextureTypeSpecial type/value that can be passed to setParameter, and that represents the texture of the object being drawn
oCsf::DrawableAbstract base class for objects that can be drawn to a render target
|oCsf::ShapeBase class for textured shapes with outline
||oCsf::CircleShapeSpecialized shape representing a circle
||oCsf::ConvexShapeSpecialized shape representing a convex polygon
||\Csf::RectangleShapeSpecialized shape representing a rectangle
|oCsf::SpriteDrawable representation of a texture, with its own transformations, color, etc
|oCsf::TextGraphical text that can be drawn to a render target
|\Csf::VertexArrayDefine a set of one or more 2D primitives
oCsf::EventDefines a system event and its parameters
oCsf::FontClass for loading and manipulating character fonts
oCsf::GlResourceBase class for classes that require an OpenGL context
|oCsf::ContextClass holding a valid drawing context
|oCsf::ShaderShader class (vertex and fragment)
|oCsf::TextureImage living on the graphics card that can be used for drawing
|\Csf::WindowWindow that serves as a target for OpenGL rendering
| \Csf::RenderWindowWindow that can serve as a target for 2D drawing
oCsf::GlyphStructure describing a glyph
oCsf::ImageClass for loading, manipulating and saving images
oCsf::InputStreamAbstract class for custom file input streams
oCsf::IpAddressEncapsulate an IPv4 network address
oCsf::JoystickGive access to the real-time state of the joysticks
oCsf::Event::JoystickButtonEventJoystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased)
oCsf::Event::JoystickConnectEventJoystick connection events parameters (JoystickConnected, JoystickDisconnected)
oCsf::Event::JoystickMoveEventJoystick axis move event parameters (JoystickMoved)
oCsf::KeyboardGive access to the real-time state of the keyboard
oCsf::Event::KeyEventKeyboard event parameters (KeyPressed, KeyReleased)
oCsf::ListenerThe audio listener is the point in the scene from where all the sounds are heard
oCsf::MouseGive access to the real-time state of the mouse
oCsf::Event::MouseButtonEventMouse buttons events parameters (MouseButtonPressed, MouseButtonReleased)
oCsf::Event::MouseMoveEventMouse move event parameters (MouseMoved)
oCsf::Event::MouseWheelEventMouse wheel events parameters (MouseWheelMoved)
oCsf::NonCopyableUtility class that makes any derived class non-copyable
|oCsf::ContextClass holding a valid drawing context
|oCsf::FtpA FTP client
|oCsf::HttpA HTTP client
|oCsf::LockAutomatic wrapper for locking and unlocking mutexes
|oCsf::MutexBlocks concurrent access to shared resources from multiple threads
|oCsf::RenderTargetBase class for all render targets (window, texture, ...)
||oCsf::RenderTextureTarget for off-screen 2D rendering into a texture
||\Csf::RenderWindowWindow that can serve as a target for 2D drawing
|oCsf::ShaderShader class (vertex and fragment)
|oCsf::SocketBase class for all the socket types
||oCsf::TcpListenerSocket that listens to new TCP connections
||oCsf::TcpSocketSpecialized socket using the TCP protocol
||\Csf::UdpSocketSpecialized socket using the UDP protocol
|oCsf::ThreadUtility class to manipulate threads
|oCsf::ThreadLocalDefines variables with thread-local storage
||\Csf::ThreadLocalPtr< T >Pointer to a thread-local variable
|\Csf::WindowWindow that serves as a target for OpenGL rendering
oCsf::PacketUtility class to build blocks of data to transfer over the network
oCsf::Rect< T >Utility class for manipulating 2D axis aligned rectangles
oCsf::Rect< float >
oCsf::Rect< int >
oCsf::RenderStatesDefine the states used for drawing to a RenderTarget
oCsf::Http::RequestDefine a HTTP request
oCsf::Http::ResponseDefine a HTTP response
oCsf::Ftp::ResponseDefine a FTP response
|oCsf::Ftp::DirectoryResponseSpecialization of FTP response returning a directory
|\Csf::Ftp::ListingResponseSpecialization of FTP response returning a filename lisiting
oCsf::Event::SizeEventSize events parameters (Resized)
oCsf::SocketSelectorMultiplexer that allows to read from multiple sockets
oCsf::SoundBufferStorage for audio samples defining a sound
oCsf::SoundRecorderAbstract base class for capturing sound data
|\Csf::SoundBufferRecorderSpecialized SoundRecorder which stores the captured audio data into a sound buffer
oCsf::SoundSourceBase class defining a sound's properties
|oCsf::SoundRegular sound that can be played in the audio environment
|\Csf::SoundStreamAbstract base class for streamed audio sources
| \Csf::MusicStreamed music played from an audio file
oCsf::StringUtility string class that automatically handles conversions between types and encodings
oCsf::Event::TextEventText event parameters (TextEntered)
oCsf::TimeRepresents a time value
oCsf::TransformDefine a 3x3 transform matrix
oCsf::TransformableDecomposed transform defined by a position, a rotation and a scale
|oCsf::ShapeBase class for textured shapes with outline
|oCsf::SpriteDrawable representation of a texture, with its own transformations, color, etc
|\Csf::TextGraphical text that can be drawn to a render target
oCsf::Utf< N >Utility class providing generic functions for UTF conversions
oCsf::Utf< 16 >Specialization of the Utf template for UTF-16
oCsf::Utf< 32 >Specialization of the Utf template for UTF-32
oCsf::Utf< 8 >Specialization of the Utf template for UTF-8
oCsf::Vector2< T >Utility template class for manipulating 2-dimensional vectors
oCsf::Vector2< float >
oCsf::Vector2< unsigned int >
oCsf::Vector3< T >Utility template class for manipulating 3-dimensional vectors
oCsf::VertexDefine a point with color and texture coordinates
oCsf::VideoModeVideoMode defines a video mode (width, height, bpp)
\Csf::View2D camera that defines what region is shown on screen
+
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/index.htm b/SFML-2.1-osx-clang-universal/doc/html/index.htm new file mode 100644 index 0000000..df8bc2a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/index.htm @@ -0,0 +1,102 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+
+
SFML Documentation
+
+
+

+Welcome

+

Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML classes and functions.
+ If you are looking for tutorials, you can visit the official website at www.sfml-dev.org.

+

+Short example

+

Here is a short example, to show you how simple it is to use SFML :

+
#include <SFML/Audio.hpp>
+
#include <SFML/Graphics.hpp>
+
+
int main()
+
{
+
// Create the main window
+
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
+
+
// Load a sprite to display
+
sf::Texture texture;
+
if (!texture.loadFromFile("cute_image.jpg"))
+
return EXIT_FAILURE;
+
sf::Sprite sprite(texture);
+
+
// Create a graphical text to display
+
sf::Font font;
+
if (!font.loadFromFile("arial.ttf"))
+
return EXIT_FAILURE;
+
sf::Text text("Hello SFML", font, 50);
+
+
// Load a music to play
+
sf::Music music;
+
if (!music.openFromFile("nice_music.ogg"))
+
return EXIT_FAILURE;
+
+
// Play the music
+
music.play();
+
+
// Start the game loop
+
while (window.isOpen())
+
{
+
// Process events
+
sf::Event event;
+
while (window.pollEvent(event))
+
{
+
// Close window : exit
+
if (event.type == sf::Event::Closed)
+
window.close();
+
}
+
+
// Clear screen
+
window.clear();
+
+
// Draw the sprite
+
window.draw(sprite);
+
+
// Draw the string
+
window.draw(text);
+
+
// Update the window
+
window.display();
+
}
+
+
return EXIT_SUCCESS;
+
}
+
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/jquery.js b/SFML-2.1-osx-clang-universal/doc/html/jquery.js new file mode 100644 index 0000000..c197801 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/jquery.js @@ -0,0 +1,31 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
t
";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType; +if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1 +},lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},ac=a(av); +ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
","
"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length; +if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b +})}})(window); diff --git a/SFML-2.1-osx-clang-universal/doc/html/mainpage_8hpp_source.htm b/SFML-2.1-osx-clang-universal/doc/html/mainpage_8hpp_source.htm new file mode 100644 index 0000000..63cb0f4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/mainpage_8hpp_source.htm @@ -0,0 +1,49 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + + + +
+
+
+
mainpage.hpp
+
+
+
1 
+
+ + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/modules.htm b/SFML-2.1-osx-clang-universal/doc/html/modules.htm new file mode 100644 index 0000000..60a2a1a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/modules.htm @@ -0,0 +1,49 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + +
+ + +
+
+
+
Modules
+
+
+
Here is a list of all modules:
+
+ + + + + +
oAudio moduleSounds, streaming (musics or custom sources), recording, spatialization
oGraphics module2D graphics module: sprites, text, shapes, ..
oNetwork moduleSocket-based communication, utilities and higher-level network protocols (HTTP, FTP)
oSystem moduleBase module of SFML, defining various utilities
\Window moduleProvides OpenGL-based windows, and abstractions for events and input handling
+ + + + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/nav_f.png b/SFML-2.1-osx-clang-universal/doc/html/nav_f.png new file mode 100644 index 0000000..72a58a5 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/nav_f.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/nav_g.png b/SFML-2.1-osx-clang-universal/doc/html/nav_g.png new file mode 100644 index 0000000..2093a23 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/nav_g.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/nav_h.png b/SFML-2.1-osx-clang-universal/doc/html/nav_h.png new file mode 100644 index 0000000..33389b1 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/nav_h.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/open.png b/SFML-2.1-osx-clang-universal/doc/html/open.png new file mode 100644 index 0000000..30f75c7 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/open.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1ContextSettings.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1ContextSettings.htm new file mode 100644 index 0000000..a6717b4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1ContextSettings.htm @@ -0,0 +1,247 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::ContextSettings Class Reference
+
+
+ +

Structure defining the settings of the OpenGL context attached to a window. + More...

+ +

#include <ContextSettings.hpp>

+ + + + + +

+Public Member Functions

 ContextSettings (unsigned int depth=0, unsigned int stencil=0, unsigned int antialiasing=0, unsigned int major=2, unsigned int minor=0)
 Default constructor. More...
 
+ + + + + + + + + + + + + + + + +

+Public Attributes

unsigned int depthBits
 Bits of the depth buffer. More...
 
unsigned int stencilBits
 Bits of the stencil buffer. More...
 
unsigned int antialiasingLevel
 Level of antialiasing. More...
 
unsigned int majorVersion
 Major number of the context version to create. More...
 
unsigned int minorVersion
 Minor number of the context version to create. More...
 
+

Detailed Description

+

Structure defining the settings of the OpenGL context attached to a window.

+

ContextSettings allows to define several advanced settings of the OpenGL context attached to a window.

+

All these settings have no impact on the regular SFML rendering (graphics module) – except the anti-aliasing level, so you may need to use this structure only if you're using SFML as a windowing system for custom OpenGL rendering.

+

The depthBits and stencilBits members define the number of bits per pixel requested for the (respectively) depth and stencil buffers.

+

antialiasingLevel represents the requested number of multisampling levels for anti-aliasing.

+

majorVersion and minorVersion define the version of the OpenGL context that you want. Only versions greater or equal to 3.0 are relevant; versions lesser than 3.0 are all handled the same way (i.e. you can use any version < 3.0 if you don't want an OpenGL 3 context).

+

Please note that these values are only a hint. No failure will be reported if one or more of these values are not supported by the system; instead, SFML will try to find the closest valid match. You can then retrieve the settings that the window actually used to create its context, with Window::getSettings().

+ +

Definition at line 36 of file ContextSettings.hpp.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sf::ContextSettings::ContextSettings (unsigned int depth = 0,
unsigned int stencil = 0,
unsigned int antialiasing = 0,
unsigned int major = 2,
unsigned int minor = 0 
)
+
+inlineexplicit
+
+ +

Default constructor.

+
Parameters
+ + + + + + +
depthDepth buffer bits
stencilStencil buffer bits
antialiasingAntialiasing level
majorMajor number of the context version
minorMinor number of the context version
+
+
+ +

Definition at line 48 of file ContextSettings.hpp.

+ +
+
+

Member Data Documentation

+ +
+
+ + + + +
unsigned int sf::ContextSettings::antialiasingLevel
+
+ +

Level of antialiasing.

+ +

Definition at line 62 of file ContextSettings.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::ContextSettings::depthBits
+
+ +

Bits of the depth buffer.

+ +

Definition at line 60 of file ContextSettings.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::ContextSettings::majorVersion
+
+ +

Major number of the context version to create.

+ +

Definition at line 63 of file ContextSettings.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::ContextSettings::minorVersion
+
+ +

Minor number of the context version to create.

+ +

Definition at line 64 of file ContextSettings.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::ContextSettings::stencilBits
+
+ +

Bits of the stencil buffer.

+ +

Definition at line 61 of file ContextSettings.hpp.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent-members.htm new file mode 100644 index 0000000..c0d1b2b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent-members.htm @@ -0,0 +1,57 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::JoystickButtonEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::JoystickButtonEvent, including all inherited members.

+ + + +
buttonsf::Event::JoystickButtonEvent
joystickIdsf::Event::JoystickButtonEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent.htm new file mode 100644 index 0000000..b21b11e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickButtonEvent.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::JoystickButtonEvent Struct Reference
+
+
+ +

Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased) + More...

+ +

#include <Event.hpp>

+ + + + + + + + +

+Public Attributes

unsigned int joystickId
 Index of the joystick (in range [0 .. Joystick::Count - 1]) More...
 
unsigned int button
 Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1]) More...
 
+

Detailed Description

+

Joystick buttons events parameters (JoystickButtonPressed, JoystickButtonReleased)

+ +

Definition at line 138 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
unsigned int sf::Event::JoystickButtonEvent::button
+
+ +

Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])

+ +

Definition at line 141 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::Event::JoystickButtonEvent::joystickId
+
+ +

Index of the joystick (in range [0 .. Joystick::Count - 1])

+ +

Definition at line 140 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent-members.htm new file mode 100644 index 0000000..9b31d50 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent-members.htm @@ -0,0 +1,56 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::JoystickConnectEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::JoystickConnectEvent, including all inherited members.

+ + +
joystickIdsf::Event::JoystickConnectEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent.htm new file mode 100644 index 0000000..3e205ec --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickConnectEvent.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::JoystickConnectEvent Struct Reference
+
+
+ +

Joystick connection events parameters (JoystickConnected, JoystickDisconnected) + More...

+ +

#include <Event.hpp>

+ + + + + +

+Public Attributes

unsigned int joystickId
 Index of the joystick (in range [0 .. Joystick::Count - 1]) More...
 
+

Detailed Description

+

Joystick connection events parameters (JoystickConnected, JoystickDisconnected)

+ +

Definition at line 117 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
unsigned int sf::Event::JoystickConnectEvent::joystickId
+
+ +

Index of the joystick (in range [0 .. Joystick::Count - 1])

+ +

Definition at line 119 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent-members.htm new file mode 100644 index 0000000..6ab1102 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::JoystickMoveEvent Member List
+
+ + + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent.htm new file mode 100644 index 0000000..09514e1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1JoystickMoveEvent.htm @@ -0,0 +1,129 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::JoystickMoveEvent Struct Reference
+
+
+ +

Joystick axis move event parameters (JoystickMoved) + More...

+ +

#include <Event.hpp>

+ + + + + + + + + + + +

+Public Attributes

unsigned int joystickId
 Index of the joystick (in range [0 .. Joystick::Count - 1]) More...
 
Joystick::Axis axis
 Axis on which the joystick moved. More...
 
float position
 New position on the axis (in range [-100 .. 100]) More...
 
+

Detailed Description

+

Joystick axis move event parameters (JoystickMoved)

+ +

Definition at line 126 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
Joystick::Axis sf::Event::JoystickMoveEvent::axis
+
+ +

Axis on which the joystick moved.

+ +

Definition at line 129 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::Event::JoystickMoveEvent::joystickId
+
+ +

Index of the joystick (in range [0 .. Joystick::Count - 1])

+ +

Definition at line 128 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
float sf::Event::JoystickMoveEvent::position
+
+ +

New position on the axis (in range [-100 .. 100])

+ +

Definition at line 130 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent-members.htm new file mode 100644 index 0000000..c2b303c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent-members.htm @@ -0,0 +1,60 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::KeyEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::KeyEvent, including all inherited members.

+ + + + + + +
altsf::Event::KeyEvent
codesf::Event::KeyEvent
controlsf::Event::KeyEvent
shiftsf::Event::KeyEvent
systemsf::Event::KeyEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent.htm new file mode 100644 index 0000000..57c6692 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1KeyEvent.htm @@ -0,0 +1,167 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::KeyEvent Struct Reference
+
+
+ +

Keyboard event parameters (KeyPressed, KeyReleased) + More...

+ +

#include <Event.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Attributes

Keyboard::Key code
 Code of the key that has been pressed. More...
 
bool alt
 Is the Alt key pressed? More...
 
bool control
 Is the Control key pressed? More...
 
bool shift
 Is the Shift key pressed? More...
 
bool system
 Is the System key pressed? More...
 
+

Detailed Description

+

Keyboard event parameters (KeyPressed, KeyReleased)

+ +

Definition at line 61 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
bool sf::Event::KeyEvent::alt
+
+ +

Is the Alt key pressed?

+ +

Definition at line 64 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
Keyboard::Key sf::Event::KeyEvent::code
+
+ +

Code of the key that has been pressed.

+ +

Definition at line 63 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
bool sf::Event::KeyEvent::control
+
+ +

Is the Control key pressed?

+ +

Definition at line 65 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
bool sf::Event::KeyEvent::shift
+
+ +

Is the Shift key pressed?

+ +

Definition at line 66 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
bool sf::Event::KeyEvent::system
+
+ +

Is the System key pressed?

+ +

Definition at line 67 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent-members.htm new file mode 100644 index 0000000..9767703 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::MouseButtonEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::MouseButtonEvent, including all inherited members.

+ + + + +
buttonsf::Event::MouseButtonEvent
xsf::Event::MouseButtonEvent
ysf::Event::MouseButtonEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent.htm new file mode 100644 index 0000000..d19ce5b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseButtonEvent.htm @@ -0,0 +1,129 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::MouseButtonEvent Struct Reference
+
+
+ +

Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased) + More...

+ +

#include <Event.hpp>

+ + + + + + + + + + + +

+Public Attributes

Mouse::Button button
 Code of the button that has been pressed. More...
 
int x
 X position of the mouse pointer, relative to the left of the owner window. More...
 
int y
 Y position of the mouse pointer, relative to the top of the owner window. More...
 
+

Detailed Description

+

Mouse buttons events parameters (MouseButtonPressed, MouseButtonReleased)

+ +

Definition at line 94 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
Mouse::Button sf::Event::MouseButtonEvent::button
+
+ +

Code of the button that has been pressed.

+ +

Definition at line 96 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
int sf::Event::MouseButtonEvent::x
+
+ +

X position of the mouse pointer, relative to the left of the owner window.

+ +

Definition at line 97 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
int sf::Event::MouseButtonEvent::y
+
+ +

Y position of the mouse pointer, relative to the top of the owner window.

+ +

Definition at line 98 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent-members.htm new file mode 100644 index 0000000..fa49cc6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent-members.htm @@ -0,0 +1,57 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::MouseMoveEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::MouseMoveEvent, including all inherited members.

+ + + +
xsf::Event::MouseMoveEvent
ysf::Event::MouseMoveEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent.htm new file mode 100644 index 0000000..7b66c0a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseMoveEvent.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::MouseMoveEvent Struct Reference
+
+
+ +

Mouse move event parameters (MouseMoved) + More...

+ +

#include <Event.hpp>

+ + + + + + + + +

+Public Attributes

int x
 X position of the mouse pointer, relative to the left of the owner window. More...
 
int y
 Y position of the mouse pointer, relative to the top of the owner window. More...
 
+

Detailed Description

+

Mouse move event parameters (MouseMoved)

+ +

Definition at line 83 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
int sf::Event::MouseMoveEvent::x
+
+ +

X position of the mouse pointer, relative to the left of the owner window.

+ +

Definition at line 85 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
int sf::Event::MouseMoveEvent::y
+
+ +

Y position of the mouse pointer, relative to the top of the owner window.

+ +

Definition at line 86 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent-members.htm new file mode 100644 index 0000000..d682895 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent-members.htm @@ -0,0 +1,58 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::MouseWheelEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::MouseWheelEvent, including all inherited members.

+ + + + +
deltasf::Event::MouseWheelEvent
xsf::Event::MouseWheelEvent
ysf::Event::MouseWheelEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent.htm new file mode 100644 index 0000000..2e52a4e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1MouseWheelEvent.htm @@ -0,0 +1,129 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::MouseWheelEvent Struct Reference
+
+
+ +

Mouse wheel events parameters (MouseWheelMoved) + More...

+ +

#include <Event.hpp>

+ + + + + + + + + + + +

+Public Attributes

int delta
 Number of ticks the wheel has moved (positive is up, negative is down) More...
 
int x
 X position of the mouse pointer, relative to the left of the owner window. More...
 
int y
 Y position of the mouse pointer, relative to the top of the owner window. More...
 
+

Detailed Description

+

Mouse wheel events parameters (MouseWheelMoved)

+ +

Definition at line 105 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
int sf::Event::MouseWheelEvent::delta
+
+ +

Number of ticks the wheel has moved (positive is up, negative is down)

+ +

Definition at line 107 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
int sf::Event::MouseWheelEvent::x
+
+ +

X position of the mouse pointer, relative to the left of the owner window.

+ +

Definition at line 108 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
int sf::Event::MouseWheelEvent::y
+
+ +

Y position of the mouse pointer, relative to the top of the owner window.

+ +

Definition at line 109 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent-members.htm new file mode 100644 index 0000000..43a8938 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent-members.htm @@ -0,0 +1,57 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::SizeEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::SizeEvent, including all inherited members.

+ + + +
heightsf::Event::SizeEvent
widthsf::Event::SizeEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent.htm new file mode 100644 index 0000000..e0f1fc6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1SizeEvent.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::SizeEvent Struct Reference
+
+
+ +

Size events parameters (Resized) + More...

+ +

#include <Event.hpp>

+ + + + + + + + +

+Public Attributes

unsigned int width
 New width, in pixels. More...
 
unsigned int height
 New height, in pixels. More...
 
+

Detailed Description

+

Size events parameters (Resized)

+ +

Definition at line 51 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
unsigned int sf::Event::SizeEvent::height
+
+ +

New height, in pixels.

+ +

Definition at line 54 of file Event.hpp.

+ +
+
+ +
+
+ + + + +
unsigned int sf::Event::SizeEvent::width
+
+ +

New width, in pixels.

+ +

Definition at line 53 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent-members.htm new file mode 100644 index 0000000..4213a53 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent-members.htm @@ -0,0 +1,56 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Event::TextEvent Member List
+
+
+ +

This is the complete list of members for sf::Event::TextEvent, including all inherited members.

+ + +
unicodesf::Event::TextEvent
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent.htm new file mode 100644 index 0000000..740dbc8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Event_1_1TextEvent.htm @@ -0,0 +1,91 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::Event::TextEvent Struct Reference
+
+
+ +

Text event parameters (TextEntered) + More...

+ +

#include <Event.hpp>

+ + + + + +

+Public Attributes

Uint32 unicode
 UTF-32 unicode value of the character. More...
 
+

Detailed Description

+

Text event parameters (TextEntered)

+ +

Definition at line 74 of file Event.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
Uint32 sf::Event::TextEvent::unicode
+
+ +

UTF-32 unicode value of the character.

+ +

Definition at line 76 of file Event.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Shader_1_1CurrentTextureType.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Shader_1_1CurrentTextureType.htm new file mode 100644 index 0000000..56b1de6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1Shader_1_1CurrentTextureType.htm @@ -0,0 +1,64 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::Shader::CurrentTextureType Struct Reference
+
+
+ +

Special type/value that can be passed to setParameter, and that represents the texture of the object being drawn. + More...

+ +

#include <Shader.hpp>

+

Detailed Description

+

Special type/value that can be passed to setParameter, and that represents the texture of the object being drawn.

+ +

Definition at line 70 of file Shader.hpp.

+

The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk-members.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk-members.htm new file mode 100644 index 0000000..d4d5472 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk-members.htm @@ -0,0 +1,57 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+
+
sf::SoundStream::Chunk Member List
+
+
+ +

This is the complete list of members for sf::SoundStream::Chunk, including all inherited members.

+ + + +
sampleCountsf::SoundStream::Chunk
samplessf::SoundStream::Chunk
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk.htm b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk.htm new file mode 100644 index 0000000..4bcac21 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/structsf_1_1SoundStream_1_1Chunk.htm @@ -0,0 +1,110 @@ + + + + SFML - Simple and Fast Multimedia Library + + + + + + + +
+ +
+
sf::SoundStream::Chunk Struct Reference
+
+
+ +

Structure defining a chunk of audio data to stream. + More...

+ +

#include <SoundStream.hpp>

+ + + + + + + + +

+Public Attributes

const Int16 * samples
 Pointer to the audio samples. More...
 
std::size_t sampleCount
 Number of samples pointed by Samples. More...
 
+

Detailed Description

+

Structure defining a chunk of audio data to stream.

+ +

Definition at line 52 of file SoundStream.hpp.

+

Member Data Documentation

+ +
+
+ + + + +
std::size_t sf::SoundStream::Chunk::sampleCount
+
+ +

Number of samples pointed by Samples.

+ +

Definition at line 55 of file SoundStream.hpp.

+ +
+
+ +
+
+ + + + +
const Int16* sf::SoundStream::Chunk::samples
+
+ +

Pointer to the audio samples.

+ +

Definition at line 54 of file SoundStream.hpp.

+ +
+
+
The documentation for this struct was generated from the following file: +
+ + + + diff --git a/SFML-2.1-osx-clang-universal/doc/html/sync_off.png b/SFML-2.1-osx-clang-universal/doc/html/sync_off.png new file mode 100644 index 0000000..3b443fc Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/sync_off.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/sync_on.png b/SFML-2.1-osx-clang-universal/doc/html/sync_on.png new file mode 100644 index 0000000..e08320f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/sync_on.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/tab_a.png b/SFML-2.1-osx-clang-universal/doc/html/tab_a.png new file mode 100644 index 0000000..3b725c4 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/tab_a.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/tab_b.png b/SFML-2.1-osx-clang-universal/doc/html/tab_b.png new file mode 100644 index 0000000..e2b4a86 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/tab_b.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/tab_h.png b/SFML-2.1-osx-clang-universal/doc/html/tab_h.png new file mode 100644 index 0000000..fd5cb70 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/tab_h.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/tab_s.png b/SFML-2.1-osx-clang-universal/doc/html/tab_s.png new file mode 100644 index 0000000..ab478c9 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/doc/html/tab_s.png differ diff --git a/SFML-2.1-osx-clang-universal/doc/html/tabs.css b/SFML-2.1-osx-clang-universal/doc/html/tabs.css new file mode 100644 index 0000000..9cf578f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/doc/html/tabs.css @@ -0,0 +1,60 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Info.plist b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Info.plist new file mode 100644 index 0000000..3ba45e1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + cocoa + CFBundleIconFile + icon.icns + CFBundleIdentifier + org.sfml-dev.cocoa + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + cocoa + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.6 + NSHumanReadableCopyright + Copyright © 2007-2012 Marco Antognini and Laurent Gomila. Shared under zlib/libpng License. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/MacOS/cocoa b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/MacOS/cocoa new file mode 100755 index 0000000..73ddcf2 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/MacOS/cocoa differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/Credits.rtf b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/Credits.rtf new file mode 100644 index 0000000..53942fc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/Credits.rtf @@ -0,0 +1,7 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qj + +\f0\fs24 \cf0 See {\field{\*\fldinst{HYPERLINK "http://sfml-dev.org"}}{\fldrslt http://sfml-dev.org}} for more information} \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/MainMenu.nib b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/MainMenu.nib new file mode 100644 index 0000000..1212631 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/MainMenu.nib differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/blue.png b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/blue.png new file mode 100644 index 0000000..8945e85 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/blue.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/green.png b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/green.png new file mode 100644 index 0000000..fac1b69 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/green.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/icon.icns b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/icon.icns new file mode 100644 index 0000000..cb95460 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/icon.icns differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/logo.png b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/logo.png new file mode 100644 index 0000000..7b04c41 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/logo.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/red.png b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/red.png new file mode 100644 index 0000000..731f36b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/red.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/sansation.ttf b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/cocoa/cocoa.app/Contents/Resources/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/examples/ftp/Ftp.cpp b/SFML-2.1-osx-clang-universal/examples/ftp/Ftp.cpp new file mode 100644 index 0000000..7b97860 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/ftp/Ftp.cpp @@ -0,0 +1,206 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Print a FTP response into a standard output stream +/// +//////////////////////////////////////////////////////////// +std::ostream& operator <<(std::ostream& stream, const sf::Ftp::Response& response) +{ + return stream << response.getStatus() << response.getMessage(); +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose the server address + sf::IpAddress address; + do + { + std::cout << "Enter the FTP server address : "; + std::cin >> address; + } + while (address == sf::IpAddress::None); + + // Connect to the server + sf::Ftp server; + sf::Ftp::Response connectResponse = server.connect(address); + std::cout << connectResponse << std::endl; + if (!connectResponse.isOk()) + return EXIT_FAILURE; + + // Ask for user name and password + std::string user, password; + std::cout << "User name : "; + std::cin >> user; + std::cout << "Password : "; + std::cin >> password; + + // Login to the server + sf::Ftp::Response loginResponse = server.login(user, password); + std::cout << loginResponse << std::endl; + if (!loginResponse.isOk()) + return EXIT_FAILURE; + + // Main menu + int choice = 0; + do + { + // Main FTP menu + std::cout << std::endl; + std::cout << "Choose an action:" << std::endl; + std::cout << "1. Print working directory" << std::endl; + std::cout << "2. Print contents of working directory" << std::endl; + std::cout << "3. Change directory" << std::endl; + std::cout << "4. Create directory" << std::endl; + std::cout << "5. Delete directory" << std::endl; + std::cout << "6. Rename file" << std::endl; + std::cout << "7. Remove file" << std::endl; + std::cout << "8. Download file" << std::endl; + std::cout << "9. Upload file" << std::endl; + std::cout << "0. Disconnect" << std::endl; + std::cout << std::endl; + + std::cout << "Your choice: "; + std::cin >> choice; + std::cout << std::endl; + + switch (choice) + { + default : + { + // Wrong choice + std::cout << "Invalid choice!" << std::endl; + std::cin.clear(); + std::cin.ignore(10000, '\n'); + break; + } + + case 1 : + { + // Print the current server directory + sf::Ftp::DirectoryResponse response = server.getWorkingDirectory(); + std::cout << response << std::endl; + std::cout << "Current directory is " << response.getDirectory() << std::endl; + break; + } + + case 2 : + { + // Print the contents of the current server directory + sf::Ftp::ListingResponse response = server.getDirectoryListing(); + std::cout << response << std::endl; + const std::vector& names = response.getListing(); + for (std::vector::const_iterator it = names.begin(); it != names.end(); ++it) + std::cout << *it << std::endl; + break; + } + + case 3 : + { + // Change the current directory + std::string directory; + std::cout << "Choose a directory: "; + std::cin >> directory; + std::cout << server.changeDirectory(directory) << std::endl; + break; + } + + case 4 : + { + // Create a new directory + std::string directory; + std::cout << "Name of the directory to create: "; + std::cin >> directory; + std::cout << server.createDirectory(directory) << std::endl; + break; + } + + case 5 : + { + // Remove an existing directory + std::string directory; + std::cout << "Name of the directory to remove: "; + std::cin >> directory; + std::cout << server.deleteDirectory(directory) << std::endl; + break; + } + + case 6 : + { + // Rename a file + std::string source, destination; + std::cout << "Name of the file to rename: "; + std::cin >> source; + std::cout << "New name: "; + std::cin >> destination; + std::cout << server.renameFile(source, destination) << std::endl; + break; + } + + case 7 : + { + // Remove an existing directory + std::string filename; + std::cout << "Name of the file to remove: "; + std::cin >> filename; + std::cout << server.deleteFile(filename) << std::endl; + break; + } + + case 8 : + { + // Download a file from server + std::string filename, directory; + std::cout << "Filename of the file to download (relative to current directory): "; + std::cin >> filename; + std::cout << "Directory to download the file to: "; + std::cin >> directory; + std::cout << server.download(filename, directory) << std::endl; + break; + } + + case 9 : + { + // Upload a file to server + std::string filename, directory; + std::cout << "Path of the file to upload (absolute or relative to working directory): "; + std::cin >> filename; + std::cout << "Directory to upload the file to (relative to current directory): "; + std::cin >> directory; + std::cout << server.upload(filename, directory) << std::endl; + break; + } + + case 0 : + { + // Disconnect + break; + } + } + + } while (choice != 0); + + // Disconnect from the server + std::cout << "Disconnecting from server..." << std::endl; + std::cout << server.disconnect() << std::endl; + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/ftp/ftp b/SFML-2.1-osx-clang-universal/examples/ftp/ftp new file mode 100755 index 0000000..b490f0a Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/ftp/ftp differ diff --git a/SFML-2.1-osx-clang-universal/examples/opengl/OpenGL.cpp b/SFML-2.1-osx-clang-universal/examples/opengl/OpenGL.cpp new file mode 100644 index 0000000..639254b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/opengl/OpenGL.cpp @@ -0,0 +1,194 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Request a 32-bits depth buffer when creating the window + sf::ContextSettings contextSettings; + contextSettings.depthBits = 32; + + // Create the main window + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML graphics with OpenGL", sf::Style::Default, contextSettings); + window.setVerticalSyncEnabled(true); + + // Make it the active window for OpenGL calls + window.setActive(); + + // Create a sprite for the background + sf::Texture backgroundTexture; + if (!backgroundTexture.loadFromFile("resources/background.jpg")) + return EXIT_FAILURE; + sf::Sprite background(backgroundTexture); + + // Create some text to draw on top of our OpenGL object + sf::Font font; + if (!font.loadFromFile("resources/sansation.ttf")) + return EXIT_FAILURE; + sf::Text text("SFML / OpenGL demo", font); + text.setColor(sf::Color(255, 255, 255, 170)); + text.setPosition(250.f, 450.f); + + // Load an OpenGL texture. + // We could directly use a sf::Texture as an OpenGL texture (with its Bind() member function), + // but here we want more control on it (generate mipmaps, ...) so we create a new one from an image + GLuint texture = 0; + { + sf::Image image; + if (!image.loadFromFile("resources/texture.jpg")) + return EXIT_FAILURE; + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getSize().x, image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + } + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + glClearDepth(1.f); + + // Disable lighting + glDisable(GL_LIGHTING); + + // Configure the viewport (the same size as the window) + glViewport(0, 0, window.getSize().x, window.getSize().y); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + GLfloat ratio = static_cast(window.getSize().x) / window.getSize().y; + glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 500.f); + + // Bind the texture + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, texture); + + // Define a 3D cube (6 faces made of 2 triangles composed by 3 vertices) + GLfloat cube[] = + { + // positions // texture coordinates + -20, -20, -20, 0, 0, + -20, 20, -20, 1, 0, + -20, -20, 20, 0, 1, + -20, -20, 20, 0, 1, + -20, 20, -20, 1, 0, + -20, 20, 20, 1, 1, + + 20, -20, -20, 0, 0, + 20, 20, -20, 1, 0, + 20, -20, 20, 0, 1, + 20, -20, 20, 0, 1, + 20, 20, -20, 1, 0, + 20, 20, 20, 1, 1, + + -20, -20, -20, 0, 0, + 20, -20, -20, 1, 0, + -20, -20, 20, 0, 1, + -20, -20, 20, 0, 1, + 20, -20, -20, 1, 0, + 20, -20, 20, 1, 1, + + -20, 20, -20, 0, 0, + 20, 20, -20, 1, 0, + -20, 20, 20, 0, 1, + -20, 20, 20, 0, 1, + 20, 20, -20, 1, 0, + 20, 20, 20, 1, 1, + + -20, -20, -20, 0, 0, + 20, -20, -20, 1, 0, + -20, 20, -20, 0, 1, + -20, 20, -20, 0, 1, + 20, -20, -20, 1, 0, + 20, 20, -20, 1, 1, + + -20, -20, 20, 0, 0, + 20, -20, 20, 1, 0, + -20, 20, 20, 0, 1, + -20, 20, 20, 0, 1, + 20, -20, 20, 1, 0, + 20, 20, 20, 1, 1 + }; + + // Enable position and texture coordinates vertex components + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), cube); + glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), cube + 3); + + // Disable normal and color vertex components + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + // Create a clock for measuring the time elapsed + sf::Clock clock; + + // Start game loop + while (window.isOpen()) + { + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window : exit + if (event.type == sf::Event::Closed) + window.close(); + + // Escape key : exit + if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)) + window.close(); + + // Adjust the viewport when the window is resized + if (event.type == sf::Event::Resized) + glViewport(0, 0, event.size.width, event.size.height); + } + + // Draw the background + window.pushGLStates(); + window.draw(background); + window.popGLStates(); + + // Clear the depth buffer + glClear(GL_DEPTH_BUFFER_BIT); + + // We get the position of the mouse cursor, so that we can move the box accordingly + float x = sf::Mouse::getPosition(window).x * 200.f / window.getSize().x - 100.f; + float y = -sf::Mouse::getPosition(window).y * 200.f / window.getSize().y + 100.f; + + // Apply some transformations + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(x, y, -100.f); + glRotatef(clock.getElapsedTime().asSeconds() * 50.f, 1.f, 0.f, 0.f); + glRotatef(clock.getElapsedTime().asSeconds() * 30.f, 0.f, 1.f, 0.f); + glRotatef(clock.getElapsedTime().asSeconds() * 90.f, 0.f, 0.f, 1.f); + + // Draw the cube + glDrawArrays(GL_TRIANGLES, 0, 36); + + // Draw some text on top of our OpenGL object + window.pushGLStates(); + window.draw(text); + window.popGLStates(); + + // Finally, display the rendered frame on screen + window.display(); + } + + // Don't forget to destroy our texture + glDeleteTextures(1, &texture); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/opengl/opengl b/SFML-2.1-osx-clang-universal/examples/opengl/opengl new file mode 100755 index 0000000..5b6144f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/opengl/opengl differ diff --git a/SFML-2.1-osx-clang-universal/examples/opengl/resources/background.jpg b/SFML-2.1-osx-clang-universal/examples/opengl/resources/background.jpg new file mode 100644 index 0000000..20724fa Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/opengl/resources/background.jpg differ diff --git a/SFML-2.1-osx-clang-universal/examples/opengl/resources/sansation.ttf b/SFML-2.1-osx-clang-universal/examples/opengl/resources/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/opengl/resources/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/examples/opengl/resources/texture.jpg b/SFML-2.1-osx-clang-universal/examples/opengl/resources/texture.jpg new file mode 100644 index 0000000..6cf7528 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/opengl/resources/texture.jpg differ diff --git a/SFML-2.1-osx-clang-universal/examples/pong/Pong.cpp b/SFML-2.1-osx-clang-universal/examples/pong/Pong.cpp new file mode 100644 index 0000000..1b9a74f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/pong/Pong.cpp @@ -0,0 +1,241 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + std::srand(static_cast(std::time(NULL))); + + // Define some constants + const float pi = 3.14159f; + const int gameWidth = 800; + const int gameHeight = 600; + sf::Vector2f paddleSize(25, 100); + float ballRadius = 10.f; + + // Create the window of the application + sf::RenderWindow window(sf::VideoMode(gameWidth, gameHeight, 32), "SFML Pong"); + window.setVerticalSyncEnabled(true); + + // Load the sounds used in the game + sf::SoundBuffer ballSoundBuffer; + if (!ballSoundBuffer.loadFromFile("resources/ball.wav")) + return EXIT_FAILURE; + sf::Sound ballSound(ballSoundBuffer); + + // Create the left paddle + sf::RectangleShape leftPaddle; + leftPaddle.setSize(paddleSize - sf::Vector2f(3, 3)); + leftPaddle.setOutlineThickness(3); + leftPaddle.setOutlineColor(sf::Color::Black); + leftPaddle.setFillColor(sf::Color(100, 100, 200)); + leftPaddle.setOrigin(paddleSize / 2.f); + + // Create the right paddle + sf::RectangleShape rightPaddle; + rightPaddle.setSize(paddleSize - sf::Vector2f(3, 3)); + rightPaddle.setOutlineThickness(3); + rightPaddle.setOutlineColor(sf::Color::Black); + rightPaddle.setFillColor(sf::Color(200, 100, 100)); + rightPaddle.setOrigin(paddleSize / 2.f); + + // Create the ball + sf::CircleShape ball; + ball.setRadius(ballRadius - 3); + ball.setOutlineThickness(3); + ball.setOutlineColor(sf::Color::Black); + ball.setFillColor(sf::Color::White); + ball.setOrigin(ballRadius / 2, ballRadius / 2); + + // Load the text font + sf::Font font; + if (!font.loadFromFile("resources/sansation.ttf")) + return EXIT_FAILURE; + + // Initialize the pause message + sf::Text pauseMessage; + pauseMessage.setFont(font); + pauseMessage.setCharacterSize(40); + pauseMessage.setPosition(170.f, 150.f); + pauseMessage.setColor(sf::Color::White); + pauseMessage.setString("Welcome to SFML pong!\nPress space to start the game"); + + // Define the paddles properties + sf::Clock AITimer; + const sf::Time AITime = sf::seconds(0.1f); + const float paddleSpeed = 400.f; + float rightPaddleSpeed = 0.f; + const float ballSpeed = 400.f; + float ballAngle = 0.f; // to be changed later + + sf::Clock clock; + bool isPlaying = false; + while (window.isOpen()) + { + // Handle events + sf::Event event; + while (window.pollEvent(event)) + { + // Window closed or escape key pressed: exit + if ((event.type == sf::Event::Closed) || + ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape))) + { + window.close(); + break; + } + + // Space key pressed: play + if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Space)) + { + if (!isPlaying) + { + // (re)start the game + isPlaying = true; + clock.restart(); + + // Reset the position of the paddles and ball + leftPaddle.setPosition(10 + paddleSize.x / 2, gameHeight / 2); + rightPaddle.setPosition(gameWidth - 10 - paddleSize.x / 2, gameHeight / 2); + ball.setPosition(gameWidth / 2, gameHeight / 2); + + // Reset the ball angle + do + { + // Make sure the ball initial angle is not too much vertical + ballAngle = (std::rand() % 360) * 2 * pi / 360; + } + while (std::abs(std::cos(ballAngle)) < 0.7f); + } + } + } + + if (isPlaying) + { + float deltaTime = clock.restart().asSeconds(); + + // Move the player's paddle + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && + (leftPaddle.getPosition().y - paddleSize.y / 2 > 5.f)) + { + leftPaddle.move(0.f, -paddleSpeed * deltaTime); + } + if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && + (leftPaddle.getPosition().y + paddleSize.y / 2 < gameHeight - 5.f)) + { + leftPaddle.move(0.f, paddleSpeed * deltaTime); + } + + // Move the computer's paddle + if (((rightPaddleSpeed < 0.f) && (rightPaddle.getPosition().y - paddleSize.y / 2 > 5.f)) || + ((rightPaddleSpeed > 0.f) && (rightPaddle.getPosition().y + paddleSize.y / 2 < gameHeight - 5.f))) + { + rightPaddle.move(0.f, rightPaddleSpeed * deltaTime); + } + + // Update the computer's paddle direction according to the ball position + if (AITimer.getElapsedTime() > AITime) + { + AITimer.restart(); + if (ball.getPosition().y + ballRadius > rightPaddle.getPosition().y + paddleSize.y / 2) + rightPaddleSpeed = paddleSpeed; + else if (ball.getPosition().y - ballRadius < rightPaddle.getPosition().y - paddleSize.y / 2) + rightPaddleSpeed = -paddleSpeed; + else + rightPaddleSpeed = 0.f; + } + + // Move the ball + float factor = ballSpeed * deltaTime; + ball.move(std::cos(ballAngle) * factor, std::sin(ballAngle) * factor); + + // Check collisions between the ball and the screen + if (ball.getPosition().x - ballRadius < 0.f) + { + isPlaying = false; + pauseMessage.setString("You lost !\nPress space to restart or\nescape to exit"); + } + if (ball.getPosition().x + ballRadius > gameWidth) + { + isPlaying = false; + pauseMessage.setString("You won !\nPress space to restart or\nescape to exit"); + } + if (ball.getPosition().y - ballRadius < 0.f) + { + ballSound.play(); + ballAngle = -ballAngle; + ball.setPosition(ball.getPosition().x, ballRadius + 0.1f); + } + if (ball.getPosition().y + ballRadius > gameHeight) + { + ballSound.play(); + ballAngle = -ballAngle; + ball.setPosition(ball.getPosition().x, gameHeight - ballRadius - 0.1f); + } + + // Check the collisions between the ball and the paddles + // Left Paddle + if (ball.getPosition().x - ballRadius < leftPaddle.getPosition().x + paddleSize.x / 2 && + ball.getPosition().x - ballRadius > leftPaddle.getPosition().x && + ball.getPosition().y + ballRadius >= leftPaddle.getPosition().y - paddleSize.y / 2 && + ball.getPosition().y - ballRadius <= leftPaddle.getPosition().y + paddleSize.y / 2) + { + if (ball.getPosition().y > leftPaddle.getPosition().y) + ballAngle = pi - ballAngle + (std::rand() % 20) * pi / 180; + else + ballAngle = pi - ballAngle - (std::rand() % 20) * pi / 180; + + ballSound.play(); + ball.setPosition(leftPaddle.getPosition().x + ballRadius + paddleSize.x / 2 + 0.1f, ball.getPosition().y); + } + + // Right Paddle + if (ball.getPosition().x + ballRadius > rightPaddle.getPosition().x - paddleSize.x / 2 && + ball.getPosition().x + ballRadius < rightPaddle.getPosition().x && + ball.getPosition().y + ballRadius >= rightPaddle.getPosition().y - paddleSize.y / 2 && + ball.getPosition().y - ballRadius <= rightPaddle.getPosition().y + paddleSize.y / 2) + { + if (ball.getPosition().y > rightPaddle.getPosition().y) + ballAngle = pi - ballAngle + (std::rand() % 20) * pi / 180; + else + ballAngle = pi - ballAngle - (std::rand() % 20) * pi / 180; + + ballSound.play(); + ball.setPosition(rightPaddle.getPosition().x - ballRadius - paddleSize.x / 2 - 0.1f, ball.getPosition().y); + } + } + + // Clear the window + window.clear(sf::Color(50, 200, 50)); + + if (isPlaying) + { + // Draw the paddles and the ball + window.draw(leftPaddle); + window.draw(rightPaddle); + window.draw(ball); + } + else + { + // Draw the pause message + window.draw(pauseMessage); + } + + // Display things on screen + window.display(); + } + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/pong/pong b/SFML-2.1-osx-clang-universal/examples/pong/pong new file mode 100755 index 0000000..e1f2eda Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/pong/pong differ diff --git a/SFML-2.1-osx-clang-universal/examples/pong/resources/ball.wav b/SFML-2.1-osx-clang-universal/examples/pong/resources/ball.wav new file mode 100644 index 0000000..8b3cfba Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/pong/resources/ball.wav differ diff --git a/SFML-2.1-osx-clang-universal/examples/pong/resources/sansation.ttf b/SFML-2.1-osx-clang-universal/examples/pong/resources/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/pong/resources/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/Effect.hpp b/SFML-2.1-osx-clang-universal/examples/shader/Effect.hpp new file mode 100644 index 0000000..ce29c47 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/Effect.hpp @@ -0,0 +1,88 @@ +#ifndef EFFECT_HPP +#define EFFECT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +// Base class for effects +//////////////////////////////////////////////////////////// +class Effect : public sf::Drawable +{ +public : + + virtual ~Effect() + { + } + + static void setFont(const sf::Font& font) + { + s_font = &font; + } + + const std::string& getName() const + { + return m_name; + } + + void load() + { + m_isLoaded = sf::Shader::isAvailable() && onLoad(); + } + + void update(float time, float x, float y) + { + if (m_isLoaded) + onUpdate(time, x, y); + } + + void draw(sf::RenderTarget& target, sf::RenderStates states) const + { + if (m_isLoaded) + { + onDraw(target, states); + } + else + { + sf::Text error("Shader not\nsupported", getFont()); + error.setPosition(320.f, 200.f); + error.setCharacterSize(36); + target.draw(error, states); + } + } + +protected : + + Effect(const std::string& name) : + m_name(name), + m_isLoaded(false) + { + } + + static const sf::Font& getFont() + { + assert(s_font != NULL); + return *s_font; + } + +private : + + // Virtual functions to be implemented in derived effects + virtual bool onLoad() = 0; + virtual void onUpdate(float time, float x, float y) = 0; + virtual void onDraw(sf::RenderTarget& target, sf::RenderStates states) const = 0; + +private : + + std::string m_name; + bool m_isLoaded; + + static const sf::Font* s_font; +}; + +#endif // EFFECT_HPP diff --git a/SFML-2.1-osx-clang-universal/examples/shader/Shader.cpp b/SFML-2.1-osx-clang-universal/examples/shader/Shader.cpp new file mode 100644 index 0000000..2b0d8a5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/Shader.cpp @@ -0,0 +1,380 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "Effect.hpp" +#include +#include +#include + + +const sf::Font* Effect::s_font = NULL; + +//////////////////////////////////////////////////////////// +// "Pixelate" fragment shader +//////////////////////////////////////////////////////////// +class Pixelate : public Effect +{ +public : + + Pixelate() : + Effect("pixelate") + { + } + + bool onLoad() + { + // Load the texture and initialize the sprite + if (!m_texture.loadFromFile("resources/background.jpg")) + return false; + m_sprite.setTexture(m_texture); + + // Load the shader + if (!m_shader.loadFromFile("resources/pixelate.frag", sf::Shader::Fragment)) + return false; + m_shader.setParameter("texture", sf::Shader::CurrentTexture); + + return true; + } + + void onUpdate(float, float x, float y) + { + m_shader.setParameter("pixel_threshold", (x + y) / 30); + } + + void onDraw(sf::RenderTarget& target, sf::RenderStates states) const + { + states.shader = &m_shader; + target.draw(m_sprite, states); + } + +private: + + sf::Texture m_texture; + sf::Sprite m_sprite; + sf::Shader m_shader; +}; + + +//////////////////////////////////////////////////////////// +// "Wave" vertex shader + "blur" fragment shader +//////////////////////////////////////////////////////////// +class WaveBlur : public Effect +{ +public : + + WaveBlur() : + Effect("wave + blur") + { + } + + bool onLoad() + { + // Create the text + m_text.setString("Praesent suscipit augue in velit pulvinar hendrerit varius purus aliquam.\n" + "Mauris mi odio, bibendum quis fringilla a, laoreet vel orci. Proin vitae vulputate tortor.\n" + "Praesent cursus ultrices justo, ut feugiat ante vehicula quis.\n" + "Donec fringilla scelerisque mauris et viverra.\n" + "Maecenas adipiscing ornare scelerisque. Nullam at libero elit.\n" + "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\n" + "Nullam leo urna, tincidunt id semper eget, ultricies sed mi.\n" + "Morbi mauris massa, commodo id dignissim vel, lobortis et elit.\n" + "Fusce vel libero sed neque scelerisque venenatis.\n" + "Integer mattis tincidunt quam vitae iaculis.\n" + "Vivamus fringilla sem non velit venenatis fermentum.\n" + "Vivamus varius tincidunt nisi id vehicula.\n" + "Integer ullamcorper, enim vitae euismod rutrum, massa nisl semper ipsum,\n" + "vestibulum sodales sem ante in massa.\n" + "Vestibulum in augue non felis convallis viverra.\n" + "Mauris ultricies dolor sed massa convallis sed aliquet augue fringilla.\n" + "Duis erat eros, porta in accumsan in, blandit quis sem.\n" + "In hac habitasse platea dictumst. Etiam fringilla est id odio dapibus sit amet semper dui laoreet.\n"); + m_text.setFont(getFont()); + m_text.setCharacterSize(22); + m_text.setPosition(30, 20); + + // Load the shader + if (!m_shader.loadFromFile("resources/wave.vert", "resources/blur.frag")) + return false; + + return true; + } + + void onUpdate(float time, float x, float y) + { + m_shader.setParameter("wave_phase", time); + m_shader.setParameter("wave_amplitude", x * 40, y * 40); + m_shader.setParameter("blur_radius", (x + y) * 0.008f); + } + + void onDraw(sf::RenderTarget& target, sf::RenderStates states) const + { + states.shader = &m_shader; + target.draw(m_text, states); + } + +private: + + sf::Text m_text; + sf::Shader m_shader; +}; + + +//////////////////////////////////////////////////////////// +// "Storm" vertex shader + "blink" fragment shader +//////////////////////////////////////////////////////////// +class StormBlink : public Effect +{ +public : + + StormBlink() : + Effect("storm + blink") + { + } + + bool onLoad() + { + // Create the points + m_points.setPrimitiveType(sf::Points); + for (int i = 0; i < 40000; ++i) + { + float x = static_cast(std::rand() % 800); + float y = static_cast(std::rand() % 600); + sf::Uint8 r = std::rand() % 255; + sf::Uint8 g = std::rand() % 255; + sf::Uint8 b = std::rand() % 255; + m_points.append(sf::Vertex(sf::Vector2f(x, y), sf::Color(r, g, b))); + } + + // Load the shader + if (!m_shader.loadFromFile("resources/storm.vert", "resources/blink.frag")) + return false; + + return true; + } + + void onUpdate(float time, float x, float y) + { + float radius = 200 + std::cos(time) * 150; + m_shader.setParameter("storm_position", x * 800, y * 600); + m_shader.setParameter("storm_inner_radius", radius / 3); + m_shader.setParameter("storm_total_radius", radius); + m_shader.setParameter("blink_alpha", 0.5f + std::cos(time * 3) * 0.25f); + } + + void onDraw(sf::RenderTarget& target, sf::RenderStates states) const + { + states.shader = &m_shader; + target.draw(m_points, states); + } + +private: + + sf::VertexArray m_points; + sf::Shader m_shader; +}; + + +//////////////////////////////////////////////////////////// +// "Edge" post-effect fragment shader +//////////////////////////////////////////////////////////// +class Edge : public Effect +{ +public : + + Edge() : + Effect("edge post-effect") + { + } + + bool onLoad() + { + // Create the off-screen surface + if (!m_surface.create(800, 600)) + return false; + m_surface.setSmooth(true); + + // Load the textures + if (!m_backgroundTexture.loadFromFile("resources/sfml.png")) + return false; + m_backgroundTexture.setSmooth(true); + if (!m_entityTexture.loadFromFile("resources/devices.png")) + return false; + m_entityTexture.setSmooth(true); + + // Initialize the background sprite + m_backgroundSprite.setTexture(m_backgroundTexture); + m_backgroundSprite.setPosition(135, 100); + + // Load the moving entities + for (int i = 0; i < 6; ++i) + { + sf::Sprite entity(m_entityTexture, sf::IntRect(96 * i, 0, 96, 96)); + m_entities.push_back(entity); + } + + // Load the shader + if (!m_shader.loadFromFile("resources/edge.frag", sf::Shader::Fragment)) + return false; + m_shader.setParameter("texture", sf::Shader::CurrentTexture); + + return true; + } + + void onUpdate(float time, float x, float y) + { + m_shader.setParameter("edge_threshold", 1 - (x + y) / 2); + + // Update the position of the moving entities + for (std::size_t i = 0; i < m_entities.size(); ++i) + { + sf::Vector2f position; + position.x = std::cos(0.25f * (time * i + (m_entities.size() - i))) * 300 + 350; + position.y = std::sin(0.25f * (time * (m_entities.size() - i) + i)) * 200 + 250; + m_entities[i].setPosition(position); + } + + // Render the updated scene to the off-screen surface + m_surface.clear(sf::Color::White); + m_surface.draw(m_backgroundSprite); + for (std::size_t i = 0; i < m_entities.size(); ++i) + m_surface.draw(m_entities[i]); + m_surface.display(); + } + + void onDraw(sf::RenderTarget& target, sf::RenderStates states) const + { + states.shader = &m_shader; + target.draw(sf::Sprite(m_surface.getTexture()), states); + } + +private: + + sf::RenderTexture m_surface; + sf::Texture m_backgroundTexture; + sf::Texture m_entityTexture; + sf::Sprite m_backgroundSprite; + std::vector m_entities; + sf::Shader m_shader; +}; + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Create the main window + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Shader"); + window.setVerticalSyncEnabled(true); + + // Load the application font and pass it to the Effect class + sf::Font font; + if (!font.loadFromFile("resources/sansation.ttf")) + return EXIT_FAILURE; + Effect::setFont(font); + + // Create the effects + std::vector effects; + effects.push_back(new Pixelate); + effects.push_back(new WaveBlur); + effects.push_back(new StormBlink); + effects.push_back(new Edge); + std::size_t current = 0; + + // Initialize them + for (std::size_t i = 0; i < effects.size(); ++i) + effects[i]->load(); + + // Create the messages background + sf::Texture textBackgroundTexture; + if (!textBackgroundTexture.loadFromFile("resources/text-background.png")) + return EXIT_FAILURE; + sf::Sprite textBackground(textBackgroundTexture); + textBackground.setPosition(0, 520); + textBackground.setColor(sf::Color(255, 255, 255, 200)); + + // Create the description text + sf::Text description("Current effect: " + effects[current]->getName(), font, 20); + description.setPosition(10, 530); + description.setColor(sf::Color(80, 80, 80)); + + // Create the instructions text + sf::Text instructions("Press left and right arrows to change the current shader", font, 20); + instructions.setPosition(280, 555); + instructions.setColor(sf::Color(80, 80, 80)); + + // Start the game loop + sf::Clock clock; + while (window.isOpen()) + { + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window: exit + if (event.type == sf::Event::Closed) + window.close(); + + if (event.type == sf::Event::KeyPressed) + { + switch (event.key.code) + { + // Escape key: exit + case sf::Keyboard::Escape: + window.close(); + break; + + // Left arrow key: previous shader + case sf::Keyboard::Left: + if (current == 0) + current = effects.size() - 1; + else + current--; + description.setString("Current effect: " + effects[current]->getName()); + break; + + // Right arrow key: next shader + case sf::Keyboard::Right: + if (current == effects.size() - 1) + current = 0; + else + current++; + description.setString("Current effect: " + effects[current]->getName()); + break; + + default: + break; + } + } + } + + // Update the current example + float x = static_cast(sf::Mouse::getPosition(window).x) / window.getSize().x; + float y = static_cast(sf::Mouse::getPosition(window).y) / window.getSize().y; + effects[current]->update(clock.getElapsedTime().asSeconds(), x, y); + + // Clear the window + window.clear(sf::Color(255, 128, 0)); + + // Draw the current example + window.draw(*effects[current]); + + // Draw the text + window.draw(textBackground); + window.draw(instructions); + window.draw(description); + + // Finally, display the rendered frame on screen + window.display(); + } + + // delete the effects + for (std::size_t i = 0; i < effects.size(); ++i) + delete effects[i]; + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/background.jpg b/SFML-2.1-osx-clang-universal/examples/shader/resources/background.jpg new file mode 100644 index 0000000..f37d7ae Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/resources/background.jpg differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/blink.frag b/SFML-2.1-osx-clang-universal/examples/shader/resources/blink.frag new file mode 100644 index 0000000..07c8ddb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/blink.frag @@ -0,0 +1,9 @@ +uniform sampler2D texture; +uniform float blink_alpha; + +void main() +{ + vec4 pixel = gl_Color; + pixel.a = blink_alpha; + gl_FragColor = pixel; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/blur.frag b/SFML-2.1-osx-clang-universal/examples/shader/resources/blur.frag new file mode 100644 index 0000000..c40e5b3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/blur.frag @@ -0,0 +1,20 @@ +uniform sampler2D texture; +uniform float blur_radius; + +void main() +{ + vec2 offx = vec2(blur_radius, 0.0); + vec2 offy = vec2(0.0, blur_radius); + + vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 4.0 + + texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0; + + gl_FragColor = gl_Color * (pixel / 16.0); +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/devices.png b/SFML-2.1-osx-clang-universal/examples/shader/resources/devices.png new file mode 100644 index 0000000..6b1cbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/resources/devices.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/edge.frag b/SFML-2.1-osx-clang-universal/examples/shader/resources/edge.frag new file mode 100644 index 0000000..14551f9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/edge.frag @@ -0,0 +1,32 @@ +uniform sampler2D texture; +uniform float edge_threshold; + +void main() +{ + const float offset = 1.0 / 512.0; + vec2 offx = vec2(offset, 0.0); + vec2 offy = vec2(0.0, offset); + + vec4 hEdge = texture2D(texture, gl_TexCoord[0].xy - offy) * -2.0 + + texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy - offx - offy) * -1.0 + + texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx - offy) * -1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0; + + vec4 vEdge = texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 + + texture2D(texture, gl_TexCoord[0].xy + offx) * -2.0 + + texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy - offx + offy) * -1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 + + texture2D(texture, gl_TexCoord[0].xy + offx + offy) * -1.0; + + vec3 result = sqrt(hEdge.rgb * hEdge.rgb + vEdge.rgb * vEdge.rgb); + float edge = length(result); + vec4 pixel = gl_Color * texture2D(texture, gl_TexCoord[0].xy); + if (edge > (edge_threshold * 8.0)) + pixel.rgb = vec3(0.0, 0.0, 0.0); + else + pixel.a = edge_threshold; + gl_FragColor = pixel; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/pixelate.frag b/SFML-2.1-osx-clang-universal/examples/shader/resources/pixelate.frag new file mode 100644 index 0000000..3c8eb0e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/pixelate.frag @@ -0,0 +1,9 @@ +uniform sampler2D texture; +uniform float pixel_threshold; + +void main() +{ + float factor = 1.0 / (pixel_threshold + 0.001); + vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; + gl_FragColor = texture2D(texture, pos) * gl_Color; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/sansation.ttf b/SFML-2.1-osx-clang-universal/examples/shader/resources/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/resources/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/sfml.png b/SFML-2.1-osx-clang-universal/examples/shader/resources/sfml.png new file mode 100644 index 0000000..1da719f Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/resources/sfml.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/storm.vert b/SFML-2.1-osx-clang-universal/examples/shader/resources/storm.vert new file mode 100644 index 0000000..442f80a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/storm.vert @@ -0,0 +1,19 @@ +uniform vec2 storm_position; +uniform float storm_total_radius; +uniform float storm_inner_radius; + +void main() +{ + vec4 vertex = gl_ModelViewMatrix * gl_Vertex; + vec2 offset = vertex.xy - storm_position; + float len = length(offset); + if (len < storm_total_radius) + { + float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius); + vertex.xy = storm_position + normalize(offset) * push_distance; + } + + gl_Position = gl_ProjectionMatrix * vertex; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_FrontColor = gl_Color; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/text-background.png b/SFML-2.1-osx-clang-universal/examples/shader/resources/text-background.png new file mode 100644 index 0000000..c86e9b6 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/resources/text-background.png differ diff --git a/SFML-2.1-osx-clang-universal/examples/shader/resources/wave.vert b/SFML-2.1-osx-clang-universal/examples/shader/resources/wave.vert new file mode 100644 index 0000000..5089cfb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/shader/resources/wave.vert @@ -0,0 +1,15 @@ +uniform float wave_phase; +uniform vec2 wave_amplitude; + +void main() +{ + vec4 vertex = gl_Vertex; + vertex.x += cos(gl_Vertex.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x + + sin(gl_Vertex.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3; + vertex.y += sin(gl_Vertex.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y + + cos(gl_Vertex.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3; + + gl_Position = gl_ModelViewProjectionMatrix * vertex; + gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_FrontColor = gl_Color; +} diff --git a/SFML-2.1-osx-clang-universal/examples/shader/shader b/SFML-2.1-osx-clang-universal/examples/shader/shader new file mode 100755 index 0000000..f43994c Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/shader/shader differ diff --git a/SFML-2.1-osx-clang-universal/examples/sockets/Sockets.cpp b/SFML-2.1-osx-clang-universal/examples/sockets/Sockets.cpp new file mode 100644 index 0000000..a73609c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/sockets/Sockets.cpp @@ -0,0 +1,59 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +void runTcpServer(unsigned short port); +void runTcpClient(unsigned short port); +void runUdpServer(unsigned short port); +void runUdpClient(unsigned short port); + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose an arbitrary port for opening sockets + const unsigned short port = 50001; + + // TCP, UDP or connected UDP ? + char protocol; + std::cout << "Do you want to use TCP (t) or UDP (u) ? "; + std::cin >> protocol; + + // Client or server ? + char who; + std::cout << "Do you want to be a server (s) or a client (c) ? "; + std::cin >> who; + + if (protocol == 't') + { + // Test the TCP protocol + if (who == 's') + runTcpServer(port); + else + runTcpClient(port); + } + else + { + // Test the unconnected UDP protocol + if (who == 's') + runUdpServer(port); + else + runUdpClient(port); + } + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/sockets/TCP.cpp b/SFML-2.1-osx-clang-universal/examples/sockets/TCP.cpp new file mode 100644 index 0000000..ff1e1f6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/sockets/TCP.cpp @@ -0,0 +1,81 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Launch a server, wait for an incoming connection, +/// send a message and wait for the answer. +/// +//////////////////////////////////////////////////////////// +void runTcpServer(unsigned short port) +{ + // Create a server socket to accept new connections + sf::TcpListener listener; + + // Listen to the given port for incoming connections + if (listener.listen(port) != sf::Socket::Done) + return; + std::cout << "Server is listening to port " << port << ", waiting for connections... " << std::endl; + + // Wait for a connection + sf::TcpSocket socket; + if (listener.accept(socket) != sf::Socket::Done) + return; + std::cout << "Client connected: " << socket.getRemoteAddress() << std::endl; + + // Send a message to the connected client + const char out[] = "Hi, I'm the server"; + if (socket.send(out, sizeof(out)) != sf::Socket::Done) + return; + std::cout << "Message sent to the client: \"" << out << "\"" << std::endl; + + // Receive a message back from the client + char in[128]; + std::size_t received; + if (socket.receive(in, sizeof(in), received) != sf::Socket::Done) + return; + std::cout << "Answer received from the client: \"" << in << "\"" << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Create a client, connect it to a server, display the +/// welcome message and send an answer. +/// +//////////////////////////////////////////////////////////// +void runTcpClient(unsigned short port) +{ + // Ask for the server address + sf::IpAddress server; + do + { + std::cout << "Type the address or name of the server to connect to: "; + std::cin >> server; + } + while (server == sf::IpAddress::None); + + // Create a socket for communicating with the server + sf::TcpSocket socket; + + // Connect to the server + if (socket.connect(server, port) != sf::Socket::Done) + return; + std::cout << "Connected to server " << server << std::endl; + + // Receive a message from the server + char in[128]; + std::size_t received; + if (socket.receive(in, sizeof(in), received) != sf::Socket::Done) + return; + std::cout << "Message received from the server: \"" << in << "\"" << std::endl; + + // Send an answer to the server + const char out[] = "Hi, I'm a client"; + if (socket.send(out, sizeof(out)) != sf::Socket::Done) + return; + std::cout << "Message sent to the server: \"" << out << "\"" << std::endl; +} diff --git a/SFML-2.1-osx-clang-universal/examples/sockets/UDP.cpp b/SFML-2.1-osx-clang-universal/examples/sockets/UDP.cpp new file mode 100644 index 0000000..abc7b4b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/sockets/UDP.cpp @@ -0,0 +1,72 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Launch a server, wait for a message, send an answer. +/// +//////////////////////////////////////////////////////////// +void runUdpServer(unsigned short port) +{ + // Create a socket to receive a message from anyone + sf::UdpSocket socket; + + // Listen to messages on the specified port + if (socket.bind(port) != sf::Socket::Done) + return; + std::cout << "Server is listening to port " << port << ", waiting for a message... " << std::endl; + + // Wait for a message + char in[128]; + std::size_t received; + sf::IpAddress sender; + unsigned short senderPort; + if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done) + return; + std::cout << "Message received from client " << sender << ": \"" << in << "\"" << std::endl; + + // Send an answer to the client + const char out[] = "Hi, I'm the server"; + if (socket.send(out, sizeof(out), sender, senderPort) != sf::Socket::Done) + return; + std::cout << "Message sent to the client: \"" << out << "\"" << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Send a message to the server, wait for the answer +/// +//////////////////////////////////////////////////////////// +void runUdpClient(unsigned short port) +{ + // Ask for the server address + sf::IpAddress server; + do + { + std::cout << "Type the address or name of the server to connect to: "; + std::cin >> server; + } + while (server == sf::IpAddress::None); + + // Create a socket for communicating with the server + sf::UdpSocket socket; + + // Send a message to the server + const char out[] = "Hi, I'm a client"; + if (socket.send(out, sizeof(out), server, port) != sf::Socket::Done) + return; + std::cout << "Message sent to the server: \"" << out << "\"" << std::endl; + + // Receive an answer from anyone (but most likely from the server) + char in[128]; + std::size_t received; + sf::IpAddress sender; + unsigned short senderPort; + if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done) + return; + std::cout << "Message received from " << sender << ": \"" << in << "\"" << std::endl; +} diff --git a/SFML-2.1-osx-clang-universal/examples/sockets/sockets b/SFML-2.1-osx-clang-universal/examples/sockets/sockets new file mode 100755 index 0000000..00a60bd Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/sockets/sockets differ diff --git a/SFML-2.1-osx-clang-universal/examples/sound-capture/SoundCapture.cpp b/SFML-2.1-osx-clang-universal/examples/sound-capture/SoundCapture.cpp new file mode 100644 index 0000000..a6946ac --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/sound-capture/SoundCapture.cpp @@ -0,0 +1,95 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Check that the device can capture audio + if (sf::SoundRecorder::isAvailable() == false) + { + std::cout << "Sorry, audio capture is not supported by your system" << std::endl; + return EXIT_SUCCESS; + } + + // Choose the sample rate + unsigned int sampleRate; + std::cout << "Please choose the sample rate for sound capture (44100 is CD quality) : "; + std::cin >> sampleRate; + std::cin.ignore(10000, '\n'); + + // Wait for user input... + std::cout << "Press enter to start recording audio"; + std::cin.ignore(10000, '\n'); + + // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer + sf::SoundBufferRecorder recorder; + + // Audio capture is done in a separate thread, so we can block the main thread while it is capturing + recorder.start(sampleRate); + std::cout << "Recording... press enter to stop"; + std::cin.ignore(10000, '\n'); + recorder.stop(); + + // Get the buffer containing the captured data + const sf::SoundBuffer& buffer = recorder.getBuffer(); + + // Display captured sound informations + std::cout << "Sound information :" << std::endl; + std::cout << " " << buffer.getDuration().asSeconds() << " seconds" << std::endl; + std::cout << " " << buffer.getSampleRate() << " samples / seconds" << std::endl; + std::cout << " " << buffer.getChannelCount() << " channels" << std::endl; + + // Choose what to do with the recorded sound data + char choice; + std::cout << "What do you want to do with captured sound (p = play, s = save) ? "; + std::cin >> choice; + std::cin.ignore(10000, '\n'); + + if (choice == 's') + { + // Choose the filename + std::string filename; + std::cout << "Choose the file to create : "; + std::getline(std::cin, filename); + + // Save the buffer + buffer.saveToFile(filename); + } + else + { + // Create a sound instance and play it + sf::Sound sound(buffer); + sound.play(); + + // Wait until finished + while (sound.getStatus() == sf::Sound::Playing) + { + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.getPlayingOffset().asSeconds() << " sec"; + std::cout << std::flush; + + // Leave some CPU time for other threads + sf::sleep(sf::milliseconds(100)); + } + } + + // Finished ! + std::cout << std::endl << "Done !" << std::endl; + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/sound-capture/sound-capture b/SFML-2.1-osx-clang-universal/examples/sound-capture/sound-capture new file mode 100755 index 0000000..b9ce4cb Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/sound-capture/sound-capture differ diff --git a/SFML-2.1-osx-clang-universal/examples/sound/Sound.cpp b/SFML-2.1-osx-clang-universal/examples/sound/Sound.cpp new file mode 100644 index 0000000..5c75ab8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/sound/Sound.cpp @@ -0,0 +1,98 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +/// Play a sound +/// +//////////////////////////////////////////////////////////// +void playSound() +{ + // Load a sound buffer from a wav file + sf::SoundBuffer buffer; + if (!buffer.loadFromFile("resources/canary.wav")) + return; + + // Display sound informations + std::cout << "canary.wav :" << std::endl; + std::cout << " " << buffer.getDuration().asSeconds() << " seconds" << std::endl; + std::cout << " " << buffer.getSampleRate() << " samples / sec" << std::endl; + std::cout << " " << buffer.getChannelCount() << " channels" << std::endl; + + // Create a sound instance and play it + sf::Sound sound(buffer); + sound.play(); + + // Loop while the sound is playing + while (sound.getStatus() == sf::Sound::Playing) + { + // Leave some CPU time for other processes + sf::sleep(sf::milliseconds(100)); + + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << sound.getPlayingOffset().asSeconds() << " sec "; + std::cout << std::flush; + } + std::cout << std::endl << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Play a music +/// +//////////////////////////////////////////////////////////// +void playMusic() +{ + // Load an ogg music file + sf::Music music; + if (!music.openFromFile("resources/orchestral.ogg")) + return; + + // Display music informations + std::cout << "orchestral.ogg :" << std::endl; + std::cout << " " << music.getDuration().asSeconds() << " seconds" << std::endl; + std::cout << " " << music.getSampleRate() << " samples / sec" << std::endl; + std::cout << " " << music.getChannelCount() << " channels" << std::endl; + + // Play it + music.play(); + + // Loop while the music is playing + while (music.getStatus() == sf::Music::Playing) + { + // Leave some CPU time for other processes + sf::sleep(sf::milliseconds(100)); + + // Display the playing position + std::cout << "\rPlaying... " << std::fixed << std::setprecision(2) << music.getPlayingOffset().asSeconds() << " sec "; + std::cout << std::flush; + } + std::cout << std::endl; +} + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Play a sound + playSound(); + + // Play a music + playMusic(); + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/sound/resources/canary.wav b/SFML-2.1-osx-clang-universal/examples/sound/resources/canary.wav new file mode 100644 index 0000000..a0f3aec Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/sound/resources/canary.wav differ diff --git a/SFML-2.1-osx-clang-universal/examples/sound/resources/orchestral.ogg b/SFML-2.1-osx-clang-universal/examples/sound/resources/orchestral.ogg new file mode 100644 index 0000000..f764d61 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/sound/resources/orchestral.ogg differ diff --git a/SFML-2.1-osx-clang-universal/examples/sound/sound b/SFML-2.1-osx-clang-universal/examples/sound/sound new file mode 100755 index 0000000..2a21d81 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/sound/sound differ diff --git a/SFML-2.1-osx-clang-universal/examples/voip/Client.cpp b/SFML-2.1-osx-clang-universal/examples/voip/Client.cpp new file mode 100644 index 0000000..ceb2da6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/voip/Client.cpp @@ -0,0 +1,129 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +const sf::Uint8 audioData = 1; +const sf::Uint8 endOfStream = 2; + + +//////////////////////////////////////////////////////////// +/// Specialization of audio recorder for sending recorded audio +/// data through the network +//////////////////////////////////////////////////////////// +class NetworkRecorder : public sf::SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// Constructor + /// + /// \param host Remote host to which send the recording data + /// \param port Port of the remote host + /// + //////////////////////////////////////////////////////////// + NetworkRecorder(const sf::IpAddress& host, unsigned short port) : + m_host(host), + m_port(port) + { + } + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundRecorder::OnStart + /// + //////////////////////////////////////////////////////////// + virtual bool onStart() + { + if (m_socket.connect(m_host, m_port) == sf::Socket::Done) + { + std::cout << "Connected to server " << m_host << std::endl; + return true; + } + else + { + return false; + } + } + + //////////////////////////////////////////////////////////// + /// /see SoundRecorder::ProcessSamples + /// + //////////////////////////////////////////////////////////// + virtual bool onProcessSamples(const sf::Int16* samples, std::size_t sampleCount) + { + // Pack the audio samples into a network packet + sf::Packet packet; + packet << audioData; + packet.append(samples, sampleCount * sizeof(sf::Int16)); + + // Send the audio packet to the server + return m_socket.send(packet) == sf::Socket::Done; + } + + //////////////////////////////////////////////////////////// + /// /see SoundRecorder::OnStop + /// + //////////////////////////////////////////////////////////// + virtual void onStop() + { + // Send a "end-of-stream" packet + sf::Packet packet; + packet << endOfStream; + m_socket.send(packet); + + // Close the socket + m_socket.disconnect(); + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sf::IpAddress m_host; ///< Address of the remote host + unsigned short m_port; ///< Remote port + sf::TcpSocket m_socket; ///< Socket used to communicate with the server +}; + + +//////////////////////////////////////////////////////////// +/// Create a client, connect it to a running server and +/// start sending him audio data +/// +//////////////////////////////////////////////////////////// +void doClient(unsigned short port) +{ + // Check that the device can capture audio + if (sf::SoundRecorder::isAvailable() == false) + { + std::cout << "Sorry, audio capture is not supported by your system" << std::endl; + return; + } + + // Ask for server address + sf::IpAddress server; + do + { + std::cout << "Type address or name of the server to connect to : "; + std::cin >> server; + } + while (server == sf::IpAddress::None); + + // Create an instance of our custom recorder + NetworkRecorder recorder(server, port); + + // Wait for user input... + std::cin.ignore(10000, '\n'); + std::cout << "Press enter to start recording audio"; + std::cin.ignore(10000, '\n'); + + // Start capturing audio data + recorder.start(44100); + std::cout << "Recording... press enter to stop"; + std::cin.ignore(10000, '\n'); + recorder.stop(); +} diff --git a/SFML-2.1-osx-clang-universal/examples/voip/Server.cpp b/SFML-2.1-osx-clang-universal/examples/voip/Server.cpp new file mode 100644 index 0000000..29227fa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/voip/Server.cpp @@ -0,0 +1,200 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +const sf::Uint8 audioData = 1; +const sf::Uint8 endOfStream = 2; + + +//////////////////////////////////////////////////////////// +/// Customized sound stream for acquiring audio data +/// from the network +//////////////////////////////////////////////////////////// +class NetworkAudioStream : public sf::SoundStream +{ +public : + + //////////////////////////////////////////////////////////// + /// Default constructor + /// + //////////////////////////////////////////////////////////// + NetworkAudioStream() : + m_offset (0), + m_hasFinished(false) + { + // Set the sound parameters + initialize(1, 44100); + } + + //////////////////////////////////////////////////////////// + /// Run the server, stream audio data from the client + /// + //////////////////////////////////////////////////////////// + void start(unsigned short port) + { + if (!m_hasFinished) + { + // Listen to the given port for incoming connections + if (m_listener.listen(port) != sf::Socket::Done) + return; + std::cout << "Server is listening to port " << port << ", waiting for connections... " << std::endl; + + // Wait for a connection + if (m_listener.accept(m_client) != sf::Socket::Done) + return; + std::cout << "Client connected: " << m_client.getRemoteAddress() << std::endl; + + // Start playback + play(); + + // Start receiving audio data + receiveLoop(); + } + else + { + // Start playback + play(); + } + } + +private : + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnGetData + /// + //////////////////////////////////////////////////////////// + virtual bool onGetData(sf::SoundStream::Chunk& data) + { + // We have reached the end of the buffer and all audio data have been played : we can stop playback + if ((m_offset >= m_samples.size()) && m_hasFinished) + return false; + + // No new data has arrived since last update : wait until we get some + while ((m_offset >= m_samples.size()) && !m_hasFinished) + sf::sleep(sf::milliseconds(10)); + + // Copy samples into a local buffer to avoid synchronization problems + // (don't forget that we run in two separate threads) + { + sf::Lock lock(m_mutex); + m_tempBuffer.assign(m_samples.begin() + m_offset, m_samples.end()); + } + + // Fill audio data to pass to the stream + data.samples = &m_tempBuffer[0]; + data.sampleCount = m_tempBuffer.size(); + + // Update the playing offset + m_offset += m_tempBuffer.size(); + + return true; + } + + //////////////////////////////////////////////////////////// + /// /see SoundStream::OnSeek + /// + //////////////////////////////////////////////////////////// + virtual void onSeek(sf::Time timeOffset) + { + m_offset = timeOffset.asMilliseconds() * getSampleRate() * getChannelCount() / 1000; + } + + //////////////////////////////////////////////////////////// + /// Get audio data from the client until playback is stopped + /// + //////////////////////////////////////////////////////////// + void receiveLoop() + { + while (!m_hasFinished) + { + // Get waiting audio data from the network + sf::Packet packet; + if (m_client.receive(packet) != sf::Socket::Done) + break; + + // Extract the message ID + sf::Uint8 id; + packet >> id; + + if (id == audioData) + { + // Extract audio samples from the packet, and append it to our samples buffer + const sf::Int16* samples = reinterpret_cast(static_cast(packet.getData()) + 1); + std::size_t sampleCount = (packet.getDataSize() - 1) / sizeof(sf::Int16); + + // Don't forget that the other thread can access the sample array at any time + // (so we protect any operation on it with the mutex) + { + sf::Lock lock(m_mutex); + std::copy(samples, samples + sampleCount, std::back_inserter(m_samples)); + } + } + else if (id == endOfStream) + { + // End of stream reached : we stop receiving audio data + std::cout << "Audio data has been 100% received!" << std::endl; + m_hasFinished = true; + } + else + { + // Something's wrong... + std::cout << "Invalid packet received..." << std::endl; + m_hasFinished = true; + } + } + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + sf::TcpListener m_listener; + sf::TcpSocket m_client; + sf::Mutex m_mutex; + std::vector m_samples; + std::vector m_tempBuffer; + std::size_t m_offset; + bool m_hasFinished; +}; + + +//////////////////////////////////////////////////////////// +/// Launch a server and wait for incoming audio data from +/// a connected client +/// +//////////////////////////////////////////////////////////// +void doServer(unsigned short port) +{ + // Build an audio stream to play sound data as it is received through the network + NetworkAudioStream audioStream; + audioStream.start(port); + + // Loop until the sound playback is finished + while (audioStream.getStatus() != sf::SoundStream::Stopped) + { + // Leave some CPU time for other threads + sf::sleep(sf::milliseconds(100)); + } + + std::cin.ignore(10000, '\n'); + + // Wait until the user presses 'enter' key + std::cout << "Press enter to replay the sound..." << std::endl; + std::cin.ignore(10000, '\n'); + + // Replay the sound (just to make sure replaying the received data is OK) + audioStream.play(); + + // Loop until the sound playback is finished + while (audioStream.getStatus() != sf::SoundStream::Stopped) + { + // Leave some CPU time for other threads + sf::sleep(sf::milliseconds(100)); + } +} diff --git a/SFML-2.1-osx-clang-universal/examples/voip/VoIP.cpp b/SFML-2.1-osx-clang-universal/examples/voip/VoIP.cpp new file mode 100644 index 0000000..93f9512 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/voip/VoIP.cpp @@ -0,0 +1,50 @@ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +//////////////////////////////////////////////////////////// +// Function prototypes +// (I'm too lazy to put them into separate headers...) +//////////////////////////////////////////////////////////// +void doClient(unsigned short port); +void doServer(unsigned short port); + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Choose a random port for opening sockets (ports < 1024 are reserved) + const unsigned short port = 2435; + + // Client or server ? + char who; + std::cout << "Do you want to be a server ('s') or a client ('c') ? "; + std::cin >> who; + + if (who == 's') + { + // Run as a server + doServer(port); + } + else + { + // Run as a client + doClient(port); + } + + // Wait until the user presses 'enter' key + std::cout << "Press enter to exit..." << std::endl; + std::cin.ignore(10000, '\n'); + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/voip/voip b/SFML-2.1-osx-clang-universal/examples/voip/voip new file mode 100755 index 0000000..85ee187 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/voip/voip differ diff --git a/SFML-2.1-osx-clang-universal/examples/window/Window.cpp b/SFML-2.1-osx-clang-universal/examples/window/Window.cpp new file mode 100644 index 0000000..360703b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/examples/window/Window.cpp @@ -0,0 +1,146 @@ +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +//////////////////////////////////////////////////////////// +/// Entry point of application +/// +/// \return Application exit code +/// +//////////////////////////////////////////////////////////// +int main() +{ + // Request a 32-bits depth buffer when creating the window + sf::ContextSettings contextSettings; + contextSettings.depthBits = 32; + + // Create the main window + sf::Window window(sf::VideoMode(640, 480), "SFML window with OpenGL", sf::Style::Default, contextSettings); + + // Make it the active window for OpenGL calls + window.setActive(); + + // Set the color and depth clear values + glClearDepth(1.f); + glClearColor(0.f, 0.f, 0.f, 1.f); + + // Enable Z-buffer read and write + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_TRUE); + + // Disable lighting and texturing + glDisable(GL_LIGHTING); + glDisable(GL_TEXTURE_2D); + + // Configure the viewport (the same size as the window) + glViewport(0, 0, window.getSize().x, window.getSize().y); + + // Setup a perspective projection + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + GLfloat ratio = static_cast(window.getSize().x) / window.getSize().y; + glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 500.f); + + // Define a 3D cube (6 faces made of 2 triangles composed by 3 vertices) + GLfloat cube[] = + { + // positions // colors (r, g, b, a) + -50, -50, -50, 0, 0, 1, 1, + -50, 50, -50, 0, 0, 1, 1, + -50, -50, 50, 0, 0, 1, 1, + -50, -50, 50, 0, 0, 1, 1, + -50, 50, -50, 0, 0, 1, 1, + -50, 50, 50, 0, 0, 1, 1, + + 50, -50, -50, 0, 1, 0, 1, + 50, 50, -50, 0, 1, 0, 1, + 50, -50, 50, 0, 1, 0, 1, + 50, -50, 50, 0, 1, 0, 1, + 50, 50, -50, 0, 1, 0, 1, + 50, 50, 50, 0, 1, 0, 1, + + -50, -50, -50, 1, 0, 0, 1, + 50, -50, -50, 1, 0, 0, 1, + -50, -50, 50, 1, 0, 0, 1, + -50, -50, 50, 1, 0, 0, 1, + 50, -50, -50, 1, 0, 0, 1, + 50, -50, 50, 1, 0, 0, 1, + + -50, 50, -50, 0, 1, 1, 1, + 50, 50, -50, 0, 1, 1, 1, + -50, 50, 50, 0, 1, 1, 1, + -50, 50, 50, 0, 1, 1, 1, + 50, 50, -50, 0, 1, 1, 1, + 50, 50, 50, 0, 1, 1, 1, + + -50, -50, -50, 1, 0, 1, 1, + 50, -50, -50, 1, 0, 1, 1, + -50, 50, -50, 1, 0, 1, 1, + -50, 50, -50, 1, 0, 1, 1, + 50, -50, -50, 1, 0, 1, 1, + 50, 50, -50, 1, 0, 1, 1, + + -50, -50, 50, 1, 1, 0, 1, + 50, -50, 50, 1, 1, 0, 1, + -50, 50, 50, 1, 1, 0, 1, + -50, 50, 50, 1, 1, 0, 1, + 50, -50, 50, 1, 1, 0, 1, + 50, 50, 50, 1, 1, 0, 1, + }; + + // Enable position and color vertex components + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + glVertexPointer(3, GL_FLOAT, 7 * sizeof(GLfloat), cube); + glColorPointer(4, GL_FLOAT, 7 * sizeof(GLfloat), cube + 3); + + // Disable normal and texture coordinates vertex components + glDisableClientState(GL_NORMAL_ARRAY); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + + // Create a clock for measuring the time elapsed + sf::Clock clock; + + // Start the game loop + while (window.isOpen()) + { + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window: exit + if (event.type == sf::Event::Closed) + window.close(); + + // Escape key: exit + if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)) + window.close(); + + // Resize event: adjust the viewport + if (event.type == sf::Event::Resized) + glViewport(0, 0, event.size.width, event.size.height); + } + + // Clear the color and depth buffers + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + // Apply some transformations to rotate the cube + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.f, 0.f, -200.f); + glRotatef(clock.getElapsedTime().asSeconds() * 50, 1.f, 0.f, 0.f); + glRotatef(clock.getElapsedTime().asSeconds() * 30, 0.f, 1.f, 0.f); + glRotatef(clock.getElapsedTime().asSeconds() * 90, 0.f, 0.f, 1.f); + + // Draw the cube + glDrawArrays(GL_TRIANGLES, 0, 36); + + // Finally, display the rendered frame on screen + window.display(); + } + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/examples/window/window b/SFML-2.1-osx-clang-universal/examples/window/window new file mode 100755 index 0000000..2a330a0 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/examples/window/window differ diff --git a/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Resources b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/Resources/Info.plist b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..f7f4218 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + freetype + CFBundleIdentifier + org.sfml-dev.freetype + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/freetype b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/freetype new file mode 100644 index 0000000..5a62814 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/A/freetype differ diff --git a/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/Current b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/freetype b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/freetype new file mode 120000 index 0000000..f38cdad --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/freetype.framework/freetype @@ -0,0 +1 @@ +Versions/A/freetype \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Resources b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/Resources/Info.plist b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..4ae5f88 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + sndfile + CFBundleIdentifier + com.mega-nerd.sndfile + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/sndfile b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/sndfile new file mode 100644 index 0000000..97defcc Binary files /dev/null and b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/A/sndfile differ diff --git a/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/Current b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/sndfile b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/sndfile new file mode 120000 index 0000000..1e01cac --- /dev/null +++ b/SFML-2.1-osx-clang-universal/extlibs/sndfile.framework/sndfile @@ -0,0 +1 @@ +Versions/Current/sndfile \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio.hpp new file mode 100644 index 0000000..1129863 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio.hpp @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_HPP +#define SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_AUDIO_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup audio Audio module +/// +/// Sounds, streaming (musics or custom sources), recording, +/// spatialization. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/Export.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Export.hpp new file mode 100644 index 0000000..7c4b6ca --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_AUDIO_EXPORT_HPP +#define SFML_AUDIO_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_AUDIO_EXPORTS) + + #define SFML_AUDIO_API SFML_API_EXPORT + +#else + + #define SFML_AUDIO_API SFML_API_IMPORT + +#endif + + +#endif // SFML_AUDIO_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/Listener.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Listener.hpp new file mode 100644 index 0000000..213d96a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Listener.hpp @@ -0,0 +1,184 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LISTENER_HPP +#define SFML_LISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief The audio listener is the point in the scene +/// from where all the sounds are heard +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Listener +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Change the global volume of all the sounds and musics + /// + /// The volume is a number between 0 and 100; it is combined with + /// the individual volume of each sound / music. + /// The default value for the volume is 100 (maximum). + /// + /// \param volume New global volume, in the range [0, 100] + /// + /// \see getGlobalVolume + /// + //////////////////////////////////////////////////////////// + static void setGlobalVolume(float volume); + + //////////////////////////////////////////////////////////// + /// \brief Get the current value of the global volume + /// + /// \return Current global volume, in the range [0, 100] + /// + /// \see setGlobalVolume + /// + //////////////////////////////////////////////////////////// + static float getGlobalVolume(); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param x X coordinate of the listener's position + /// \param y Y coordinate of the listener's position + /// \param z Z coordinate of the listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the position of the listener in the scene + /// + /// The default listener's position is (0, 0, 0). + /// + /// \param position New listener's position + /// + /// \see getPosition, setDirection + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector3f& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the listener in the scene + /// + /// \return Listener's position + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + static Vector3f getPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the listener in the scene + /// + /// The orientation defines the 3D axes of the listener + /// (left, up, front) in the scene. The orientation vector + /// doesn't have to be normalized. + /// The default listener's orientation is (0, 0, -1). + /// + /// \param x X coordinate of the listener's orientation + /// \param y Y coordinate of the listener's orientation + /// \param z Z coordinate of the listener's orientation + /// + /// \see getDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the listener in the scene + /// + /// The orientation defines the 3D axes of the listener + /// (left, up, front) in the scene. The orientation vector + /// doesn't have to be normalized. + /// The default listener's orientation is (0, 0, -1). + /// + /// \param direction New listener's orientation + /// + /// \see getDirection, setPosition + /// + //////////////////////////////////////////////////////////// + static void setDirection(const Vector3f& direction); + + //////////////////////////////////////////////////////////// + /// \brief Get the current orientation of the listener in the scene + /// + /// \return Listener's orientation + /// + /// \see setDirection + /// + //////////////////////////////////////////////////////////// + static Vector3f getDirection(); +}; + +} // namespace sf + + +#endif // SFML_LISTENER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Listener +/// \ingroup audio +/// +/// The audio listener defines the global properties of the +/// audio environment, it defines where and how sounds and musics +/// are heard. If sf::View is the eyes of the user, then sf::Listener +/// is his ears (by the way, they are often linked together -- +/// same position, orientation, etc.). +/// +/// sf::Listener is a simple interface, which allows to setup the +/// listener in the 3D audio environment (position and direction), +/// and to adjust the global volume. +/// +/// Because the listener is unique in the scene, sf::Listener only +/// contains static functions and doesn't have to be instanciated. +/// +/// Usage example: +/// \code +/// // Move the listener to the position (1, 0, -5) +/// sf::Listener::setPosition(1, 0, -5); +/// +/// // Make it face the right axis (1, 0, 0) +/// sf::Listener::setDirection(1, 0, 0); +/// +/// // Reduce the global volume +/// sf::Listener::setGlobalVolume(50); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/Music.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Music.hpp new file mode 100644 index 0000000..ba922e9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Music.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUSIC_HPP +#define SFML_MUSIC_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class SoundFile; +} + +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Streamed music played from an audio file +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Music : public SoundStream +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Music(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Music(); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the music file to open + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromMemory, openFromStream + /// + //////////////////////////////////////////////////////////// + bool openFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file in memory + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// Since the music is not loaded completely but rather streamed + /// continuously, the \a data must remain available as long as the + /// music is playing (ie. you can't deallocate it right after calling + /// this function). + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromFile, openFromStream + /// + //////////////////////////////////////////////////////////// + bool openFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Open a music from an audio file in a custom stream + /// + /// This function doesn't start playing the music (call play() + /// to do so). + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// Since the music is not loaded completely but rather streamed + /// continuously, the \a stream must remain alive as long as the + /// music is playing (ie. you can't destroy it right after calling + /// this function). + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see openFromFile, openFromMemory + /// + //////////////////////////////////////////////////////////// + bool openFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Get the total duration of the music + /// + /// \return Music duration + /// + //////////////////////////////////////////////////////////// + Time getDuration() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Request a new chunk of audio samples from the stream source + /// + /// This function fills the chunk from the next samples + /// to read from the audio file. + /// + /// \param data Chunk of data to fill + /// + /// \return True to continue playback, false to stop + /// + //////////////////////////////////////////////////////////// + virtual bool onGetData(Chunk& data); + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position in the stream source + /// + /// \param timeOffset New playing position, from the beginning of the music + /// + //////////////////////////////////////////////////////////// + virtual void onSeek(Time timeOffset); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Initialize the internal state after loading a new music + /// + //////////////////////////////////////////////////////////// + void initialize(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::SoundFile* m_file; ///< Sound file + Time m_duration; ///< Music duration + std::vector m_samples; ///< Temporary buffer of samples + Mutex m_mutex; ///< Mutex protecting the data +}; + +} // namespace sf + + +#endif // SFML_MUSIC_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Music +/// \ingroup audio +/// +/// Musics are sounds that are streamed rather than completely +/// loaded in memory. This is especially useful for compressed +/// musics that usually take hundreds of MB when they are +/// uncompressed: by streaming it instead of loading it entirely, +/// you avoid saturating the memory and have almost no loading delay. +/// +/// Apart from that, a sf::Music has almost the same features as +/// the sf::SoundBuffer / sf::Sound pair: you can play/pause/stop +/// it, request its parameters (channels, sample rate), change +/// the way it is played (pitch, volume, 3D position, ...), etc. +/// +/// As a sound stream, a music is played in its own thread in order +/// not to block the rest of the program. This means that you can +/// leave the music alone after calling play(), it will manage itself +/// very well. +/// +/// Usage example: +/// \code +/// // Declare a new music +/// sf::Music music; +/// +/// // Open it from an audio file +/// if (!music.openFromFile("music.ogg")) +/// { +/// // error... +/// } +/// +/// // Change some parameters +/// music.setPosition(0, 1, 10); // change its 3D position +/// music.setPitch(2); // increase the pitch +/// music.setVolume(50); // reduce the volume +/// music.setLoop(true); // make it loop +/// +/// // Play it +/// music.play(); +/// \endcode +/// +/// \see sf::Sound, sf::SoundStream +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/Sound.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Sound.hpp new file mode 100644 index 0000000..1250f42 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/Sound.hpp @@ -0,0 +1,262 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUND_HPP +#define SFML_SOUND_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class SoundBuffer; + +//////////////////////////////////////////////////////////// +/// \brief Regular sound that can be played in the audio environment +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API Sound : public SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Sound(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sound with a buffer + /// + /// \param buffer Sound buffer containing the audio data to play with the sound + /// + //////////////////////////////////////////////////////////// + explicit Sound(const SoundBuffer& buffer); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + Sound(const Sound& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Sound(); + + //////////////////////////////////////////////////////////// + /// \brief Start or resume playing the sound + /// + /// This function starts the stream if it was stopped, resumes + /// it if it was paused, and restarts it from beginning if it + /// was it already playing. + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the sound is played. + /// + /// \see pause, stop + /// + //////////////////////////////////////////////////////////// + void play(); + + //////////////////////////////////////////////////////////// + /// \brief Pause the sound + /// + /// This function pauses the sound if it was playing, + /// otherwise (sound already paused or stopped) it has no effect. + /// + /// \see play, stop + /// + //////////////////////////////////////////////////////////// + void pause(); + + //////////////////////////////////////////////////////////// + /// \brief stop playing the sound + /// + /// This function stops the sound if it was playing or paused, + /// and does nothing if it was already stopped. + /// It also resets the playing position (unlike pause()). + /// + /// \see play, pause + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Set the source buffer containing the audio data to play + /// + /// It is important to note that the sound buffer is not copied, + /// thus the sf::SoundBuffer instance must remain alive as long + /// as it is attached to the sound. + /// + /// \param buffer Sound buffer to attach to the sound + /// + /// \see getBuffer + /// + //////////////////////////////////////////////////////////// + void setBuffer(const SoundBuffer& buffer); + + //////////////////////////////////////////////////////////// + /// \brief Set whether or not the sound should loop after reaching the end + /// + /// If set, the sound will restart from beginning after + /// reaching the end and so on, until it is stopped or + /// setLoop(false) is called. + /// The default looping state for sound is false. + /// + /// \param loop True to play in loop, false to play once + /// + /// \see getLoop + /// + //////////////////////////////////////////////////////////// + void setLoop(bool loop); + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position of the sound + /// + /// The playing position can be changed when the sound is + /// either paused or playing. + /// + /// \param timeOffset New playing position, from the beginning of the sound + /// + /// \see getPlayingOffset + /// + //////////////////////////////////////////////////////////// + void setPlayingOffset(Time timeOffset); + + //////////////////////////////////////////////////////////// + /// \brief Get the audio buffer attached to the sound + /// + /// \return Sound buffer attached to the sound (can be NULL) + /// + //////////////////////////////////////////////////////////// + const SoundBuffer* getBuffer() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the sound is in loop mode + /// + /// \return True if the sound is looping, false otherwise + /// + /// \see setLoop + /// + //////////////////////////////////////////////////////////// + bool getLoop() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current playing position of the sound + /// + /// \return Current playing position, from the beginning of the sound + /// + /// \see setPlayingOffset + /// + //////////////////////////////////////////////////////////// + Time getPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the sound (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Sound& operator =(const Sound& right); + + //////////////////////////////////////////////////////////// + /// \brief Reset the internal buffer of the sound + /// + /// This function is for internal use only, you don't have + /// to use it. It is called by the sf::SoundBuffer that + /// this sound uses, when it is destroyed in order to prevent + /// the sound from using a dead buffer. + /// + //////////////////////////////////////////////////////////// + void resetBuffer(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + const SoundBuffer* m_buffer; ///< Sound buffer bound to the source +}; + +} // namespace sf + + +#endif // SFML_SOUND_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Sound +/// \ingroup audio +/// +/// sf::Sound is the class to use to play sounds. +/// It provides: +/// \li Control (play, pause, stop) +/// \li Ability to modify output parameters in real-time (pitch, volume, ...) +/// \li 3D spatial features (position, attenuation, ...). +/// +/// sf::Sound is perfect for playing short sounds that can +/// fit in memory and require no latency, like foot steps or +/// gun shots. For longer sounds, like background musics +/// or long speeches, rather see sf::Music (which is based +/// on streaming). +/// +/// In order to work, a sound must be given a buffer of audio +/// data to play. Audio data (samples) is stored in sf::SoundBuffer, +/// and attached to a sound with the setBuffer() function. +/// The buffer object attached to a sound must remain alive +/// as long as the sound uses it. Note that multiple sounds +/// can use the same sound buffer at the same time. +/// +/// Usage example: +/// \code +/// sf::SoundBuffer buffer; +/// buffer.loadFromFile("sound.wav"); +/// +/// sf::Sound sound; +/// sound.setBuffer(buffer); +/// sound.play(); +/// \endcode +/// +/// \see sf::SoundBuffer, sf::Music +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBuffer.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBuffer.hpp new file mode 100644 index 0000000..23fed88 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBuffer.hpp @@ -0,0 +1,359 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFER_HPP +#define SFML_SOUNDBUFFER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class SoundFile; +} + +class Sound; +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Storage for audio samples defining a sound +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundBuffer +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SoundBuffer(const SoundBuffer& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~SoundBuffer(); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a file + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the sound file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream, loadFromSamples, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a file in memory + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from a custom stream + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Load the sound buffer from an array of audio samples + /// + /// The assumed format of the audio samples is 16 bits signed integer + /// (sf::Int16). + /// + /// \param samples Pointer to the array of samples in memory + /// \param sampleCount Number of samples in the array + /// \param channelCount Number of channels (1 = mono, 2 = stereo, ...) + /// \param sampleRate Sample rate (number of samples to play per second) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Save the sound buffer to an audio file + /// + /// Here is a complete list of all the supported audio formats: + /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, + /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. + /// + /// \param filename Path of the sound file to write + /// + /// \return True if saving succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory, loadFromSamples + /// + //////////////////////////////////////////////////////////// + bool saveToFile(const std::string& filename) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the array of audio samples stored in the buffer + /// + /// The format of the returned samples is 16 bits signed integer + /// (sf::Int16). The total number of samples in this array + /// is given by the getSampleCount() function. + /// + /// \return Read-only pointer to the array of sound samples + /// + /// \see getSampleCount + /// + //////////////////////////////////////////////////////////// + const Int16* getSamples() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of samples stored in the buffer + /// + /// The array of samples can be accessed with the getSamples() + /// function. + /// + /// \return Number of samples + /// + /// \see getSamples + /// + //////////////////////////////////////////////////////////// + std::size_t getSampleCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sample rate of the sound + /// + /// The sample rate is the number of samples played per second. + /// The higher, the better the quality (for example, 44100 + /// samples/s is CD quality). + /// + /// \return Sample rate (number of samples per second) + /// + /// \see getChannelCount, getDuration + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of channels used by the sound + /// + /// If the sound is mono then the number of channels will + /// be 1, 2 for stereo, etc. + /// + /// \return Number of channels + /// + /// \see getSampleRate, getDuration + /// + //////////////////////////////////////////////////////////// + unsigned int getChannelCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the total duration of the sound + /// + /// \return Sound duration + /// + /// \see getSampleRate, getChannelCount + /// + //////////////////////////////////////////////////////////// + Time getDuration() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + SoundBuffer& operator =(const SoundBuffer& right); + +private : + + friend class Sound; + + //////////////////////////////////////////////////////////// + /// \brief Initialize the internal state after loading a new sound + /// + /// \param file Sound file providing access to the new loaded sound + /// + /// \return True on succesful initialization, false on failure + /// + //////////////////////////////////////////////////////////// + bool initialize(priv::SoundFile& file); + + //////////////////////////////////////////////////////////// + /// \brief Update the internal buffer with the cached audio samples + /// + /// \param channelCount Number of channels + /// \param sampleRate Sample rate (number of samples per second) + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool update(unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Add a sound to the list of sounds that use this buffer + /// + /// \param sound Sound instance to attach + /// + //////////////////////////////////////////////////////////// + void attachSound(Sound* sound) const; + + //////////////////////////////////////////////////////////// + /// \brief Remove a sound from the list of sounds that use this buffer + /// + /// \param sound Sound instance to detach + /// + //////////////////////////////////////////////////////////// + void detachSound(Sound* sound) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::set SoundList; ///< Set of unique sound instances + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_buffer; ///< OpenAL buffer identifier + std::vector m_samples; ///< Samples buffer + Time m_duration; ///< Sound duration + mutable SoundList m_sounds; ///< List of sounds that are using this buffer +}; + +} // namespace sf + + +#endif // SFML_SOUNDBUFFER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundBuffer +/// \ingroup audio +/// +/// A sound buffer holds the data of a sound, which is +/// an array of audio samples. A sample is a 16 bits signed integer +/// that defines the amplitude of the sound at a given time. +/// The sound is then restituted by playing these samples at +/// a high rate (for example, 44100 samples per second is the +/// standard rate used for playing CDs). In short, audio samples +/// are like texture pixels, and a sf::SoundBuffer is similar to +/// a sf::Texture. +/// +/// A sound buffer can be loaded from a file (see loadFromFile() +/// for the complete list of supported formats), from memory, from +/// a custom stream (see sf::InputStream) or directly from an array +/// of samples. It can also be saved back to a file. +/// +/// Sound buffers alone are not very useful: they hold the audio data +/// but cannot be played. To do so, you need to use the sf::Sound class, +/// which provides functions to play/pause/stop the sound as well as +/// changing the way it is outputted (volume, pitch, 3D position, ...). +/// This separation allows more flexibility and better performances: +/// indeed a sf::SoundBuffer is a heavy resource, and any operation on it +/// is slow (often too slow for real-time applications). On the other +/// side, a sf::Sound is a lightweight object, which can use the audio data +/// of a sound buffer and change the way it is played without actually +/// modifying that data. Note that it is also possible to bind +/// several sf::Sound instances to the same sf::SoundBuffer. +/// +/// It is important to note that the sf::Sound instance doesn't +/// copy the buffer that it uses, it only keeps a reference to it. +/// Thus, a sf::SoundBuffer must not be destructed while it is +/// used by a sf::Sound (i.e. never write a function that +/// uses a local sf::SoundBuffer instance for loading a sound). +/// +/// Usage example: +/// \code +/// // Declare a new sound buffer +/// sf::SoundBuffer buffer; +/// +/// // Load it from a file +/// if (!buffer.loadFromFile("sound.wav")) +/// { +/// // error... +/// } +/// +/// // Create a sound source and bind it to the buffer +/// sf::Sound sound1; +/// sound1.setBuffer(buffer); +/// +/// // Play the sound +/// sound1.play(); +/// +/// // Create another sound source bound to the same buffer +/// sf::Sound sound2; +/// sound2.setBuffer(buffer); +/// +/// // Play it with a higher pitch -- the first sound remains unchanged +/// sound2.setPitch(2); +/// sound2.play(); +/// \endcode +/// +/// \see sf::Sound, sf::SoundBufferRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBufferRecorder.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBufferRecorder.hpp new file mode 100644 index 0000000..fa4ac4c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundBufferRecorder.hpp @@ -0,0 +1,138 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDBUFFERRECORDER_HPP +#define SFML_SOUNDBUFFERRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized SoundRecorder which stores the captured +/// audio data into a sound buffer +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundBufferRecorder : public SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Get the sound buffer containing the captured audio data + /// + /// The sound buffer is valid only after the capture has ended. + /// This function provides a read-only access to the internal + /// sound buffer, but it can be copied if you need to + /// make any modification to it. + /// + /// \return Read-only access to the sound buffer + /// + //////////////////////////////////////////////////////////// + const SoundBuffer& getBuffer() const; + +protected: + + //////////////////////////////////////////////////////////// + /// \brief Start capturing audio data + /// + /// \return True to start the capture, or false to abort it + /// + //////////////////////////////////////////////////////////// + virtual bool onStart(); + + //////////////////////////////////////////////////////////// + /// \brief Process a new chunk of recorded samples + /// + /// \param samples Pointer to the new chunk of recorded samples + /// \param sampleCount Number of samples pointed by \a samples + /// + /// \return True to continue the capture, or false to stop it + /// + //////////////////////////////////////////////////////////// + virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount); + + //////////////////////////////////////////////////////////// + /// \brief Stop capturing audio data + /// + //////////////////////////////////////////////////////////// + virtual void onStop(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_samples; ///< Temporary sample buffer to hold the recorded data + SoundBuffer m_buffer; ///< Sound buffer that will contain the recorded data +}; + +} // namespace sf + +#endif // SFML_SOUNDBUFFERRECORDER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundBufferRecorder +/// \ingroup audio +/// +/// sf::SoundBufferRecorder allows to access a recorded sound +/// through a sf::SoundBuffer, so that it can be played, saved +/// to a file, etc. +/// +/// It has the same simple interface as its base class (start(), stop()) +/// and adds a function to retrieve the recorded sound buffer +/// (getBuffer()). +/// +/// As usual, don't forget to call the isAvailable() function +/// before using this class (see sf::SoundRecorder for more details +/// about this). +/// +/// Usage example: +/// \code +/// if (sf::SoundBufferRecorder::isAvailable()) +/// { +/// // Record some audio data +/// sf::SoundBufferRecorder recorder; +/// recorder.start(); +/// ... +/// recorder.stop(); +/// +/// // Get the buffer containing the captured audio data +/// const sf::SoundBuffer& buffer = recorder.getBuffer(); +/// +/// // Save it to a file (for example...) +/// buffer.saveToFile("my_record.ogg"); +/// } +/// \endcode +/// +/// \see sf::SoundRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundRecorder.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundRecorder.hpp new file mode 100644 index 0000000..eddf48e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundRecorder.hpp @@ -0,0 +1,270 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDRECORDER_HPP +#define SFML_SOUNDRECORDER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for capturing sound data +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundRecorder +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundRecorder(); + + //////////////////////////////////////////////////////////// + /// \brief Start the capture + /// + /// The \a sampleRate parameter defines the number of audio samples + /// captured per second. The higher, the better the quality + /// (for example, 44100 samples/sec is CD quality). + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the capture runs. + /// Please note that only one capture can happen at the same time. + /// + /// \param sampleRate Desired capture rate, in number of samples per second + /// + /// \see stop + /// + //////////////////////////////////////////////////////////// + void start(unsigned int sampleRate = 44100); + + //////////////////////////////////////////////////////////// + /// \brief Stop the capture + /// + /// \see start + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Get the sample rate + /// + /// The sample rate defines the number of audio samples + /// captured per second. The higher, the better the quality + /// (for example, 44100 samples/sec is CD quality). + /// + /// \return Sample rate, in samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the system supports audio capture + /// + /// This function should always be called before using + /// the audio capture features. If it returns false, then + /// any attempt to use sf::SoundRecorder or one of its derived + /// classes will fail. + /// + /// \return True if audio capture is supported, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isAvailable(); + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is only meant to be called by derived classes. + /// + //////////////////////////////////////////////////////////// + SoundRecorder(); + + //////////////////////////////////////////////////////////// + /// \brief Start capturing audio data + /// + /// This virtual function may be overriden by a derived class + /// if something has to be done every time a new capture + /// starts. If not, this function can be ignored; the default + /// implementation does nothing. + /// + /// \return True to start the capture, or false to abort it + /// + //////////////////////////////////////////////////////////// + virtual bool onStart(); + + //////////////////////////////////////////////////////////// + /// \brief Process a new chunk of recorded samples + /// + /// This virtual function is called every time a new chunk of + /// recorded data is available. The derived class can then do + /// whatever it wants with it (storing it, playing it, sending + /// it over the network, etc.). + /// + /// \param samples Pointer to the new chunk of recorded samples + /// \param sampleCount Number of samples pointed by \a samples + /// + /// \return True to continue the capture, or false to stop it + /// + //////////////////////////////////////////////////////////// + virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Stop capturing audio data + /// + /// This virtual function may be overriden by a derived class + /// if something has to be done every time the capture + /// ends. If not, this function can be ignored; the default + /// implementation does nothing. + /// + //////////////////////////////////////////////////////////// + virtual void onStop(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Function called as the entry point of the thread + /// + /// This function starts the recording loop, and returns + /// only when the capture is stopped. + /// + //////////////////////////////////////////////////////////// + void record(); + + //////////////////////////////////////////////////////////// + /// \brief Get the new available audio samples and process them + /// + /// This function is called continuously during the + /// capture loop. It retrieves the captured samples and + /// forwards them to the derived class. + /// + //////////////////////////////////////////////////////////// + void processCapturedSamples(); + + //////////////////////////////////////////////////////////// + /// \brief Clean up the recorder's internal resources + /// + /// This function is called when the capture stops. + /// + //////////////////////////////////////////////////////////// + void cleanup(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Thread m_thread; ///< Thread running the background recording task + std::vector m_samples; ///< Buffer to store captured samples + unsigned int m_sampleRate; ///< Sample rate + bool m_isCapturing; ///< Capturing state +}; + +} // namespace sf + + +#endif // SFML_SOUNDRECORDER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundRecorder +/// \ingroup audio +/// +/// sf::SoundBuffer provides a simple interface to access +/// the audio recording capabilities of the computer +/// (the microphone). As an abstract base class, it only cares +/// about capturing sound samples, the task of making something +/// useful with them is left to the derived class. Note that +/// SFML provides a built-in specialization for saving the +/// captured data to a sound buffer (see sf::SoundBufferRecorder). +/// +/// A derived class has only one virtual function to override: +/// \li onProcessSamples provides the new chunks of audio samples while the capture happens +/// +/// Moreover, two additionnal virtual functions can be overriden +/// as well if necessary: +/// \li onStart is called before the capture happens, to perform custom initializations +/// \li onStop is called after the capture ends, to perform custom cleanup +/// +/// The audio capture feature may not be supported or activated +/// on every platform, thus it is recommended to check its +/// availability with the isAvailable() function. If it returns +/// false, then any attempt to use an audio recorder will fail. +/// +/// It is important to note that the audio capture happens in a +/// separate thread, so that it doesn't block the rest of the +/// program. In particular, the onProcessSamples and onStop +/// virtual functions (but not onStart) will be called +/// from this separate thread. It is important to keep this in +/// mind, because you may have to take care of synchronization +/// issues if you share data between threads. +/// +/// Usage example: +/// \code +/// class CustomRecorder : public sf::SoundRecorder +/// { +/// virtual bool onStart() // optional +/// { +/// // Initialize whatever has to be done before the capture starts +/// ... +/// +/// // Return true to start playing +/// return true; +/// } +/// +/// virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount) +/// { +/// // Do something with the new chunk of samples (store them, send them, ...) +/// ... +/// +/// // Return true to continue playing +/// return true; +/// } +/// +/// virtual void onStop() // optional +/// { +/// // Clean up whatever has to be done after the capture ends +/// ... +/// } +/// } +/// +/// // Usage +/// if (CustomRecorder::isAvailable()) +/// { +/// CustomRecorder recorder; +/// recorder.start(); +/// ... +/// recorder.stop(); +/// } +/// \endcode +/// +/// \see sf::SoundBufferRecorder +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundSource.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundSource.hpp new file mode 100644 index 0000000..8ccc0b7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundSource.hpp @@ -0,0 +1,286 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSOURCE_HPP +#define SFML_SOUNDSOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class defining a sound's properties +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the sound source states + /// + //////////////////////////////////////////////////////////// + enum Status + { + Stopped, ///< Sound is not playing + Paused, ///< Sound is paused + Playing ///< Sound is playing + }; + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SoundSource(const SoundSource& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundSource(); + + //////////////////////////////////////////////////////////// + /// \brief Set the pitch of the sound + /// + /// The pitch represents the perceived fundamental frequency + /// of a sound; thus you can make a sound more acute or grave + /// by changing its pitch. A side effect of changing the pitch + /// is to modify the playing speed of the sound as well. + /// The default value for the pitch is 1. + /// + /// \param pitch New pitch to apply to the sound + /// + /// \see getPitch + /// + //////////////////////////////////////////////////////////// + void setPitch(float pitch); + + //////////////////////////////////////////////////////////// + /// \brief Set the volume of the sound + /// + /// The volume is a value between 0 (mute) and 100 (full volume). + /// The default value for the volume is 100. + /// + /// \param volume Volume of the sound + /// + /// \see getVolume + /// + //////////////////////////////////////////////////////////// + void setVolume(float volume); + + //////////////////////////////////////////////////////////// + /// \brief Set the 3D position of the sound in the audio scene + /// + /// Only sounds with one channel (mono sounds) can be + /// spatialized. + /// The default position of a sound is (0, 0, 0). + /// + /// \param x X coordinate of the position of the sound in the scene + /// \param y Y coordinate of the position of the sound in the scene + /// \param z Z coordinate of the position of the sound in the scene + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Set the 3D position of the sound in the audio scene + /// + /// Only sounds with one channel (mono sounds) can be + /// spatialized. + /// The default position of a sound is (0, 0, 0). + /// + /// \param position Position of the sound in the scene + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector3f& position); + + //////////////////////////////////////////////////////////// + /// \brief Make the sound's position relative to the listener or absolute + /// + /// Making a sound relative to the listener will ensure that it will always + /// be played the same way regardless the position of the listener. + /// This can be useful for non-spatialized sounds, sounds that are + /// produced by the listener, or sounds attached to it. + /// The default value is false (position is absolute). + /// + /// \param relative True to set the position relative, false to set it absolute + /// + /// \see isRelativeToListener + /// + //////////////////////////////////////////////////////////// + void setRelativeToListener(bool relative); + + //////////////////////////////////////////////////////////// + /// \brief Set the minimum distance of the sound + /// + /// The "minimum distance" of a sound is the maximum + /// distance at which it is heard at its maximum volume. Further + /// than the minimum distance, it will start to fade out according + /// to its attenuation factor. A value of 0 ("inside the head + /// of the listener") is an invalid value and is forbidden. + /// The default value of the minimum distance is 1. + /// + /// \param distance New minimum distance of the sound + /// + /// \see getMinDistance, setAttenuation + /// + //////////////////////////////////////////////////////////// + void setMinDistance(float distance); + + //////////////////////////////////////////////////////////// + /// \brief Set the attenuation factor of the sound + /// + /// The attenuation is a multiplicative factor which makes + /// the sound more or less loud according to its distance + /// from the listener. An attenuation of 0 will produce a + /// non-attenuated sound, i.e. its volume will always be the same + /// whether it is heard from near or from far. On the other hand, + /// an attenuation value such as 100 will make the sound fade out + /// very quickly as it gets further from the listener. + /// The default value of the attenuation is 1. + /// + /// \param attenuation New attenuation factor of the sound + /// + /// \see getAttenuation, setMinDistance + /// + //////////////////////////////////////////////////////////// + void setAttenuation(float attenuation); + + //////////////////////////////////////////////////////////// + /// \brief Get the pitch of the sound + /// + /// \return Pitch of the sound + /// + /// \see setPitch + /// + //////////////////////////////////////////////////////////// + float getPitch() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the volume of the sound + /// + /// \return Volume of the sound, in the range [0, 100] + /// + /// \see setVolume + /// + //////////////////////////////////////////////////////////// + float getVolume() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the 3D position of the sound in the audio scene + /// + /// \return Position of the sound + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + Vector3f getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the sound's position is relative to the + /// listener or is absolute + /// + /// \return True if the position is relative, false if it's absolute + /// + /// \see setRelativeToListener + /// + //////////////////////////////////////////////////////////// + bool isRelativeToListener() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the minimum distance of the sound + /// + /// \return Minimum distance of the sound + /// + /// \see setMinDistance, getAttenuation + /// + //////////////////////////////////////////////////////////// + float getMinDistance() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the attenuation factor of the sound + /// + /// \return Attenuation factor of the sound + /// + /// \see setAttenuation, getMinDistance + /// + //////////////////////////////////////////////////////////// + float getAttenuation() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is meant ot be called by derived classes only. + /// + //////////////////////////////////////////////////////////// + SoundSource(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the sound (stopped, paused, playing) + /// + /// \return Current status of the sound + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_source; ///< OpenAL source identifier +}; + +} // namespace sf + + +#endif // SFML_SOUNDSOURCE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundSource +/// \ingroup audio +/// +/// sf::SoundSource is not meant to be used directly, it +/// only serves as a common base for all audio objects +/// that can live in the audio environment. +/// +/// It defines several properties for the sound: pitch, +/// volume, position, attenuation, etc. All of them can be +/// changed at any time with no impact on performances. +/// +/// \see sf::Sound, sf::SoundStream +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundStream.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundStream.hpp new file mode 100644 index 0000000..461dd92 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Audio/SoundStream.hpp @@ -0,0 +1,377 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOUNDSTREAM_HPP +#define SFML_SOUNDSTREAM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for streamed audio sources +/// +//////////////////////////////////////////////////////////// +class SFML_AUDIO_API SoundStream : public SoundSource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a chunk of audio data to stream + /// + //////////////////////////////////////////////////////////// + struct Chunk + { + const Int16* samples; ///< Pointer to the audio samples + std::size_t sampleCount; ///< Number of samples pointed by Samples + }; + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~SoundStream(); + + //////////////////////////////////////////////////////////// + /// \brief Start or resume playing the audio stream + /// + /// This function starts the stream if it was stopped, resumes + /// it if it was paused, and restarts it from beginning if it + /// was it already playing. + /// This function uses its own thread so that it doesn't block + /// the rest of the program while the stream is played. + /// + /// \see pause, stop + /// + //////////////////////////////////////////////////////////// + void play(); + + //////////////////////////////////////////////////////////// + /// \brief Pause the audio stream + /// + /// This function pauses the stream if it was playing, + /// otherwise (stream already paused or stopped) it has no effect. + /// + /// \see play, stop + /// + //////////////////////////////////////////////////////////// + void pause(); + + //////////////////////////////////////////////////////////// + /// \brief Stop playing the audio stream + /// + /// This function stops the stream if it was playing or paused, + /// and does nothing if it was already stopped. + /// It also resets the playing position (unlike pause()). + /// + /// \see play, pause + /// + //////////////////////////////////////////////////////////// + void stop(); + + //////////////////////////////////////////////////////////// + /// \brief Return the number of channels of the stream + /// + /// 1 channel means a mono sound, 2 means stereo, etc. + /// + /// \return Number of channels + /// + //////////////////////////////////////////////////////////// + unsigned int getChannelCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the stream sample rate of the stream + /// + /// The sample rate is the number of audio samples played per + /// second. The higher, the better the quality. + /// + /// \return Sample rate, in number of samples per second + /// + //////////////////////////////////////////////////////////// + unsigned int getSampleRate() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current status of the stream (stopped, paused, playing) + /// + /// \return Current status + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position of the stream + /// + /// The playing position can be changed when the stream is + /// either paused or playing. + /// + /// \param timeOffset New playing position, from the beginning of the stream + /// + /// \see getPlayingOffset + /// + //////////////////////////////////////////////////////////// + void setPlayingOffset(Time timeOffset); + + //////////////////////////////////////////////////////////// + /// \brief Get the current playing position of the stream + /// + /// \return Current playing position, from the beginning of the stream + /// + /// \see setPlayingOffset + /// + //////////////////////////////////////////////////////////// + Time getPlayingOffset() const; + + //////////////////////////////////////////////////////////// + /// \brief Set whether or not the stream should loop after reaching the end + /// + /// If set, the stream will restart from beginning after + /// reaching the end and so on, until it is stopped or + /// setLoop(false) is called. + /// The default looping state for streams is false. + /// + /// \param loop True to play in loop, false to play once + /// + /// \see getLoop + /// + //////////////////////////////////////////////////////////// + void setLoop(bool loop); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the stream is in loop mode + /// + /// \return True if the stream is looping, false otherwise + /// + /// \see setLoop + /// + //////////////////////////////////////////////////////////// + bool getLoop() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is only meant to be called by derived classes. + /// + //////////////////////////////////////////////////////////// + SoundStream(); + + //////////////////////////////////////////////////////////// + /// \brief Define the audio stream parameters + /// + /// This function must be called by derived classes as soon + /// as they know the audio settings of the stream to play. + /// Any attempt to manipulate the stream (play(), ...) before + /// calling this function will fail. + /// It can be called multiple times if the settings of the + /// audio stream change, but only when the stream is stopped. + /// + /// \param channelCount Number of channels of the stream + /// \param sampleRate Sample rate, in samples per second + /// + //////////////////////////////////////////////////////////// + void initialize(unsigned int channelCount, unsigned int sampleRate); + + //////////////////////////////////////////////////////////// + /// \brief Request a new chunk of audio samples from the stream source + /// + /// This function must be overriden by derived classes to provide + /// the audio samples to play. It is called continuously by the + /// streaming loop, in a separate thread. + /// The source can choose to stop the streaming loop at any time, by + /// returning false to the caller. + /// + /// \param data Chunk of data to fill + /// + /// \return True to continue playback, false to stop + /// + //////////////////////////////////////////////////////////// + virtual bool onGetData(Chunk& data) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Change the current playing position in the stream source + /// + /// This function must be overriden by derived classes to + /// allow random seeking into the stream source. + /// + /// \param timeOffset New playing position, relative to the beginning of the stream + /// + //////////////////////////////////////////////////////////// + virtual void onSeek(Time timeOffset) = 0; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Function called as the entry point of the thread + /// + /// This function starts the streaming loop, and returns + /// only when the sound is stopped. + /// + //////////////////////////////////////////////////////////// + void streamData(); + + //////////////////////////////////////////////////////////// + /// \brief Fill a new buffer with audio samples, and append + /// it to the playing queue + /// + /// This function is called as soon as a buffer has been fully + /// consumed; it fills it again and inserts it back into the + /// playing queue. + /// + /// \param buffer Number of the buffer to fill (in [0, BufferCount]) + /// + /// \return True if the stream source has requested to stop, false otherwise + /// + //////////////////////////////////////////////////////////// + bool fillAndPushBuffer(unsigned int bufferNum); + + //////////////////////////////////////////////////////////// + /// \brief Fill the audio buffers and put them all into the playing queue + /// + /// This function is called when playing starts and the + /// playing queue is empty. + /// + /// \return True if the derived class has requested to stop, false otherwise + /// + //////////////////////////////////////////////////////////// + bool fillQueue(); + + //////////////////////////////////////////////////////////// + /// \brief Clear all the audio buffers and empty the playing queue + /// + /// This function is called when the stream is stopped. + /// + //////////////////////////////////////////////////////////// + void clearQueue(); + + enum + { + BufferCount = 3 ///< Number of audio buffers used by the streaming loop + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Thread m_thread; ///< Thread running the background tasks + bool m_isStreaming; ///< Streaming state (true = playing, false = stopped) + unsigned int m_buffers[BufferCount]; ///< Sound buffers used to store temporary audio data + unsigned int m_channelCount; ///< Number of channels (1 = mono, 2 = stereo, ...) + unsigned int m_sampleRate; ///< Frequency (samples / second) + Uint32 m_format; ///< Format of the internal sound buffers + bool m_loop; ///< Loop flag (true to loop, false to play once) + Uint64 m_samplesProcessed; ///< Number of buffers processed since beginning of the stream + bool m_endBuffers[BufferCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation +}; + +} // namespace sf + + +#endif // SFML_SOUNDSTREAM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SoundStream +/// \ingroup audio +/// +/// Unlike audio buffers (see sf::SoundBuffer), audio streams +/// are never completely loaded in memory. Instead, the audio +/// data is acquired continuously while the stream is playing. +/// This behaviour allows to play a sound with no loading delay, +/// and keeps the memory consumption very low. +/// +/// Sound sources that need to be streamed are usually big files +/// (compressed audio musics that would eat hundreds of MB in memory) +/// or files that would take a lot of time to be received +/// (sounds played over the network). +/// +/// sf::SoundStream is a base class that doesn't care about the +/// stream source, which is left to the derived class. SFML provides +/// a built-in specialization for big files (see sf::Music). +/// No network stream source is provided, but you can write your own +/// by combining this class with the network module. +/// +/// A derived class has to override two virtual functions: +/// \li onGetData fills a new chunk of audio data to be played +/// \li onSeek changes the current playing position in the source +/// +/// It is important to note that each SoundStream is played in its +/// own separate thread, so that the streaming loop doesn't block the +/// rest of the program. In particular, the OnGetData and OnSeek +/// virtual functions may sometimes be called from this separate thread. +/// It is important to keep this in mind, because you may have to take +/// care of synchronization issues if you share data between threads. +/// +/// Usage example: +/// \code +/// class CustomStream : public sf::SoundStream +/// { +/// public : +/// +/// bool open(const std::string& location) +/// { +/// // Open the source and get audio settings +/// ... +/// unsigned int channelCount = ...; +/// unsigned int sampleRate = ...; +/// +/// // Initialize the stream -- important! +/// initialize(channelCount, sampleRate); +/// } +/// +/// private : +/// +/// virtual bool onGetData(Chunk& data) +/// { +/// // Fill the chunk with audio data from the stream source +/// data.samples = ...; +/// data.sampleCount = ...; +/// +/// // Return true to continue playing +/// return true; +/// } +/// +/// virtual void onSeek(Uint32 timeOffset) +/// { +/// // Change the current position in the stream source +/// ... +/// } +/// } +/// +/// // Usage +/// CustomStream stream; +/// stream.open("path/to/stream"); +/// stream.play(); +/// \endcode +/// +/// \see sf::Music +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Config.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Config.hpp new file mode 100644 index 0000000..933cd11 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Config.hpp @@ -0,0 +1,159 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONFIG_HPP +#define SFML_CONFIG_HPP + + +//////////////////////////////////////////////////////////// +// Define the SFML version +//////////////////////////////////////////////////////////// +#define SFML_VERSION_MAJOR 2 +#define SFML_VERSION_MINOR 1 + + +//////////////////////////////////////////////////////////// +// Identify the operating system +//////////////////////////////////////////////////////////// +#if defined(_WIN32) || defined(__WIN32__) + + // Windows + #define SFML_SYSTEM_WINDOWS + #ifndef NOMINMAX + #define NOMINMAX + #endif + +#elif defined(linux) || defined(__linux) + + // Linux + #define SFML_SYSTEM_LINUX + +#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) + + // MacOS + #define SFML_SYSTEM_MACOS + +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + + // FreeBSD + #define SFML_SYSTEM_FREEBSD + +#else + + // Unsupported system + #error This operating system is not supported by SFML library + +#endif + + +//////////////////////////////////////////////////////////// +// Define a portable debug macro +//////////////////////////////////////////////////////////// +#if !defined(NDEBUG) + + #define SFML_DEBUG + +#endif + + +//////////////////////////////////////////////////////////// +// Define helpers to create portable import / export macros for each module +//////////////////////////////////////////////////////////// +#if !defined(SFML_STATIC) + + #if defined(SFML_SYSTEM_WINDOWS) + + // Windows compilers need specific (and different) keywords for export and import + #define SFML_API_EXPORT __declspec(dllexport) + #define SFML_API_IMPORT __declspec(dllimport) + + // For Visual C++ compilers, we also need to turn off this annoying C4251 warning + #ifdef _MSC_VER + + #pragma warning(disable : 4251) + + #endif + + #else // Linux, FreeBSD, Mac OS X + + #if __GNUC__ >= 4 + + // GCC 4 has special keywords for showing/hidding symbols, + // the same keyword is used for both importing and exporting + #define SFML_API_EXPORT __attribute__ ((__visibility__ ("default"))) + #define SFML_API_IMPORT __attribute__ ((__visibility__ ("default"))) + + #else + + // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported + #define SFML_API_EXPORT + #define SFML_API_IMPORT + + #endif + + #endif + +#else + + // Static build doesn't need import/export macros + #define SFML_API_EXPORT + #define SFML_API_IMPORT + +#endif + + +//////////////////////////////////////////////////////////// +// Define portable fixed-size types +//////////////////////////////////////////////////////////// +namespace sf +{ + // All "common" platforms use the same size for char, short and int + // (basically there are 3 types for 3 sizes, so no other match is possible), + // we can use them without doing any kind of check + + // 8 bits integer types + typedef signed char Int8; + typedef unsigned char Uint8; + + // 16 bits integer types + typedef signed short Int16; + typedef unsigned short Uint16; + + // 32 bits integer types + typedef signed int Int32; + typedef unsigned int Uint32; + + // 64 bits integer types + #if defined(_MSC_VER) + typedef signed __int64 Int64; + typedef unsigned __int64 Uint64; + #else + typedef signed long long Int64; + typedef unsigned long long Uint64; + #endif + +} // namespace sf + + +#endif // SFML_CONFIG_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics.hpp new file mode 100644 index 0000000..0dc6534 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics.hpp @@ -0,0 +1,62 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_HPP +#define SFML_GRAPHICS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_GRAPHICS_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup graphics Graphics module +/// +/// 2D graphics module: sprites, text, shapes, ... +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/BlendMode.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/BlendMode.hpp new file mode 100644 index 0000000..4b12e11 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/BlendMode.hpp @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_BLENDMODE_HPP +#define SFML_BLENDMODE_HPP + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup graphics +/// \brief Available blending modes for drawing +/// +//////////////////////////////////////////////////////////// +enum BlendMode +{ + BlendAlpha, ///< Pixel = Source * Source.a + Dest * (1 - Source.a) + BlendAdd, ///< Pixel = Source + Dest + BlendMultiply, ///< Pixel = Source * Dest + BlendNone ///< Pixel = Source +}; + +} // namespace sf + + +#endif // SFML_BLENDMODE_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/CircleShape.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/CircleShape.hpp new file mode 100644 index 0000000..b82539e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/CircleShape.hpp @@ -0,0 +1,151 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CIRCLESHAPE_HPP +#define SFML_CIRCLESHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a circle +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API CircleShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param radius Radius of the circle + /// \param pointCount Number of points composing the circle + /// + //////////////////////////////////////////////////////////// + explicit CircleShape(float radius = 0, unsigned int pointCount = 30); + + //////////////////////////////////////////////////////////// + /// \brief Set the radius of the circle + /// + /// \param radius New radius of the circle + /// + /// \see getRadius + /// + //////////////////////////////////////////////////////////// + void setRadius(float radius); + + //////////////////////////////////////////////////////////// + /// \brief Get the radius of the circle + /// + /// \return Radius of the circle + /// + /// \see setRadius + /// + //////////////////////////////////////////////////////////// + float getRadius() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the number of points of the circle + /// + /// \param count New number of points of the circle + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + void setPointCount(unsigned int count); + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points of the shape + /// + /// \return Number of points of the shape + /// + /// \see setPointCount + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + float m_radius; ///< Radius of the circle + unsigned int m_pointCount; ///< Number of points composing the circle +}; + +} // namespace sf + + +#endif // SFML_CIRCLESHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::CircleShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// Usage example: +/// \code +/// sf::CircleShape circle; +/// circle.setRadius(150); +/// circle.setOutlineColor(sf::Color::Red); +/// circle.setOutlineThickness(5); +/// circle.setPosition(10, 20); +/// ... +/// window.draw(circle); +/// \endcode +/// +/// Since the graphics card can't draw perfect circles, we have to +/// fake them with multiple triangles connected to each other. The +/// "points count" property of sf::CircleShape defines how many of these +/// triangles to use, and therefore defines the quality of the circle. +/// +/// The number of points can also be used for another purpose; with +/// small numbers you can create any regular polygon shape: +/// equilateral triangle, square, pentagon, hexagon, ... +/// +/// \see sf::Shape, sf::RectangleShape, sf::ConvexShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Color.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Color.hpp new file mode 100644 index 0000000..fb2aa2d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Color.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_COLOR_HPP +#define SFML_COLOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class for manpulating RGBA colors +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Color +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an opaque black color. It is equivalent to + /// sf::Color(0, 0, 0, 255). + /// + //////////////////////////////////////////////////////////// + Color(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the color from its 4 RGBA components + /// + /// \param red Red component (in the range [0, 255]) + /// \param green Green component (in the range [0, 255]) + /// \param blue Blue component (in the range [0, 255]) + /// \param alpha Alpha (opacity) component (in the range [0, 255]) + /// + //////////////////////////////////////////////////////////// + Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + 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 + static const Color Transparent; ///< Transparent (black) predefined color + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint8 r; ///< Red component + Uint8 g; ///< Green component + Uint8 b; ///< Blue component + Uint8 a; ///< Alpha (opacity) component +}; + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the == operator +/// +/// This operator compares two colors and check if they are equal. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return True if colors are equal, false if they are different +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API bool operator ==(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the != operator +/// +/// This operator compares two colors and check if they are different. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return True if colors are different, false if they are equal +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API bool operator !=(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary + operator +/// +/// This operator returns the component-wise sum of two colors. +/// Components that exceed 255 are clamped to 255. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Result of \a left + \a right +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color operator +(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary * operator +/// +/// This operator returns the component-wise multiplication +/// (also called "modulation") of two colors. +/// Components are then divided by 255 so that the result is +/// still in the range [0, 255]. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Result of \a left * \a right +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color operator *(const Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary += operator +/// +/// This operator computes the component-wise sum of two colors, +/// and assigns the result to the left operand. +/// Components that exceed 255 are clamped to 255. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color& operator +=(Color& left, const Color& right); + +//////////////////////////////////////////////////////////// +/// \relates Color +/// \brief Overload of the binary *= operator +/// +/// This operator returns the component-wise multiplication +/// (also called "modulation") of two colors, and assigns +/// the result to the left operand. +/// Components are then divided by 255 so that the result is +/// still in the range [0, 255]. +/// +/// \param left Left operand +/// \param right Right operand +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Color& operator *=(Color& left, const Color& right); + +} // namespace sf + + +#endif // SFML_COLOR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Color +/// \ingroup graphics +/// +/// sf::Color is a simple color class composed of 4 components: +/// \li Red +/// \li Green +/// \li Blue +/// \li Alpha (opacity) +/// +/// Each component is a public member, an unsigned integer in +/// the range [0, 255]. Thus, colors can be constructed and +/// manipulated very easily: +/// +/// \code +/// sf::Color color(255, 0, 0); // red +/// color.r = 0; // make it black +/// color.b = 128; // make it dark blue +/// \endcode +/// +/// The fourth component of colors, named "alpha", represents +/// the opacity of the color. A color with an alpha value of +/// 255 will be fully opaque, while an alpha value of 0 will +/// make a color fully transparent, whatever the value of the +/// other components is. +/// +/// The most common colors are already defined as static variables: +/// \code +/// sf::Color black = sf::Color::Black; +/// sf::Color white = sf::Color::White; +/// sf::Color red = sf::Color::Red; +/// sf::Color green = sf::Color::Green; +/// sf::Color blue = sf::Color::Blue; +/// sf::Color yellow = sf::Color::Yellow; +/// sf::Color magenta = sf::Color::Magenta; +/// sf::Color cyan = sf::Color::Cyan; +/// sf::Color transparent = sf::Color::Transparent; +/// \endcode +/// +/// Colors can also be added and modulated (multiplied) using the +/// overloaded operators + and *. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/ConvexShape.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/ConvexShape.hpp new file mode 100644 index 0000000..03af57f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/ConvexShape.hpp @@ -0,0 +1,150 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONVEXSHAPE_HPP +#define SFML_CONVEXSHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a convex polygon +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API ConvexShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param pointCount Number of points of the polygon + /// + //////////////////////////////////////////////////////////// + explicit ConvexShape(unsigned int pointCount = 0); + + //////////////////////////////////////////////////////////// + /// \brief Set the number of points of the polygon + /// + /// \a count must be greater than 2 to define a valid shape. + /// + /// \param count New number of points of the polygon + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + void setPointCount(unsigned int count); + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points of the polygon + /// + /// \return Number of points of the polygon + /// + /// \see setPointCount + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Set the position of a point + /// + /// Don't forget that the polygon must remain convex, and + /// the points need to stay ordered! + /// setPointCount must be called first in order to set the total + /// number of points. The result is undefined if \a index is out + /// of the valid range. + /// + /// \param index Index of the point to change, in range [0 .. getPointCount() - 1] + /// \param point New position of the point + /// + /// \see getPoint + /// + //////////////////////////////////////////////////////////// + void setPoint(unsigned int index, const Vector2f& point); + + //////////////////////////////////////////////////////////// + /// \brief Get the position of a point + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Position of the index-th point of the polygon + /// + /// \see setPoint + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_points; ///< Points composing the convex polygon +}; + +} // namespace sf + + +#endif // SFML_CONVEXSHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ConvexShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// It is important to keep in mind that a convex shape must +/// always be... convex, otherwise it may not be drawn correctly. +/// Moreover, the points must be defined in order; using a random +/// order would result in an incorrect shape. +/// +/// Usage example: +/// \code +/// sf::ConvexShape polygon; +/// polygon.setPointCount(3); +/// polygon.setPoint(0, sf::Vector2f(0, 0)); +/// polygon.setPoint(1, sf::Vector2f(0, 10)); +/// polygon.setPoint(2, sf::Vector2f(25, 5)); +/// polygon.setOutlineColor(sf::Color::Red); +/// polygon.setOutlineThickness(5); +/// polygon.setPosition(10, 20); +/// ... +/// window.draw(polygon); +/// \endcode +/// +/// \see sf::Shape, sf::RectangleShape, sf::CircleShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Drawable.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Drawable.hpp new file mode 100644 index 0000000..accebfc --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Drawable.hpp @@ -0,0 +1,126 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_DRAWABLE_HPP +#define SFML_DRAWABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class RenderTarget; + +//////////////////////////////////////////////////////////// +/// \brief Abstract base class for objects that can be drawn +/// to a render target +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Drawable() {} + +protected : + + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// \brief Draw the object to a render target + /// + /// This is a pure virtual function that has to be implemented + /// by the derived class to define how the drawable should be + /// drawn. + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const = 0; +}; + +} // namespace sf + + +#endif // SFML_DRAWABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Drawable +/// \ingroup graphics +/// +/// sf::Drawable is a very simple base class that allows objects +/// of derived classes to be drawn to a sf::RenderTarget. +/// +/// All you have to do in your derived class is to override the +/// draw virtual function. +/// +/// Note that inheriting from sf::Drawable is not mandatory, +/// but it allows this nice syntax "window.draw(object)" rather +/// than "object.draw(window)", which is more consistent with other +/// SFML classes. +/// +/// Example: +/// \code +/// class MyDrawable : public sf::Drawable +/// { +/// public : +/// +/// ... +/// +/// private : +/// +/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const +/// { +/// // You can draw other high-level objects +/// target.draw(m_sprite, states); +/// +/// // ... or use the low-level API +/// states.texture = &m_texture; +/// target.draw(m_vertices, states); +/// +/// // ... or draw with OpenGL directly +/// glBegin(GL_QUADS); +/// ... +/// glEnd(); +/// } +/// +/// sf::Sprite m_sprite; +/// sf::Texture m_texture; +/// sf::VertexArray m_vertices; +/// }; +/// \endcode +/// +/// \see sf::RenderTarget +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Export.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Export.hpp new file mode 100644 index 0000000..eb76ae8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GRAPHICS_EXPORT_HPP +#define SFML_GRAPHICS_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_GRAPHICS_EXPORTS) + + #define SFML_GRAPHICS_API SFML_API_EXPORT + +#else + + #define SFML_GRAPHICS_API SFML_API_IMPORT + +#endif + + +#endif // SFML_GRAPHICS_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Font.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Font.hpp new file mode 100644 index 0000000..d3b1955 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Font.hpp @@ -0,0 +1,361 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FONT_HPP +#define SFML_FONT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Class for loading and manipulating character fonts +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Font +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor defines an empty font + /// + //////////////////////////////////////////////////////////// + Font(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + Font(const Font& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Cleans up all the internal resources used by the font + /// + //////////////////////////////////////////////////////////// + ~Font(); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a file + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Note that this function know nothing about the standard + /// fonts installed on the user's system, thus you can't + /// load them directly. + /// + /// \param filename Path of the font file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a file in memory + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Warning: SFML cannot preload all the font data in this + /// function, so the buffer pointed by \a data has to remain + /// valid as long as the font is used. + /// + /// \param data Pointer to the file data in memory + /// \param sizeInBytes Size of the data to load, in bytes + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Load the font from a custom stream + /// + /// The supported font formats are: TrueType, Type 1, CFF, + /// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42. + /// Warning: SFML cannot preload all the font data in this + /// function, so the contents of \a stream have to remain + /// valid as long as the font is used. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve a glyph of the font + /// + /// \param codePoint Unicode code point of the character to get + /// \param characterSize Reference character size + /// \param bold Retrieve the bold version or the regular one? + /// + /// \return The glyph corresponding to \a codePoint and \a characterSize + /// + //////////////////////////////////////////////////////////// + const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the kerning offset of two glyphs + /// + /// The kerning is an extra offset (negative) to apply between two + /// glyphs when rendering them, to make the pair look more "natural". + /// For example, the pair "AV" have a special kerning to make them + /// closer than other characters. Most of the glyphs pairs have a + /// kerning offset of zero, though. + /// + /// \param first Unicode code point of the first character + /// \param second Unicode code point of the second character + /// \param characterSize Reference character size + /// + /// \return Kerning value for \a first and \a second, in pixels + /// + //////////////////////////////////////////////////////////// + int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the line spacing + /// + /// Line spacing is the vertical offset to apply between two + /// consecutive lines of text. + /// + /// \param characterSize Reference character size + /// + /// \return Line spacing, in pixels + /// + //////////////////////////////////////////////////////////// + int getLineSpacing(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Retrieve the texture containing the loaded glyphs of a certain size + /// + /// The contents of the returned texture changes as more glyphs + /// are requested, thus it is not very relevant. It is mainly + /// used internally by sf::Text. + /// + /// \param characterSize Reference character size + /// + /// \return Texture containing the glyphs of the requested size + /// + //////////////////////////////////////////////////////////// + const Texture& getTexture(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Font& operator =(const Font& right); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a row of glyphs + /// + //////////////////////////////////////////////////////////// + struct Row + { + Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight) {} + + unsigned int width; ///< Current width of the row + unsigned int top; ///< Y position of the row into the texture + unsigned int height; ///< Height of the row + }; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map GlyphTable; ///< Table mapping a codepoint to its glyph + + //////////////////////////////////////////////////////////// + /// \brief Structure defining a page of glyphs + /// + //////////////////////////////////////////////////////////// + struct Page + { + Page(); + + GlyphTable glyphs; ///< Table mapping code points to their corresponding glyph + sf::Texture texture; ///< Texture containing the pixels of the glyphs + unsigned int nextRow; ///< Y position of the next new row in the texture + std::vector rows; ///< List containing the position of all the existing rows + }; + + //////////////////////////////////////////////////////////// + /// \brief Free all the internal resources + /// + //////////////////////////////////////////////////////////// + void cleanup(); + + //////////////////////////////////////////////////////////// + /// \brief Load a new glyph and store it in the cache + /// + /// \param codePoint Unicode code point of the character to load + /// \param characterSize Reference character size + /// \param bold Retrieve the bold version or the regular one? + /// + /// \return The glyph corresponding to \a codePoint and \a characterSize + /// + //////////////////////////////////////////////////////////// + Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const; + + //////////////////////////////////////////////////////////// + /// \brief Find a suitable rectangle within the texture for a glyph + /// + /// \param page Page of glyphs to search in + /// \param width Width of the rectangle + /// \param height Height of the rectangle + /// + /// \return Found rectangle within the texture + /// + //////////////////////////////////////////////////////////// + IntRect findGlyphRect(Page& page, unsigned int width, unsigned int height) const; + + //////////////////////////////////////////////////////////// + /// \brief Make sure that the given size is the current one + /// + /// \param characterSize Reference character size + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool setCurrentSize(unsigned int characterSize) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map PageTable; ///< Table mapping a character size to its page (texture) + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + void* m_library; ///< Pointer to the internal library interface (it is typeless to avoid exposing implementation details) + void* m_face; ///< Pointer to the internal font face (it is typeless to avoid exposing implementation details) + void* m_streamRec; ///< Pointer to the stream rec instance (it is typeless to avoid exposing implementation details) + int* m_refCount; ///< Reference counter used by implicit sharing + mutable PageTable m_pages; ///< Table containing the glyphs pages by character size + mutable std::vector m_pixelBuffer; ///< Pixel buffer holding a glyph's pixels before being written to the texture +}; + +} // namespace sf + + +#endif // SFML_FONT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Font +/// \ingroup graphics +/// +/// Fonts can be loaded from a file, from memory or from a custom +/// stream, and supports the most common types of fonts. See +/// the loadFromFile function for the complete list of supported formats. +/// +/// Once it is loaded, a sf::Font instance provides three +/// types of information about the font: +/// \li Global metrics, such as the line spacing +/// \li Per-glyph metrics, such as bounding box or kerning +/// \li Pixel representation of glyphs +/// +/// Fonts alone are not very useful: they hold the font data +/// but cannot make anything useful of it. To do so you need to +/// use the sf::Text class, which is able to properly output text +/// with several options such as character size, style, color, +/// position, rotation, etc. +/// This separation allows more flexibility and better performances: +/// indeed a sf::Font is a heavy resource, and any operation on it +/// is slow (often too slow for real-time applications). On the other +/// side, a sf::Text is a lightweight object which can combine the +/// glyphs data and metrics of a sf::Font to display any text on a +/// render target. +/// Note that it is also possible to bind several sf::Text instances +/// to the same sf::Font. +/// +/// It is important to note that the sf::Text instance doesn't +/// copy the font that it uses, it only keeps a reference to it. +/// Thus, a sf::Font must not be destructed while it is +/// used by a sf::Text (i.e. never write a function that +/// uses a local sf::Font instance for creating a text). +/// +/// Usage example: +/// \code +/// // Declare a new font +/// sf::Font font; +/// +/// // Load it from a file +/// if (!font.loadFromFile("arial.ttf")) +/// { +/// // error... +/// } +/// +/// // Create a text which uses our font +/// sf::Text text1; +/// text1.setFont(font); +/// text1.setCharacterSize(30); +/// text1.setStyle(sf::Text::Regular); +/// +/// // Create another text using the same font, but with different parameters +/// sf::Text text2; +/// text2.setFont(font); +/// text2.setCharacterSize(50); +/// text1.setStyle(sf::Text::Italic); +/// \endcode +/// +/// Apart from loading font files, and passing them to instances +/// of sf::Text, you should normally not have to deal directly +/// with this class. However, it may be useful to access the +/// font metrics or rasterized glyphs for advanced usage. +/// +/// \see sf::Text +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Glyph.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Glyph.hpp new file mode 100644 index 0000000..d97616f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Glyph.hpp @@ -0,0 +1,79 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLYPH_HPP +#define SFML_GLYPH_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Structure describing a glyph +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Glyph +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Glyph() : advance(0) {} + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + int advance; ///< Offset to move horizontically to the next character + IntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline + IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture +}; + +} // namespace sf + + +#endif // SFML_GLYPH_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Glyph +/// \ingroup graphics +/// +/// A glyph is the visual representation of a character. +/// +/// The sf::Glyph structure provides the information needed +/// to handle the glyph: +/// \li its coordinates in the font's texture +/// \li its bounding rectangle +/// \li the offset to apply to get the starting position of the next glyph +/// +/// \see sf::Font +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Image.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Image.hpp new file mode 100644 index 0000000..0b61d6c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Image.hpp @@ -0,0 +1,318 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IMAGE_HPP +#define SFML_IMAGE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Class for loading, manipulating and saving images +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Image +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty image. + /// + //////////////////////////////////////////////////////////// + Image(); + + //////////////////////////////////////////////////////////// + /// \brief Create the image and fill it with a unique color + /// + /// \param width Width of the image + /// \param height Height of the image + /// \param color Fill color + /// + //////////////////////////////////////////////////////////// + void create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0)); + + //////////////////////////////////////////////////////////// + /// \brief Create the image from an array of pixels + /// + /// The \a pixel array is assumed to contain 32-bits RGBA pixels, + /// and have the given \a width and \a height. If not, this is + /// an undefined behaviour. + /// If \a pixels is null, an empty image is created. + /// + /// \param width Width of the image + /// \param height Height of the image + /// \param pixels Array of pixels to copy to the image + /// + //////////////////////////////////////////////////////////// + void create(unsigned int width, unsigned int height, const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a file on disk + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param filename Path of the image file to load + /// + /// \return True if loading was successful + /// + /// \see loadFromMemory, loadFromStream, saveToFile + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a file in memory + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param data Pointer to the file data in memory + /// \param size Size of the data to load, in bytes + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t size); + + //////////////////////////////////////////////////////////// + /// \brief Load the image from a custom stream + /// + /// The supported image formats are bmp, png, tga, jpg, gif, + /// psd, hdr and pic. Some format options are not supported, + /// like progressive jpeg. + /// If this function fails, the image is left unchanged. + /// + /// \param stream Source stream to read from + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream); + + //////////////////////////////////////////////////////////// + /// \brief Save the image to a file on disk + /// + /// The format of the image is automatically deduced from + /// the extension. The supported image formats are bmp, png, + /// tga and jpg. The destination file is overwritten + /// if it already exists. This function fails if the image is empty. + /// + /// \param filename Path of the file to save + /// + /// \return True if saving was successful + /// + /// \see create, loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool saveToFile(const std::string& filename) const; + + //////////////////////////////////////////////////////////// + /// \brief Return the size (width and height) of the image + /// + /// \return Size of the image, in pixels + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Create a transparency mask from a specified color-key + /// + /// This function sets the alpha value of every pixel matching + /// the given color to \a alpha (0 by default), so that they + /// become transparent. + /// + /// \param color Color to make transparent + /// \param alpha Alpha value to assign to transparent pixels + /// + //////////////////////////////////////////////////////////// + void createMaskFromColor(const Color& color, Uint8 alpha = 0); + + //////////////////////////////////////////////////////////// + /// \brief Copy pixels from another image onto this one + /// + /// This function does a slow pixel copy and should not be + /// used intensively. It can be used to prepare a complex + /// static image from several others, but if you need this + /// kind of feature in real-time you'd better use sf::RenderTexture. + /// + /// If \a sourceRect is empty, the whole image is copied. + /// If \a applyAlpha is set to true, the transparency of + /// source pixels is applied. If it is false, the pixels are + /// copied unchanged with their alpha value. + /// + /// \param source Source image to copy + /// \param destX X coordinate of the destination position + /// \param destY Y coordinate of the destination position + /// \param sourceRect Sub-rectangle of the source image to copy + /// \param applyAlpha Should the copy take in account the source transparency? + /// + //////////////////////////////////////////////////////////// + void copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false); + + //////////////////////////////////////////////////////////// + /// \brief Change the color of a pixel + /// + /// This function doesn't check the validity of the pixel + /// coordinates, using out-of-range values will result in + /// an undefined behaviour. + /// + /// \param x X coordinate of pixel to change + /// \param y Y coordinate of pixel to change + /// \param color New color of the pixel + /// + /// \see getPixel + /// + //////////////////////////////////////////////////////////// + void setPixel(unsigned int x, unsigned int y, const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the color of a pixel + /// + /// This function doesn't check the validity of the pixel + /// coordinates, using out-of-range values will result in + /// an undefined behaviour. + /// + /// \param x X coordinate of pixel to get + /// \param y Y coordinate of pixel to get + /// + /// \return Color of the pixel at coordinates (x, y) + /// + /// \see setPixel + /// + //////////////////////////////////////////////////////////// + Color getPixel(unsigned int x, unsigned int y) const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only pointer to the array of pixels + /// + /// The returned value points to an array of RGBA pixels made of + /// 8 bits integers components. The size of the array is + /// width * height * 4 (getSize().x * getSize().y * 4). + /// Warning: the returned pointer may become invalid if you + /// modify the image, so you should never store it for too long. + /// If the image is empty, a null pointer is returned. + /// + /// \return Read-only pointer to the array of pixels + /// + //////////////////////////////////////////////////////////// + const Uint8* getPixelsPtr() const; + + //////////////////////////////////////////////////////////// + /// \brief Flip the image horizontally (left <-> right) + /// + //////////////////////////////////////////////////////////// + void flipHorizontally(); + + //////////////////////////////////////////////////////////// + /// \brief Flip the image vertically (top <-> bottom) + /// + //////////////////////////////////////////////////////////// + void flipVertically(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2u m_size; ///< Image size + std::vector m_pixels; ///< Pixels of the image +}; + +} // namespace sf + + +#endif // SFML_IMAGE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Image +/// \ingroup graphics +/// +/// sf::Image is an abstraction to manipulate images +/// as bidimensional arrays of pixels. The class provides +/// functions to load, read, write and save pixels, as well +/// as many other useful functions. +/// +/// sf::Image can handle a unique internal representation of +/// pixels, which is RGBA 32 bits. This means that a pixel +/// must be composed of 8 bits red, green, blue and alpha +/// channels -- just like a sf::Color. +/// All the functions that return an array of pixels follow +/// this rule, and all parameters that you pass to sf::Image +/// functions (such as loadFromPixels) must use this +/// representation as well. +/// +/// A sf::Image can be copied, but it is a heavy resource and +/// if possible you should always use [const] references to +/// pass or return them to avoid useless copies. +/// +/// Usage example: +/// \code +/// // Load an image file from a file +/// sf::Image background; +/// if (!background.loadFromFile("background.jpg")) +/// return -1; +/// +/// // Create a 20x20 image filled with black color +/// sf::Image image; +/// image.create(20, 20, sf::Color::Black); +/// +/// // Copy image1 on image2 at position (10, 10) +/// image.copy(background, 10, 10); +/// +/// // Make the top-left pixel transparent +/// sf::Color color = image.getPixel(0, 0); +/// color.a = 0; +/// image.setPixel(0, 0, color); +/// +/// // Save the image to a file +/// if (!image.saveToFile("result.png")) +/// return -1; +/// \endcode +/// +/// \see sf::Texture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/PrimitiveType.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/PrimitiveType.hpp new file mode 100644 index 0000000..8f3cfb2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/PrimitiveType.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PRIMITIVETYPE_HPP +#define SFML_PRIMITIVETYPE_HPP + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup graphics +/// \brief Types of primitives that a sf::VertexArray can render +/// +/// Points and lines have no area, therefore their thickness +/// will always be 1 pixel, regarldess the current transform +/// and view. +/// +//////////////////////////////////////////////////////////// +enum PrimitiveType +{ + Points, ///< List of individual points + Lines, ///< List of individual lines + LinesStrip, ///< List of connected lines, a point uses the previous point to form a line + Triangles, ///< List of individual triangles + TrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle + TrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle + Quads ///< List of individual quads +}; + +} // namespace sf + + +#endif // SFML_PRIMITIVETYPE_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.hpp new file mode 100644 index 0000000..3a3acc7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.hpp @@ -0,0 +1,248 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECT_HPP +#define SFML_RECT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class for manipulating 2D axis aligned rectangles +/// +//////////////////////////////////////////////////////////// +template +class Rect +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty rectangle (it is equivalent to calling + /// Rect(0, 0, 0, 0)). + /// + //////////////////////////////////////////////////////////// + Rect(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from its coordinates + /// + /// Be careful, the last two parameters are the width + /// and height, not the right and bottom coordinates! + /// + /// \param rectLeft Left coordinate of the rectangle + /// \param rectTop Top coordinate of the rectangle + /// \param rectWidth Width of the rectangle + /// \param rectHeight Height of the rectangle + /// + //////////////////////////////////////////////////////////// + Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from position and size + /// + /// Be careful, the last parameter is the size, + /// not the bottom-right corner! + /// + /// \param position Position of the top-left corner of the rectangle + /// \param size Size of the rectangle + /// + //////////////////////////////////////////////////////////// + Rect(const Vector2& position, const Vector2& size); + + //////////////////////////////////////////////////////////// + /// \brief Construct the rectangle from another type of rectangle + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param rectangle Rectangle to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Rect(const Rect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Check if a point is inside the rectangle's area + /// + /// \param x X coordinate of the point to test + /// \param y Y coordinate of the point to test + /// + /// \return True if the point is inside, false otherwise + /// + /// \see intersects + /// + //////////////////////////////////////////////////////////// + bool contains(T x, T y) const; + + //////////////////////////////////////////////////////////// + /// \brief Check if a point is inside the rectangle's area + /// + /// \param point Point to test + /// + /// \return True if the point is inside, false otherwise + /// + /// \see intersects + /// + //////////////////////////////////////////////////////////// + bool contains(const Vector2& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Check the intersection between two rectangles + /// + /// \param rectangle Rectangle to test + /// + /// \return True if rectangles overlap, false otherwise + /// + /// \see contains + /// + //////////////////////////////////////////////////////////// + bool intersects(const Rect& rectangle) const; + + //////////////////////////////////////////////////////////// + /// \brief Check the intersection between two rectangles + /// + /// This overload returns the overlapped rectangle in the + /// \a intersection parameter. + /// + /// \param rectangle Rectangle to test + /// \param intersection Rectangle to be filled with the intersection + /// + /// \return True if rectangles overlap, false otherwise + /// + /// \see contains + /// + //////////////////////////////////////////////////////////// + bool intersects(const Rect& rectangle, Rect& intersection) const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T left; ///< Left coordinate of the rectangle + T top; ///< Top coordinate of the rectangle + T width; ///< Width of the rectangle + T height; ///< Height of the rectangle +}; + +//////////////////////////////////////////////////////////// +/// \relates Rect +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two rectangles. +/// +/// \param left Left operand (a rectangle) +/// \param right Right operand (a rectangle) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Rect& left, const Rect& right); + +//////////////////////////////////////////////////////////// +/// \relates Rect +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two rectangles. +/// +/// \param left Left operand (a rectangle) +/// \param right Right operand (a rectangle) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Rect& left, const Rect& right); + +#include + +// Create typedefs for the most common types +typedef Rect IntRect; +typedef Rect FloatRect; + +} // namespace sf + + +#endif // SFML_RECT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Rect +/// \ingroup graphics +/// +/// A rectangle is defined by its top-left corner and its size. +/// It is a very simple class defined for convenience, so +/// its member variables (left, top, width and height) are public +/// and can be accessed directly, just like the vector classes +/// (Vector2 and Vector3). +/// +/// To keep things simple, sf::Rect doesn't define +/// functions to emulate the properties that are not directly +/// members (such as right, bottom, center, etc.), it rather +/// only provides intersection functions. +/// +/// sf::Rect uses the usual rules for its boundaries: +/// \li The left and top edges are included in the rectangle's area +/// \li The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area +/// +/// This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1) +/// don't intersect. +/// +/// sf::Rect is a template and may be used with any numeric type, but +/// for simplicity the instanciations used by SFML are typedefed: +/// \li sf::Rect is sf::IntRect +/// \li sf::Rect is sf::FloatRect +/// +/// So that you don't have to care about the template syntax. +/// +/// Usage example: +/// \code +/// // Define a rectangle, located at (0, 0) with a size of 20x5 +/// sf::IntRect r1(0, 0, 20, 5); +/// +/// // Define another rectangle, located at (4, 2) with a size of 18x10 +/// sf::Vector2i position(4, 2); +/// sf::Vector2i size(18, 10); +/// sf::IntRect r2(position, size); +/// +/// // Test intersections with the point (3, 1) +/// bool b1 = r1.contains(3, 1); // true +/// bool b2 = r2.contains(3, 1); // false +/// +/// // Test the intersection between r1 and r2 +/// sf::IntRect result; +/// bool b3 = r1.intersects(r2, result); // true +/// // result == (4, 2, 16, 3) +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.inl b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.inl new file mode 100644 index 0000000..0a97b99 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Rect.inl @@ -0,0 +1,159 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +Rect::Rect() : +left (0), +top (0), +width (0), +height(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +Rect::Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) : +left (rectLeft), +top (rectTop), +width (rectWidth), +height(rectHeight) +{ + +} + + +//////////////////////////////////////////////////////////// +template +Rect::Rect(const Vector2& position, const Vector2& size) : +left (position.x), +top (position.y), +width (size.x), +height(size.y) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +Rect::Rect(const Rect& rectangle) : +left (static_cast(rectangle.left)), +top (static_cast(rectangle.top)), +width (static_cast(rectangle.width)), +height(static_cast(rectangle.height)) +{ +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::contains(T x, T y) const +{ + // Rectangles with negative dimensions are allowed, so we must handle them correctly + + // Compute the real min and max of the rectangle on both axes + T minX = std::min(left, left + width); + T maxX = std::max(left, left + width); + T minY = std::min(top, top + height); + T maxY = std::max(top, top + height); + + return (x >= minX) && (x < maxX) && (y >= minY) && (y < maxY); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::contains(const Vector2& point) const +{ + return contains(point.x, point.y); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::intersects(const Rect& rectangle) const +{ + Rect intersection; + return intersects(rectangle, intersection); +} + + +//////////////////////////////////////////////////////////// +template +bool Rect::intersects(const Rect& rectangle, Rect& intersection) const +{ + // Rectangles with negative dimensions are allowed, so we must handle them correctly + + // Compute the min and max of the first rectangle on both axes + T r1MinX = std::min(left, left + width); + T r1MaxX = std::max(left, left + width); + T r1MinY = std::min(top, top + height); + T r1MaxY = std::max(top, top + height); + + // Compute the min and max of the second rectangle on both axes + T r2MinX = std::min(rectangle.left, rectangle.left + rectangle.width); + T r2MaxX = std::max(rectangle.left, rectangle.left + rectangle.width); + T r2MinY = std::min(rectangle.top, rectangle.top + rectangle.height); + T r2MaxY = std::max(rectangle.top, rectangle.top + rectangle.height); + + // Compute the intersection boundaries + T interLeft = std::max(r1MinX, r2MinX); + T interTop = std::max(r1MinY, r2MinY); + T interRight = std::min(r1MaxX, r2MaxX); + T interBottom = std::min(r1MaxY, r2MaxY); + + // If the intersection is valid (positive non zero area), then there is an intersection + if ((interLeft < interRight) && (interTop < interBottom)) + { + intersection = Rect(interLeft, interTop, interRight - interLeft, interBottom - interTop); + return true; + } + else + { + intersection = Rect(0, 0, 0, 0); + return false; + } +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Rect& left, const Rect& right) +{ + return (left.left == right.left) && (left.width == right.width) && + (left.top == right.top) && (left.height == right.height); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Rect& left, const Rect& right) +{ + return !(left == right); +} diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RectangleShape.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RectangleShape.hpp new file mode 100644 index 0000000..2140e91 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RectangleShape.hpp @@ -0,0 +1,128 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RECTANGLESHAPE_HPP +#define SFML_RECTANGLESHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Specialized shape representing a rectangle +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RectangleShape : public Shape +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param size Size of the rectangle + /// + //////////////////////////////////////////////////////////// + explicit RectangleShape(const Vector2f& size = Vector2f(0, 0)); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the rectangle + /// + /// \param size New size of the rectangle + /// + /// \see getSize + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rectangle + /// + /// \return Size of the rectangle + /// + /// \see setSize + /// + //////////////////////////////////////////////////////////// + const Vector2f& getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the number of points defining the shape + /// + /// \return Number of points of the shape + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_size; ///< Size of the rectangle +}; + +} // namespace sf + + +#endif // SFML_RECTANGLESHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RectangleShape +/// \ingroup graphics +/// +/// This class inherits all the functions of sf::Transformable +/// (position, rotation, scale, bounds, ...) as well as the +/// functions of sf::Shape (outline, color, texture, ...). +/// +/// Usage example: +/// \code +/// sf::RectangleShape rectangle; +/// rectangle.setSize(sf::Vector2f(100, 50)); +/// rectangle.setOutlineColor(sf::Color::Red); +/// rectangle.setOutlineThickness(5); +/// rectangle.setPosition(10, 20); +/// ... +/// window.draw(rectangle); +/// \endcode +/// +/// \see sf::Shape, sf::CircleShape, sf::ConvexShape +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderStates.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderStates.hpp new file mode 100644 index 0000000..bf4183c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderStates.hpp @@ -0,0 +1,174 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERSTATES_HPP +#define SFML_RENDERSTATES_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Shader; +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Define the states used for drawing to a RenderTarget +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderStates +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructing a default set of render states is equivalent + /// to using sf::RenderStates::Default. + /// The default set defines: + /// \li the BlendAlpha blend mode + /// \li the identity transform + /// \li a null texture + /// \li a null shader + /// + //////////////////////////////////////////////////////////// + RenderStates(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom blend mode + /// + /// \param theBlendMode Blend mode to use + /// + //////////////////////////////////////////////////////////// + RenderStates(BlendMode theBlendMode); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom transform + /// + /// \param theTransform Transform to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Transform& theTransform); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom texture + /// + /// \param theTexture Texture to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Texture* theTexture); + + //////////////////////////////////////////////////////////// + /// \brief Construct a default set of render states with a custom shader + /// + /// \param theShader Shader to use + /// + //////////////////////////////////////////////////////////// + RenderStates(const Shader* theShader); + + //////////////////////////////////////////////////////////// + /// \brief Construct a set of render states with all its attributes + /// + /// \param theBlendMode Blend mode to use + /// \param theTransform Transform to use + /// \param theTexture Texture to use + /// \param theShader Shader to use + /// + //////////////////////////////////////////////////////////// + RenderStates(BlendMode theBlendMode, const Transform& theTransform, + const Texture* theTexture, const Shader* theShader); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const RenderStates Default; ///< Special instance holding the default render states + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + BlendMode blendMode; ///< Blending mode + Transform transform; ///< Transform + const Texture* texture; ///< Texture + const Shader* shader; ///< Shader +}; + +} // namespace sf + + +#endif // SFML_RENDERSTATES_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderStates +/// \ingroup graphics +/// +/// There are four global states that can be applied to +/// the drawn objects: +/// \li the blend mode: how pixels of the object are blended with the background +/// \li the transform: how the object is positioned/rotated/scaled +/// \li the texture: what image is mapped to the object +/// \li the shader: what custom effect is applied to the object +/// +/// High-level objects such as sprites or text force some of +/// these states when they are drawn. For example, a sprite +/// will set its own texture, so that you don't have to care +/// about it when drawing the sprite. +/// +/// The transform is a special case: sprites, texts and shapes +/// (and it's a good idea to do it with your own drawable classes +/// too) combine their transform with the one that is passed in the +/// RenderStates structure. So that you can use a "global" transform +/// on top of each object's transform. +/// +/// Most objects, especially high-level drawables, can be drawn +/// directly without defining render states explicitely -- the +/// default set of states is ok in most cases. +/// \code +/// window.Draw(sprite); +/// \endcode +/// +/// If you want to use a single specific render state, +/// for example a shader, you can pass it directly to the Draw +/// function: sf::RenderStates has an implicit one-argument +/// constructor for each state. +/// \code +/// window.draw(sprite, shader); +/// \endcode +/// +/// When you're inside the Draw function of a drawable +/// object (inherited from sf::Drawable), you can +/// either pass the render states unmodified, or change +/// some of them. +/// For example, a transformable object will combine the +/// current transform with its own transform. A sprite will +/// set its texture. Etc. +/// +/// \see sf::RenderTarget, sf::Drawable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTarget.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTarget.hpp new file mode 100644 index 0000000..5f69e7f --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTarget.hpp @@ -0,0 +1,451 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERTARGET_HPP +#define SFML_RENDERTARGET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class Drawable; + +//////////////////////////////////////////////////////////// +/// \brief Base class for all render targets (window, texture, ...) +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderTarget : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderTarget(); + + //////////////////////////////////////////////////////////// + /// \brief Clear the entire target with a single color + /// + /// This function is usually called once every frame, + /// to clear the previous contents of the target. + /// + /// \param color Fill color to use to clear the render target + /// + //////////////////////////////////////////////////////////// + void clear(const Color& color = Color(0, 0, 0, 255)); + + //////////////////////////////////////////////////////////// + /// \brief Change the current active view + /// + /// The view is like a 2D camera, it controls which part of + /// the 2D scene is visible, and how it is viewed in the + /// render-target. + /// The new view will affect everything that is drawn, until + /// another view is set. + /// The render target keeps its own copy of the view object, + /// so it is not necessary to keep the original one alive + /// after calling this function. + /// To restore the original view of the target, you can pass + /// the result of getDefaultView() to this function. + /// + /// \param view New view to use + /// + /// \see getView, getDefaultView + /// + //////////////////////////////////////////////////////////// + void setView(const View& view); + + //////////////////////////////////////////////////////////// + /// \brief Get the view currently in use in the render target + /// + /// \return The view object that is currently used + /// + /// \see setView, getDefaultView + /// + //////////////////////////////////////////////////////////// + const View& getView() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the default view of the render target + /// + /// The default view has the initial size of the render target, + /// and never changes after the target has been created. + /// + /// \return The default view of the render target + /// + /// \see setView, getView + /// + //////////////////////////////////////////////////////////// + const View& getDefaultView() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the viewport of a view, applied to this render target + /// + /// The viewport is defined in the view as a ratio, this function + /// simply applies this ratio to the current dimensions of the + /// render target to calculate the pixels rectangle that the viewport + /// actually covers in the target. + /// + /// \param view The view for which we want to compute the viewport + /// + /// \return Viewport rectangle, expressed in pixels + /// + //////////////////////////////////////////////////////////// + IntRect getViewport(const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from target coordinates to world + /// coordinates, using the current view + /// + /// This function is an overload of the mapPixelToCoords + /// function that implicitely uses the current view. + /// It is equivalent to: + /// \code + /// target.mapPixelToCoords(point, target.getView()); + /// \endcode + /// + /// \param point Pixel to convert + /// + /// \return The converted point, in "world" coordinates + /// + /// \see mapCoordsToPixel + /// + //////////////////////////////////////////////////////////// + Vector2f mapPixelToCoords(const Vector2i& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from target coordinates to world coordinates + /// + /// This function finds the 2D position that matches the + /// given pixel of the render-target. In other words, it does + /// the inverse of what the graphics card does, to find the + /// initial position of a rendered pixel. + /// + /// Initially, both coordinate systems (world units and target pixels) + /// match perfectly. But if you define a custom view or resize your + /// render-target, this assertion is not true anymore, ie. a point + /// located at (10, 50) in your render-target may map to the point + /// (150, 75) in your 2D world -- if the view is translated by (140, 25). + /// + /// For render-windows, this function is typically used to find + /// which point (or object) is located below the mouse cursor. + /// + /// This version uses a custom view for calculations, see the other + /// overload of the function if you want to use the current view of the + /// render-target. + /// + /// \param point Pixel to convert + /// \param view The view to use for converting the point + /// + /// \return The converted point, in "world" units + /// + /// \see mapCoordsToPixel + /// + //////////////////////////////////////////////////////////// + Vector2f mapPixelToCoords(const Vector2i& point, const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from world coordinates to target + /// coordinates, using the current view + /// + /// This function is an overload of the mapCoordsToPixel + /// function that implicitely uses the current view. + /// It is equivalent to: + /// \code + /// target.mapCoordsToPixel(point, target.getView()); + /// \endcode + /// + /// \param point Point to convert + /// + /// \return The converted point, in target coordinates (pixels) + /// + /// \see mapPixelToCoords + /// + //////////////////////////////////////////////////////////// + Vector2i mapCoordsToPixel(const Vector2f& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert a point from world coordinates to target coordinates + /// + /// This function finds the pixel of the render-target that matches + /// the given 2D point. In other words, it goes through the same process + /// as the graphics card, to compute the final position of a rendered point. + /// + /// Initially, both coordinate systems (world units and target pixels) + /// match perfectly. But if you define a custom view or resize your + /// render-target, this assertion is not true anymore, ie. a point + /// located at (150, 75) in your 2D world may map to the pixel + /// (10, 50) of your render-target -- if the view is translated by (140, 25). + /// + /// This version uses a custom view for calculations, see the other + /// overload of the function if you want to use the current view of the + /// render-target. + /// + /// \param point Point to convert + /// \param view The view to use for converting the point + /// + /// \return The converted point, in target coordinates (pixels) + /// + /// \see mapPixelToCoords + /// + //////////////////////////////////////////////////////////// + Vector2i mapCoordsToPixel(const Vector2f& point, const View& view) const; + + //////////////////////////////////////////////////////////// + /// \brief Draw a drawable object to the render-target + /// + /// \param drawable Object to draw + /// \param states Render states to use for drawing + /// + //////////////////////////////////////////////////////////// + void draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default); + + //////////////////////////////////////////////////////////// + /// \brief Draw primitives defined by an array of vertices + /// + /// \param vertices Pointer to the vertices + /// \param vertexCount Number of vertices in the array + /// \param type Type of primitives to draw + /// \param states Render states to use for drawing + /// + //////////////////////////////////////////////////////////// + void draw(const Vertex* vertices, unsigned int vertexCount, + PrimitiveType type, const RenderStates& states = RenderStates::Default); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the rendering region of the target + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Save the current OpenGL render states and matrices + /// + /// This function can be used when you mix SFML drawing + /// and direct OpenGL rendering. Combined with PopGLStates, + /// it ensures that: + /// \li SFML's internal states are not messed up by your OpenGL code + /// \li your OpenGL states are not modified by a call to a SFML function + /// + /// More specifically, it must be used around code that + /// calls Draw functions. Example: + /// \code + /// // OpenGL code here... + /// window.pushGLStates(); + /// window.draw(...); + /// window.draw(...); + /// window.popGLStates(); + /// // OpenGL code here... + /// \endcode + /// + /// Note that this function is quite expensive: it saves all the + /// possible OpenGL states and matrices, even the ones you + /// don't care about. Therefore it should be used wisely. + /// It is provided for convenience, but the best results will + /// be achieved if you handle OpenGL states yourself (because + /// you know which states have really changed, and need to be + /// saved and restored). Take a look at the ResetGLStates + /// function if you do so. + /// + /// \see popGLStates + /// + //////////////////////////////////////////////////////////// + void pushGLStates(); + + //////////////////////////////////////////////////////////// + /// \brief Restore the previously saved OpenGL render states and matrices + /// + /// See the description of pushGLStates to get a detailed + /// description of these functions. + /// + /// \see pushGLStates + /// + //////////////////////////////////////////////////////////// + void popGLStates(); + + //////////////////////////////////////////////////////////// + /// \brief Reset the internal OpenGL states so that the target is ready for drawing + /// + /// This function can be used when you mix SFML drawing + /// and direct OpenGL rendering, if you choose not to use + /// pushGLStates/popGLStates. It makes sure that all OpenGL + /// states needed by SFML are set, so that subsequent draw() + /// calls will work as expected. + /// + /// Example: + /// \code + /// // OpenGL code here... + /// glPushAttrib(...); + /// window.resetGLStates(); + /// window.draw(...); + /// window.draw(...); + /// glPopAttrib(...); + /// // OpenGL code here... + /// \endcode + /// + //////////////////////////////////////////////////////////// + void resetGLStates(); + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + RenderTarget(); + + //////////////////////////////////////////////////////////// + /// \brief Performs the common initialization step after creation + /// + /// The derived classes must call this function after the + /// target is created and ready for drawing. + /// + //////////////////////////////////////////////////////////// + void initialize(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Apply the current view + /// + //////////////////////////////////////////////////////////// + void applyCurrentView(); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new blending mode + /// + /// \param mode Blending mode to apply + /// + //////////////////////////////////////////////////////////// + void applyBlendMode(BlendMode mode); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new transform + /// + /// \param transform Transform to apply + /// + //////////////////////////////////////////////////////////// + void applyTransform(const Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new texture + /// + /// \param texture Texture to apply + /// + //////////////////////////////////////////////////////////// + void applyTexture(const Texture* texture); + + //////////////////////////////////////////////////////////// + /// \brief Apply a new shader + /// + /// \param shader Shader to apply + /// + //////////////////////////////////////////////////////////// + void applyShader(const Shader* shader); + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// This function must be implemented by derived classes to make + /// their OpenGL context current; it is called by the base class + /// everytime it's going to use OpenGL calls. + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Render states cache + /// + //////////////////////////////////////////////////////////// + struct StatesCache + { + enum {VertexCacheSize = 4}; + + bool glStatesSet; ///< Are our internal GL states set yet? + bool viewChanged; ///< Has the current view changed since last draw? + BlendMode lastBlendMode; ///< Cached blending mode + Uint64 lastTextureId; ///< Cached texture + bool useVertexCache; ///< Did we previously use the vertex cache? + Vertex vertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + View m_defaultView; ///< Default view + View m_view; ///< Current view + StatesCache m_cache; ///< Render states cache +}; + +} // namespace sf + + +#endif // SFML_RENDERTARGET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderTarget +/// \ingroup graphics +/// +/// sf::RenderTarget defines the common behaviour of all the +/// 2D render targets usable in the graphics module. It makes +/// it possible to draw 2D entities like sprites, shapes, text +/// without using any OpenGL command directly. +/// +/// A sf::RenderTarget is also able to use views (sf::View), +/// which are a kind of 2D cameras. With views you can globally +/// scroll, rotate or zoom everything that is drawn, +/// without having to transform every single entity. See the +/// documentation of sf::View for more details and sample pieces of +/// code about this class. +/// +/// On top of that, render targets are still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. When doing so, make sure that +/// OpenGL states are not messed up by calling the +/// pushGLStates/popGLStates functions. +/// +/// \see sf::RenderWindow, sf::RenderTexture, sf::View +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTexture.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTexture.hpp new file mode 100644 index 0000000..384e459 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderTexture.hpp @@ -0,0 +1,280 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERTEXTURE_HPP +#define SFML_RENDERTEXTURE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class RenderTextureImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Target for off-screen 2D rendering into a texture +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderTexture : public RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an empty, invalid render-texture. You must + /// call create to have a valid render-texture. + /// + /// \see create + /// + //////////////////////////////////////////////////////////// + RenderTexture(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~RenderTexture(); + + //////////////////////////////////////////////////////////// + /// \brief Create the render-texture + /// + /// Before calling this function, the render-texture is in + /// an invalid state, thus it is mandatory to call it before + /// doing anything with the render-texture. + /// The last parameter, \a depthBuffer, is useful if you want + /// to use the render-texture for 3D OpenGL rendering that requires + /// a depth-buffer. Otherwise it is unnecessary, and you should + /// leave this parameter to false (which is its default value). + /// + /// \param width Width of the render-texture + /// \param height Height of the render-texture + /// \param depthBuffer Do you want this render-texture to have a depth buffer? + /// + /// \return True if creation has been successful + /// + //////////////////////////////////////////////////////////// + bool create(unsigned int width, unsigned int height, bool depthBuffer = false); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable texture smoothing + /// + /// This function is similar to Texture::setSmooth. + /// This parameter is disabled by default. + /// + /// \param smooth True to enable smoothing, false to disable it + /// + /// \see isSmooth + /// + //////////////////////////////////////////////////////////// + void setSmooth(bool smooth); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the smooth filtering is enabled or not + /// + /// \return True if texture smoothing is enabled + /// + /// \see setSmooth + /// + //////////////////////////////////////////////////////////// + bool isSmooth() const; + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable texture repeating + /// + /// This function is similar to Texture::setRepeated. + /// This parameter is disabled by default. + /// + /// \param repeated True to enable repeating, false to disable it + /// + /// \see isRepeated + /// + //////////////////////////////////////////////////////////// + void setRepeated(bool repeated); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the texture is repeated or not + /// + /// \return True if texture is repeated + /// + /// \see setRepeated + /// + //////////////////////////////////////////////////////////// + bool isRepeated() const; + + //////////////////////////////////////////////////////////// + /// \brief Activate of deactivate the render-texture for rendering + /// + /// This function makes the render-texture's context current for + /// future OpenGL rendering operations (so you shouldn't care + /// about it if you're not doing direct OpenGL stuff). + /// Only one context can be current in a thread, so if you + /// want to draw OpenGL geometry to another render target + /// (like a RenderWindow) don't forget to activate it again. + /// + /// \param active True to activate, false to deactivate + /// + /// \return True if operation was successful, false otherwise + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active = true); + + //////////////////////////////////////////////////////////// + /// \brief Update the contents of the target texture + /// + /// This function updates the target texture with what + /// has been drawn so far. Like for windows, calling this + /// function is mandatory at the end of rendering. Not calling + /// it may leave the texture in an undefined state. + /// + //////////////////////////////////////////////////////////// + void display(); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the rendering region of the texture + /// + /// The returned value is the size that you passed to + /// the create function. + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only reference to the target texture + /// + /// After drawing to the render-texture and calling Display, + /// you can retrieve the updated texture using this function, + /// and draw it using a sprite (for example). + /// The internal sf::Texture of a render-texture is always the + /// same instance, so that it is possible to call this function + /// once and keep a reference to the texture even after it is + /// modified. + /// + /// \return Const reference to the texture + /// + //////////////////////////////////////////////////////////// + const Texture& getTexture() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// This function is called by the base class + /// everytime it's going to use OpenGL calls. + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::RenderTextureImpl* m_impl; ///< Platform/hardware specific implementation + Texture m_texture; ///< Target texture to draw on +}; + +} // namespace sf + + +#endif // SFML_RENDERTEXTURE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderTexture +/// \ingroup graphics +/// +/// sf::RenderTexture is the little brother of sf::RenderWindow. +/// It implements the same 2D drawing and OpenGL-related functions +/// (see their base class sf::RenderTarget for more details), +/// the difference is that the result is stored in an off-screen +/// texture rather than being show in a window. +/// +/// Rendering to a texture can be useful in a variety of situations: +/// \li precomputing a complex static texture (like a level's background from multiple tiles) +/// \li applying post-effects to the whole scene with shaders +/// \li creating a sprite from a 3D object rendered with OpenGL +/// \li etc. +/// +/// Usage example: +/// +/// \code +/// // Create a new render-window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Create a new render-texture +/// sf::RenderTexture texture; +/// if (!texture.create(500, 500)) +/// return -1; +/// +/// // The main loop +/// while (window.isOpen()) +/// { +/// // Event processing +/// // ... +/// +/// // Clear the whole texture with red color +/// texture.clear(sf::Color::Red); +/// +/// // Draw stuff to the texture +/// texture.draw(sprite); // sprite is a sf::Sprite +/// texture.draw(shape); // shape is a sf::Shape +/// texture.draw(text); // text is a sf::Text +/// +/// // We're done drawing to the texture +/// texture.display(); +/// +/// // Now we start rendering to the window, clear it first +/// window.clear(); +/// +/// // Draw the texture +/// sf::Sprite sprite(texture.getTexture()); +/// window.draw(sprite); +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +/// Like sf::RenderWindow, sf::RenderTexture is still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. If you need a depth buffer for +/// 3D rendering, don't forget to request it when calling RenderTexture::create. +/// +/// \see sf::RenderTarget, sf::RenderWindow, sf::View, sf::Texture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderWindow.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderWindow.hpp new file mode 100644 index 0000000..b069347 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/RenderWindow.hpp @@ -0,0 +1,266 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_RENDERWINDOW_HPP +#define SFML_RENDERWINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Window that can serve as a target for 2D drawing +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API RenderWindow : public Window, public RenderTarget +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor doesn't actually create the window, + /// use the other constructors or call "create" to do so. + /// + //////////////////////////////////////////////////////////// + RenderWindow(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a new window + /// + /// This constructor creates the window with the size and pixel + /// depth defined in \a mode. An optional style can be passed to + /// customize the look and behaviour of the window (borders, + /// title bar, resizable, closable, ...). + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. You shouldn't care about these + /// parameters for a regular usage of the graphics module. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + RenderWindow(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Construct the window from an existing control + /// + /// Use this constructor if you want to create an SFML + /// rendering area into an already existing control. + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. You shouldn't care about these + /// parameters for a regular usage of the graphics module. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + explicit RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Closes the window and free all the resources attached to it. + /// + //////////////////////////////////////////////////////////// + virtual ~RenderWindow(); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rendering region of the window + /// + /// The size doesn't include the titlebar and borders + /// of the window. + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + virtual Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Copy the current contents of the window to an image + /// + /// This is a slow operation, whose main purpose is to make + /// screenshots of the application. If you want to update an + /// image with the contents of the window and then use it for + /// drawing, you should rather use a sf::Texture and its + /// update(Window&) function. + /// You can also draw things directly to a texture with the + /// sf::RenderTexture class. + /// + /// \return Image containing the captured contents + /// + //////////////////////////////////////////////////////////// + Image capture() const; + +protected: + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been created + /// + /// This function is called so that derived classes can + /// perform their own specific initialization as soon as + /// the window is created. + /// + //////////////////////////////////////////////////////////// + virtual void onCreate(); + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been resized + /// + /// This function is called so that derived classes can + /// perform custom actions when the size of the window changes. + /// + //////////////////////////////////////////////////////////// + virtual void onResize(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Activate the target for rendering + /// + /// \param active True to make the target active, false to deactivate it + /// + /// \return True if the function succeeded + /// + //////////////////////////////////////////////////////////// + virtual bool activate(bool active); +}; + +} // namespace sf + + +#endif // SFML_RENDERWINDOW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::RenderWindow +/// \ingroup graphics +/// +/// sf::RenderWindow is the main class of the Graphics module. +/// It defines an OS window that can be painted using the other +/// classes of the graphics module. +/// +/// sf::RenderWindow is derived from sf::Window, thus it inherits +/// all its features: events, window management, OpenGL rendering, +/// etc. See the documentation of sf::Window for a more complete +/// description of all these features, as well as code examples. +/// +/// On top of that, sf::RenderWindow adds more features related to +/// 2D drawing with the graphics module (see its base class +/// sf::RenderTarget for more details). +/// Here is a typical rendering and event loop with a sf::RenderWindow: +/// +/// \code +/// // Declare and create a new render-window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Limit the framerate to 60 frames per second (this step is optional) +/// window.setFramerateLimit(60); +/// +/// // The main loop - ends as soon as the window is closed +/// while (window.isOpen()) +/// { +/// // Event processing +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// } +/// +/// // Clear the whole window before rendering a new frame +/// window.clear(); +/// +/// // Draw some graphical entities +/// window.draw(sprite); +/// window.draw(circle); +/// window.draw(text); +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +/// Like sf::Window, sf::RenderWindow is still able to render direct +/// OpenGL stuff. It is even possible to mix together OpenGL calls +/// and regular SFML drawing commands. +/// +/// \code +/// // Create the render window +/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL"); +/// +/// // Create a sprite and a text to display +/// sf::Sprite sprite; +/// sf::Text text; +/// ... +/// +/// // Perform OpenGL initializations +/// glMatrixMode(GL_PROJECTION); +/// ... +/// +/// // Start the rendering loop +/// while (window.isOpen()) +/// { +/// // Process events +/// ... +/// +/// // Draw a background sprite +/// window.pushGLStates(); +/// window.draw(sprite); +/// window.popGLStates(); +/// +/// // Draw a 3D object using OpenGL +/// glBegin(GL_QUADS); +/// glVertex3f(...); +/// ... +/// glEnd(); +/// +/// // Draw text on top of the 3D object +/// window.pushGLStates(); +/// window.draw(text); +/// window.popGLStates(); +/// +/// // Finally, display the rendered frame on screen +/// window.display(); +/// } +/// \endcode +/// +/// \see sf::Window, sf::RenderTarget, sf::RenderTexture, sf::View +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shader.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shader.hpp new file mode 100644 index 0000000..2fbbf6e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shader.hpp @@ -0,0 +1,635 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SHADER_HPP +#define SFML_SHADER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class InputStream; +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Shader class (vertex and fragment) +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Shader : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Types of shaders + /// + //////////////////////////////////////////////////////////// + enum Type + { + Vertex, ///< Vertex shader + Fragment ///< Fragment (pixel) shader + }; + + //////////////////////////////////////////////////////////// + /// \brief Special type/value that can be passed to setParameter, + /// and that represents the texture of the object being drawn + /// + //////////////////////////////////////////////////////////// + struct CurrentTextureType {}; + static CurrentTextureType CurrentTexture; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an invalid shader. + /// + //////////////////////////////////////////////////////////// + Shader(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Shader(); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a file + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source must be a text file containing a valid + /// shader in GLSL language. GLSL is a C-like language + /// dedicated to OpenGL shaders; you'll probably need to + /// read a good documentation for it before writing your + /// own shaders. + /// + /// \param filename Path of the vertex or fragment shader file to load + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from files + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The sources must be text files containing valid shaders + /// in GLSL language. GLSL is a C-like language dedicated to + /// OpenGL shaders; you'll probably need to read a good documentation + /// for it before writing your own shaders. + /// + /// \param vertexShaderFilename Path of the vertex shader file to load + /// \param fragmentShaderFilename Path of the fragment shader file to load + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromMemory, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a source code in memory + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source code must be a valid shader in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for + /// it before writing your own shaders. + /// + /// \param shader String containing the source code of the shader + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const std::string& shader, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from source codes in memory + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The sources must be valid shaders in GLSL language. GLSL is + /// a C-like language dedicated to OpenGL shaders; you'll + /// probably need to read a good documentation for it before + /// writing your own shaders. + /// + /// \param vertexShader String containing the source code of the vertex shader + /// \param fragmentShader String containing the source code of the fragment shader + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromStream + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader); + + //////////////////////////////////////////////////////////// + /// \brief Load either the vertex or fragment shader from a custom stream + /// + /// This function loads a single shader, either vertex or + /// fragment, identified by the second argument. + /// The source code must be a valid shader in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for it + /// before writing your own shaders. + /// + /// \param stream Source stream to read from + /// \param type Type of shader (vertex or fragment) + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& stream, Type type); + + //////////////////////////////////////////////////////////// + /// \brief Load both the vertex and fragment shaders from custom streams + /// + /// This function loads both the vertex and the fragment + /// shaders. If one of them fails to load, the shader is left + /// empty (the valid shader is unloaded). + /// The source codes must be valid shaders in GLSL language. + /// GLSL is a C-like language dedicated to OpenGL shaders; + /// you'll probably need to read a good documentation for + /// it before writing your own shaders. + /// + /// \param vertexShaderStream Source stream to read the vertex shader from + /// \param fragmentShaderStream Source stream to read the fragment shader from + /// + /// \return True if loading succeeded, false if it failed + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream); + + //////////////////////////////////////////////////////////// + /// \brief Change a float parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a float + /// (float GLSL type). + /// + /// Example: + /// \code + /// uniform float myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x Value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x); + + //////////////////////////////////////////////////////////// + /// \brief Change a 2-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2x1 vector + /// (vec2 GLSL type). + /// + /// Example: + /// \code + /// uniform vec2 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Change a 3-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 3x1 vector + /// (vec3 GLSL type). + /// + /// Example: + /// \code + /// uniform vec3 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// \param z Third component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y, float z); + + //////////////////////////////////////////////////////////// + /// \brief Change a 4-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x1 vector + /// (vec4 GLSL type). + /// + /// Example: + /// \code + /// uniform vec4 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param x First component of the value to assign + /// \param y Second component of the value to assign + /// \param z Third component of the value to assign + /// \param w Fourth component of the value to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, float x, float y, float z, float w); + + //////////////////////////////////////////////////////////// + /// \brief Change a 2-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2x1 vector + /// (vec2 GLSL type). + /// + /// Example: + /// \code + /// uniform vec2 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", sf::Vector2f(5.2f, 6.0f)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param vector Vector to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Vector2f& vector); + + //////////////////////////////////////////////////////////// + /// \brief Change a 3-components vector parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 3x1 vector + /// (vec3 GLSL type). + /// + /// Example: + /// \code + /// uniform vec3 myparam; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param vector Vector to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Vector3f& vector); + + //////////////////////////////////////////////////////////// + /// \brief Change a color parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x1 vector + /// (vec4 GLSL type). + /// + /// It is important to note that the components of the color are + /// normalized before being passed to the shader. Therefore, + /// they are converted from range [0 .. 255] to range [0 .. 1]. + /// For example, a sf::Color(255, 125, 0, 255) will be transformed + /// to a vec4(1.0, 0.5, 0.0, 1.0) in the shader. + /// + /// Example: + /// \code + /// uniform vec4 color; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("color", sf::Color(255, 128, 0, 255)); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param color Color to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Change a matrix parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 4x4 matrix + /// (mat4 GLSL type). + /// + /// Example: + /// \code + /// uniform mat4 matrix; // this is the variable in the shader + /// \endcode + /// \code + /// sf::Transform transform; + /// transform.translate(5, 10); + /// shader.setParameter("matrix", transform); + /// \endcode + /// + /// \param name Name of the parameter in the shader + /// \param transform Transform to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const sf::Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Change a texture parameter of the shader + /// + /// \a name is the name of the variable to change in the shader. + /// The corresponding parameter in the shader must be a 2D texture + /// (sampler2D GLSL type). + /// + /// Example: + /// \code + /// uniform sampler2D the_texture; // this is the variable in the shader + /// \endcode + /// \code + /// sf::Texture texture; + /// ... + /// shader.setParameter("the_texture", texture); + /// \endcode + /// It is important to note that \a texture must remain alive as long + /// as the shader uses it, no copy is made internally. + /// + /// To use the texture of the object being draw, which cannot be + /// known in advance, you can pass the special value + /// sf::Shader::CurrentTexture: + /// \code + /// shader.setParameter("the_texture", sf::Shader::CurrentTexture). + /// \endcode + /// + /// \param name Name of the texture in the shader + /// \param texture Texture to assign + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, const Texture& texture); + + //////////////////////////////////////////////////////////// + /// \brief Change a texture parameter of the shader + /// + /// This overload maps a shader texture variable to the + /// texture of the object being drawn, which cannot be + /// known in advance. The second argument must be + /// sf::Shader::CurrentTexture. + /// The corresponding parameter in the shader must be a 2D texture + /// (sampler2D GLSL type). + /// + /// Example: + /// \code + /// uniform sampler2D current; // this is the variable in the shader + /// \endcode + /// \code + /// shader.setParameter("current", sf::Shader::CurrentTexture); + /// \endcode + /// + /// \param name Name of the texture in the shader + /// + //////////////////////////////////////////////////////////// + void setParameter(const std::string& name, CurrentTextureType); + + //////////////////////////////////////////////////////////// + /// \brief Bind a shader for rendering + /// + /// This function is not part of the graphics API, it mustn't be + /// used when drawing SFML entities. It must be used only if you + /// mix sf::Shader with OpenGL code. + /// + /// \code + /// sf::Shader s1, s2; + /// ... + /// sf::Shader::bind(&s1); + /// // draw OpenGL stuff that use s1... + /// sf::Shader::bind(&s2); + /// // draw OpenGL stuff that use s2... + /// sf::Shader::bind(NULL); + /// // draw OpenGL stuff that use no shader... + /// \endcode + /// + /// \param shader Shader to bind, can be null to use no shader + /// + //////////////////////////////////////////////////////////// + static void bind(const Shader* shader); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the system supports shaders + /// + /// This function should always be called before using + /// the shader features. If it returns false, then + /// any attempt to use sf::Shader will fail. + /// + /// \return True if shaders are supported, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isAvailable(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Compile the shader(s) and create the program + /// + /// If one of the arguments is NULL, the corresponding shader + /// is not created. + /// + /// \param vertexShaderCode Source code of the vertex shader + /// \param fragmentShaderCode Source code of the fragment shader + /// + /// \return True on success, false if any error happened + /// + //////////////////////////////////////////////////////////// + bool compile(const char* vertexShaderCode, const char* fragmentShaderCode); + + //////////////////////////////////////////////////////////// + /// \brief Bind all the textures used by the shader + /// + /// This function each texture to a different unit, and + /// updates the corresponding variables in the shader accordingly. + /// + //////////////////////////////////////////////////////////// + void bindTextures() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the location ID of a shader parameter + /// + /// \param name Name of the parameter to search + /// + /// \return Location ID of the parameter, or -1 if not found + /// + //////////////////////////////////////////////////////////// + int getParamLocation(const std::string& name); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map TextureTable; + typedef std::map ParamTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int m_shaderProgram; ///< OpenGL identifier for the program + int m_currentTexture; ///< Location of the current texture in the shader + TextureTable m_textures; ///< Texture variables in the shader, mapped to their location + ParamTable m_params; ///< Parameters location cache +}; + +} // namespace sf + + +#endif // SFML_SHADER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Shader +/// \ingroup graphics +/// +/// Shaders are programs written using a specific language, +/// executed directly by the graphics card and allowing +/// to apply real-time operations to the rendered entities. +/// +/// There are two kinds of shaders: +/// \li Vertex shaders, that process vertices +/// \li Fragment (pixel) shaders, that process pixels +/// +/// A sf::Shader can be composed of either a vertex shader +/// alone, a fragment shader alone, or both combined +/// (see the variants of the load functions). +/// +/// Shaders are written in GLSL, which is a C-like +/// language dedicated to OpenGL shaders. You'll probably +/// need to learn its basics before writing your own shaders +/// for SFML. +/// +/// Like any C/C++ program, a shader has its own variables +/// that you can set from your C++ application. sf::Shader +/// handles 5 different types of variables: +/// \li floats +/// \li vectors (2, 3 or 4 components) +/// \li colors +/// \li textures +/// \li transforms (matrices) +/// +/// The value of the variables can be changed at any time +/// with the various overloads of the setParameter function: +/// \code +/// shader.setParameter("offset", 2.f); +/// shader.setParameter("point", 0.5f, 0.8f, 0.3f); +/// shader.setParameter("color", sf::Color(128, 50, 255)); +/// shader.setParameter("matrix", transform); // transform is a sf::Transform +/// shader.setParameter("overlay", texture); // texture is a sf::Texture +/// shader.setParameter("texture", sf::Shader::CurrentTexture); +/// \endcode +/// +/// The special Shader::CurrentTexture argument maps the +/// given texture variable to the current texture of the +/// object being drawn (which cannot be known in advance). +/// +/// To apply a shader to a drawable, you must pass it as an +/// additional parameter to the Draw function: +/// \code +/// window.draw(sprite, &shader); +/// \endcode +/// +/// ... which is in fact just a shortcut for this: +/// \code +/// sf::RenderStates states; +/// states.shader = &shader; +/// window.draw(sprite, states); +/// \endcode +/// +/// In the code above we pass a pointer to the shader, because it may +/// be null (which means "no shader"). +/// +/// Shaders can be used on any drawable, but some combinations are +/// not interesting. For example, using a vertex shader on a sf::Sprite +/// is limited because there are only 4 vertices, the sprite would +/// have to be subdivided in order to apply wave effects. +/// Another bad example is a fragment shader with sf::Text: the texture +/// of the text is not the actual text that you see on screen, it is +/// a big texture containing all the characters of the font in an +/// arbitrary order; thus, texture lookups on pixels other than the +/// current one may not give you the expected result. +/// +/// Shaders can also be used to apply global post-effects to the +/// current contents of the target (like the old sf::PostFx class +/// in SFML 1). This can be done in two different ways: +/// \li draw everything to a sf::RenderTexture, then draw it to +/// the main target using the shader +/// \li draw everything directly to the main target, then use +/// sf::Texture::update(Window&) to copy its contents to a texture +/// and draw it to the main target using the shader +/// +/// The first technique is more optimized because it doesn't involve +/// retrieving the target's pixels to system memory, but the +/// second one doesn't impact the rendering process and can be +/// easily inserted anywhere without impacting all the code. +/// +/// Like sf::Texture that can be used as a raw OpenGL texture, +/// sf::Shader can also be used directly as a raw shader for +/// custom OpenGL geometry. +/// \code +/// sf::Shader::bind(&shader); +/// ... render OpenGL geometry ... +/// sf::Shader::bind(NULL); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shape.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shape.hpp new file mode 100644 index 0000000..bc38775 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Shape.hpp @@ -0,0 +1,345 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SHAPE_HPP +#define SFML_SHAPE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class for textured shapes with outline +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Shape : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Shape(); + + //////////////////////////////////////////////////////////// + /// \brief Change the source texture of the shape + /// + /// The \a texture argument refers to a texture that must + /// exist as long as the shape uses it. Indeed, the shape + /// doesn't store its own copy of the texture, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the source texture is destroyed and the shape tries to + /// use it, the behaviour is undefined. + /// \a texture can be NULL to disable texturing. + /// If \a resetRect is true, the TextureRect property of + /// the shape is automatically adjusted to the size of the new + /// texture. If it is false, the texture rect is left unchanged. + /// + /// \param texture New texture + /// \param resetRect Should the texture rect be reset to the size of the new texture? + /// + /// \see getTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + void setTexture(const Texture* texture, bool resetRect = false); + + //////////////////////////////////////////////////////////// + /// \brief Set the sub-rectangle of the texture that the shape will display + /// + /// The texture rect is useful when you don't want to display + /// the whole texture, but rather a part of it. + /// By default, the texture rect covers the entire texture. + /// + /// \param rect Rectangle defining the region of the texture to display + /// + /// \see getTextureRect, setTexture + /// + //////////////////////////////////////////////////////////// + void setTextureRect(const IntRect& rect); + + //////////////////////////////////////////////////////////// + /// \brief Set the fill color of the shape + /// + /// This color is modulated (multiplied) with the shape's + /// texture if any. It can be used to colorize the shape, + /// or change its global opacity. + /// You can use sf::Color::Transparent to make the inside of + /// the shape transparent, and have the outline alone. + /// By default, the shape's fill color is opaque white. + /// + /// \param color New color of the shape + /// + /// \see getFillColor, setOutlineColor + /// + //////////////////////////////////////////////////////////// + void setFillColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Set the outline color of the shape + /// + /// By default, the shape's outline color is opaque white. + /// + /// \param color New outline color of the shape + /// + /// \see getOutlineColor, setFillColor + /// + //////////////////////////////////////////////////////////// + void setOutlineColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Set the thickness of the shape's outline + /// + /// Note that negative values are allowed (so that the outline + /// expands towards the center of the shape), and using zero + /// disables the outline. + /// By default, the outline thickness is 0. + /// + /// \param thickness New outline thickness + /// + /// \see getOutlineThickness + /// + //////////////////////////////////////////////////////////// + void setOutlineThickness(float thickness); + + //////////////////////////////////////////////////////////// + /// \brief Get the source texture of the shape + /// + /// If the shape has no source texture, a NULL pointer is returned. + /// The returned pointer is const, which means that you can't + /// modify the texture when you retrieve it with this function. + /// + /// \return Pointer to the shape's texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + const Texture* getTexture() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sub-rectangle of the texture displayed by the shape + /// + /// \return Texture rectangle of the shape + /// + /// \see setTextureRect + /// + //////////////////////////////////////////////////////////// + const IntRect& getTextureRect() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the fill color of the shape + /// + /// \return Fill color of the shape + /// + /// \see setFillColor + /// + //////////////////////////////////////////////////////////// + const Color& getFillColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the outline color of the shape + /// + /// \return Outline color of the shape + /// + /// \see setOutlineColor + /// + //////////////////////////////////////////////////////////// + const Color& getOutlineColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the outline thickness of the shape + /// + /// \return Outline thickness of the shape + /// + /// \see setOutlineThickness + /// + //////////////////////////////////////////////////////////// + float getOutlineThickness() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the total number of points of the shape + /// + /// \return Number of points of the shape + /// + /// \see getPoint + /// + //////////////////////////////////////////////////////////// + virtual unsigned int getPointCount() const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get a point of the shape + /// + /// The result is undefined if \a index is out of the valid range. + /// + /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] + /// + /// \return Index-th point of the shape + /// + /// \see getPointCount + /// + //////////////////////////////////////////////////////////// + virtual Vector2f getPoint(unsigned int index) const = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Shape(); + + //////////////////////////////////////////////////////////// + /// \brief Recompute the internal geometry of the shape + /// + /// This function must be called by the derived class everytime + /// the shape's points change (ie. the result of either + /// getPointCount or getPoint is different). + /// + //////////////////////////////////////////////////////////// + void update(); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the shape to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the fill vertices' color + /// + //////////////////////////////////////////////////////////// + void updateFillColors(); + + //////////////////////////////////////////////////////////// + /// \brief Update the fill vertices' texture coordinates + /// + //////////////////////////////////////////////////////////// + void updateTexCoords(); + + //////////////////////////////////////////////////////////// + /// \brief Update the outline vertices' position + /// + //////////////////////////////////////////////////////////// + void updateOutline(); + + //////////////////////////////////////////////////////////// + /// \brief Update the outline vertices' color + /// + //////////////////////////////////////////////////////////// + void updateOutlineColors(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + const Texture* m_texture; ///< Texture of the shape + IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display + Color m_fillColor; ///< Fill color + Color m_outlineColor; ///< Outline color + float m_outlineThickness; ///< Thickness of the shape's outline + VertexArray m_vertices; ///< Vertex array containing the fill geometry + VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry + FloatRect m_insideBounds; ///< Bounding rectangle of the inside (fill) + FloatRect m_bounds; ///< Bounding rectangle of the whole shape (outline + fill) +}; + +} // namespace sf + + +#endif // SFML_SHAPE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Shape +/// \ingroup graphics +/// +/// sf::Shape is a drawable class that allows to define and +/// display a custom convex shape on a render target. +/// It's only an abstract base, it needs to be specialized for +/// concrete types of shapes (circle, rectangle, convex polygon, +/// star, ...). +/// +/// In addition to the attributes provided by the specialized +/// shape classes, a shape always has the following attributes: +/// \li a texture +/// \li a texture rectangle +/// \li a fill color +/// \li an outline color +/// \li an outline thickness +/// +/// Each feature is optional, and can be disabled easily: +/// \li the texture can be null +/// \li the fill/outline colors can be sf::Color::Transparent +/// \li the outline thickness can be zero +/// +/// You can write your own derived shape class, there are only +/// two virtual functions to override: +/// \li getPointCount must return the number of points of the shape +/// \li getPoint must return the points of the shape +/// +/// \see sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Sprite.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Sprite.hpp new file mode 100644 index 0000000..954881d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Sprite.hpp @@ -0,0 +1,277 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SPRITE_HPP +#define SFML_SPRITE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +class Texture; + +//////////////////////////////////////////////////////////// +/// \brief Drawable representation of a texture, with its +/// own transformations, color, etc. +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Sprite : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty sprite with no source texture. + /// + //////////////////////////////////////////////////////////// + Sprite(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sprite from a source texture + /// + /// \param texture Source texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + explicit Sprite(const Texture& texture); + + //////////////////////////////////////////////////////////// + /// \brief Construct the sprite from a sub-rectangle of a source texture + /// + /// \param texture Source texture + /// \param rectangle Sub-rectangle of the texture to assign to the sprite + /// + /// \see setTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + Sprite(const Texture& texture, const IntRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Change the source texture of the sprite + /// + /// The \a texture argument refers to a texture that must + /// exist as long as the sprite uses it. Indeed, the sprite + /// doesn't store its own copy of the texture, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the source texture is destroyed and the sprite tries to + /// use it, the behaviour is undefined. + /// If \a resetRect is true, the TextureRect property of + /// the sprite is automatically adjusted to the size of the new + /// texture. If it is false, the texture rect is left unchanged. + /// + /// \param texture New texture + /// \param resetRect Should the texture rect be reset to the size of the new texture? + /// + /// \see getTexture, setTextureRect + /// + //////////////////////////////////////////////////////////// + void setTexture(const Texture& texture, bool resetRect = false); + + //////////////////////////////////////////////////////////// + /// \brief Set the sub-rectangle of the texture that the sprite will display + /// + /// The texture rect is useful when you don't want to display + /// the whole texture, but rather a part of it. + /// By default, the texture rect covers the entire texture. + /// + /// \param rectangle Rectangle defining the region of the texture to display + /// + /// \see getTextureRect, setTexture + /// + //////////////////////////////////////////////////////////// + void setTextureRect(const IntRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Set the global color of the sprite + /// + /// This color is modulated (multiplied) with the sprite's + /// texture. It can be used to colorize the sprite, or change + /// its global opacity. + /// By default, the sprite's color is opaque white. + /// + /// \param color New color of the sprite + /// + /// \see getColor + /// + //////////////////////////////////////////////////////////// + void setColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the source texture of the sprite + /// + /// If the sprite has no source texture, a NULL pointer is returned. + /// The returned pointer is const, which means that you can't + /// modify the texture when you retrieve it with this function. + /// + /// \return Pointer to the sprite's texture + /// + /// \see setTexture + /// + //////////////////////////////////////////////////////////// + const Texture* getTexture() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the sub-rectangle of the texture displayed by the sprite + /// + /// \return Texture rectangle of the sprite + /// + /// \see setTextureRect + /// + //////////////////////////////////////////////////////////// + const IntRect& getTextureRect() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global color of the sprite + /// + /// \return Global color of the sprite + /// + /// \see setColor + /// + //////////////////////////////////////////////////////////// + const Color& getColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the sprite to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the vertices' positions + /// + //////////////////////////////////////////////////////////// + void updatePositions(); + + //////////////////////////////////////////////////////////// + /// \brief Update the vertices' texture coordinates + /// + //////////////////////////////////////////////////////////// + void updateTexCoords(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vertex m_vertices[4]; ///< Vertices defining the sprite's geometry + const Texture* m_texture; ///< Texture of the sprite + IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display +}; + +} // namespace sf + + +#endif // SFML_SPRITE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Sprite +/// \ingroup graphics +/// +/// sf::Sprite is a drawable class that allows to easily display +/// a texture (or a part of it) on a render target. +/// +/// It inherits all the functions from sf::Transformable: +/// position, rotation, scale, origin. It also adds sprite-specific +/// properties such as the texture to use, the part of it to display, +/// and some convenience functions to change the overall color of the +/// sprite, or to get its bounding rectangle. +/// +/// sf::Sprite works in combination with the sf::Texture class, which +/// loads and provides the pixel data of a given texture. +/// +/// The separation of sf::Sprite and sf::Texture allows more flexibility +/// and better performances: indeed a sf::Texture is a heavy resource, +/// and any operation on it is slow (often too slow for real-time +/// applications). On the other side, a sf::Sprite is a lightweight +/// object which can use the pixel data of a sf::Texture and draw +/// it with its own transformation/color/blending attributes. +/// +/// It is important to note that the sf::Sprite instance doesn't +/// copy the texture that it uses, it only keeps a reference to it. +/// Thus, a sf::Texture must not be destroyed while it is +/// used by a sf::Sprite (i.e. never write a function that +/// uses a local sf::Texture instance for creating a sprite). +/// +/// Usage example: +/// \code +/// // Declare and load a texture +/// sf::Texture texture; +/// texture.loadFromFile("texture.png"); +/// +/// // Create a sprite +/// sf::Sprite sprite; +/// sprite.setTexture(texture); +/// sprite.setTextureRect(sf::IntRect(10, 10, 50, 30)); +/// sprite.setColor(sf::Color(255, 255, 255, 200)); +/// sprite.setPosition(100, 25); +/// +/// // Draw it +/// window.draw(sprite); +/// \endcode +/// +/// \see sf::Texture, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Text.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Text.hpp new file mode 100644 index 0000000..04abd24 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Text.hpp @@ -0,0 +1,351 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TEXT_HPP +#define SFML_TEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Graphical text that can be drawn to a render target +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Text : public Drawable, public Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the string drawing styles + /// + //////////////////////////////////////////////////////////// + enum Style + { + Regular = 0, ///< Regular characters, no style + Bold = 1 << 0, ///< Bold characters + Italic = 1 << 1, ///< Italic characters + Underlined = 1 << 2 ///< Underlined characters + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty text. + /// + //////////////////////////////////////////////////////////// + Text(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the text from a string, font and size + /// + /// \param string Text assigned to the string + /// \param font Font used to draw the string + /// \param characterSize Base size of characters, in pixels + /// + //////////////////////////////////////////////////////////// + Text(const String& string, const Font& font, unsigned int characterSize = 30); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's string + /// + /// The \a string argument is a sf::String, which can + /// automatically be constructed from standard string types. + /// So, the following calls are all valid: + /// \code + /// text.setString("hello"); + /// text.setString(L"hello"); + /// text.setString(std::string("hello")); + /// text.setString(std::wstring(L"hello")); + /// \endcode + /// A text's string is empty by default. + /// + /// \param string New string + /// + /// \see getString + /// + //////////////////////////////////////////////////////////// + void setString(const String& string); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's font + /// + /// The \a font argument refers to a font that must + /// exist as long as the text uses it. Indeed, the text + /// doesn't store its own copy of the font, but rather keeps + /// a pointer to the one that you passed to this function. + /// If the font is destroyed and the text tries to + /// use it, the behaviour is undefined. + /// + /// \param font New font + /// + /// \see getFont + /// + //////////////////////////////////////////////////////////// + void setFont(const Font& font); + + //////////////////////////////////////////////////////////// + /// \brief Set the character size + /// + /// The default size is 30. + /// + /// \param size New character size, in pixels + /// + /// \see getCharacterSize + /// + //////////////////////////////////////////////////////////// + void setCharacterSize(unsigned int size); + + //////////////////////////////////////////////////////////// + /// \brief Set the text's style + /// + /// You can pass a combination of one or more styles, for + /// example sf::Text::Bold | sf::Text::Italic. + /// The default style is sf::Text::Regular. + /// + /// \param style New style + /// + /// \see getStyle + /// + //////////////////////////////////////////////////////////// + void setStyle(Uint32 style); + + //////////////////////////////////////////////////////////// + /// \brief Set the global color of the text + /// + /// By default, the text's color is opaque white. + /// + /// \param color New color of the text + /// + /// \see getColor + /// + //////////////////////////////////////////////////////////// + void setColor(const Color& color); + + //////////////////////////////////////////////////////////// + /// \brief Get the text's string + /// + /// The returned string is a sf::String, which can automatically + /// be converted to standard string types. So, the following + /// lines of code are all valid: + /// \code + /// sf::String s1 = text.getString(); + /// std::string s2 = text.getString(); + /// std::wstring s3 = text.getString(); + /// \endcode + /// + /// \return Text's string + /// + /// \see setString + /// + //////////////////////////////////////////////////////////// + const String& getString() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the text's font + /// + /// If the text has no font attached, a NULL pointer is returned. + /// The returned reference is const, which means that you + /// cannot modify the font when you get it from this function. + /// + /// \return Pointer to the text's font + /// + /// \see setFont + /// + //////////////////////////////////////////////////////////// + const Font* getFont() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the character size + /// + /// \return Size of the characters, in pixels + /// + /// \see setCharacterSize + /// + //////////////////////////////////////////////////////////// + unsigned int getCharacterSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the text's style + /// + /// \return Text's style + /// + /// \see setStyle + /// + //////////////////////////////////////////////////////////// + Uint32 getStyle() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global color of the text + /// + /// \return Global color of the text + /// + /// \see setColor + /// + //////////////////////////////////////////////////////////// + const Color& getColor() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the position of the \a index-th character + /// + /// This function computes the visual position of a character + /// from its index in the string. The returned position is + /// in global coordinates (translation, rotation, scale and + /// origin are applied). + /// If \a index is out of range, the position of the end of + /// the string is returned. + /// + /// \param index Index of the character + /// + /// \return Position of the character + /// + //////////////////////////////////////////////////////////// + Vector2f findCharacterPos(std::size_t index) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the local bounding rectangle of the entity + /// + /// The returned rectangle is in local coordinates, which means + /// that it ignores the transformations (translation, rotation, + /// scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// entity in the entity's coordinate system. + /// + /// \return Local bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getLocalBounds() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the global bounding rectangle of the entity + /// + /// The returned rectangle is in global coordinates, which means + /// that it takes in account the transformations (translation, + /// rotation, scale, ...) that are applied to the entity. + /// In other words, this function returns the bounds of the + /// sprite in the global 2D world's coordinate system. + /// + /// \return Global bounding rectangle of the entity + /// + //////////////////////////////////////////////////////////// + FloatRect getGlobalBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the text to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + + //////////////////////////////////////////////////////////// + /// \brief Update the text's geometry + /// + //////////////////////////////////////////////////////////// + void updateGeometry(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + String m_string; ///< String to display + const Font* m_font; ///< Font used to display the string + unsigned int m_characterSize; ///< Base size of characters, in pixels + Uint32 m_style; ///< Text style (see Style enum) + Color m_color; ///< Text color + VertexArray m_vertices; ///< Vertex array containing the text's geometry + FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates) +}; + +} // namespace sf + + +#endif // SFML_TEXT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Text +/// \ingroup graphics +/// +/// sf::Text is a drawable class that allows to easily display +/// some text with custom style and color on a render target. +/// +/// It inherits all the functions from sf::Transformable: +/// position, rotation, scale, origin. It also adds text-specific +/// properties such as the font to use, the character size, +/// the font style (bold, italic, underlined), the global color +/// and the text to display of course. +/// It also provides convenience functions to calculate the +/// graphical size of the text, or to get the global position +/// of a given character. +/// +/// sf::Text works in combination with the sf::Font class, which +/// loads and provides the glyphs (visual characters) of a given font. +/// +/// The separation of sf::Font and sf::Text allows more flexibility +/// and better performances: indeed a sf::Font is a heavy resource, +/// and any operation on it is slow (often too slow for real-time +/// applications). On the other side, a sf::Text is a lightweight +/// object which can combine the glyphs data and metrics of a sf::Font +/// to display any text on a render target. +/// +/// It is important to note that the sf::Text instance doesn't +/// copy the font that it uses, it only keeps a reference to it. +/// Thus, a sf::Font must not be destructed while it is +/// used by a sf::Text (i.e. never write a function that +/// uses a local sf::Font instance for creating a text). +/// +/// Usage example: +/// \code +/// // Declare and load a font +/// sf::Font font; +/// font.loadFromFile("arial.ttf"); +/// +/// // Create a text +/// sf::Text text("hello", font); +/// text.setCharacterSize(30); +/// text.setStyle(sf::Text::Bold); +/// text.setColor(sf::Color::Red); +/// +/// // Draw it +/// window.draw(text); +/// \endcode +/// +/// \see sf::Font, sf::Transformable +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Texture.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Texture.hpp new file mode 100644 index 0000000..ba61f54 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Texture.hpp @@ -0,0 +1,602 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TEXTURE_HPP +#define SFML_TEXTURE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class Window; +class RenderTarget; +class RenderTexture; +class InputStream; + +//////////////////////////////////////////////////////////// +/// \brief Image living on the graphics card that can be used for drawing +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Texture : GlResource +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Types of texture coordinates that can be used for rendering + /// + //////////////////////////////////////////////////////////// + enum CoordinateType + { + Normalized, ///< Texture coordinates in range [0 .. 1] + Pixels ///< Texture coordinates in range [0 .. size] + }; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty texture. + /// + //////////////////////////////////////////////////////////// + Texture(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy instance to copy + /// + //////////////////////////////////////////////////////////// + Texture(const Texture& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Texture(); + + //////////////////////////////////////////////////////////// + /// \brief Create the texture + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param width Width of the texture + /// \param height Height of the texture + /// + /// \return True if creation was successful + /// + //////////////////////////////////////////////////////////// + bool create(unsigned int width, unsigned int height); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a file on disk + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromFile(filename); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param filename Path of the image file to load + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromMemory, loadFromStream, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromFile(const std::string& filename, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a file in memory + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromMemory(data, size); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param data Pointer to the file data in memory + /// \param size Size of the data to load, in bytes + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromStream, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from a custom stream + /// + /// This function is a shortcut for the following code: + /// \code + /// sf::Image image; + /// image.loadFromStream(stream); + /// texture.loadFromImage(image, area); + /// \endcode + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param stream Source stream to read from + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory, loadFromImage + /// + //////////////////////////////////////////////////////////// + bool loadFromStream(sf::InputStream& stream, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Load the texture from an image + /// + /// The \a area argument can be used to load only a sub-rectangle + /// of the whole image. If you want the entire image then leave + /// the default value (which is an empty IntRect). + /// If the \a area rectangle crosses the bounds of the image, it + /// is adjusted to fit the image size. + /// + /// The maximum size for a texture depends on the graphics + /// driver and can be retrieved with the getMaximumSize function. + /// + /// If this function fails, the texture is left unchanged. + /// + /// \param image Image to load into the texture + /// \param area Area of the image to load + /// + /// \return True if loading was successful + /// + /// \see loadFromFile, loadFromMemory + /// + //////////////////////////////////////////////////////////// + bool loadFromImage(const Image& image, const IntRect& area = IntRect()); + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the texture + /// + /// \return Size in pixels + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Copy the texture pixels to an image + /// + /// This function performs a slow operation that downloads + /// the texture's pixels from the graphics card and copies + /// them to a new image, potentially applying transformations + /// to pixels if necessary (texture may be padded or flipped). + /// + /// \return Image containing the texture's pixels + /// + /// \see loadFromImage + /// + //////////////////////////////////////////////////////////// + Image copyToImage() const; + + //////////////////////////////////////////////////////////// + /// \brief Update the whole texture from an array of pixels + /// + /// The \a pixel array is assumed to have the same size as + /// the \a area rectangle, and to contain 32-bits RGBA pixels. + /// + /// No additional check is performed on the size of the pixel + /// array, passing invalid arguments will lead to an undefined + /// behaviour. + /// + /// This function does nothing if \a pixels is null or if the + /// texture was not previously created. + /// + /// \param pixels Array of pixels to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from an array of pixels + /// + /// The size of the \a pixel array must match the \a width and + /// \a height arguments, and it must contain 32-bits RGBA pixels. + /// + /// No additional check is performed on the size of the pixel + /// array or the bounds of the area to update, passing invalid + /// arguments will lead to an undefined behaviour. + /// + /// This function does nothing if \a pixels is null or if the + /// texture was not previously created. + /// + /// \param pixels Array of pixels to copy to the texture + /// \param width Width of the pixel region contained in \a pixels + /// \param height Height of the pixel region contained in \a pixels + /// \param x X offset in the texture where to copy the source pixels + /// \param y Y offset in the texture where to copy the source pixels + /// + //////////////////////////////////////////////////////////// + void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Update the texture from an image + /// + /// Although the source image can be smaller than the texture, + /// this function is usually used for updating the whole texture. + /// The other overload, which has (x, y) additional arguments, + /// is more convenient for updating a sub-area of the texture. + /// + /// No additional check is performed on the size of the image, + /// passing an image bigger than the texture will lead to an + /// undefined behaviour. + /// + /// This function does nothing if the texture was not + /// previously created. + /// + /// \param image Image to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Image& image); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from an image + /// + /// No additional check is performed on the size of the image, + /// passing an invalid combination of image size and offset + /// will lead to an undefined behaviour. + /// + /// This function does nothing if the texture was not + /// previously created. + /// + /// \param image Image to copy to the texture + /// \param x X offset in the texture where to copy the source image + /// \param y Y offset in the texture where to copy the source image + /// + //////////////////////////////////////////////////////////// + void update(const Image& image, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Update the texture from the contents of a window + /// + /// Although the source window can be smaller than the texture, + /// this function is usually used for updating the whole texture. + /// The other overload, which has (x, y) additional arguments, + /// is more convenient for updating a sub-area of the texture. + /// + /// No additional check is performed on the size of the window, + /// passing a window bigger than the texture will lead to an + /// undefined behaviour. + /// + /// This function does nothing if either the texture or the window + /// was not previously created. + /// + /// \param window Window to copy to the texture + /// + //////////////////////////////////////////////////////////// + void update(const Window& window); + + //////////////////////////////////////////////////////////// + /// \brief Update a part of the texture from the contents of a window + /// + /// No additional check is performed on the size of the window, + /// passing an invalid combination of window size and offset + /// will lead to an undefined behaviour. + /// + /// This function does nothing if either the texture or the window + /// was not previously created. + /// + /// \param window Window to copy to the texture + /// \param x X offset in the texture where to copy the source window + /// \param y Y offset in the texture where to copy the source window + /// + //////////////////////////////////////////////////////////// + void update(const Window& window, unsigned int x, unsigned int y); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable the smooth filter + /// + /// When the filter is activated, the texture appears smoother + /// so that pixels are less noticeable. However if you want + /// the texture to look exactly the same as its source file, + /// you should leave it disabled. + /// The smooth filter is disabled by default. + /// + /// \param smooth True to enable smoothing, false to disable it + /// + /// \see isSmooth + /// + //////////////////////////////////////////////////////////// + void setSmooth(bool smooth); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the smooth filter is enabled or not + /// + /// \return True if smoothing is enabled, false if it is disabled + /// + /// \see setSmooth + /// + //////////////////////////////////////////////////////////// + bool isSmooth() const; + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable repeating + /// + /// Repeating is involved when using texture coordinates + /// outside the texture rectangle [0, 0, width, height]. + /// In this case, if repeat mode is enabled, the whole texture + /// will be repeated as many times as needed to reach the + /// coordinate (for example, if the X texture coordinate is + /// 3 * width, the texture will be repeated 3 times). + /// If repeat mode is disabled, the "extra space" will instead + /// be filled with border pixels. + /// Warning: on very old graphics cards, white pixels may appear + /// when the texture is repeated. With such cards, repeat mode + /// can be used reliably only if the texture has power-of-two + /// dimensions (such as 256x128). + /// Repeating is disabled by default. + /// + /// \param repeated True to repeat the texture, false to disable repeating + /// + /// \see isRepeated + /// + //////////////////////////////////////////////////////////// + void setRepeated(bool repeated); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the texture is repeated or not + /// + /// \return True if repeat mode is enabled, false if it is disabled + /// + /// \see setRepeated + /// + //////////////////////////////////////////////////////////// + bool isRepeated() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + Texture& operator =(const Texture& right); + + //////////////////////////////////////////////////////////// + /// \brief Bind a texture for rendering + /// + /// This function is not part of the graphics API, it mustn't be + /// used when drawing SFML entities. It must be used only if you + /// mix sf::Texture with OpenGL code. + /// + /// \code + /// sf::Texture t1, t2; + /// ... + /// sf::Texture::bind(&t1); + /// // draw OpenGL stuff that use t1... + /// sf::Texture::bind(&t2); + /// // draw OpenGL stuff that use t2... + /// sf::Texture::bind(NULL); + /// // draw OpenGL stuff that use no texture... + /// \endcode + /// + /// The \a coordinateType argument controls how texture + /// coordinates will be interpreted. If Normalized (the default), they + /// must be in range [0 .. 1], which is the default way of handling + /// texture coordinates with OpenGL. If Pixels, they must be given + /// in pixels (range [0 .. size]). This mode is used internally by + /// the graphics classes of SFML, it makes the definition of texture + /// coordinates more intuitive for the high-level API, users don't need + /// to compute normalized values. + /// + /// \param texture Pointer to the texture to bind, can be null to use no texture + /// \param coordinateType Type of texture coordinates to use + /// + //////////////////////////////////////////////////////////// + static void bind(const Texture* texture, CoordinateType coordinateType = Normalized); + + //////////////////////////////////////////////////////////// + /// \brief Get the maximum texture size allowed + /// + /// This maximum size is defined by the graphics driver. + /// You can expect a value of 512 pixels for low-end graphics + /// card, and up to 8192 pixels or more for newer hardware. + /// + /// \return Maximum size allowed for textures, in pixels + /// + //////////////////////////////////////////////////////////// + static unsigned int getMaximumSize(); + +private : + + friend class RenderTexture; + friend class RenderTarget; + + //////////////////////////////////////////////////////////// + /// \brief Get a valid image size according to hardware support + /// + /// This function checks whether the graphics driver supports + /// non power of two sizes or not, and adjusts the size + /// accordingly. + /// The returned size is greater than or equal to the original size. + /// + /// \param Size size to convert + /// + /// \return Valid nearest size (greater than or equal to specified size) + /// + //////////////////////////////////////////////////////////// + static unsigned int getValidSize(unsigned int size); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2u m_size; ///< Public texture size + Vector2u m_actualSize; ///< Actual texture size (can be greater than public size because of padding) + unsigned int m_texture; ///< Internal texture identifier + bool m_isSmooth; ///< Status of the smooth filter + bool m_isRepeated; ///< Is the texture in repeat mode? + mutable bool m_pixelsFlipped; ///< To work around the inconsistency in Y orientation + Uint64 m_cacheId; ///< Unique number that identifies the texture to the render target's cache +}; + +} // namespace sf + + +#endif // SFML_TEXTURE_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::Texture +/// \ingroup graphics +/// +/// sf::Texture stores pixels that can be drawn, with a sprite +/// for example. A texture lives in the graphics card memory, +/// therefore it is very fast to draw a texture to a render target, +/// or copy a render target to a texture (the graphics card can +/// access both directly). +/// +/// Being stored in the graphics card memory has some drawbacks. +/// A texture cannot be manipulated as freely as a sf::Image, +/// you need to prepare the pixels first and then upload them +/// to the texture in a single operation (see Texture::update). +/// +/// sf::Texture makes it easy to convert from/to sf::Image, but +/// keep in mind that these calls require transfers between +/// the graphics card and the central memory, therefore they are +/// slow operations. +/// +/// A texture can be loaded from an image, but also directly +/// from a file/memory/stream. The necessary shortcuts are defined +/// so that you don't need an image first for the most common cases. +/// However, if you want to perform some modifications on the pixels +/// before creating the final texture, you can load your file to a +/// sf::Image, do whatever you need with the pixels, and then call +/// Texture::loadFromImage. +/// +/// Since they live in the graphics card memory, the pixels of a texture +/// cannot be accessed without a slow copy first. And they cannot be +/// accessed individually. Therefore, if you need to read the texture's +/// pixels (like for pixel-perfect collisions), it is recommended to +/// store the collision information separately, for example in an array +/// of booleans. +/// +/// Like sf::Image, sf::Texture can handle a unique internal +/// representation of pixels, which is RGBA 32 bits. This means +/// that a pixel must be composed of 8 bits red, green, blue and +/// alpha channels -- just like a sf::Color. +/// +/// Usage example: +/// \code +/// // This example shows the most common use of sf::Texture: +/// // drawing a sprite +/// +/// // Load a texture from a file +/// sf::Texture texture; +/// if (!texture.loadFromFile("texture.png")) +/// return -1; +/// +/// // Assign it to a sprite +/// sf::Sprite sprite; +/// sprite.setTexture(texture); +/// +/// // Draw the textured sprite +/// window.draw(sprite); +/// \endcode +/// +/// \code +/// // This example shows another common use of sf::Texture: +/// // streaming real-time data, like video frames +/// +/// // Create an empty texture +/// sf::Texture texture; +/// if (!texture.create(640, 480)) +/// return -1; +/// +/// // Create a sprite that will display the texture +/// sf::Sprite sprite(texture); +/// +/// while (...) // the main loop +/// { +/// ... +/// +/// // update the texture +/// sf::Uint8* pixels = ...; // get a fresh chunk of pixels (the next frame of a movie, for example) +/// texture.update(pixels); +/// +/// // draw it +/// window.draw(sprite); +/// +/// ... +/// } +/// +/// \endcode +/// +/// Like sf::Shader that can be used as a raw OpenGL shader, +/// sf::Texture can also be used directly as a raw texture for +/// custom OpenGL geometry. +/// \code +/// sf::Texture::bind(&texture); +/// ... render OpenGL geometry ... +/// sf::Texture::bind(NULL); +/// \endcode +/// +/// \see sf::Sprite, sf::Image, sf::RenderTexture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transform.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transform.hpp new file mode 100644 index 0000000..3b91a8a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transform.hpp @@ -0,0 +1,450 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TRANSFORM_HPP +#define SFML_TRANSFORM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a 3x3 transform matrix +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Transform +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an identity transform (a transform that does nothing). + /// + //////////////////////////////////////////////////////////// + Transform(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a transform from a 3x3 matrix + /// + /// \param a00 Element (0, 0) of the matrix + /// \param a01 Element (0, 1) of the matrix + /// \param a02 Element (0, 2) of the matrix + /// \param a10 Element (1, 0) of the matrix + /// \param a11 Element (1, 1) of the matrix + /// \param a12 Element (1, 2) of the matrix + /// \param a20 Element (2, 0) of the matrix + /// \param a21 Element (2, 1) of the matrix + /// \param a22 Element (2, 2) of the matrix + /// + //////////////////////////////////////////////////////////// + Transform(float a00, float a01, float a02, + float a10, float a11, float a12, + float a20, float a21, float a22); + + //////////////////////////////////////////////////////////// + /// \brief Return the transform as a 4x4 matrix + /// + /// This function returns a pointer to an array of 16 floats + /// containing the transform elements as a 4x4 matrix, which + /// is directly compatible with OpenGL functions. + /// + /// \code + /// sf::Transform transform = ...; + /// glLoadMatrixf(transform.getMatrix()); + /// \endcode + /// + /// \return Pointer to a 4x4 matrix + /// + //////////////////////////////////////////////////////////// + const float* getMatrix() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the inverse of the transform + /// + /// If the inverse cannot be computed, an identity transform + /// is returned. + /// + /// \return A new transform which is the inverse of self + /// + //////////////////////////////////////////////////////////// + Transform getInverse() const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a 2D point + /// + /// \param x X coordinate of the point to transform + /// \param y Y coordinate of the point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + Vector2f transformPoint(float x, float y) const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a 2D point + /// + /// \param point Point to transform + /// + /// \return Transformed point + /// + //////////////////////////////////////////////////////////// + Vector2f transformPoint(const Vector2f& point) const; + + //////////////////////////////////////////////////////////// + /// \brief Transform a rectangle + /// + /// Since SFML doesn't provide support for oriented rectangles, + /// the result of this function is always an axis-aligned + /// rectangle. Which means that if the transform contains a + /// rotation, the bounding rectangle of the transformed rectangle + /// is returned. + /// + /// \param rectangle Rectangle to transform + /// + /// \return Transformed rectangle + /// + //////////////////////////////////////////////////////////// + FloatRect transformRect(const FloatRect& rectangle) const; + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with another one + /// + /// The result is a transform that is equivalent to applying + /// *this followed by \a transform. Mathematically, it is + /// equivalent to a matrix multiplication. + /// + /// \param transform Transform to combine with this transform + /// + /// \return Reference to *this + /// + //////////////////////////////////////////////////////////// + Transform& combine(const Transform& transform); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a translation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.translate(100, 200).rotate(45); + /// \endcode + /// + /// \param x Offset to apply on X axis + /// \param y Offset to apply on Y axis + /// + /// \return Reference to *this + /// + /// \see rotate, scale + /// + //////////////////////////////////////////////////////////// + Transform& translate(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a translation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.translate(sf::Vector2f(100, 200)).rotate(45); + /// \endcode + /// + /// \param offset Translation offset to apply + /// + /// \return Reference to *this + /// + /// \see rotate, scale + /// + //////////////////////////////////////////////////////////// + Transform& translate(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90).translate(50, 20); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// The center of rotation is provided for convenience as a second + /// argument, so that you can build rotations around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).rotate(angle).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90, 8, 3).translate(50, 20); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// \param centerX X coordinate of the center of rotation + /// \param centerY Y coordinate of the center of rotation + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle, float centerX, float centerY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a rotation + /// + /// The center of rotation is provided for convenience as a second + /// argument, so that you can build rotations around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).rotate(angle).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.rotate(90, sf::Vector2f(8, 3)).translate(sf::Vector2f(50, 20)); + /// \endcode + /// + /// \param angle Rotation angle, in degrees + /// \param center Center of rotation + /// + /// \return Reference to *this + /// + /// \see translate, scale + /// + //////////////////////////////////////////////////////////// + Transform& rotate(float angle, const Vector2f& center); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(2, 1).rotate(45); + /// \endcode + /// + /// \param scaleX Scaling factor on the X axis + /// \param scaleY Scaling factor on the Y axis + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(float scaleX, float scaleY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// The center of scaling is provided for convenience as a second + /// argument, so that you can build scaling around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).scale(factors).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(2, 1, 8, 3).rotate(45); + /// \endcode + /// + /// \param scaleX Scaling factor on X axis + /// \param scaleY Scaling factor on Y axis + /// \param centerX X coordinate of the center of scaling + /// \param centerY Y coordinate of the center of scaling + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(float scaleX, float scaleY, float centerX, float centerY); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(sf::Vector2f(2, 1)).rotate(45); + /// \endcode + /// + /// \param factors Scaling factors + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(const Vector2f& factors); + + //////////////////////////////////////////////////////////// + /// \brief Combine the current transform with a scaling + /// + /// The center of scaling is provided for convenience as a second + /// argument, so that you can build scaling around arbitrary points + /// more easily (and efficiently) than the usual + /// translate(-center).scale(factors).translate(center). + /// + /// This function returns a reference to *this, so that calls + /// can be chained. + /// \code + /// sf::Transform transform; + /// transform.scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).rotate(45); + /// \endcode + /// + /// \param factors Scaling factors + /// \param center Center of scaling + /// + /// \return Reference to *this + /// + /// \see translate, rotate + /// + //////////////////////////////////////////////////////////// + Transform& scale(const Vector2f& factors, const Vector2f& center); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Transform Identity; ///< The identity transform (does nothing) + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + float m_matrix[16]; ///< 4x4 matrix defining the transformation +}; + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator * to combine two transforms +/// +/// This call is equivalent to calling Transform(left).combine(right). +/// +/// \param left Left operand (the first transform) +/// \param right Right operand (the second transform) +/// +/// \return New combined transform +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& right); + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator *= to combine two transforms +/// +/// This call is equivalent to calling left.combine(right). +/// +/// \param left Left operand (the first transform) +/// \param right Right operand (the second transform) +/// +/// \return The combined transform +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right); + +//////////////////////////////////////////////////////////// +/// \relates sf::Transform +/// \brief Overload of binary operator * to transform a point +/// +/// This call is equivalent to calling left.transformPoint(right). +/// +/// \param left Left operand (the transform) +/// \param right Right operand (the point to transform) +/// +/// \return New transformed point +/// +//////////////////////////////////////////////////////////// +SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right); + +} // namespace sf + + +#endif // SFML_TRANSFORM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Transform +/// \ingroup graphics +/// +/// A sf::Transform specifies how to translate, rotate, scale, +/// shear, project, whatever things. In mathematical terms, it defines +/// how to transform a coordinate system into another. +/// +/// For example, if you apply a rotation transform to a sprite, the +/// result will be a rotated sprite. And anything that is transformed +/// by this rotation transform will be rotated the same way, according +/// to its initial position. +/// +/// Transforms are typically used for drawing. But they can also be +/// used for any computation that requires to transform points between +/// the local and global coordinate systems of an entity (like collision +/// detection). +/// +/// Example: +/// \code +/// // define a translation transform +/// sf::Transform translation; +/// translation.translate(20, 50); +/// +/// // define a rotation transform +/// sf::Transform rotation; +/// rotation.rotate(45); +/// +/// // combine them +/// sf::Transform transform = translation * rotation; +/// +/// // use the result to transform stuff... +/// sf::Vector2f point = transform.transformPoint(10, 20); +/// sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100)); +/// \endcode +/// +/// \see sf::Transformable, sf::RenderStates +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transformable.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transformable.hpp new file mode 100644 index 0000000..28fb386 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Transformable.hpp @@ -0,0 +1,417 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TRANSFORMABLE_HPP +#define SFML_TRANSFORMABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Decomposed transform defined by a position, a rotation and a scale +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Transformable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Transformable(); + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Transformable(); + + //////////////////////////////////////////////////////////// + /// \brief set the position of the object + /// + /// This function completely overwrites the previous position. + /// See the move function to apply an offset based on the previous position instead. + /// The default position of a transformable object is (0, 0). + /// + /// \param x X coordinate of the new position + /// \param y Y coordinate of the new position + /// + /// \see move, getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief set the position of the object + /// + /// This function completely overwrites the previous position. + /// See the move function to apply an offset based on the previous position instead. + /// The default position of a transformable object is (0, 0). + /// + /// \param position New position + /// + /// \see move, getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector2f& position); + + //////////////////////////////////////////////////////////// + /// \brief set the orientation of the object + /// + /// This function completely overwrites the previous rotation. + /// See the rotate function to add an angle based on the previous rotation instead. + /// The default rotation of a transformable object is 0. + /// + /// \param angle New rotation, in degrees + /// + /// \see rotate, getRotation + /// + //////////////////////////////////////////////////////////// + void setRotation(float angle); + + //////////////////////////////////////////////////////////// + /// \brief set the scale factors of the object + /// + /// This function completely overwrites the previous scale. + /// See the scale function to add a factor based on the previous scale instead. + /// The default scale of a transformable object is (1, 1). + /// + /// \param factorX New horizontal scale factor + /// \param factorY New vertical scale factor + /// + /// \see scale, getScale + /// + //////////////////////////////////////////////////////////// + void setScale(float factorX, float factorY); + + //////////////////////////////////////////////////////////// + /// \brief set the scale factors of the object + /// + /// This function completely overwrites the previous scale. + /// See the scale function to add a factor based on the previous scale instead. + /// The default scale of a transformable object is (1, 1). + /// + /// \param factors New scale factors + /// + /// \see scale, getScale + /// + //////////////////////////////////////////////////////////// + void setScale(const Vector2f& factors); + + //////////////////////////////////////////////////////////// + /// \brief set the local origin of the object + /// + /// The origin of an object defines the center point for + /// all transformations (position, scale, rotation). + /// The coordinates of this point must be relative to the + /// top-left corner of the object, and ignore all + /// transformations (position, scale, rotation). + /// The default origin of a transformable object is (0, 0). + /// + /// \param x X coordinate of the new origin + /// \param y Y coordinate of the new origin + /// + /// \see getOrigin + /// + //////////////////////////////////////////////////////////// + void setOrigin(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief set the local origin of the object + /// + /// The origin of an object defines the center point for + /// all transformations (position, scale, rotation). + /// The coordinates of this point must be relative to the + /// top-left corner of the object, and ignore all + /// transformations (position, scale, rotation). + /// The default origin of a transformable object is (0, 0). + /// + /// \param origin New origin + /// + /// \see getOrigin + /// + //////////////////////////////////////////////////////////// + void setOrigin(const Vector2f& origin); + + //////////////////////////////////////////////////////////// + /// \brief get the position of the object + /// + /// \return Current position + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + const Vector2f& getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief get the orientation of the object + /// + /// The rotation is always in the range [0, 360]. + /// + /// \return Current rotation, in degrees + /// + /// \see setRotation + /// + //////////////////////////////////////////////////////////// + float getRotation() const; + + //////////////////////////////////////////////////////////// + /// \brief get the current scale of the object + /// + /// \return Current scale factors + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + const Vector2f& getScale() const; + + //////////////////////////////////////////////////////////// + /// \brief get the local origin of the object + /// + /// \return Current origin + /// + /// \see setOrigin + /// + //////////////////////////////////////////////////////////// + const Vector2f& getOrigin() const; + + //////////////////////////////////////////////////////////// + /// \brief Move the object by a given offset + /// + /// This function adds to the current position of the object, + /// unlike setPosition which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f pos = object.getPosition(); + /// object.setPosition(pos.x + offsetX, pos.y + offsetY); + /// \endcode + /// + /// \param offsetX X offset + /// \param offsetY Y offset + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + void move(float offsetX, float offsetY); + + //////////////////////////////////////////////////////////// + /// \brief Move the object by a given offset + /// + /// This function adds to the current position of the object, + /// unlike setPosition which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// object.setPosition(object.getPosition() + offset); + /// \endcode + /// + /// \param offset Offset + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + void move(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Rotate the object + /// + /// This function adds to the current rotation of the object, + /// unlike setRotation which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// object.setRotation(object.getRotation() + angle); + /// \endcode + /// + /// \param angle Angle of rotation, in degrees + /// + //////////////////////////////////////////////////////////// + void rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Scale the object + /// + /// This function multiplies the current scale of the object, + /// unlike setScale which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f scale = object.getScale(); + /// object.setScale(scale.x * factorX, scale.y * factorY); + /// \endcode + /// + /// \param factorX Horizontal scale factor + /// \param factorY Vertical scale factor + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + void scale(float factorX, float factorY); + + //////////////////////////////////////////////////////////// + /// \brief Scale the object + /// + /// This function multiplies the current scale of the object, + /// unlike setScale which overwrites it. + /// Thus, it is equivalent to the following code: + /// \code + /// sf::Vector2f scale = object.getScale(); + /// object.setScale(scale.x * factor.x, scale.y * factor.y); + /// \endcode + /// + /// \param factor Scale factors + /// + /// \see setScale + /// + //////////////////////////////////////////////////////////// + void scale(const Vector2f& factor); + + //////////////////////////////////////////////////////////// + /// \brief get the combined transform of the object + /// + /// \return Transform combining the position/rotation/scale/origin of the object + /// + /// \see getInverseTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getTransform() const; + + //////////////////////////////////////////////////////////// + /// \brief get the inverse of the combined transform of the object + /// + /// \return Inverse of the combined transformations applied to the object + /// + /// \see getTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getInverseTransform() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_origin; ///< Origin of translation/rotation/scaling of the object + Vector2f m_position; ///< Position of the object in the 2D world + float m_rotation; ///< Orientation of the object, in degrees + Vector2f m_scale; ///< Scale of the object + mutable Transform m_transform; ///< Combined transformation of the object + mutable bool m_transformNeedUpdate; ///< Does the transform need to be recomputed? + mutable Transform m_inverseTransform; ///< Combined transformation of the object + mutable bool m_inverseTransformNeedUpdate; ///< Does the transform need to be recomputed? +}; + +} // namespace sf + + +#endif // SFML_TRANSFORMABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Transformable +/// \ingroup graphics +/// +/// This class is provided for convenience, on top of sf::Transform. +/// +/// sf::Transform, as a low-level class, offers a great level of +/// flexibility but it is not always convenient to manage. Indeed, +/// one can easily combine any kind of operation, such as a translation +/// followed by a rotation followed by a scaling, but once the result +/// transform is built, there's no way to go backward and, let's say, +/// change only the rotation without modifying the translation and scaling. +/// The entire transform must be recomputed, which means that you +/// need to retrieve the initial translation and scale factors as +/// well, and combine them the same way you did before updating the +/// rotation. This is a tedious operation, and it requires to store +/// all the individual components of the final transform. +/// +/// That's exactly what sf::Transformable was written for: it hides +/// these variables and the composed transform behind an easy to use +/// interface. You can set or get any of the individual components +/// without worrying about the others. It also provides the composed +/// transform (as a sf::Transform), and keeps it up-to-date. +/// +/// In addition to the position, rotation and scale, sf::Transformable +/// provides an "origin" component, which represents the local origin +/// of the three other components. Let's take an example with a 10x10 +/// pixels sprite. By default, the sprite is positioned/rotated/scaled +/// relatively to its top-left corner, because it is the local point +/// (0, 0). But if we change the origin to be (5, 5), the sprite will +/// be positioned/rotated/scaled around its center instead. And if +/// we set the origin to (10, 10), it will be transformed around its +/// bottom-right corner. +/// +/// To keep the sf::Transformable class simple, there's only one +/// origin for all the components. You cannot position the sprite +/// relatively to its top-left corner while rotating it around its +/// center, for example. To do such things, use sf::Transform directly. +/// +/// sf::Transformable can be used as a base class. It is often +/// combined with sf::Drawable -- that's what SFML's sprites, +/// texts and shapes do. +/// \code +/// class MyEntity : public sf::Transformable, public sf::Drawable +/// { +/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const +/// { +/// states.transform *= getTransform(); +/// target.draw(..., states); +/// } +/// }; +/// +/// MyEntity entity; +/// entity.setPosition(10, 20); +/// entity.setRotation(45); +/// window.draw(entity); +/// \endcode +/// +/// It can also be used as a member, if you don't want to use +/// its API directly (because you don't need all its functions, +/// or you have different naming conventions for example). +/// \code +/// class MyEntity +/// { +/// public : +/// void SetPosition(const MyVector& v) +/// { +/// myTransform.setPosition(v.x(), v.y()); +/// } +/// +/// void Draw(sf::RenderTarget& target) const +/// { +/// target.draw(..., myTransform.getTransform()); +/// } +/// +/// private : +/// sf::Transformable myTransform; +/// }; +/// \endcode +/// +/// \see sf::Transform +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Vertex.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Vertex.hpp new file mode 100644 index 0000000..b983ef2 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/Vertex.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VERTEX_HPP +#define SFML_VERTEX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a point with color and texture coordinates +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API Vertex +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Vertex(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position + /// + /// The vertex color is white and texture coordinates are (0, 0). + /// + /// \param thePosition Vertex position + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position and color + /// + /// The texture coordinates are (0, 0). + /// + /// \param thePosition Vertex position + /// \param theColor Vertex color + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Color& theColor); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position and texture coordinates + /// + /// The vertex color is white. + /// + /// \param thePosition Vertex position + /// \param theTexCoords Vertex texture coordinates + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Vector2f& theTexCoords); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex from its position, color and texture coordinates + /// + /// \param thePosition Vertex position + /// \param theColor Vertex color + /// \param theTexCoords Vertex texture coordinates + /// + //////////////////////////////////////////////////////////// + Vertex(const Vector2f& thePosition, const Color& theColor, const Vector2f& theTexCoords); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f position; ///< 2D position of the vertex + Color color; ///< Color of the vertex + Vector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex +}; + +} // namespace sf + + +#endif // SFML_VERTEX_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vertex +/// \ingroup graphics +/// +/// A vertex is an improved point. It has a position and other +/// extra attributes that will be used for drawing: in SFML, +/// vertices also have a color and a pair of texture coordinates. +/// +/// The vertex is the building block of drawing. Everything which +/// is visible on screen is made of vertices. They are grouped +/// as 2D primitives (triangles, quads, ...), and these primitives +/// are grouped to create even more complex 2D entities such as +/// sprites, texts, etc. +/// +/// If you use the graphical entities of SFML (sprite, text, shape) +/// you won't have to deal with vertices directly. But if you want +/// to define your own 2D entities, such as tiled maps or particle +/// systems, using vertices will allow you to get maximum performances. +/// +/// Example: +/// \code +/// // define a 100x100 square, red, with a 10x10 texture mapped on it +/// sf::Vertex vertices[] = +/// { +/// sf::Vertex(sf::Vector2f( 0, 0), sf::Color::Red, sf::Vector2f( 0, 0)), +/// sf::Vertex(sf::Vector2f( 0, 100), sf::Color::Red, sf::Vector2f( 0, 10)), +/// sf::Vertex(sf::Vector2f(100, 100), sf::Color::Red, sf::Vector2f(10, 10)), +/// sf::Vertex(sf::Vector2f(100, 0), sf::Color::Red, sf::Vector2f(10, 0)) +/// }; +/// +/// // draw it +/// window.draw(vertices, 4, sf::Quads); +/// \endcode +/// +/// Note: although texture coordinates are supposed to be an integer +/// amount of pixels, their type is float because of some buggy graphics +/// drivers that are not able to process integer coordinates correctly. +/// +/// \see sf::VertexArray +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/VertexArray.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/VertexArray.hpp new file mode 100644 index 0000000..fc67845 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/VertexArray.hpp @@ -0,0 +1,223 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VERTEXARRAY_HPP +#define SFML_VERTEXARRAY_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Define a set of one or more 2D primitives +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API VertexArray : public Drawable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty vertex array. + /// + //////////////////////////////////////////////////////////// + VertexArray(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vertex array with a type and an initial number of vertices + /// + /// \param type Type of primitives + /// \param vertexCount Initial number of vertices in the array + /// + //////////////////////////////////////////////////////////// + explicit VertexArray(PrimitiveType type, unsigned int vertexCount = 0); + + //////////////////////////////////////////////////////////// + /// \brief Return the vertex count + /// + /// \return Number of vertices in the array + /// + //////////////////////////////////////////////////////////// + unsigned int getVertexCount() const; + + //////////////////////////////////////////////////////////// + /// \brief Get a read-write access to a vertex by its index + /// + /// This function doesn't check \a index, it must be in range + /// [0, getVertexCount() - 1]. The behaviour is undefined + /// otherwise. + /// + /// \param index Index of the vertex to get + /// + /// \return Reference to the index-th vertex + /// + /// \see getVertexCount + /// + //////////////////////////////////////////////////////////// + Vertex& operator [](unsigned int index); + + //////////////////////////////////////////////////////////// + /// \brief Get a read-only access to a vertex by its index + /// + /// This function doesn't check \a index, it must be in range + /// [0, getVertexCount() - 1]. The behaviour is undefined + /// otherwise. + /// + /// \param index Index of the vertex to get + /// + /// \return Const reference to the index-th vertex + /// + /// \see getVertexCount + /// + //////////////////////////////////////////////////////////// + const Vertex& operator [](unsigned int index) const; + + //////////////////////////////////////////////////////////// + /// \brief Clear the vertex array + /// + /// This function removes all the vertices from the array. + /// It doesn't deallocate the corresponding memory, so that + /// adding new vertices after clearing doesn't involve + /// reallocating all the memory. + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Resize the vertex array + /// + /// If \a vertexCount is greater than the current size, the previous + /// vertices are kept and new (default-constructed) vertices are + /// added. + /// If \a vertexCount is less than the current size, existing vertices + /// are removed from the array. + /// + /// \param vertexCount New size of the array (number of vertices) + /// + //////////////////////////////////////////////////////////// + void resize(unsigned int vertexCount); + + //////////////////////////////////////////////////////////// + /// \brief Add a vertex to the array + /// + /// \param vertex Vertex to add + /// + //////////////////////////////////////////////////////////// + void append(const Vertex& vertex); + + //////////////////////////////////////////////////////////// + /// \brief Set the type of primitives to draw + /// + /// This function defines how the vertices must be interpreted + /// when it's time to draw them: + /// \li As points + /// \li As lines + /// \li As triangles + /// \li As quads + /// The default primitive type is sf::Points. + /// + /// \param type Type of primitive + /// + //////////////////////////////////////////////////////////// + void setPrimitiveType(PrimitiveType type); + + //////////////////////////////////////////////////////////// + /// \brief Get the type of primitives drawn by the vertex array + /// + /// \return Primitive type + /// + //////////////////////////////////////////////////////////// + PrimitiveType getPrimitiveType() const; + + //////////////////////////////////////////////////////////// + /// \brief Compute the bounding rectangle of the vertex array + /// + /// This function returns the axis-aligned rectangle that + /// contains all the vertices of the array. + /// + /// \return Bounding rectangle of the vertex array + /// + //////////////////////////////////////////////////////////// + FloatRect getBounds() const; + +private : + + //////////////////////////////////////////////////////////// + /// \brief Draw the vertex array to a render target + /// + /// \param target Render target to draw to + /// \param states Current render states + /// + //////////////////////////////////////////////////////////// + virtual void draw(RenderTarget& target, RenderStates states) const; + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_vertices; ///< Vertices contained in the array + PrimitiveType m_primitiveType; ///< Type of primitives to draw +}; + +} // namespace sf + + +#endif // SFML_VERTEXARRAY_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::VertexArray +/// \ingroup graphics +/// +/// sf::VertexArray is a very simple wrapper around a dynamic +/// array of vertices and a primitives type. +/// +/// It inherits sf::Drawable, but unlike other drawables it +/// is not transformable. +/// +/// Example: +/// \code +/// sf::VertexArray lines(sf::LinesStrip, 4); +/// lines[0].position = sf::Vector2f(10, 0); +/// lines[1].position = sf::Vector2f(20, 0); +/// lines[2].position = sf::Vector2f(30, 5); +/// lines[3].position = sf::Vector2f(40, 2); +/// +/// window.draw(lines); +/// \endcode +/// +/// \see sf::Vertex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Graphics/View.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/View.hpp new file mode 100644 index 0000000..7713aef --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Graphics/View.hpp @@ -0,0 +1,341 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIEW_HPP +#define SFML_VIEW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief 2D camera that defines what region is shown on screen +/// +//////////////////////////////////////////////////////////// +class SFML_GRAPHICS_API View +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates a default view of (0, 0, 1000, 1000) + /// + //////////////////////////////////////////////////////////// + View(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the view from a rectangle + /// + /// \param rectangle Rectangle defining the zone to display + /// + //////////////////////////////////////////////////////////// + explicit View(const FloatRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Construct the view from its center and size + /// + /// \param center Center of the zone to display + /// \param size Size of zone to display + /// + //////////////////////////////////////////////////////////// + View(const Vector2f& center, const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Set the center of the view + /// + /// \param x X coordinate of the new center + /// \param y Y coordinate of the new center + /// + /// \see setSize, getCenter + /// + //////////////////////////////////////////////////////////// + void setCenter(float x, float y); + + //////////////////////////////////////////////////////////// + /// \brief Set the center of the view + /// + /// \param center New center + /// + /// \see setSize, getCenter + /// + //////////////////////////////////////////////////////////// + void setCenter(const Vector2f& center); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the view + /// + /// \param width New width of the view + /// \param height New height of the view + /// + /// \see setCenter, getCenter + /// + //////////////////////////////////////////////////////////// + void setSize(float width, float height); + + //////////////////////////////////////////////////////////// + /// \brief Set the size of the view + /// + /// \param size New size + /// + /// \see setCenter, getCenter + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2f& size); + + //////////////////////////////////////////////////////////// + /// \brief Set the orientation of the view + /// + /// The default rotation of a view is 0 degree. + /// + /// \param angle New angle, in degrees + /// + /// \see getRotation + /// + //////////////////////////////////////////////////////////// + void setRotation(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Set the target viewport + /// + /// The viewport is the rectangle into which the contents of the + /// view are displayed, expressed as a factor (between 0 and 1) + /// of the size of the RenderTarget to which the view is applied. + /// For example, a view which takes the left side of the target would + /// be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)). + /// By default, a view has a viewport which covers the entire target. + /// + /// \param viewport New viewport rectangle + /// + /// \see getViewport + /// + //////////////////////////////////////////////////////////// + void setViewport(const FloatRect& viewport); + + //////////////////////////////////////////////////////////// + /// \brief Reset the view to the given rectangle + /// + /// Note that this function resets the rotation angle to 0. + /// + /// \param rectangle Rectangle defining the zone to display + /// + /// \see setCenter, setSize, setRotation + /// + //////////////////////////////////////////////////////////// + void reset(const FloatRect& rectangle); + + //////////////////////////////////////////////////////////// + /// \brief Get the center of the view + /// + /// \return Center of the view + /// + /// \see getSize, setCenter + /// + //////////////////////////////////////////////////////////// + const Vector2f& getCenter() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the view + /// + /// \return Size of the view + /// + /// \see getCenter, setSize + /// + //////////////////////////////////////////////////////////// + const Vector2f& getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the current orientation of the view + /// + /// \return Rotation angle of the view, in degrees + /// + /// \see setRotation + /// + //////////////////////////////////////////////////////////// + float getRotation() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the target viewport rectangle of the view + /// + /// \return Viewport rectangle, expressed as a factor of the target size + /// + /// \see setViewport + /// + //////////////////////////////////////////////////////////// + const FloatRect& getViewport() const; + + //////////////////////////////////////////////////////////// + /// \brief Move the view relatively to its current position + /// + /// \param offsetX X coordinate of the move offset + /// \param offsetY Y coordinate of the move offset + /// + /// \see setCenter, rotate, zoom + /// + //////////////////////////////////////////////////////////// + void move(float offsetX, float offsetY); + + //////////////////////////////////////////////////////////// + /// \brief Move the view relatively to its current position + /// + /// \param offset Move offset + /// + /// \see setCenter, rotate, zoom + /// + //////////////////////////////////////////////////////////// + void move(const Vector2f& offset); + + //////////////////////////////////////////////////////////// + /// \brief Rotate the view relatively to its current orientation + /// + /// \param angle Angle to rotate, in degrees + /// + /// \see setRotation, move, zoom + /// + //////////////////////////////////////////////////////////// + void rotate(float angle); + + //////////////////////////////////////////////////////////// + /// \brief Resize the view rectangle relatively to its current size + /// + /// Resizing the view simulates a zoom, as the zone displayed on + /// screen grows or shrinks. + /// \a factor is a multiplier: + /// \li 1 keeps the size unchanged + /// \li > 1 makes the view bigger (objects appear smaller) + /// \li < 1 makes the view smaller (objects appear bigger) + /// + /// \param factor Zoom factor to apply + /// + /// \see setSize, move, rotate + /// + //////////////////////////////////////////////////////////// + void zoom(float factor); + + //////////////////////////////////////////////////////////// + /// \brief Get the projection transform of the view + /// + /// This function is meant for internal use only. + /// + /// \return Projection transform defining the view + /// + /// \see getInverseTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getTransform() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the inverse projection transform of the view + /// + /// This function is meant for internal use only. + /// + /// \return Inverse of the projection transform defining the view + /// + /// \see getTransform + /// + //////////////////////////////////////////////////////////// + const Transform& getInverseTransform() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Vector2f m_center; ///< Center of the view, in scene coordinates + Vector2f m_size; ///< Size of the view, in scene coordinates + float m_rotation; ///< Angle of rotation of the view rectangle, in degrees + FloatRect m_viewport; ///< Viewport rectangle, expressed as a factor of the render-target's size + mutable Transform m_transform; ///< Precomputed projection transform corresponding to the view + mutable Transform m_inverseTransform; ///< Precomputed inverse projection transform corresponding to the view + mutable bool m_transformUpdated; ///< Internal state telling if the transform needs to be updated + mutable bool m_invTransformUpdated; ///< Internal state telling if the inverse transform needs to be updated +}; + +} // namespace sf + + +#endif // SFML_VIEW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::View +/// \ingroup graphics +/// +/// sf::View defines a camera in the 2D scene. This is a +/// very powerful concept: you can scroll, rotate or zoom +/// the entire scene without altering the way that your +/// drawable objects are drawn. +/// +/// A view is composed of a source rectangle, which defines +/// what part of the 2D scene is shown, and a target viewport, +/// which defines where the contents of the source rectangle +/// will be displayed on the render target (window or texture). +/// +/// The viewport allows to map the scene to a custom part +/// of the render target, and can be used for split-screen +/// or for displaying a minimap, for example. If the source +/// rectangle has not the same size as the viewport, its +/// contents will be stretched to fit in. +/// +/// To apply a view, you have to assign it to the render target. +/// Then, every objects drawn in this render target will be +/// affected by the view until you use another view. +/// +/// Usage example: +/// \code +/// sf::RenderWindow window; +/// sf::View view; +/// +/// // Initialize the view to a rectangle located at (100, 100) and with a size of 400x200 +/// view.reset(sf::FloatRect(100, 100, 400, 200)); +/// +/// // Rotate it by 45 degrees +/// view.rotate(45); +/// +/// // Set its target viewport to be half of the window +/// view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f)); +/// +/// // Apply it +/// window.setView(view); +/// +/// // Render stuff +/// window.draw(someSprite); +/// +/// // Set the default view back +/// window.setView(window.getDefaultView()); +/// +/// // Render stuff not affected by the view +/// window.draw(someText); +/// \endcode +/// +/// \see sf::RenderWindow, sf::RenderTexture +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network.hpp new file mode 100644 index 0000000..66b3b85 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network.hpp @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_HPP +#define SFML_NETWORK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_NETWORK_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup network Network module +/// +/// Socket-based communication, utilities and higher-level +/// network protocols (HTTP, FTP). +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/Export.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/Export.hpp new file mode 100644 index 0000000..7dcd1d0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NETWORK_EXPORT_HPP +#define SFML_NETWORK_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_NETWORK_EXPORTS) + + #define SFML_NETWORK_API SFML_API_EXPORT + +#else + + #define SFML_NETWORK_API SFML_API_IMPORT + +#endif + + +#endif // SFML_NETWORK_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/Ftp.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/Ftp.hpp new file mode 100644 index 0000000..9b8ed9b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/Ftp.hpp @@ -0,0 +1,591 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_FTP_HPP +#define SFML_FTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +class IpAddress; + +//////////////////////////////////////////////////////////// +/// \brief A FTP client +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Ftp : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of transfer modes + /// + //////////////////////////////////////////////////////////// + enum TransferMode + { + Binary, ///< Binary mode (file is transfered as a sequence of bytes) + Ascii, ///< Text mode using ASCII encoding + Ebcdic ///< Text mode using EBCDIC encoding + }; + + //////////////////////////////////////////////////////////// + /// \brief Define a FTP response + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Status codes possibly returned by a FTP response + /// + //////////////////////////////////////////////////////////// + enum Status + { + // 1xx: the requested action is being initiated, + // expect another reply before proceeding with a new command + RestartMarkerReply = 110, ///< Restart marker reply + ServiceReadySoon = 120, ///< Service ready in N minutes + DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting + OpeningDataConnection = 150, ///< File status ok, about to open data connection + + // 2xx: the requested action has been successfully completed + Ok = 200, ///< Command ok + PointlessCommand = 202, ///< Command not implemented + SystemStatus = 211, ///< System status, or system help reply + DirectoryStatus = 212, ///< Directory status + FileStatus = 213, ///< File status + HelpMessage = 214, ///< Help message + SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document + ServiceReady = 220, ///< Service ready for new user + ClosingConnection = 221, ///< Service closing control connection + DataConnectionOpened = 225, ///< Data connection open, no transfer in progress + ClosingDataConnection = 226, ///< Closing data connection, requested file action successful + EnteringPassiveMode = 227, ///< Entering passive mode + LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate + FileActionOk = 250, ///< Requested file action ok + DirectoryOk = 257, ///< PATHNAME created + + // 3xx: the command has been accepted, but the requested action + // is dormant, pending receipt of further information + NeedPassword = 331, ///< User name ok, need password + NeedAccountToLogIn = 332, ///< Need account for login + NeedInformation = 350, ///< Requested file action pending further information + + // 4xx: the command was not accepted and the requested action did not take place, + // but the error condition is temporary and the action may be requested again + ServiceUnavailable = 421, ///< Service not available, closing control connection + DataConnectionUnavailable = 425, ///< Can't open data connection + TransferAborted = 426, ///< Connection closed, transfer aborted + FileActionAborted = 450, ///< Requested file action not taken + LocalError = 451, ///< Requested action aborted, local error in processing + InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable + + // 5xx: the command was not accepted and + // the requested action did not take place + CommandUnknown = 500, ///< Syntax error, command unrecognized + ParametersUnknown = 501, ///< Syntax error in parameters or arguments + CommandNotImplemented = 502, ///< Command not implemented + BadCommandSequence = 503, ///< Bad sequence of commands + ParameterNotImplemented = 504, ///< Command not implemented for that parameter + NotLoggedIn = 530, ///< Not logged in + NeedAccountToStore = 532, ///< Need account for storing files + FileUnavailable = 550, ///< Requested action not taken, file unavailable + PageTypeUnknown = 551, ///< Requested action aborted, page type unknown + NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation + FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid FTP one + ConnectionFailed = 1001, ///< Connection with server failed + ConnectionClosed = 1002, ///< Connection with server closed + InvalidFile = 1003 ///< Invalid file to upload / download + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor is used by the FTP client to build + /// the response. + /// + /// \param code Response status code + /// \param message Response message + /// + //////////////////////////////////////////////////////////// + explicit Response(Status code = InvalidResponse, const std::string& message = ""); + + //////////////////////////////////////////////////////////// + /// \brief Check if the status code means a success + /// + /// This function is defined for convenience, it is + /// equivalent to testing if the status code is < 400. + /// + /// \return True if the status is a success, false if it is a failure + /// + //////////////////////////////////////////////////////////// + bool isOk() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the status code of the response + /// + /// \return Status code + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the full message contained in the response + /// + /// \return The response message + /// + //////////////////////////////////////////////////////////// + const std::string& getMessage() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Status m_status; ///< Status code returned from the server + std::string m_message; ///< Last message received from the server + }; + + //////////////////////////////////////////////////////////// + /// \brief Specialization of FTP response returning a directory + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API DirectoryResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param response Source response + /// + //////////////////////////////////////////////////////////// + DirectoryResponse(const Response& response); + + //////////////////////////////////////////////////////////// + /// \brief Get the directory returned in the response + /// + /// \return Directory name + /// + //////////////////////////////////////////////////////////// + const std::string& getDirectory() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::string m_directory; ///< Directory extracted from the response message + }; + + + //////////////////////////////////////////////////////////// + /// \brief Specialization of FTP response returning a + /// filename lisiting + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API ListingResponse : public Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param response Source response + /// \param data Data containing the raw listing + /// + //////////////////////////////////////////////////////////// + ListingResponse(const Response& response, const std::vector& data); + + //////////////////////////////////////////////////////////// + /// \brief Return the array of directory/file names + /// + /// \return Array containing the requested listing + /// + //////////////////////////////////////////////////////////// + const std::vector& getListing() const; + + private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_listing; ///< Directory/file names extracted from the data + }; + + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Automatically closes the connection with the server if + /// it is still opened. + /// + //////////////////////////////////////////////////////////// + ~Ftp(); + + //////////////////////////////////////////////////////////// + /// \brief Connect to the specified FTP server + /// + /// The port has a default value of 21, which is the standard + /// port used by the FTP protocol. You shouldn't use a different + /// value, unless you really know what you do. + /// This function tries to connect to the server so it may take + /// a while to complete, especially if the server is not + /// reachable. To avoid blocking your application for too long, + /// you can use a timeout. The default value, Time::Zero, means that the + /// system timeout will be used (which is usually pretty long). + /// + /// \param server Name or address of the FTP server to connect to + /// \param port Port used for the connection + /// \param timeout Maximum time to wait + /// + /// \return Server response to the request + /// + /// \see disconnect + /// + //////////////////////////////////////////////////////////// + Response connect(const IpAddress& server, unsigned short port = 21, Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Close the connection with the server + /// + /// \return Server response to the request + /// + /// \see connect + /// + //////////////////////////////////////////////////////////// + Response disconnect(); + + //////////////////////////////////////////////////////////// + /// \brief Log in using an anonymous account + /// + /// Logging in is mandatory after connecting to the server. + /// Users that are not logged in cannot perform any operation. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response login(); + + //////////////////////////////////////////////////////////// + /// \brief Log in using a username and a password + /// + /// Logging in is mandatory after connecting to the server. + /// Users that are not logged in cannot perform any operation. + /// + /// \param name User name + /// \param password Password + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response login(const std::string& name, const std::string& password); + + //////////////////////////////////////////////////////////// + /// \brief Send a null command to keep the connection alive + /// + /// This command is useful because the server may close the + /// connection automatically if no command is sent. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response keepAlive(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current working directory + /// + /// The working directory is the root path for subsequent + /// operations involving directories and/or filenames. + /// + /// \return Server response to the request + /// + /// \see getDirectoryListing, changeDirectory, parentDirectory + /// + //////////////////////////////////////////////////////////// + DirectoryResponse getWorkingDirectory(); + + //////////////////////////////////////////////////////////// + /// \brief Get the contents of the given directory + /// + /// This function retrieves the sub-directories and files + /// contained in the given directory. It is not recursive. + /// The \a directory parameter is relative to the current + /// working directory. + /// + /// \param directory Directory to list + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, changeDirectory, parentDirectory + /// + //////////////////////////////////////////////////////////// + ListingResponse getDirectoryListing(const std::string& directory = ""); + + //////////////////////////////////////////////////////////// + /// \brief Change the current working directory + /// + /// The new directory must be relative to the current one. + /// + /// \param directory New working directory + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, getDirectoryListing, parentDirectory + /// + //////////////////////////////////////////////////////////// + Response changeDirectory(const std::string& directory); + + //////////////////////////////////////////////////////////// + /// \brief Go to the parent directory of the current one + /// + /// \return Server response to the request + /// + /// \see getWorkingDirectory, getDirectoryListing, changeDirectory + /// + //////////////////////////////////////////////////////////// + Response parentDirectory(); + + //////////////////////////////////////////////////////////// + /// \brief Create a new directory + /// + /// The new directory is created as a child of the current + /// working directory. + /// + /// \param name Name of the directory to create + /// + /// \return Server response to the request + /// + /// \see deleteDirectory + /// + //////////////////////////////////////////////////////////// + Response createDirectory(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Remove an existing directory + /// + /// The directory to remove must be relative to the + /// current working directory. + /// Use this function with caution, the directory will + /// be removed permanently! + /// + /// \param name Name of the directory to remove + /// + /// \return Server response to the request + /// + /// \see createDirectory + /// + //////////////////////////////////////////////////////////// + Response deleteDirectory(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Rename an existing file + /// + /// The filenames must be relative to the current working + /// directory. + /// + /// \param file File to rename + /// \param newName New name of the file + /// + /// \return Server response to the request + /// + /// \see deleteFile + /// + //////////////////////////////////////////////////////////// + Response renameFile(const std::string& file, const std::string& newName); + + //////////////////////////////////////////////////////////// + /// \brief Remove an existing file + /// + /// The file name must be relative to the current working + /// directory. + /// Use this function with caution, the file will be + /// removed permanently! + /// + /// \param name File to remove + /// + /// \return Server response to the request + /// + /// \see renameFile + /// + //////////////////////////////////////////////////////////// + Response deleteFile(const std::string& name); + + //////////////////////////////////////////////////////////// + /// \brief Download a file from the server + /// + /// The filename of the distant file is relative to the + /// current working directory of the server, and the local + /// destination path is relative to the current directory + /// of your application. + /// + /// \param remoteFile Filename of the distant file to download + /// \param localPath Where to put to file on the local computer + /// \param mode Transfer mode + /// + /// \return Server response to the request + /// + /// \see upload + /// + //////////////////////////////////////////////////////////// + Response download(const std::string& remoteFile, const std::string& localPath, TransferMode mode = Binary); + + //////////////////////////////////////////////////////////// + /// \brief Upload a file to the server + /// + /// The name of the local file is relative to the current + /// working directory of your application, and the + /// remote path is relative to the current directory of the + /// FTP server. + /// + /// \param localFile Path of the local file to upload + /// \param remotePath Where to put to file on the server + /// \param mode Transfer mode + /// + /// \return Server response to the request + /// + /// \see download + /// + //////////////////////////////////////////////////////////// + Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary); + +private : + + //////////////////////////////////////////////////////////// + /// \brief Send a command to the FTP server + /// + /// \param command Command to send + /// \param parameter Command parameter + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response sendCommand(const std::string& command, const std::string& parameter = ""); + + //////////////////////////////////////////////////////////// + /// \brief Receive a response from the server + /// + /// This function must be called after each call to + /// SendCommand that expects a response. + /// + /// \return Server response to the request + /// + //////////////////////////////////////////////////////////// + Response getResponse(); + + //////////////////////////////////////////////////////////// + /// \brief Utility class for exchanging datas with the server + /// on the data channel + /// + //////////////////////////////////////////////////////////// + class DataChannel; + + friend class DataChannel; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + TcpSocket m_commandSocket; ///< Socket holding the control connection with the server +}; + +} // namespace sf + + +#endif // SFML_FTP_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Ftp +/// \ingroup network +/// +/// sf::Ftp is a very simple FTP client that allows you +/// to communicate with a FTP server. The FTP protocol allows +/// you to manipulate a remote file system (list files, +/// upload, download, create, remove, ...). +/// +/// Using the FTP client consists of 4 parts: +/// \li Connecting to the FTP server +/// \li Logging in (either as a registered user or anonymously) +/// \li Sending commands to the server +/// \li Disconnecting (this part can be done implicitely by the destructor) +/// +/// Every command returns a FTP response, which contains the +/// status code as well as a message from the server. Some +/// commands such as getWorkingDirectory and getDirectoryListing +/// return additional data, and use a class derived from +/// sf::Ftp::Response to provide this data. +/// +/// All commands, especially upload and download, may take some +/// time to complete. This is important to know if you don't want +/// to block your application while the server is completing +/// the task. +/// +/// Usage example: +/// \code +/// // Create a new FTP client +/// sf::Ftp ftp; +/// +/// // Connect to the server +/// sf::Ftp::Response response = ftp.connect("ftp://ftp.myserver.com"); +/// if (response.isOk()) +/// std::cout << "Connected" << std::endl; +/// +/// // Log in +/// response = ftp.login("laurent", "dF6Zm89D"); +/// if (response.isOk()) +/// std::cout << "Logged in" << std::endl; +/// +/// // Print the working directory +/// sf::Ftp::DirectoryResponse directory = ftp.getWorkingDirectory(); +/// if (directory.isOk()) +/// std::cout << "Working directory: " << directory.getDirectory() << std::endl; +/// +/// // Create a new directory +/// response = ftp.createDirectory("files"); +/// if (response.isOk()) +/// std::cout << "Created new directory" << std::endl; +/// +/// // Upload a file to this new directory +/// response = ftp.upload("local-path/file.txt", "files", sf::Ftp::Ascii); +/// if (response.isOk()) +/// std::cout << "File uploaded" << std::endl; +/// +/// // Disconnect from the server (optional) +/// ftp.disconnect(); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/Http.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/Http.hpp new file mode 100644 index 0000000..7338f5a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/Http.hpp @@ -0,0 +1,467 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_HTTP_HPP +#define SFML_HTTP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief A HTTP client +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Http : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Define a HTTP request + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Request + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Enumerate the available HTTP methods for a request + /// + //////////////////////////////////////////////////////////// + enum Method + { + Get, ///< Request in get mode, standard method to retrieve a page + Post, ///< Request in post mode, usually to send data to a page + Head ///< Request a page's header only + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates a GET request, with the root + /// URI ("/") and an empty body. + /// + /// \param uri Target URI + /// \param method Method to use for the request + /// \param body Content of the request's body + /// + //////////////////////////////////////////////////////////// + Request(const std::string& uri = "/", Method method = Get, const std::string& body = ""); + + //////////////////////////////////////////////////////////// + /// \brief Set the value of a field + /// + /// The field is created if it doesn't exist. The name of + /// the field is case insensitive. + /// By default, a request doesn't contain any field (but the + /// mandatory fields are added later by the HTTP client when + /// sending the request). + /// + /// \param field Name of the field to set + /// \param value Value of the field + /// + //////////////////////////////////////////////////////////// + void setField(const std::string& field, const std::string& value); + + //////////////////////////////////////////////////////////// + /// \brief Set the request method + /// + /// See the Method enumeration for a complete list of all + /// the availale methods. + /// The method is Http::Request::Get by default. + /// + /// \param method Method to use for the request + /// + //////////////////////////////////////////////////////////// + void setMethod(Method method); + + //////////////////////////////////////////////////////////// + /// \brief Set the requested URI + /// + /// The URI is the resource (usually a web page or a file) + /// that you want to get or post. + /// The URI is "/" (the root page) by default. + /// + /// \param uri URI to request, relative to the host + /// + //////////////////////////////////////////////////////////// + void setUri(const std::string& uri); + + //////////////////////////////////////////////////////////// + /// \brief Set the HTTP version for the request + /// + /// The HTTP version is 1.0 by default. + /// + /// \param major Major HTTP version number + /// \param minor Minor HTTP version number + /// + //////////////////////////////////////////////////////////// + void setHttpVersion(unsigned int major, unsigned int minor); + + //////////////////////////////////////////////////////////// + /// \brief Set the body of the request + /// + /// The body of a request is optional and only makes sense + /// for POST requests. It is ignored for all other methods. + /// The body is empty by default. + /// + /// \param body Content of the body + /// + //////////////////////////////////////////////////////////// + void setBody(const std::string& body); + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// \brief Prepare the final request to send to the server + /// + /// This is used internally by Http before sending the + /// request to the web server. + /// + /// \return String containing the request, ready to be sent + /// + //////////////////////////////////////////////////////////// + std::string prepare() const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the request defines a field + /// + /// This function uses case-insensitive comparisons. + /// + /// \param field Name of the field to test + /// + /// \return True if the field exists, false otherwise + /// + //////////////////////////////////////////////////////////// + bool hasField(const std::string& field) const; + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable m_fields; ///< Fields of the header associated to their value + Method m_method; ///< Method to use for the request + std::string m_uri; ///< Target URI of the request + unsigned int m_majorVersion; ///< Major HTTP version + unsigned int m_minorVersion; ///< Minor HTTP version + std::string m_body; ///< Body of the request + }; + + //////////////////////////////////////////////////////////// + /// \brief Define a HTTP response + /// + //////////////////////////////////////////////////////////// + class SFML_NETWORK_API Response + { + public : + + //////////////////////////////////////////////////////////// + /// \brief Enumerate all the valid status codes for a response + /// + //////////////////////////////////////////////////////////// + enum Status + { + // 2xx: success + Ok = 200, ///< Most common code returned when operation was successful + Created = 201, ///< The resource has successfully been created + Accepted = 202, ///< The request has been accepted, but will be processed later by the server + NoContent = 204, ///< The server didn't send any data in return + ResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent + PartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request + + // 3xx: redirection + MultipleChoices = 300, ///< The requested page can be accessed from several locations + MovedPermanently = 301, ///< The requested page has permanently moved to a new location + MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location + NotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed + + // 4xx: client error + BadRequest = 400, ///< The server couldn't understand the request (syntax error) + Unauthorized = 401, ///< The requested page needs an authentification to be accessed + Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentification + NotFound = 404, ///< The requested page doesn't exist + RangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field) + + // 5xx: server error + InternalServerError = 500, ///< The server encountered an unexpected error + NotImplemented = 501, ///< The server doesn't implement a requested feature + BadGateway = 502, ///< The gateway server has received an error from the source server + ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) + GatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server + VersionNotSupported = 505, ///< The server doesn't support the requested HTTP version + + // 10xx: SFML custom codes + InvalidResponse = 1000, ///< Response is not a valid HTTP one + ConnectionFailed = 1001 ///< Connection with server failed + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Constructs an empty response. + /// + //////////////////////////////////////////////////////////// + Response(); + + //////////////////////////////////////////////////////////// + /// \brief Get the value of a field + /// + /// If the field \a field is not found in the response header, + /// the empty string is returned. This function uses + /// case-insensitive comparisons. + /// + /// \param field Name of the field to get + /// + /// \return Value of the field, or empty string if not found + /// + //////////////////////////////////////////////////////////// + const std::string& getField(const std::string& field) const; + + //////////////////////////////////////////////////////////// + /// \brief Get the response status code + /// + /// The status code should be the first thing to be checked + /// after receiving a response, it defines whether it is a + /// success, a failure or anything else (see the Status + /// enumeration). + /// + /// \return Status code of the response + /// + //////////////////////////////////////////////////////////// + Status getStatus() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the major HTTP version number of the response + /// + /// \return Major HTTP version number + /// + /// \see getMinorHttpVersion + /// + //////////////////////////////////////////////////////////// + unsigned int getMajorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the minor HTTP version number of the response + /// + /// \return Minor HTTP version number + /// + /// \see getMajorHttpVersion + /// + //////////////////////////////////////////////////////////// + unsigned int getMinorHttpVersion() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the body of the response + /// + /// The body of a response may contain: + /// \li the requested page (for GET requests) + /// \li a response from the server (for POST requests) + /// \li nothing (for HEAD requests) + /// \li an error message (in case of an error) + /// + /// \return The response body + /// + //////////////////////////////////////////////////////////// + const std::string& getBody() const; + + private : + + friend class Http; + + //////////////////////////////////////////////////////////// + /// \brief Construct the header from a response string + /// + /// This function is used by Http to build the response + /// of a request. + /// + /// \param data Content of the response to parse + /// + //////////////////////////////////////////////////////////// + void parse(const std::string& data); + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::map FieldTable; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + FieldTable m_fields; ///< Fields of the header + Status m_status; ///< Status code + unsigned int m_majorVersion; ///< Major HTTP version + unsigned int m_minorVersion; ///< Minor HTTP version + std::string m_body; ///< Body of the response + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Http(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the HTTP client with the target host + /// + /// This is equivalent to calling setHost(host, port). + /// The port has a default value of 0, which means that the + /// HTTP client will use the right port according to the + /// protocol used (80 for HTTP, 443 for HTTPS). You should + /// leave it like this unless you really need a port other + /// than the standard one, or use an unknown protocol. + /// + /// \param host Web server to connect to + /// \param port Port to use for connection + /// + //////////////////////////////////////////////////////////// + Http(const std::string& host, unsigned short port = 0); + + //////////////////////////////////////////////////////////// + /// \brief Set the target host + /// + /// This function just stores the host address and port, it + /// doesn't actually connect to it until you send a request. + /// The port has a default value of 0, which means that the + /// HTTP client will use the right port according to the + /// protocol used (80 for HTTP, 443 for HTTPS). You should + /// leave it like this unless you really need a port other + /// than the standard one, or use an unknown protocol. + /// + /// \param host Web server to connect to + /// \param port Port to use for connection + /// + //////////////////////////////////////////////////////////// + void setHost(const std::string& host, unsigned short port = 0); + + //////////////////////////////////////////////////////////// + /// \brief Send a HTTP request and return the server's response. + /// + /// You must have a valid host before sending a request (see setHost). + /// Any missing mandatory header field in the request will be added + /// with an appropriate value. + /// Warning: this function waits for the server's response and may + /// not return instantly; use a thread if you don't want to block your + /// application, or use a timeout to limit the time to wait. A value + /// of Time::Zero means that the client will use the system defaut timeout + /// (which is usually pretty long). + /// + /// \param request Request to send + /// \param timeout Maximum time to wait + /// + /// \return Server's response + /// + //////////////////////////////////////////////////////////// + Response sendRequest(const Request& request, Time timeout = Time::Zero); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + TcpSocket m_connection; ///< Connection to the host + IpAddress m_host; ///< Web host address + std::string m_hostName; ///< Web host name + unsigned short m_port; ///< Port used for connection with host +}; + +} // namespace sf + + +#endif // SFML_HTTP_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Http +/// \ingroup network +/// +/// sf::Http is a very simple HTTP client that allows you +/// to communicate with a web server. You can retrieve +/// web pages, send data to an interactive resource, +/// download a remote file, etc. +/// +/// The HTTP client is split into 3 classes: +/// \li sf::Http::Request +/// \li sf::Http::Response +/// \li sf::Http +/// +/// sf::Http::Request builds the request that will be +/// sent to the server. A request is made of: +/// \li a method (what you want to do) +/// \li a target URI (usually the name of the web page or file) +/// \li one or more header fields (options that you can pass to the server) +/// \li an optional body (for POST requests) +/// +/// sf::Http::Response parse the response from the web server +/// and provides getters to read them. The response contains: +/// \li a status code +/// \li header fields (that may be answers to the ones that you requested) +/// \li a body, which contains the contents of the requested resource +/// +/// sf::Http provides a simple function, SendRequest, to send a +/// sf::Http::Request and return the corresponding sf::Http::Response +/// from the server. +/// +/// Usage example: +/// \code +/// // Create a new HTTP client +/// sf::Http http; +/// +/// // We'll work on http://www.sfml-dev.org +/// http.setHost("http://www.sfml-dev.org"); +/// +/// // Prepare a request to get the 'features.php' page +/// sf::Http::Request request("features.php"); +/// +/// // Send the request +/// sf::Http::Response response = http.sendRequest(request); +/// +/// // Check the status code and display the result +/// sf::Http::Response::Status status = response.getStatus(); +/// if (status == sf::Http::Response::Ok) +/// { +/// std::cout << response.getBody() << std::endl; +/// } +/// else +/// { +/// std::cout << "Error " << status << std::endl; +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/IpAddress.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/IpAddress.hpp new file mode 100644 index 0000000..15c4ac3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/IpAddress.hpp @@ -0,0 +1,316 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_IPADDRESS_HPP +#define SFML_IPADDRESS_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Encapsulate an IPv4 network address +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API IpAddress +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an empty (invalid) address + /// + //////////////////////////////////////////////////////////// + IpAddress(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a string + /// + /// Here \a address can be either a decimal address + /// (ex: "192.168.1.56") or a network name (ex: "localhost"). + /// + /// \param address IP address or network name + /// + //////////////////////////////////////////////////////////// + IpAddress(const std::string& address); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a string + /// + /// Here \a address can be either a decimal address + /// (ex: "192.168.1.56") or a network name (ex: "localhost"). + /// This is equivalent to the constructor taking a std::string + /// parameter, it is defined for convenience so that the + /// implicit conversions from literal strings to IpAddress work. + /// + /// \param address IP address or network name + /// + //////////////////////////////////////////////////////////// + IpAddress(const char* address); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from 4 bytes + /// + /// Calling IpAddress(a, b, c, d) is equivalent to calling + /// IpAddress("a.b.c.d"), but safer as it doesn't have to + /// parse a string to get the address components. + /// + /// \param byte0 First byte of the address + /// \param byte1 Second byte of the address + /// \param byte2 Third byte of the address + /// \param byte3 Fourth byte of the address + /// + //////////////////////////////////////////////////////////// + IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3); + + //////////////////////////////////////////////////////////// + /// \brief Construct the address from a 32-bits integer + /// + /// This constructor uses the internal representation of + /// the address directly. It should be used for optimization + /// purposes, and only if you got that representation from + /// IpAddress::ToInteger(). + /// + /// \param address 4 bytes of the address packed into a 32-bits integer + /// + /// \see toInteger + /// + //////////////////////////////////////////////////////////// + explicit IpAddress(Uint32 address); + + //////////////////////////////////////////////////////////// + /// \brief Get a string representation of the address + /// + /// The returned string is the decimal representation of the + /// IP address (like "192.168.1.56"), even if it was constructed + /// from a host name. + /// + /// \return String representation of the address + /// + /// \see toInteger + /// + //////////////////////////////////////////////////////////// + std::string toString() const; + + //////////////////////////////////////////////////////////// + /// \brief Get an integer representation of the address + /// + /// The returned number is the internal representation of the + /// address, and should be used for optimization purposes only + /// (like sending the address through a socket). + /// The integer produced by this function can then be converted + /// back to a sf::IpAddress with the proper constructor. + /// + /// \return 32-bits unsigned integer representation of the address + /// + /// \see toString + /// + //////////////////////////////////////////////////////////// + Uint32 toInteger() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the computer's local address + /// + /// The local address is the address of the computer from the + /// LAN point of view, i.e. something like 192.168.1.56. It is + /// meaningful only for communications over the local network. + /// Unlike getPublicAddress, this function is fast and may be + /// used safely anywhere. + /// + /// \return Local IP address of the computer + /// + /// \see getPublicAddress + /// + //////////////////////////////////////////////////////////// + static IpAddress getLocalAddress(); + + //////////////////////////////////////////////////////////// + /// \brief Get the computer's public address + /// + /// The public address is the address of the computer from the + /// internet point of view, i.e. something like 89.54.1.169. + /// It is necessary for communications over the world wide web. + /// The only way to get a public address is to ask it to a + /// distant website; as a consequence, this function depends on + /// both your network connection and the server, and may be + /// very slow. You should use it as few as possible. Because + /// this function depends on the network connection and on a distant + /// server, you may use a time limit if you don't want your program + /// to be possibly stuck waiting in case there is a problem; this + /// limit is deactivated by default. + /// + /// \param timeout Maximum time to wait + /// + /// \return Public IP address of the computer + /// + /// \see getLocalAddress + /// + //////////////////////////////////////////////////////////// + static IpAddress getPublicAddress(Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const IpAddress None; ///< Value representing an empty/invalid address + static const IpAddress LocalHost; ///< The "localhost" address (for connecting a computer to itself locally) + static const IpAddress Broadcast; ///< The "broadcast" address (for sending UDP messages to everyone on a local network) + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Uint32 m_address; ///< Address stored as an unsigned 32 bits integer +}; + +//////////////////////////////////////////////////////////// +/// \brief Overload of == operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if both addresses are equal +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator ==(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of != operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if both addresses are different +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator !=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of < operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of > operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator >(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of <= operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator <=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of >= operator to compare two IP addresses +/// +/// \param left Left operand (a IP address) +/// \param right Right operand (a IP address) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API bool operator >=(const IpAddress& left, const IpAddress& right); + +//////////////////////////////////////////////////////////// +/// \brief Overload of >> operator to extract an IP address from an input stream +/// +/// \param stream Input stream +/// \param address IP address to extract +/// +/// \return Reference to the input stream +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API std::istream& operator >>(std::istream& stream, IpAddress& address); + +//////////////////////////////////////////////////////////// +/// \brief Overload of << operator to print an IP address to an output stream +/// +/// \param stream Output stream +/// \param address IP address to print +/// +/// \return Reference to the output stream +/// +//////////////////////////////////////////////////////////// +SFML_NETWORK_API std::ostream& operator <<(std::ostream& stream, const IpAddress& address); + +} // namespace sf + + +#endif // SFML_IPADDRESS_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::IpAddress +/// \ingroup network +/// +/// sf::IpAddress is a utility class for manipulating network +/// addresses. It provides a set a implicit constructors and +/// conversion functions to easily build or transform an IP +/// address from/to various representations. +/// +/// Usage example: +/// \code +/// sf::IpAddress a0; // an invalid address +/// sf::IpAddress a1 = sf::IpAddress::None; // an invalid address (same as a0) +/// sf::IpAddress a2("127.0.0.1"); // the local host address +/// sf::IpAddress a3 = sf::IpAddress::Broadcast; // the broadcast address +/// sf::IpAddress a4(192, 168, 1, 56); // a local address +/// sf::IpAddress a5("my_computer"); // a local address created from a network name +/// sf::IpAddress a6("89.54.1.169"); // a distant address +/// sf::IpAddress a7("www.google.com"); // a distant address created from a network name +/// sf::IpAddress a8 = sf::IpAddress::getLocalAddress(); // my address on the local network +/// sf::IpAddress a9 = sf::IpAddress::getPublicAddress(); // my address on the internet +/// \endcode +/// +/// Note that sf::IpAddress currently doesn't support IPv6 +/// nor other types of network addresses. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/Packet.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/Packet.hpp new file mode 100644 index 0000000..2d3e201 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/Packet.hpp @@ -0,0 +1,407 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_PACKET_HPP +#define SFML_PACKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class String; +class TcpSocket; +class UdpSocket; + +//////////////////////////////////////////////////////////// +/// \brief Utility class to build blocks of data to transfer +/// over the network +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Packet +{ + // A bool-like type that cannot be converted to integer or pointer types + typedef bool (Packet::*BoolType)(std::size_t); + +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates an empty packet. + /// + //////////////////////////////////////////////////////////// + Packet(); + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Packet(); + + //////////////////////////////////////////////////////////// + /// \brief Append data to the end of the packet + /// + /// \param data Pointer to the sequence of bytes to append + /// \param sizeInBytes Number of bytes to append + /// + /// \see clear + /// + //////////////////////////////////////////////////////////// + void append(const void* data, std::size_t sizeInBytes); + + //////////////////////////////////////////////////////////// + /// \brief Clear the packet + /// + /// After calling Clear, the packet is empty. + /// + /// \see append + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Get a pointer to the data contained in the packet + /// + /// Warning: the returned pointer may become invalid after + /// you append data to the packet, therefore it should never + /// be stored. + /// The return pointer is NULL if the packet is empty. + /// + /// \return Pointer to the data + /// + /// \see getDataSize + /// + //////////////////////////////////////////////////////////// + const void* getData() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the data contained in the packet + /// + /// This function returns the number of bytes pointed to by + /// what getData returns. + /// + /// \return Data size, in bytes + /// + /// \see getData + /// + //////////////////////////////////////////////////////////// + std::size_t getDataSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Tell if the reading position has reached the + /// end of the packet + /// + /// This function is useful to know if there is some data + /// left to be read, without actually reading it. + /// + /// \return True if all data was read, false otherwise + /// + /// \see operator bool + /// + //////////////////////////////////////////////////////////// + bool endOfPacket() const; + +public: + + //////////////////////////////////////////////////////////// + /// \brief Test the validity of the packet, for reading + /// + /// This operator allows to test the packet as a boolean + /// variable, to check if a reading operation was successful. + /// + /// A packet will be in an invalid state if it has no more + /// data to read. + /// + /// This behaviour is the same as standard C++ streams. + /// + /// Usage example: + /// \code + /// float x; + /// packet >> x; + /// if (packet) + /// { + /// // ok, x was extracted successfully + /// } + /// + /// // -- or -- + /// + /// float x; + /// if (packet >> x) + /// { + /// // ok, x was extracted successfully + /// } + /// \endcode + /// + /// Don't focus on the return type, it's equivalent to bool but + /// it disallows unwanted implicit conversions to integer or + /// pointer types. + /// + /// \return True if last data extraction from packet was successful + /// + /// \see endOfPacket + /// + //////////////////////////////////////////////////////////// + operator BoolType() const; + + //////////////////////////////////////////////////////////// + /// Overloads of operator >> to read data from the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator >>(bool& data); + Packet& operator >>(Int8& data); + Packet& operator >>(Uint8& data); + Packet& operator >>(Int16& data); + Packet& operator >>(Uint16& data); + Packet& operator >>(Int32& data); + Packet& operator >>(Uint32& data); + Packet& operator >>(float& data); + Packet& operator >>(double& data); + Packet& operator >>(char* data); + Packet& operator >>(std::string& data); + Packet& operator >>(wchar_t* data); + Packet& operator >>(std::wstring& data); + Packet& operator >>(String& data); + + //////////////////////////////////////////////////////////// + /// Overloads of operator << to write data into the packet + /// + //////////////////////////////////////////////////////////// + Packet& operator <<(bool data); + Packet& operator <<(Int8 data); + Packet& operator <<(Uint8 data); + Packet& operator <<(Int16 data); + Packet& operator <<(Uint16 data); + Packet& operator <<(Int32 data); + Packet& operator <<(Uint32 data); + Packet& operator <<(float data); + Packet& operator <<(double data); + Packet& operator <<(const char* data); + Packet& operator <<(const std::string& data); + Packet& operator <<(const wchar_t* data); + Packet& operator <<(const std::wstring& data); + Packet& operator <<(const String& data); + +protected: + + friend class TcpSocket; + friend class UdpSocket; + + //////////////////////////////////////////////////////////// + /// \brief Called before the packet is sent over the network + /// + /// This function can be defined by derived classes to + /// transform the data before it is sent; this can be + /// used for compression, encryption, etc. + /// The function must return a pointer to the modified data, + /// as well as the number of bytes pointed. + /// The default implementation provides the packet's data + /// without transforming it. + /// + /// \param size Variable to fill with the size of data to send + /// + /// \return Pointer to the array of bytes to send + /// + /// \see onReceive + /// + //////////////////////////////////////////////////////////// + virtual const void* onSend(std::size_t& size); + + //////////////////////////////////////////////////////////// + /// \brief Called after the packet is received over the network + /// + /// This function can be defined by derived classes to + /// transform the data after it is received; this can be + /// used for uncompression, decryption, etc. + /// The function receives a pointer to the received data, + /// and must fill the packet with the transformed bytes. + /// The default implementation fills the packet directly + /// without transforming the data. + /// + /// \param data Pointer to the received bytes + /// \param size Number of bytes + /// + /// \see onSend + /// + //////////////////////////////////////////////////////////// + virtual void onReceive(const void* data, std::size_t size); + +private : + + //////////////////////////////////////////////////////////// + /// Disallow comparisons between packets + /// + //////////////////////////////////////////////////////////// + bool operator ==(const Packet& right) const; + bool operator !=(const Packet& right) const; + + //////////////////////////////////////////////////////////// + /// \brief Check if the packet can extract a given number of bytes + /// + /// This function updates accordingly the state of the packet. + /// + /// \param size Size to check + /// + /// \return True if \a size bytes can be read from the packet + /// + //////////////////////////////////////////////////////////// + bool checkSize(std::size_t size); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_data; ///< Data stored in the packet + std::size_t m_readPos; ///< Current reading position in the packet + bool m_isValid; ///< Reading state of the packet +}; + +} // namespace sf + + +#endif // SFML_PACKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Packet +/// \ingroup network +/// +/// Packets provide a safe and easy way to serialize data, +/// in order to send it over the network using sockets +/// (sf::TcpSocket, sf::UdpSocket). +/// +/// Packets solve 2 fundamental problems that arise when +/// transfering data over the network: +/// \li data is interpreted correctly according to the endianness +/// \li the bounds of the packet are preserved (one send == one receive) +/// +/// The sf::Packet class provides both input and output modes. +/// It is designed to follow the behaviour of standard C++ streams, +/// using operators >> and << to extract and insert data. +/// +/// It is recommended to use only fixed-size types (like sf::Int32, etc.), +/// to avoid possible differences between the sender and the receiver. +/// Indeed, the native C++ types may have different sizes on two platforms +/// and your data may be corrupted if that happens. +/// +/// Usage example: +/// \code +/// sf::Uint32 x = 24; +/// std::string s = "hello"; +/// double d = 5.89; +/// +/// // Group the variables to send into a packet +/// sf::Packet packet; +/// packet << x << s << d; +/// +/// // Send it over the network (socket is a valid sf::TcpSocket) +/// socket.send(packet); +/// +/// ----------------------------------------------------------------- +/// +/// // Receive the packet at the other end +/// sf::Packet packet; +/// socket.receive(packet); +/// +/// // Extract the variables contained in the packet +/// sf::Uint32 x; +/// std::string s; +/// double d; +/// if (packet >> x >> s >> d) +/// { +/// // Data extracted successfully... +/// } +/// \endcode +/// +/// Packets have built-in operator >> and << overloads for +/// standard types: +/// \li bool +/// \li fixed-size integer types (sf::Int8/16/32, sf::Uint8/16/32) +/// \li floating point numbers (float, double) +/// \li string types (char*, wchar_t*, std::string, std::wstring, sf::String) +/// +/// Like standard streams, it is also possible to define your own +/// overloads of operators >> and << in order to handle your +/// custom types. +/// +/// \code +/// struct MyStruct +/// { +/// float number; +/// sf::Int8 integer; +/// std::string str; +/// }; +/// +/// sf::Packet& operator <<(sf::Packet& packet, const MyStruct& m) +/// { +/// return packet << m.number << m.integer << m.str; +/// } +/// +/// sf::Packet& operator >>(sf::Packet& packet, MyStruct& m) +/// { +/// return packet >> m.number >> m.integer >> m.str; +/// } +/// \endcode +/// +/// Packets also provide an extra feature that allows to apply +/// custom transformations to the data before it is sent, +/// and after it is received. This is typically used to +/// handle automatic compression or encryption of the data. +/// This is achieved by inheriting from sf::Packet, and overriding +/// the onSend and onReceive functions. +/// +/// Here is an example: +/// \code +/// class ZipPacket : public sf::Packet +/// { +/// virtual const void* onSend(std::size_t& size) +/// { +/// const void* srcData = getData(); +/// std::size_t srcSize = getDataSize(); +/// +/// return MySuperZipFunction(srcData, srcSize, &size); +/// } +/// +/// virtual void onReceive(const void* data, std::size_t size) +/// { +/// std::size_t dstSize; +/// const void* dstData = MySuperUnzipFunction(data, size, &dstSize); +/// +/// append(dstData, dstSize); +/// } +/// }; +/// +/// // Use like regular packets: +/// ZipPacket packet; +/// packet << x << s << d; +/// ... +/// \endcode +/// +/// \see sf::TcpSocket, sf::UdpSocket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/Socket.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/Socket.hpp new file mode 100644 index 0000000..4b30307 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/Socket.hpp @@ -0,0 +1,218 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKET_HPP +#define SFML_SOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +class SocketSelector; + +//////////////////////////////////////////////////////////// +/// \brief Base class for all the socket types +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API Socket : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Status codes that may be returned by socket functions + /// + //////////////////////////////////////////////////////////// + enum Status + { + Done, ///< The socket has sent / received the data + NotReady, ///< The socket is not ready to send / receive data yet + Disconnected, ///< The TCP socket has been disconnected + Error ///< An unexpected error happened + }; + + //////////////////////////////////////////////////////////// + /// \brief Some special values used by sockets + /// + //////////////////////////////////////////////////////////// + enum + { + AnyPort = 0 ///< Special value that tells the system to pick any available port + }; + +public : + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + virtual ~Socket(); + + //////////////////////////////////////////////////////////// + /// \brief Set the blocking state of the socket + /// + /// In blocking mode, calls will not return until they have + /// completed their task. For example, a call to Receive in + /// blocking mode won't return until some data was actually + /// received. + /// In non-blocking mode, calls will always return immediately, + /// using the return code to signal whether there was data + /// available or not. + /// By default, all sockets are blocking. + /// + /// \param blocking True to set the socket as blocking, false for non-blocking + /// + /// \see isBlocking + /// + //////////////////////////////////////////////////////////// + void setBlocking(bool blocking); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether the socket is in blocking or non-blocking mode + /// + /// \return True if the socket is blocking, false otherwise + /// + /// \see setBlocking + /// + //////////////////////////////////////////////////////////// + bool isBlocking() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Types of protocols that the socket can use + /// + //////////////////////////////////////////////////////////// + enum Type + { + Tcp, ///< TCP protocol + Udp ///< UDP protocol + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor can only be accessed by derived classes. + /// + /// \param type Type of the socket (TCP or UDP) + /// + //////////////////////////////////////////////////////////// + Socket(Type type); + + //////////////////////////////////////////////////////////// + /// \brief Return the internal handle of the socket + /// + /// The returned handle may be invalid if the socket + /// was not created yet (or already destroyed). + /// This function can only be accessed by derived classes. + /// + /// \return The internal (OS-specific) handle of the socket + /// + //////////////////////////////////////////////////////////// + SocketHandle getHandle() const; + + //////////////////////////////////////////////////////////// + /// \brief Create the internal representation of the socket + /// + /// This function can only be accessed by derived classes. + /// + //////////////////////////////////////////////////////////// + void create(); + + //////////////////////////////////////////////////////////// + /// \brief Create the internal representation of the socket + /// from a socket handle + /// + /// This function can only be accessed by derived classes. + /// + /// \param handle OS-specific handle of the socket to wrap + /// + //////////////////////////////////////////////////////////// + void create(SocketHandle handle); + + //////////////////////////////////////////////////////////// + /// \brief Close the socket gracefully + /// + /// This function can only be accessed by derived classes. + /// + //////////////////////////////////////////////////////////// + void close(); + +private : + + friend class SocketSelector; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Type m_type; ///< Type of the socket (TCP or UDP) + SocketHandle m_socket; ///< Socket descriptor + bool m_isBlocking; ///< Current blocking mode of the socket +}; + +} // namespace sf + + +#endif // SFML_SOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Socket +/// \ingroup network +/// +/// This class mainly defines internal stuff to be used by +/// derived classes. +/// +/// The only public features that it defines, and which +/// is therefore common to all the socket classes, is the +/// blocking state. All sockets can be set as blocking or +/// non-blocking. +/// +/// In blocking mode, socket functions will hang until +/// the operation completes, which means that the entire +/// program (well, in fact the current thread if you use +/// multiple ones) will be stuck waiting for your socket +/// operation to complete. +/// +/// In non-blocking mode, all the socket functions will +/// return immediately. If the socket is not ready to complete +/// the requested operation, the function simply returns +/// the proper status code (Socket::NotReady). +/// +/// The default mode, which is blocking, is the one that is +/// generally used, in combination with threads or selectors. +/// The non-blocking mode is rather used in real-time +/// applications that run an endless loop that can poll +/// the socket often enough, and cannot afford blocking +/// this loop. +/// +/// \see sf::TcpListener, sf::TcpSocket, sf::UdpSocket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketHandle.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketHandle.hpp new file mode 100644 index 0000000..8edd46a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketHandle.hpp @@ -0,0 +1,57 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETHANDLE_HPP +#define SFML_SOCKETHANDLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +#if defined(SFML_SYSTEM_WINDOWS) + #include +#endif + + +namespace sf +{ +//////////////////////////////////////////////////////////// +// Define the low-level socket handle type, specific to +// each platform +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + typedef UINT_PTR SocketHandle; + +#else + + typedef int SocketHandle; + +#endif + +} // namespace sf + + +#endif // SFML_SOCKETHANDLE_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketSelector.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketSelector.hpp new file mode 100644 index 0000000..414a941 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/SocketSelector.hpp @@ -0,0 +1,263 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SOCKETSELECTOR_HPP +#define SFML_SOCKETSELECTOR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Socket; + +//////////////////////////////////////////////////////////// +/// \brief Multiplexer that allows to read from multiple sockets +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API SocketSelector +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + SocketSelector(); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + SocketSelector(const SocketSelector& copy); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~SocketSelector(); + + //////////////////////////////////////////////////////////// + /// \brief Add a new socket to the selector + /// + /// This function keeps a weak reference to the socket, + /// so you have to make sure that the socket is not destroyed + /// while it is stored in the selector. + /// This function does nothing if the socket is not valid. + /// + /// \param socket Reference to the socket to add + /// + /// \see remove, clear + /// + //////////////////////////////////////////////////////////// + void add(Socket& socket); + + //////////////////////////////////////////////////////////// + /// \brief Remove a socket from the selector + /// + /// This function doesn't destroy the socket, it simply + /// removes the reference that the selector has to it. + /// + /// \param socket Reference to the socket to remove + /// + /// \see add, clear + /// + //////////////////////////////////////////////////////////// + void remove(Socket& socket); + + //////////////////////////////////////////////////////////// + /// \brief Remove all the sockets stored in the selector + /// + /// This function doesn't destroy any instance, it simply + /// removes all the references that the selector has to + /// external sockets. + /// + /// \see add, remove + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Wait until one or more sockets are ready to receive + /// + /// This function returns as soon as at least one socket has + /// some data available to be received. To know which sockets are + /// ready, use the isReady function. + /// If you use a timeout and no socket is ready before the timeout + /// is over, the function returns false. + /// + /// \param timeout Maximum time to wait, (use Time::Zero for infinity) + /// + /// \return True if there are sockets ready, false otherwise + /// + /// \see isReady + /// + //////////////////////////////////////////////////////////// + bool wait(Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Test a socket to know if it is ready to receive data + /// + /// This function must be used after a call to Wait, to know + /// which sockets are ready to receive data. If a socket is + /// ready, a call to receive will never block because we know + /// that there is data available to read. + /// Note that if this function returns true for a TcpListener, + /// this means that it is ready to accept a new connection. + /// + /// \param socket Socket to test + /// + /// \return True if the socket is ready to read, false otherwise + /// + /// \see isReady + /// + //////////////////////////////////////////////////////////// + bool isReady(Socket& socket) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + SocketSelector& operator =(const SocketSelector& right); + +private : + + struct SocketSelectorImpl; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + SocketSelectorImpl* m_impl; ///< Opaque pointer to the implementation (which requires OS-specific types) +}; + +} // namespace sf + + +#endif // SFML_SOCKETSELECTOR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::SocketSelector +/// \ingroup network +/// +/// Socket selectors provide a way to wait until some data is +/// available on a set of sockets, instead of just one. This +/// is convenient when you have multiple sockets that may +/// possibly receive data, but you don't know which one will +/// be ready first. In particular, it avoids to use a thread +/// for each socket; with selectors, a single thread can handle +/// all the sockets. +/// +/// All types of sockets can be used in a selector: +/// \li sf::TcpListener +/// \li sf::TcpSocket +/// \li sf::UdpSocket +/// +/// A selector doesn't store its own copies of the sockets +/// (socket classes are not copyable anyway), it simply keeps +/// a reference to the original sockets that you pass to the +/// "add" function. Therefore, you can't use the selector as a +/// socket container, you must store them oustide and make sure +/// that they are alive as long as they are used in the selector. +/// +/// Using a selector is simple: +/// \li populate the selector with all the sockets that you want to observe +/// \li make it wait until there is data available on any of the sockets +/// \li test each socket to find out which ones are ready +/// +/// Usage example: +/// \code +/// // Create a socket to listen to new connections +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Create a list to store the future clients +/// std::list clients; +/// +/// // Create a selector +/// sf::SocketSelector selector; +/// +/// // Add the listener to the selector +/// selector.add(listener); +/// +/// // Endless loop that waits for new connections +/// while (running) +/// { +/// // Make the selector wait for data on any socket +/// if (selector.wait()) +/// { +/// // Test the listener +/// if (selector.isReady(listener)) +/// { +/// // The listener is ready: there is a pending connection +/// sf::TcpSocket* client = new sf::TcpSocket; +/// if (listener.accept(*client) == sf::Socket::Done) +/// { +/// // Add the new client to the clients list +/// clients.push_back(client); +/// +/// // Add the new client to the selector so that we will +/// // be notified when he sends something +/// selector.add(*client); +/// } +/// else +/// { +/// // Error, we won't get a new connection, delete the socket +/// delete client; +/// } +/// } +/// else +/// { +/// // The listener socket is not ready, test all other sockets (the clients) +/// for (std::list::iterator it = clients.begin(); it != clients.end(); ++it) +/// { +/// sf::TcpSocket& client = **it; +/// if (selector.isReady(client)) +/// { +/// // The client has sent some data, we can receive it +/// sf::Packet packet; +/// if (client.receive(packet) == sf::Socket::Done) +/// { +/// ... +/// } +/// } +/// } +/// } +/// } +/// } +/// \endcode +/// +/// \see sf::Socket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpListener.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpListener.hpp new file mode 100644 index 0000000..5a5bdb3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpListener.hpp @@ -0,0 +1,162 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPLISTENER_HPP +#define SFML_TCPLISTENER_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class TcpSocket; + +//////////////////////////////////////////////////////////// +/// \brief Socket that listens to new TCP connections +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API TcpListener : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + TcpListener(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not listening to a port, this function + /// returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Start listening for connections + /// + /// This functions makes the socket listen to the specified + /// port, waiting for new connections. + /// If the socket was previously listening to another port, + /// it will be stopped first and bound to the new port. + /// + /// \param port Port to listen for new connections + /// + /// \return Status code + /// + /// \see accept, close + /// + //////////////////////////////////////////////////////////// + Status listen(unsigned short port); + + //////////////////////////////////////////////////////////// + /// \brief Stop listening and close the socket + /// + /// This function gracefully stops the listener. If the + /// socket is not listening, this function has no effect. + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + void close(); + + //////////////////////////////////////////////////////////// + /// \brief Accept a new connection + /// + /// If the socket is in blocking mode, this function will + /// not return until a connection is actually received. + /// + /// \param socket Socket that will hold the new connection + /// + /// \return Status code + /// + /// \see listen + /// + //////////////////////////////////////////////////////////// + Status accept(TcpSocket& socket); +}; + + +} // namespace sf + + +#endif // SFML_TCPLISTENER_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::TcpListener +/// \ingroup network +/// +/// A listener socket is a special type of socket that listens to +/// a given port and waits for connections on that port. +/// This is all it can do. +/// +/// When a new connection is received, you must call accept and +/// the listener returns a new instance of sf::TcpSocket that +/// is properly initialized and can be used to communicate with +/// the new client. +/// +/// Listener sockets are specific to the TCP protocol, +/// UDP sockets are connectionless and can therefore communicate +/// directly. As a consequence, a listener socket will always +/// return the new connections as sf::TcpSocket instances. +/// +/// A listener is automatically closed on destruction, like all +/// other types of socket. However if you want to stop listening +/// before the socket is destroyed, you can call its close() +/// function. +/// +/// Usage example: +/// \code +/// // Create a listener socket and make it wait for new +/// // connections on port 55001 +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Endless loop that waits for new connections +/// while (running) +/// { +/// sf::TcpSocket client; +/// if (listener.accept(client) == sf::Socket::Done) +/// { +/// // A new client just connected! +/// std::cout << "New connection received from " << client.getRemoteAddress() << std::endl; +/// doSomethingWith(client); +/// } +/// } +/// \endcode +/// +/// \see sf::TcpSocket, sf::Socket +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpSocket.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpSocket.hpp new file mode 100644 index 0000000..2db2b72 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/TcpSocket.hpp @@ -0,0 +1,292 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TCPSOCKET_HPP +#define SFML_TCPSOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class TcpListener; +class IpAddress; +class Packet; + +//////////////////////////////////////////////////////////// +/// \brief Specialized socket using the TCP protocol +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API TcpSocket : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + TcpSocket(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not connected, this function returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see connect, getRemotePort + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the address of the connected peer + /// + /// It the socket is not connected, this function returns + /// sf::IpAddress::None. + /// + /// \return Address of the remote peer + /// + /// \see getRemotePort + /// + //////////////////////////////////////////////////////////// + IpAddress getRemoteAddress() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the port of the connected peer to which + /// the socket is connected + /// + /// If the socket is not connected, this function returns 0. + /// + /// \return Remote port to which the socket is connected + /// + /// \see getRemoteAddress + /// + //////////////////////////////////////////////////////////// + unsigned short getRemotePort() const; + + //////////////////////////////////////////////////////////// + /// \brief Connect the socket to a remote peer + /// + /// In blocking mode, this function may take a while, especially + /// if the remote peer is not reachable. The last parameter allows + /// you to stop trying to connect after a given timeout. + /// If the socket was previously connected, it is first disconnected. + /// + /// \param remoteAddress Address of the remote peer + /// \param remotePort Port of the remote peer + /// \param timeout Optional maximum time to wait + /// + /// \return Status code + /// + /// \see disconnect + /// + //////////////////////////////////////////////////////////// + Status connect(const IpAddress& remoteAddress, unsigned short remotePort, Time timeout = Time::Zero); + + //////////////////////////////////////////////////////////// + /// \brief Disconnect the socket from its remote peer + /// + /// This function gracefully closes the connection. If the + /// socket is not connected, this function has no effect. + /// + /// \see connect + /// + //////////////////////////////////////////////////////////// + void disconnect(); + + //////////////////////////////////////////////////////////// + /// \brief Send raw data to the remote peer + /// + /// This function will fail if the socket is not connected. + /// + /// \param data Pointer to the sequence of bytes to send + /// \param size Number of bytes to send + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(const void* data, std::size_t size); + + //////////////////////////////////////////////////////////// + /// \brief Receive raw data from the remote peer + /// + /// In blocking mode, this function will wait until some + /// bytes are actually received. + /// This function will fail if the socket is not connected. + /// + /// \param data Pointer to the array to fill with the received bytes + /// \param size Maximum number of bytes that can be received + /// \param received This variable is filled with the actual number of bytes received + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(void* data, std::size_t size, std::size_t& received); + + //////////////////////////////////////////////////////////// + /// \brief Send a formatted packet of data to the remote peer + /// + /// This function will fail if the socket is not connected. + /// + /// \param packet Packet to send + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(Packet& packet); + + //////////////////////////////////////////////////////////// + /// \brief Receive a formatted packet of data from the remote peer + /// + /// In blocking mode, this function will wait until the whole packet + /// has been received. + /// This function will fail if the socket is not connected. + /// + /// \param packet Packet to fill with the received data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(Packet& packet); + +private: + + friend class TcpListener; + + //////////////////////////////////////////////////////////// + /// \brief Structure holding the data of a pending packet + /// + //////////////////////////////////////////////////////////// + struct PendingPacket + { + PendingPacket(); + + Uint32 Size; ///< Data of packet size + std::size_t SizeReceived; ///< Number of size bytes received so far + std::vector Data; ///< Data of the packet + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + PendingPacket m_pendingPacket; ///< Temporary data of the packet currently being received +}; + +} // namespace sf + + +#endif // SFML_TCPSOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::TcpSocket +/// \ingroup network +/// +/// TCP is a connected protocol, which means that a TCP +/// socket can only communicate with the host it is connected +/// to. It can't send or receive anything if it is not connected. +/// +/// The TCP protocol is reliable but adds a slight overhead. +/// It ensures that your data will always be received in order +/// and without errors (no data corrupted, lost or duplicated). +/// +/// When a socket is connected to a remote host, you can +/// retrieve informations about this host with the +/// getRemoteAddress and getRemotePort functions. You can +/// also get the local port to which the socket is bound +/// (which is automatically chosen when the socket is connected), +/// with the getLocalPort function. +/// +/// Sending and receiving data can use either the low-level +/// or the high-level functions. The low-level functions +/// process a raw sequence of bytes, and cannot ensure that +/// one call to Send will exactly match one call to Receive +/// at the other end of the socket. +/// +/// The high-level interface uses packets (see sf::Packet), +/// which are easier to use and provide more safety regarding +/// the data that is exchanged. You can look at the sf::Packet +/// class to get more details about how they work. +/// +/// The socket is automatically disconnected when it is destroyed, +/// but if you want to explicitely close the connection while +/// the socket instance is still alive, you can call disconnect. +/// +/// Usage example: +/// \code +/// // ----- The client ----- +/// +/// // Create a socket and connect it to 192.168.1.50 on port 55001 +/// sf::TcpSocket socket; +/// socket.connect("192.168.1.50", 55001); +/// +/// // Send a message to the connected host +/// std::string message = "Hi, I am a client"; +/// socket.send(message.c_str(), message.size() + 1); +/// +/// // Receive an answer from the server +/// char buffer[1024]; +/// std::size_t received = 0; +/// socket.receive(buffer, sizeof(buffer), received); +/// std::cout << "The server said: " << buffer << std::endl; +/// +/// // ----- The server ----- +/// +/// // Create a listener to wait for incoming connections on port 55001 +/// sf::TcpListener listener; +/// listener.listen(55001); +/// +/// // Wait for a connection +/// sf::TcpSocket socket; +/// listener.accept(socket); +/// std::cout << "New client connected: " << socket.getRemoteAddress() << std::endl; +/// +/// // Receive a message from the client +/// char buffer[1024]; +/// std::size_t received = 0; +/// socket.receive(buffer, sizeof(buffer), received); +/// std::cout << "The client said: " << buffer << std::endl; +/// +/// // Send an answer +/// std::string message = "Welcome, client"; +/// socket.send(message.c_str(), message.size() + 1); +/// \endcode +/// +/// \see sf::Socket, sf::UdpSocket, sf::Packet +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Network/UdpSocket.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Network/UdpSocket.hpp new file mode 100644 index 0000000..e5fa3b0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Network/UdpSocket.hpp @@ -0,0 +1,283 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UDPSOCKET_HPP +#define SFML_UDPSOCKET_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +class IpAddress; +class Packet; + +//////////////////////////////////////////////////////////// +/// \brief Specialized socket using the UDP protocol +/// +//////////////////////////////////////////////////////////// +class SFML_NETWORK_API UdpSocket : public Socket +{ +public : + + //////////////////////////////////////////////////////////// + // Constants + //////////////////////////////////////////////////////////// + enum + { + MaxDatagramSize = 65507 ///< The maximum number of bytes that can be sent in a single UDP datagram + }; + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + UdpSocket(); + + //////////////////////////////////////////////////////////// + /// \brief Get the port to which the socket is bound locally + /// + /// If the socket is not bound to a port, this function + /// returns 0. + /// + /// \return Port to which the socket is bound + /// + /// \see bind + /// + //////////////////////////////////////////////////////////// + unsigned short getLocalPort() const; + + //////////////////////////////////////////////////////////// + /// \brief Bind the socket to a specific port + /// + /// Binding the socket to a port is necessary for being + /// able to receive data on that port. + /// You can use the special value Socket::AnyPort to tell the + /// system to automatically pick an available port, and then + /// call getLocalPort to retrieve the chosen port. + /// + /// \param port Port to bind the socket to + /// + /// \return Status code + /// + /// \see unbind, getLocalPort + /// + //////////////////////////////////////////////////////////// + Status bind(unsigned short port); + + //////////////////////////////////////////////////////////// + /// \brief Unbind the socket from the local port to which it is bound + /// + /// The port that the socket was previously using is immediately + /// available after this function is called. If the + /// socket is not bound to a port, this function has no effect. + /// + /// \see bind + /// + //////////////////////////////////////////////////////////// + void unbind(); + + //////////////////////////////////////////////////////////// + /// \brief Send raw data to a remote peer + /// + /// Make sure that \a size is not greater than + /// UdpSocket::MaxDatagramSize, otherwise this function will + /// fail and no data will be sent. + /// + /// \param data Pointer to the sequence of bytes to send + /// \param size Number of bytes to send + /// \param remoteAddress Address of the receiver + /// \param remotePort Port of the receiver to send the data to + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(const void* data, std::size_t size, const IpAddress& remoteAddress, unsigned short remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Receive raw data from a remote peer + /// + /// In blocking mode, this function will wait until some + /// bytes are actually received. + /// Be careful to use a buffer which is large enough for + /// the data that you intend to receive, if it is too small + /// then an error will be returned and *all* the data will + /// be lost. + /// + /// \param data Pointer to the array to fill with the received bytes + /// \param size Maximum number of bytes that can be received + /// \param received This variable is filled with the actual number of bytes received + /// \param remoteAddress Address of the peer that sent the data + /// \param remotePort Port of the peer that sent the data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(void* data, std::size_t size, std::size_t& received, IpAddress& remoteAddress, unsigned short& remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Send a formatted packet of data to a remote peer + /// + /// Make sure that the packet size is not greater than + /// UdpSocket::MaxDatagramSize, otherwise this function will + /// fail and no data will be sent. + /// + /// \param packet Packet to send + /// \param remoteAddress Address of the receiver + /// \param remotePort Port of the receiver to send the data to + /// + /// \return Status code + /// + /// \see receive + /// + //////////////////////////////////////////////////////////// + Status send(Packet& packet, const IpAddress& remoteAddress, unsigned short remotePort); + + //////////////////////////////////////////////////////////// + /// \brief Receive a formatted packet of data from a remote peer + /// + /// In blocking mode, this function will wait until the whole packet + /// has been received. + /// + /// \param packet Packet to fill with the received data + /// \param remoteAddress Address of the peer that sent the data + /// \param remotePort Port of the peer that sent the data + /// + /// \return Status code + /// + /// \see send + /// + //////////////////////////////////////////////////////////// + Status receive(Packet& packet, IpAddress& remoteAddress, unsigned short& remotePort); + +private: + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::vector m_buffer; ///< Temporary buffer holding the received data in Receive(Packet) +}; + +} // namespace sf + + +#endif // SFML_UDPSOCKET_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::UdpSocket +/// \ingroup network +/// +/// A UDP socket is a connectionless socket. Instead of +/// connecting once to a remote host, like TCP sockets, +/// it can send to and receive from any host at any time. +/// +/// It is a datagram protocol: bounded blocks of data (datagrams) +/// are transfered over the network rather than a continuous +/// stream of data (TCP). Therefore, one call to send will always +/// match one call to receive (if the datagram is not lost), +/// with the same data that was sent. +/// +/// The UDP protocol is lightweight but unreliable. Unreliable +/// means that datagrams may be duplicated, be lost or +/// arrive reordered. However, if a datagram arrives, its +/// data is guaranteed to be valid. +/// +/// UDP is generally used for real-time communication +/// (audio or video streaming, real-time games, etc.) where +/// speed is crucial and lost data doesn't matter much. +/// +/// Sending and receiving data can use either the low-level +/// or the high-level functions. The low-level functions +/// process a raw sequence of bytes, whereas the high-level +/// interface uses packets (see sf::Packet), which are easier +/// to use and provide more safety regarding the data that is +/// exchanged. You can look at the sf::Packet class to get +/// more details about how they work. +/// +/// It is important to note that UdpSocket is unable to send +/// datagrams bigger than MaxDatagramSize. In this case, it +/// returns an error and doesn't send anything. This applies +/// to both raw data and packets. Indeed, even packets are +/// unable to split and recompose data, due to the unreliability +/// of the protocol (dropped, mixed or duplicated datagrams may +/// lead to a big mess when trying to recompose a packet). +/// +/// If the socket is bound to a port, it is automatically +/// unbound from it when the socket is destroyed. However, +/// you can unbind the socket explicitely with the Unbind +/// function if necessary, to stop receiving messages or +/// make the port available for other sockets. +/// +/// Usage example: +/// \code +/// // ----- The client ----- +/// +/// // Create a socket and bind it to the port 55001 +/// sf::UdpSocket socket; +/// socket.bind(55001); +/// +/// // Send a message to 192.168.1.50 on port 55002 +/// std::string message = "Hi, I am " + sf::IpAddress::getLocalAddress().toString(); +/// socket.send(message.c_str(), message.size() + 1, "192.168.1.50", 55002); +/// +/// // Receive an answer (most likely from 192.168.1.50, but could be anyone else) +/// char buffer[1024]; +/// std::size_t received = 0; +/// sf::IpAddress sender; +/// unsigned short port; +/// socket.receive(buffer, sizeof(buffer), received, sender, port); +/// std::cout << sender.ToString() << " said: " << buffer << std::endl; +/// +/// // ----- The server ----- +/// +/// // Create a socket and bind it to the port 55002 +/// sf::UdpSocket socket; +/// socket.bind(55002); +/// +/// // Receive a message from anyone +/// char buffer[1024]; +/// std::size_t received = 0; +/// sf::IpAddress sender; +/// unsigned short port; +/// socket.receive(buffer, sizeof(buffer), received, sender, port); +/// std::cout << sender.ToString() << " said: " << buffer << std::endl; +/// +/// // Send an answer +/// std::string message = "Welcome " + sender.toString(); +/// socket.send(message.c_str(), message.size() + 1, sender, port); +/// \endcode +/// +/// \see sf::Socket, sf::TcpSocket, sf::Packet +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/OpenGL.hpp b/SFML-2.1-osx-clang-universal/include/SFML/OpenGL.hpp new file mode 100644 index 0000000..3d04603 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/OpenGL.hpp @@ -0,0 +1,62 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_OPENGL_HPP +#define SFML_OPENGL_HPP + + +//////////////////////////////////////////////////////////// +/// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +/// This file just includes the OpenGL (GL and GLU) headers, +/// which have actually different paths on each system +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + // The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them + #ifdef _MSC_VER + #include + #endif + + #include + #include + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + #include + #include + +#elif defined(SFML_SYSTEM_MACOS) + + #include + #include + +#endif + + +#endif // SFML_OPENGL_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System.hpp new file mode 100644 index 0000000..9d2166b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System.hpp @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_HPP +#define SFML_SYSTEM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // SFML_SYSTEM_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup system System module +/// +/// Base module of SFML, defining various utilities. It provides +/// vector classes, unicode strings and conversion functions, +/// threads and mutexes, timing classes. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Clock.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Clock.hpp new file mode 100644 index 0000000..4ae0f2d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Clock.hpp @@ -0,0 +1,117 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CLOCK_HPP +#define SFML_CLOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class that measures the elapsed time +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Clock +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// The clock starts automatically after being constructed. + /// + //////////////////////////////////////////////////////////// + Clock(); + + //////////////////////////////////////////////////////////// + /// \brief Get the elapsed time + /// + /// This function returns the time elapsed since the last call + /// to restart() (or the construction of the instance if restart() + /// has not been called). + /// + /// \return Time elapsed + /// + //////////////////////////////////////////////////////////// + Time getElapsedTime() const; + + //////////////////////////////////////////////////////////// + /// \brief Restart the clock + /// + /// This function puts the time counter back to zero. + /// It also returns the time elapsed since the clock was started. + /// + /// \return Time elapsed + /// + //////////////////////////////////////////////////////////// + Time restart(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Time m_startTime; ///< Time of last reset, in microseconds +}; + +} // namespace sf + + +#endif // SFML_CLOCK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Clock +/// \ingroup system +/// +/// sf::Clock is a lightweight class for measuring time. +/// +/// Its provides the most precise time that the underlying +/// OS can achieve (generally microseconds or nanoseconds). +/// It also ensures monotonicity, which means that the returned +/// time can never go backward, even if the system time is +/// changed. +/// +/// Usage example: +/// \code +/// sf::Clock clock; +/// ... +/// Time time1 = clock.getElapsedTime(); +/// ... +/// Time time2 = clock.restart(); +/// \endcode +/// +/// The sf::Time value returned by the clock can then be +/// converted to a number of seconds, milliseconds or even +/// microseconds. +/// +/// \see sf::Time +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Err.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Err.hpp new file mode 100644 index 0000000..7903020 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Err.hpp @@ -0,0 +1,78 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_ERR_HPP +#define SFML_ERR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Standard stream used by SFML to output warnings and errors +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API std::ostream& err(); + +} // namespace sf + + +#endif // SFML_ERR_HPP + + +//////////////////////////////////////////////////////////// +/// \fn sf::err +/// \ingroup system +/// +/// By default, sf::err() outputs to the same location as std::cerr, +/// (-> the stderr descriptor) which is the console if there's +/// one available. +/// +/// It is a standard std::ostream instance, so it supports all the +/// insertion operations defined by the STL +/// (operator <<, manipulators, etc.). +/// +/// sf::err() can be redirected to write to another output, independantly +/// of std::cerr, by using the rdbuf() function provided by the +/// std::ostream class. +/// +/// Example: +/// \code +/// // Redirect to a file +/// std::ofstream file("sfml-log.txt"); +/// std::streambuf* previous = sf::err().rdbuf(file.rdbuf()); +/// +/// // Redirect to nothing +/// sf::err().rdbuf(NULL); +/// +/// // Restore the original output +/// sf::err().rdbuf(previous); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Export.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Export.hpp new file mode 100644 index 0000000..ec08fbe --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SYSTEM_EXPORT_HPP +#define SFML_SYSTEM_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_EXPORTS) + + #define SFML_SYSTEM_API SFML_API_EXPORT + +#else + + #define SFML_SYSTEM_API SFML_API_IMPORT + +#endif + + +#endif // SFML_SYSTEM_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/InputStream.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/InputStream.hpp new file mode 100644 index 0000000..b79436a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/InputStream.hpp @@ -0,0 +1,151 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_INPUTSTREAM_HPP +#define SFML_INPUTSTREAM_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Abstract class for custom file input streams +/// +//////////////////////////////////////////////////////////// +class InputStream +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Virtual destructor + /// + //////////////////////////////////////////////////////////// + virtual ~InputStream() {} + + //////////////////////////////////////////////////////////// + /// \brief Read data from the stream + /// + /// After reading, the stream's reading position must be + /// advanced by the amount of bytes read. + /// + /// \param data Buffer where to copy the read data + /// \param size Desired number of bytes to read + /// + /// \return The number of bytes actually read, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 read(void* data, Int64 size) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Change the current reading position + /// + /// \param position The position to seek to, from the beginning + /// + /// \return The position actually sought to, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 seek(Int64 position) = 0; + + //////////////////////////////////////////////////////////// + /// \brief Get the current reading position in the stream + /// + /// \return The current position, or -1 on error. + /// + //////////////////////////////////////////////////////////// + virtual Int64 tell() = 0; + + //////////////////////////////////////////////////////////// + /// \brief Return the size of the stream + /// + /// \return The total number of bytes available in the stream, or -1 on error + /// + //////////////////////////////////////////////////////////// + virtual Int64 getSize() = 0; +}; + +} // namespace sf + + +#endif // SFML_INPUTSTREAM_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::InputStream +/// \ingroup system +/// +/// This class allows users to define their own file input sources +/// from which SFML can load resources. +/// +/// SFML resource classes like sf::Texture and +/// sf::SoundBuffer provide loadFromFile and loadFromMemory functions, +/// which read data from conventional sources. However, if you +/// have data coming from a different source (over a network, +/// embedded, encrypted, compressed, etc) you can derive your +/// own class from sf::InputStream and load SFML resources with +/// their loadFromStream function. +/// +/// Usage example: +/// \code +/// // custom stream class that reads from inside a zip file +/// class ZipStream : public sf::InputStream +/// { +/// public : +/// +/// ZipStream(std::string archive); +/// +/// bool open(std::string filename); +/// +/// Int64 read(void* data, Int64 size); +/// +/// Int64 seek(Int64 position); +/// +/// Int64 tell(); +/// +/// Int64 getSize(); +/// +/// private : +/// +/// ... +/// }; +/// +/// // now you can load textures... +/// sf::Texture texture; +/// ZipStream stream("resources.zip"); +/// stream.open("images/img.png"); +/// texture.loadFromStream(stream); +/// +/// // musics... +/// sf::Music music; +/// ZipStream stream("resources.zip"); +/// stream.open("musics/msc.ogg"); +/// music.openFromStream(stream); +/// +/// // etc. +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Lock.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Lock.hpp new file mode 100644 index 0000000..09c2a8e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Lock.hpp @@ -0,0 +1,139 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_LOCK_HPP +#define SFML_LOCK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Mutex; + +//////////////////////////////////////////////////////////// +/// \brief Automatic wrapper for locking and unlocking mutexes +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Lock : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct the lock with a target mutex + /// + /// The mutex passed to sf::Lock is automatically locked. + /// + /// \param mutex Mutex to lock + /// + //////////////////////////////////////////////////////////// + explicit Lock(Mutex& mutex); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// The destructor of sf::Lock automatically unlocks its mutex. + /// + //////////////////////////////////////////////////////////// + ~Lock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Mutex& m_mutex; ///< Mutex to lock / unlock +}; + +} // namespace sf + + +#endif // SFML_LOCK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Lock +/// \ingroup system +/// +/// sf::Lock is a RAII wrapper for sf::Mutex. By unlocking +/// it in its destructor, it ensures that the mutex will +/// always be released when the current scope (most likely +/// a function) ends. +/// This is even more important when an exception or an early +/// return statement can interrupt the execution flow of the +/// function. +/// +/// For maximum robustness, sf::Lock should always be used +/// to lock/unlock a mutex. +/// +/// Usage example: +/// \code +/// sf::Mutex mutex; +/// +/// void function() +/// { +/// sf::Lock lock(mutex); // mutex is now locked +/// +/// functionThatMayThrowAnException(); // mutex is unlocked if this function throws +/// +/// if (someCondition) +/// return; // mutex is unlocked +/// +/// } // mutex is unlocked +/// \endcode +/// +/// Because the mutex is not explicitely unlocked in the code, +/// it may remain locked longer than needed. If the region +/// of the code that needs to be protected by the mutex is +/// not the entire function, a good practice is to create a +/// smaller, inner scope so that the lock is limited to this +/// part of the code. +/// +/// \code +/// sf::Mutex mutex; +/// +/// void function() +/// { +/// { +/// sf::Lock lock(mutex); +/// codeThatRequiresProtection(); +/// +/// } // mutex is unlocked here +/// +/// codeThatDoesntCareAboutTheMutex(); +/// } +/// \endcode +/// +/// Having a mutex locked longer than required is a bad practice +/// which can lead to bad performances. Don't forget that when +/// a mutex is locked, other threads may be waiting doing nothing +/// until it is released. +/// +/// \see sf::Mutex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Mutex.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Mutex.hpp new file mode 100644 index 0000000..ac95236 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Mutex.hpp @@ -0,0 +1,148 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MUTEX_HPP +#define SFML_MUTEX_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +namespace priv +{ + class MutexImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Blocks concurrent access to shared resources +/// from multiple threads +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Mutex : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + Mutex(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~Mutex(); + + //////////////////////////////////////////////////////////// + /// \brief Lock the mutex + /// + /// If the mutex is already locked in another thread, + /// this call will block the execution until the mutex + /// is released. + /// + /// \see unlock + /// + //////////////////////////////////////////////////////////// + void lock(); + + //////////////////////////////////////////////////////////// + /// \brief Unlock the mutex + /// + /// \see lock + /// + //////////////////////////////////////////////////////////// + void unlock(); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::MutexImpl* m_mutexImpl; ///< OS-specific implementation +}; + +} // namespace sf + + +#endif // SFML_MUTEX_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Mutex +/// \ingroup system +/// +/// Mutex stands for "MUTual EXclusion". A mutex is a +/// synchronization object, used when multiple threads are involved. +/// +/// When you want to protect a part of the code from being accessed +/// simultaneously by multiple threads, you typically use a +/// mutex. When a thread is locked by a mutex, any other thread +/// trying to lock it will be blocked until the mutex is released +/// by the thread that locked it. This way, you can allow only +/// one thread at a time to access a critical region of your code. +/// +/// Usage example: +/// \code +/// Database database; // this is a critical resource that needs some protection +/// sf::Mutex mutex; +/// +/// void thread1() +/// { +/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread2 +/// database.write(...); +/// mutex.unlock(); // if thread2 was waiting, it will now be unblocked +/// } +/// +/// void thread2() +/// { +/// mutex.lock(); // this call will block the thread if the mutex is already locked by thread1 +/// database.write(...); +/// mutex.unlock(); // if thread1 was waiting, it will now be unblocked +/// } +/// \endcode +/// +/// Be very careful with mutexes. A bad usage can lead to bad problems, +/// like deadlocks (two threads are waiting for each other and the +/// application is globally stuck). +/// +/// To make the usage of mutexes more robust, particularly in +/// environments where exceptions can be thrown, you should +/// use the helper class sf::Lock to lock/unlock mutexes. +/// +/// SFML mutexes are recursive, which means that you can lock +/// a mutex multiple times in the same thread without creating +/// a deadlock. In this case, the first call to lock() behaves +/// as usual, and the following ones have no effect. +/// However, you must call unlock() exactly as many times as you +/// called lock(). If you don't, the mutex won't be released. +/// +/// \see sf::Lock +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/NonCopyable.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/NonCopyable.hpp new file mode 100644 index 0000000..8c9cdb6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/NonCopyable.hpp @@ -0,0 +1,119 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_NONCOPYABLE_HPP +#define SFML_NONCOPYABLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility class that makes any derived +/// class non-copyable +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API NonCopyable +{ +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Because this class has a copy constructor, the compiler + /// will not automatically generate the default constructor. + /// That's why we must define it explicitely. + /// + //////////////////////////////////////////////////////////// + NonCopyable() {} + +private : + + //////////////////////////////////////////////////////////// + /// \brief Disabled copy constructor + /// + /// By making the copy constructor private, the compiler will + /// trigger an error if anyone outside tries to use it. + /// To prevent NonCopyable or friend classes from using it, + /// we also give no definition, so that the linker will + /// produce an error if the first protection was inefficient. + /// + //////////////////////////////////////////////////////////// + NonCopyable(const NonCopyable&); + + //////////////////////////////////////////////////////////// + /// \brief Disabled assignment operator + /// + /// By making the assignment operator private, the compiler will + /// trigger an error if anyone outside tries to use it. + /// To prevent NonCopyable or friend classes from using it, + /// we also give no definition, so that the linker will + /// produce an error if the first protection was inefficient. + /// + //////////////////////////////////////////////////////////// + NonCopyable& operator =(const NonCopyable&); +}; + +} // namespace sf + + +#endif // SFML_NONCOPYABLE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::NonCopyable +/// \ingroup system +/// +/// This class makes its instances non-copyable, by explicitely +/// disabling its copy constructor and its assignment operator. +/// +/// To create a non-copyable class, simply inherit from +/// sf::NonCopyable. +/// +/// The type of inheritance (public or private) doesn't matter, +/// the copy constructor and assignment operator are declared private +/// in sf::NonCopyable so they will end up being inaccessible in both +/// cases. Thus you can use a shorter syntax for inheriting from it +/// (see below). +/// +/// Usage example: +/// \code +/// class MyNonCopyableClass : sf::NonCopyable +/// { +/// ... +/// }; +/// \endcode +/// +/// Deciding whether the instances of a class can be copied +/// or not is a very important design choice. You are strongly +/// encouraged to think about it before writing a class, +/// and to use sf::NonCopyable when necessary to prevent +/// many potential future errors when using it. This is also +/// a very important indication to users of your class. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Sleep.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Sleep.hpp new file mode 100644 index 0000000..47567a9 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Sleep.hpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SLEEP_HPP +#define SFML_SLEEP_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \ingroup system +/// \brief Make the current thread sleep for a given duration +/// +/// sf::sleep is the best way to block a program or one of its +/// threads, as it doesn't consume any CPU power. +/// +/// \param duration Time to sleep +/// +//////////////////////////////////////////////////////////// +void SFML_SYSTEM_API sleep(Time duration); + +} // namespace sf + + +#endif // SFML_SLEEP_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/String.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/String.hpp new file mode 100644 index 0000000..080a809 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/String.hpp @@ -0,0 +1,543 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_STRING_HPP +#define SFML_STRING_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility string class that automatically handles +/// conversions between types and encodings +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API String +{ +public : + + //////////////////////////////////////////////////////////// + // Types + //////////////////////////////////////////////////////////// + typedef std::basic_string::iterator Iterator; ///< Iterator type + typedef std::basic_string::const_iterator ConstIterator; ///< Constant iterator type + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const std::size_t InvalidPos; ///< Represents an invalid position in the string + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor creates an empty string. + /// + //////////////////////////////////////////////////////////// + String(); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a single ANSI character and a locale + /// + /// The source character is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiChar ANSI character to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(char ansiChar, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from single wide character + /// + /// \param wideChar Wide character to convert + /// + //////////////////////////////////////////////////////////// + String(wchar_t wideChar); + + //////////////////////////////////////////////////////////// + /// \brief Construct from single UTF-32 character + /// + /// \param utf32Char UTF-32 character to convert + /// + //////////////////////////////////////////////////////////// + String(Uint32 utf32Char); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a null-terminated C-style ANSI string and a locale + /// + /// The source string is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiString ANSI string to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(const char* ansiString, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from an ANSI string and a locale + /// + /// The source string is converted to UTF-32 according + /// to the given locale. + /// + /// \param ansiString ANSI string to convert + /// \param locale Locale to use for conversion + /// + //////////////////////////////////////////////////////////// + String(const std::string& ansiString, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Construct from null-terminated C-style wide string + /// + /// \param wideString Wide string to convert + /// + //////////////////////////////////////////////////////////// + String(const wchar_t* wideString); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a wide string + /// + /// \param wideString Wide string to convert + /// + //////////////////////////////////////////////////////////// + String(const std::wstring& wideString); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a null-terminated C-style UTF-32 string + /// + /// \param utf32String UTF-32 string to assign + /// + //////////////////////////////////////////////////////////// + String(const Uint32* utf32String); + + //////////////////////////////////////////////////////////// + /// \brief Construct from an UTF-32 string + /// + /// \param utf32String UTF-32 string to assign + /// + //////////////////////////////////////////////////////////// + String(const std::basic_string& utf32String); + + //////////////////////////////////////////////////////////// + /// \brief Copy constructor + /// + /// \param copy Instance to copy + /// + //////////////////////////////////////////////////////////// + String(const String& copy); + + //////////////////////////////////////////////////////////// + /// \brief Implicit cast operator to std::string (ANSI string) + /// + /// The current global locale is used for conversion. If you + /// want to explicitely specify a locale, see toAnsiString. + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// This operator is defined for convenience, and is equivalent + /// to calling toAnsiString(). + /// + /// \return Converted ANSI string + /// + /// \see toAnsiString, operator std::wstring + /// + //////////////////////////////////////////////////////////// + operator std::string() const; + + //////////////////////////////////////////////////////////// + /// \brief Implicit cast operator to std::wstring (wide string) + /// + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// This operator is defined for convenience, and is equivalent + /// to calling toWideString(). + /// + /// \return Converted wide string + /// + /// \see toWideString, operator std::string + /// + //////////////////////////////////////////////////////////// + operator std::wstring() const; + + //////////////////////////////////////////////////////////// + /// \brief Convert the unicode string to an ANSI string + /// + /// The UTF-32 string is converted to an ANSI string in + /// the encoding defined by \a locale. + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// + /// \param locale Locale to use for conversion + /// + /// \return Converted ANSI string + /// + /// \see toWideString, operator std::string + /// + //////////////////////////////////////////////////////////// + std::string toAnsiString(const std::locale& locale = std::locale()) const; + + //////////////////////////////////////////////////////////// + /// \brief Convert the unicode string to a wide string + /// + /// Characters that do not fit in the target encoding are + /// discarded from the returned string. + /// + /// \return Converted wide string + /// + /// \see toAnsiString, operator std::wstring + /// + //////////////////////////////////////////////////////////// + std::wstring toWideString() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of assignment operator + /// + /// \param right Instance to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + String& operator =(const String& right); + + //////////////////////////////////////////////////////////// + /// \brief Overload of += operator to append an UTF-32 string + /// + /// \param right String to append + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + String& operator +=(const String& right); + + //////////////////////////////////////////////////////////// + /// \brief Overload of [] operator to access a character by its position + /// + /// This function provides read-only access to characters. + /// Note: this function doesn't throw if \a index is out of range. + /// + /// \param index Index of the character to get + /// + /// \return Character at position \a index + /// + //////////////////////////////////////////////////////////// + Uint32 operator [](std::size_t index) const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of [] operator to access a character by its position + /// + /// This function provides read and write access to characters. + /// Note: this function doesn't throw if \a index is out of range. + /// + /// \param index Index of the character to get + /// + /// \return Reference to the character at position \a index + /// + //////////////////////////////////////////////////////////// + Uint32& operator [](std::size_t index); + + //////////////////////////////////////////////////////////// + /// \brief Clear the string + /// + /// This function removes all the characters from the string. + /// + /// \see isEmpty, erase + /// + //////////////////////////////////////////////////////////// + void clear(); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the string + /// + /// \return Number of characters in the string + /// + /// \see isEmpty + /// + //////////////////////////////////////////////////////////// + std::size_t getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Check whether the string is empty or not + /// + /// \return True if the string is empty (i.e. contains no character) + /// + /// \see clear, getSize + /// + //////////////////////////////////////////////////////////// + bool isEmpty() const; + + //////////////////////////////////////////////////////////// + /// \brief Erase one or more characters from the string + /// + /// This function removes a sequence of \a count characters + /// starting from \a position. + /// + /// \param position Position of the first character to erase + /// \param count Number of characters to erase + /// + //////////////////////////////////////////////////////////// + void erase(std::size_t position, std::size_t count = 1); + + //////////////////////////////////////////////////////////// + /// \brief Insert one or more characters into the string + /// + /// This function inserts the characters of \a str + /// into the string, starting from \a position. + /// + /// \param position Position of insertion + /// \param str Characters to insert + /// + //////////////////////////////////////////////////////////// + void insert(std::size_t position, const String& str); + + //////////////////////////////////////////////////////////// + /// \brief Find a sequence of one or more characters in the string + /// + /// This function searches for the characters of \a str + /// into the string, starting from \a start. + /// + /// \param str Characters to find + /// \param start Where to begin searching + /// + /// \return Position of \a str in the string, or String::InvalidPos if not found + /// + //////////////////////////////////////////////////////////// + std::size_t find(const String& str, std::size_t start = 0) const; + + //////////////////////////////////////////////////////////// + /// \brief Get a pointer to the C-style array of characters + /// + /// This functions provides a read-only access to a + /// null-terminated C-style representation of the string. + /// The returned pointer is temporary and is meant only for + /// immediate use, thus it is not recommended to store it. + /// + /// \return Read-only pointer to the array of characters + /// + //////////////////////////////////////////////////////////// + const Uint32* getData() const; + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// \return Read-write iterator to the beginning of the string characters + /// + /// \see end + /// + //////////////////////////////////////////////////////////// + Iterator begin(); + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// \return Read-only iterator to the beginning of the string characters + /// + /// \see end + /// + //////////////////////////////////////////////////////////// + ConstIterator begin() const; + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// The end iterator refers to 1 position past the last character; + /// thus it represents an invalid character and should never be + /// accessed. + /// + /// \return Read-write iterator to the end of the string characters + /// + /// \see begin + /// + //////////////////////////////////////////////////////////// + Iterator end(); + + //////////////////////////////////////////////////////////// + /// \brief Return an iterator to the beginning of the string + /// + /// The end iterator refers to 1 position past the last character; + /// thus it represents an invalid character and should never be + /// accessed. + /// + /// \return Read-only iterator to the end of the string characters + /// + /// \see begin + /// + //////////////////////////////////////////////////////////// + ConstIterator end() const; + +private : + + friend SFML_SYSTEM_API bool operator ==(const String& left, const String& right); + friend SFML_SYSTEM_API bool operator <(const String& left, const String& right); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + std::basic_string m_string; ///< Internal string of UTF-32 characters +}; + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of == operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if both strings are equal +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator ==(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of != operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if both strings are different +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator !=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of < operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of > operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of <= operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of >= operator to compare two UTF-32 strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return True if \a left is alphabetically greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >=(const String& left, const String& right); + +//////////////////////////////////////////////////////////// +/// \relates String +/// \brief Overload of binary + operator to concatenate two strings +/// +/// \param left Left operand (a string) +/// \param right Right operand (a string) +/// +/// \return Concatenated string +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API String operator +(const String& left, const String& right); + +} // namespace sf + + +#endif // SFML_STRING_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::String +/// \ingroup system +/// +/// sf::String is a utility string class defined mainly for +/// convenience. It is a Unicode string (implemented using +/// UTF-32), thus it can store any character in the world +/// (european, chinese, arabic, hebrew, etc.). +/// +/// It automatically handles conversions from/to ANSI and +/// wide strings, so that you can work with standard string +/// classes and still be compatible with functions taking a +/// sf::String. +/// +/// \code +/// sf::String s; +/// +/// std::string s1 = s; // automatically converted to ANSI string +/// std::wstring s2 = s; // automatically converted to wide string +/// s = "hello"; // automatically converted from ANSI string +/// s = L"hello"; // automatically converted from wide string +/// s += 'a'; // automatically converted from ANSI string +/// s += L'a'; // automatically converted from wide string +/// \endcode +/// +/// Conversions involving ANSI strings use the default user locale. However +/// it is possible to use a custom locale if necessary: +/// \code +/// std::locale locale; +/// sf::String s; +/// ... +/// std::string s1 = s.toAnsiString(locale); +/// s = sf::String("hello", locale); +/// \endcode +/// +/// sf::String defines the most important functions of the +/// standard std::string class: removing, random access, iterating, +/// appending, comparing, etc. However it is a simple class +/// provided for convenience, and you may have to consider using +/// a more optimized class if your program requires complex string +/// handling. The automatic conversion functions will then take +/// care of converting your string to sf::String whenever SFML +/// requires it. +/// +/// Please note that SFML also defines a low-level, generic +/// interface for Unicode handling, see the sf::Utf classes. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.hpp new file mode 100644 index 0000000..8313646 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.hpp @@ -0,0 +1,282 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREAD_HPP +#define SFML_THREAD_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class ThreadImpl; + struct ThreadFunc; +} + +//////////////////////////////////////////////////////////// +/// \brief Utility class to manipulate threads +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Thread : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a functor with no argument + /// + /// This constructor works for function objects, as well + /// as free function. + /// + /// Use this constructor for this kind of function: + /// \code + /// void function(); + /// + /// // --- or ---- + /// + /// struct Functor + /// { + /// void operator()(); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Functor or free function to use as the entry point of the thread + /// + //////////////////////////////////////////////////////////// + template + Thread(F function); + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a functor with an argument + /// + /// This constructor works for function objects, as well + /// as free function. + /// It is a template, which means that the argument can + /// have any type (int, std::string, void*, Toto, ...). + /// + /// Use this constructor for this kind of function: + /// \code + /// void function(int arg); + /// + /// // --- or ---- + /// + /// struct Functor + /// { + /// void operator()(std::string arg); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Functor or free function to use as the entry point of the thread + /// \param argument argument to forward to the function + /// + //////////////////////////////////////////////////////////// + template + Thread(F function, A argument); + + //////////////////////////////////////////////////////////// + /// \brief Construct the thread from a member function and an object + /// + /// This constructor is template, which means that you can + /// use it with any class. + /// Use this constructor for this kind of function: + /// \code + /// class MyClass + /// { + /// public : + /// + /// void function(); + /// }; + /// \endcode + /// Note: this does *not* run the thread, use Launch(). + /// + /// \param function Entry point of the thread + /// \param object Pointer to the object to use + /// + //////////////////////////////////////////////////////////// + template + Thread(void(C::*function)(), C* object); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// This destructor calls Wait(), so that the internal thread + /// cannot survive after its sf::Thread instance is destroyed. + /// + //////////////////////////////////////////////////////////// + ~Thread(); + + //////////////////////////////////////////////////////////// + /// \brief Run the thread + /// + /// This function starts the entry point passed to the + /// thread's constructor, and returns immediately. + /// After this function returns, the thread's function is + /// running in parallel to the calling code. + /// + //////////////////////////////////////////////////////////// + void launch(); + + //////////////////////////////////////////////////////////// + /// \brief Wait until the thread finishes + /// + /// This function will block the execution until the + /// thread's function ends. + /// Warning: if the thread function never ends, the calling + /// thread will block forever. + /// If this function is called from its owner thread, it + /// returns without doing anything. + /// + //////////////////////////////////////////////////////////// + void wait(); + + //////////////////////////////////////////////////////////// + /// \brief Terminate the thread + /// + /// This function immediately stops the thread, without waiting + /// for its function to finish. + /// Terminating a thread with this function is not safe, + /// and can lead to local variables not being destroyed + /// on some operating systems. You should rather try to make + /// the thread function terminate by itself. + /// + //////////////////////////////////////////////////////////// + void terminate(); + +private : + + friend class priv::ThreadImpl; + + //////////////////////////////////////////////////////////// + /// \brief Internal entry point of the thread + /// + /// This function is called by the thread implementation. + /// + //////////////////////////////////////////////////////////// + void run(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::ThreadImpl* m_impl; ///< OS-specific implementation of the thread + priv::ThreadFunc* m_entryPoint; ///< Abstraction of the function to run +}; + +#include + +} // namespace sf + +#endif // SFML_THREAD_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Thread +/// \ingroup system +/// +/// Threads provide a way to run multiple parts of the code +/// in parallel. When you launch a new thread, the execution +/// is split and both the new thread and the caller run +/// in parallel. +/// +/// To use a sf::Thread, you construct it directly with the +/// function to execute as the entry point of the thread. +/// sf::Thread has multiple template constructors, which means +/// that you can use several types of entry points: +/// \li non-member functions with no argument +/// \li non-member functions with one argument of any type +/// \li functors with no argument (this one is particularly useful for compatibility with boost/std::bind) +/// \li functors with one argument of any type +/// \li member functions from any class with no argument +/// +/// The function argument, if any, is copied in the sf::Thread +/// instance, as well as the functor (if the corresponding +/// constructor is used). Class instances, however, are passed +/// by pointer so you must make sure that the object won't be +/// destroyed while the thread is still using it. +/// +/// The thread ends when its function is terminated. If the +/// owner sf::Thread instance is destroyed before the +/// thread is finished, the destructor will wait (see wait()) +/// +/// Usage examples: +/// \code +/// // example 1: non member function with one argument +/// +/// void threadFunc(int argument) +/// { +/// ... +/// } +/// +/// sf::Thread thread(&threadFunc, 5); +/// thread.launch(); // start the thread (internally calls threadFunc(5)) +/// \endcode +/// +/// \code +/// // example 2: member function +/// +/// class Task +/// { +/// public : +/// void run() +/// { +/// ... +/// } +/// }; +/// +/// Task task; +/// sf::Thread thread(&Task::run, &task); +/// thread.launch(); // start the thread (internally calls task.run()) +/// \endcode +/// +/// \code +/// // example 3: functor +/// +/// struct Task +/// { +/// void operator()() +/// { +/// ... +/// } +/// }; +/// +/// sf::Thread thread(Task()); +/// thread.launch(); // start the thread (internally calls operator() on the Task instance) +/// \endcode +/// +/// Creating parallel threads of execution can be dangerous: +/// all threads inside the same process share the same memory space, +/// which means that you may end up accessing the same variable +/// from multiple threads at the same time. To prevent this +/// kind of situations, you can use mutexes (see sf::Mutex). +/// +/// \see sf::Mutex +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.inl b/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.inl new file mode 100644 index 0000000..126228a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Thread.inl @@ -0,0 +1,90 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + +namespace priv +{ +// Base class for abstract thread functions +struct ThreadFunc +{ + virtual ~ThreadFunc() {} + virtual void run() = 0; +}; + +// Specialization using a functor (including free functions) with no argument +template +struct ThreadFunctor : ThreadFunc +{ + ThreadFunctor(T functor) : m_functor(functor) {} + virtual void run() {m_functor();} + T m_functor; +}; + +// Specialization using a functor (including free functions) with one argument +template +struct ThreadFunctorWithArg : ThreadFunc +{ + ThreadFunctorWithArg(F function, A arg) : m_function(function), m_arg(arg) {} + virtual void run() {m_function(m_arg);} + F m_function; + A m_arg; +}; + +// Specialization using a member function +template +struct ThreadMemberFunc : ThreadFunc +{ + ThreadMemberFunc(void(C::*function)(), C* object) : m_function(function), m_object(object) {} + virtual void run() {(m_object->*m_function)();} + void(C::*m_function)(); + C* m_object; +}; + +} // namespace priv + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(F functor) : +m_impl (NULL), +m_entryPoint(new priv::ThreadFunctor(functor)) +{ +} + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(F function, A argument) : +m_impl (NULL), +m_entryPoint(new priv::ThreadFunctorWithArg(function, argument)) +{ +} + + +//////////////////////////////////////////////////////////// +template +Thread::Thread(void(C::*function)(), C* object) : +m_impl (NULL), +m_entryPoint(new priv::ThreadMemberFunc(function, object)) +{ +} diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocal.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocal.hpp new file mode 100644 index 0000000..fe2ba82 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocal.hpp @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADLOCAL_HPP +#define SFML_THREADLOCAL_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class ThreadLocalImpl; +} + +//////////////////////////////////////////////////////////// +/// \brief Defines variables with thread-local storage +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API ThreadLocal : NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param value Optional value to initalize the variable + /// + //////////////////////////////////////////////////////////// + ThreadLocal(void* value = NULL); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~ThreadLocal(); + + //////////////////////////////////////////////////////////// + /// \brief Set the thread-specific value of the variable + /// + /// \param value Value of the variable for the current thread + /// + //////////////////////////////////////////////////////////// + void setValue(void* value); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve the thread-specific value of the variable + /// + /// \return Value of the variable for the current thread + /// + //////////////////////////////////////////////////////////// + void* getValue() const; + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::ThreadLocalImpl* m_impl; ///< Pointer to the OS specific implementation +}; + +} // namespace sf + + +#endif // SFML_THREADLOCAL_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ThreadLocal +/// \ingroup system +/// +/// This class manipulates void* parameters and thus is not +/// appropriate for strongly-typed variables. You should rather +/// use the sf::ThreadLocalPtr template class. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.hpp new file mode 100644 index 0000000..e6dc1eb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.hpp @@ -0,0 +1,158 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_THREADLOCALPTR_HPP +#define SFML_THREADLOCALPTR_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Pointer to a thread-local variable +/// +//////////////////////////////////////////////////////////// +template +class ThreadLocalPtr : private ThreadLocal +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param value Optional value to initalize the variable + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr(T* value = NULL); + + //////////////////////////////////////////////////////////// + /// \brief Overload of unary operator * + /// + /// Like raw pointers, applying the * operator returns a + /// reference to the pointed object. + /// + /// \return Reference to the pointed object + /// + //////////////////////////////////////////////////////////// + T& operator *() const; + + //////////////////////////////////////////////////////////// + /// \brief Overload of operator -> + /// + /// Like raw pointers, applying the -> operator returns the + /// pointed object. + /// + /// \return Pointed object + /// + //////////////////////////////////////////////////////////// + T* operator ->() const; + + //////////////////////////////////////////////////////////// + /// \brief Cast operator to implicitely convert the + /// pointer to its raw pointer type (T*) + /// + /// \return Pointer to the actual object + /// + //////////////////////////////////////////////////////////// + operator T*() const; + + //////////////////////////////////////////////////////////// + /// \brief Assignment operator for a raw pointer parameter + /// + /// \param value Pointer to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr& operator =(T* value); + + //////////////////////////////////////////////////////////// + /// \brief Assignment operator for a ThreadLocalPtr parameter + /// + /// \param right ThreadLocalPtr to assign + /// + /// \return Reference to self + /// + //////////////////////////////////////////////////////////// + ThreadLocalPtr& operator =(const ThreadLocalPtr& right); +}; + +} // namespace sf + +#include + + +#endif // SFML_THREADLOCALPTR_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ThreadLocalPtr +/// \ingroup system +/// +/// sf::ThreadLocalPtr is a type-safe wrapper for storing +/// pointers to thread-local variables. A thread-local +/// variable holds a different value for each different +/// thread, unlike normal variable that are shared. +/// +/// Its usage is completely transparent, so that it is similar +/// to manipulating the raw pointer directly (like any smart pointer). +/// +/// Usage example: +/// \code +/// MyClass object1; +/// MyClass object2; +/// sf::ThreadLocalPtr objectPtr; +/// +/// void thread1() +/// { +/// objectPtr = &object1; // doesn't impact thread2 +/// ... +/// } +/// +/// void thread2() +/// { +/// objectPtr = &object2; // doesn't impact thread1 +/// ... +/// } +/// +/// int main() +/// { +/// // Create and launch the two threads +/// sf::Thread t1(&thread1); +/// sf::Thread t2(&thread2); +/// t1.launch(); +/// t2.launch(); +/// +/// return 0; +/// } +/// \endcode +/// +/// ThreadLocalPtr is designed for internal use; however you +/// can use it if you feel like it fits well your implementation. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.inl b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.inl new file mode 100644 index 0000000..8442025 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/ThreadLocalPtr.inl @@ -0,0 +1,77 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +namespace sf +{ +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr::ThreadLocalPtr(T* value) : +ThreadLocal(value) +{ +} + + +//////////////////////////////////////////////////////////// +template +T& ThreadLocalPtr::operator *() const +{ + return *static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +T* ThreadLocalPtr::operator ->() const +{ + return static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr::operator T*() const +{ + return static_cast(getValue()); +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr& ThreadLocalPtr::operator =(T* value) +{ + setValue(value); + return *this; +} + + +//////////////////////////////////////////////////////////// +template +ThreadLocalPtr& ThreadLocalPtr::operator =(const ThreadLocalPtr& right) +{ + setValue(right.getValue()); + return *this; +} + +} // namespace sf diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Time.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Time.hpp new file mode 100644 index 0000000..5037f52 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Time.hpp @@ -0,0 +1,452 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_TIME_HPP +#define SFML_TIME_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Represents a time value +/// +//////////////////////////////////////////////////////////// +class SFML_SYSTEM_API Time +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Sets the time value to zero. + /// + //////////////////////////////////////////////////////////// + Time(); + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of seconds + /// + /// \return Time in seconds + /// + /// \see asMilliseconds, asMicroseconds + /// + //////////////////////////////////////////////////////////// + float asSeconds() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of milliseconds + /// + /// \return Time in milliseconds + /// + /// \see asSeconds, asMicroseconds + /// + //////////////////////////////////////////////////////////// + Int32 asMilliseconds() const; + + //////////////////////////////////////////////////////////// + /// \brief Return the time value as a number of microseconds + /// + /// \return Time in microseconds + /// + /// \see asSeconds, asMilliseconds + /// + //////////////////////////////////////////////////////////// + Int64 asMicroseconds() const; + + //////////////////////////////////////////////////////////// + // Static member data + //////////////////////////////////////////////////////////// + static const Time Zero; ///< Predefined "zero" time value + +private : + + friend SFML_SYSTEM_API Time seconds(float); + friend SFML_SYSTEM_API Time milliseconds(Int32); + friend SFML_SYSTEM_API Time microseconds(Int64); + + //////////////////////////////////////////////////////////// + /// \brief Construct from a number of microseconds + /// + /// This function is internal. To construct time values, + /// use sf::seconds, sf::milliseconds or sf::microseconds instead. + /// + /// \param microseconds Number of microseconds + /// + //////////////////////////////////////////////////////////// + explicit Time(Int64 microseconds); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + Int64 m_microseconds; ///< Time value stored as microseconds +}; + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of seconds +/// +/// \param amount Number of seconds +/// +/// \return Time value constructed from the amount of seconds +/// +/// \see milliseconds, microseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time seconds(float amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of milliseconds +/// +/// \param amount Number of milliseconds +/// +/// \return Time value constructed from the amount of milliseconds +/// +/// \see seconds, microseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time milliseconds(Int32 amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Construct a time value from a number of microseconds +/// +/// \param amount Number of microseconds +/// +/// \return Time value constructed from the amount of microseconds +/// +/// \see seconds, milliseconds +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time microseconds(Int64 amount); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of == operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if both time values are equal +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator ==(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of != operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if both time values are different +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator !=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of < operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of > operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of <= operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator <=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of >= operator to compare two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API bool operator >=(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of unary - operator to negate a time value +/// +/// \param right Right operand (a time) +/// +/// \return Opposite of the time value +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator -(Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary + operator to add two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Sum of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator +(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary += operator to add/assign two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Sum of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator +=(Time& left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary - operator to subtract two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Difference of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator -(Time left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary -= operator to subtract/assign two time values +/// +/// \param left Left operand (a time) +/// \param right Right operand (a time) +/// +/// \return Difference of the two times values +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator -=(Time& left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Time left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Time left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a number) +/// \param right Right operand (a time) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(float left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary * operator to scale a time value +/// +/// \param left Left operand (a number) +/// \param right Right operand (a time) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator *(Int64 left, Time right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary *= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator *=(Time& left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary *= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left multiplied by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator *=(Time& left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary / operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator /(Time left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary / operator to scale a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time operator /(Time left, Int64 right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary /= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator /=(Time& left, float right); + +//////////////////////////////////////////////////////////// +/// \relates Time +/// \brief Overload of binary /= operator to scale/assign a time value +/// +/// \param left Left operand (a time) +/// \param right Right operand (a number) +/// +/// \return \a left divided by \a right +/// +//////////////////////////////////////////////////////////// +SFML_SYSTEM_API Time& operator /=(Time& left, Int64 right); + +} // namespace sf + + +#endif // SFML_TIME_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Time +/// \ingroup system +/// +/// sf::Time encapsulates a time value in a flexible way. +/// It allows to define a time value either as a number of +/// seconds, milliseconds or microseconds. It also works the +/// other way round: you can read a time value as either +/// a number of seconds, milliseconds or microseconds. +/// +/// By using such a flexible interface, the API doesn't +/// impose any fixed type or resolution for time values, +/// and let the user choose its own favorite representation. +/// +/// Time values support the usual mathematical operations: +/// you can add or subtract two times, multiply or divide +/// a time by a number, compare two times, etc. +/// +/// Since they represent a time span and not an absolute time +/// value, times can also be negative. +/// +/// Usage example: +/// \code +/// sf::Time t1 = sf::seconds(0.1f); +/// Int32 milli = t1.asMilliseconds(); // 100 +/// +/// sf::Time t2 = sf::milliseconds(30); +/// Int64 micro = t2.asMicroseconds(); // 30000 +/// +/// sf::Time t3 = sf::microseconds(-800000); +/// float sec = t3.asSeconds(); // -0.8 +/// \endcode +/// +/// \code +/// void update(sf::Time elapsed) +/// { +/// position += speed * elapsed.asSeconds(); +/// } +/// +/// update(sf::milliseconds(100)); +/// \endcode +/// +/// \see sf::Clock +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.hpp new file mode 100644 index 0000000..48e6e1b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.hpp @@ -0,0 +1,763 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_UTF_HPP +#define SFML_UTF_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + + +namespace sf +{ +template +class Utf; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-8 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<8> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-8 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-8 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-8 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-8. + /// + /// \param input Codepoint to encode as UTF-8 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-8 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint8 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-8 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-8 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-8 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-8 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); +}; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-16 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<16> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-16 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-16 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-16 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-16. + /// + /// \param input Codepoint to encode as UTF-16 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-16 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint16 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-16 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-16 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-16 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-16 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); +}; + +//////////////////////////////////////////////////////////// +/// \brief Specialization of the Utf template for UTF-32 +/// +//////////////////////////////////////////////////////////// +template <> +class Utf<32> +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-32 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// For UTF-32, the character value is the same as the codepoint. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-32 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-32. + /// For UTF-32, the codepoint is the same as the character value. + /// + /// \param input Codepoint to encode as UTF-32 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-32 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encode(Uint32 input, Out output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-32 character + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static In next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-32 sequence + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template + static std::size_t count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-32 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out fromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-32 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out toUtf32(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single ANSI character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input ANSI character + /// \param locale Locale to use for conversion + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template + static Uint32 decodeAnsi(In input, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single wide character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input wide character + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template + static Uint32 decodeWide(In input); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to ANSI + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to ANSI (use 0 to skip it) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to wide + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to wide (use 0 to skip it) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template + static Out encodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); +}; + +#include + +// Make typedefs to get rid of the template syntax +typedef Utf<8> Utf8; +typedef Utf<16> Utf16; +typedef Utf<32> Utf32; + +} // namespace sf + + +#endif // SFML_UTF_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Utf +/// \ingroup system +/// +/// Utility class providing generic functions for UTF conversions. +/// +/// sf::Utf is a low-level, generic interface for counting, iterating, +/// encoding and decoding Unicode characters and strings. It is able +/// to handle ANSI, wide, latin-1, UTF-8, UTF-16 and UTF-32 encodings. +/// +/// sf::Utf functions are all static, these classes are not meant to +/// be instanciated. All the functions are template, so that you +/// can use any character / string type for a given encoding. +/// +/// It has 3 specializations: +/// \li sf::Utf<8> (typedef'd to sf::Utf8) +/// \li sf::Utf<16> (typedef'd to sf::Utf16) +/// \li sf::Utf<32> (typedef'd to sf::Utf32) +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.inl b/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.inl new file mode 100644 index 0000000..672a0fa --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Utf.inl @@ -0,0 +1,752 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +// References : +// +// http://www.unicode.org/ +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c +// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h +// http://people.w3.org/rishida/scripts/uniview/conversion +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement) +{ + // Some useful precomputed data + static const int trailing[256] = + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 + }; + static const Uint32 offsets[6] = + { + 0x00000000, 0x00003080, 0x000E2080, 0x03C82080, 0xFA082080, 0x82082080 + }; + + // decode the character + int trailingBytes = trailing[static_cast(*begin)]; + if (begin + trailingBytes < end) + { + output = 0; + switch (trailingBytes) + { + case 5 : output += static_cast(*begin++); output <<= 6; + case 4 : output += static_cast(*begin++); output <<= 6; + case 3 : output += static_cast(*begin++); output <<= 6; + case 2 : output += static_cast(*begin++); output <<= 6; + case 1 : output += static_cast(*begin++); output <<= 6; + case 0 : output += static_cast(*begin++); + } + output -= offsets[trailingBytes]; + } + else + { + // Incomplete character + begin = end; + output = replacement; + } + + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement) +{ + // Some useful precomputed data + static const Uint8 firstBytes[7] = + { + 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC + }; + + // encode the character + if ((input > 0x0010FFFF) || ((input >= 0xD800) && (input <= 0xDBFF))) + { + // Invalid character + if (replacement) + *output++ = replacement; + } + else + { + // Valid character + + // Get the number of bytes to write + std::size_t bytestoWrite = 1; + if (input < 0x80) bytestoWrite = 1; + else if (input < 0x800) bytestoWrite = 2; + else if (input < 0x10000) bytestoWrite = 3; + else if (input <= 0x0010FFFF) bytestoWrite = 4; + + // Extract the bytes to write + Uint8 bytes[4]; + switch (bytestoWrite) + { + case 4 : bytes[3] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 3 : bytes[2] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 2 : bytes[1] = static_cast((input | 0x80) & 0xBF); input >>= 6; + case 1 : bytes[0] = static_cast (input | firstBytes[bytestoWrite]); + } + + // Add them to the output + output = std::copy(bytes, bytes + bytestoWrite, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<8>::next(In begin, In end) +{ + Uint32 codepoint; + return decode(begin, end, codepoint); +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<8>::count(In begin, In end) +{ + std::size_t length = 0; + while (begin < end) + { + begin = next(begin, end); + ++length; + } + + return length; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeWide(*begin++); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + output = encode(*begin++, output); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeWide(codepoint, output, replacement); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint < 256 ? static_cast(codepoint) : replacement; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf8(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf16(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<16>::encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<8>::toUtf32(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement) +{ + Uint16 first = *begin++; + + // If it's a surrogate pair, first convert to a single UTF-32 character + if ((first >= 0xD800) && (first <= 0xDBFF)) + { + if (begin < end) + { + Uint32 second = *begin++; + if ((second >= 0xDC00) && (second <= 0xDFFF)) + { + // The second element is valid: convert the two elements to a UTF-32 character + output = static_cast(((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000); + } + else + { + // Invalid character + output = replacement; + } + } + else + { + // Invalid character + begin = end; + output = replacement; + } + } + else + { + // We can make a direct copy + output = first; + } + + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::encode(Uint32 input, Out output, Uint16 replacement) +{ + if (input < 0xFFFF) + { + // The character can be copied directly, we just need to check if it's in the valid range + if ((input >= 0xD800) && (input <= 0xDFFF)) + { + // Invalid character (this range is reserved) + if (replacement) + *output++ = replacement; + } + else + { + // Valid character directly convertible to a single UTF-16 character + *output++ = static_cast(input); + } + } + else if (input > 0x0010FFFF) + { + // Invalid character (greater than the maximum unicode value) + if (replacement) + *output++ = replacement; + } + else + { + // The input character will be converted to two UTF-16 elements + input -= 0x0010000; + *output++ = static_cast((input >> 10) + 0xD800); + *output++ = static_cast((input & 0x3FFUL) + 0xDC00); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<16>::next(In begin, In end) +{ + Uint32 codepoint; + return decode(begin, end, codepoint); +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<16>::count(In begin, In end) +{ + std::size_t length = 0; + while (begin < end) + { + begin = next(begin, end); + ++length; + } + + return length; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeAnsi(*begin++, locale); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint = Utf<32>::decodeWide(*begin++); + output = encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeAnsi(codepoint, output, replacement, locale); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<32>::encodeWide(codepoint, output, replacement); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + *output++ = *begin < 256 ? static_cast(*begin) : replacement; + begin++; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf8(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + output = Utf<8>::encode(codepoint, output); + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf16(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<16>::toUtf32(In begin, In end, Out output) +{ + while (begin < end) + { + Uint32 codepoint; + begin = decode(begin, end, codepoint); + *output++ = codepoint; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<32>::decode(In begin, In /*end*/, Uint32& output, Uint32 /*replacement*/) +{ + output = *begin++; + return begin; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encode(Uint32 input, Out output, Uint32 /*replacement*/) +{ + *output++ = input; + return output; +} + + +//////////////////////////////////////////////////////////// +template +In Utf<32>::next(In begin, In /*end*/) +{ + return ++begin; +} + + +//////////////////////////////////////////////////////////// +template +std::size_t Utf<32>::count(In begin, In end) +{ + return begin - end; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromAnsi(In begin, In end, Out output, const std::locale& locale) +{ + while (begin < end) + *output++ = decodeAnsi(*begin++, locale); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromWide(In begin, In end, Out output) +{ + while (begin < end) + *output++ = decodeWide(*begin++); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::fromLatin1(In begin, In end, Out output) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toAnsi(In begin, In end, Out output, char replacement, const std::locale& locale) +{ + while (begin < end) + output = encodeAnsi(*begin++, output, replacement, locale); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toWide(In begin, In end, Out output, wchar_t replacement) +{ + while (begin < end) + output = encodeWide(*begin++, output, replacement); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toLatin1(In begin, In end, Out output, char replacement) +{ + // Latin-1 is directly compatible with Unicode encodings, + // and can thus be treated as (a sub-range of) UTF-32 + while (begin < end) + { + *output++ = *begin < 256 ? static_cast(*begin) : replacement; + begin++; + } + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf8(In begin, In end, Out output) +{ + while (begin < end) + output = Utf<8>::encode(*begin++, output); + + return output; +} + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf16(In begin, In end, Out output) +{ + while (begin < end) + output = Utf<16>::encode(*begin++, output); + + return output; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::toUtf32(In begin, In end, Out output) +{ + return std::copy(begin, end, output); +} + + +//////////////////////////////////////////////////////////// +template +Uint32 Utf<32>::decodeAnsi(In input, const std::locale& locale) +{ + // On Windows, gcc's standard library (glibc++) has almost + // no support for Unicode stuff. As a consequence, in this + // context we can only use the default locale and ignore + // the one passed as parameter. + + #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ + (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ + !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ + + (void)locale; // to avoid warnings + + wchar_t character = 0; + mbtowc(&character, &input, 1); + return static_cast(character); + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& facet = std::use_facet< std::ctype >(locale); + + // Use the facet to convert each character of the input string + return static_cast(facet.widen(input)); + + #endif +} + + +//////////////////////////////////////////////////////////// +template +Uint32 Utf<32>::decodeWide(In input) +{ + // The encoding of wide characters is not well defined and is left to the system; + // however we can safely assume that it is UCS-2 on Windows and + // UCS-4 on Unix systems. + // In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4, + // and UCS-4 *is* UTF-32). + + return input; +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encodeAnsi(Uint32 codepoint, Out output, char replacement, const std::locale& locale) +{ + // On Windows, gcc's standard library (glibc++) has almost + // no support for Unicode stuff. As a consequence, in this + // context we can only use the default locale and ignore + // the one passed as parameter. + + #if defined(SFML_SYSTEM_WINDOWS) && /* if Windows ... */ \ + (defined(__GLIBCPP__) || defined (__GLIBCXX__)) && /* ... and standard library is glibc++ ... */ \ + !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) /* ... and STLPort is not used on top of it */ + + (void)locale; // to avoid warnings + + char character = 0; + if (wctomb(&character, static_cast(codepoint)) >= 0) + *output++ = character; + else if (replacement) + *output++ = replacement; + + return output; + + #else + + // Get the facet of the locale which deals with character conversion + const std::ctype& facet = std::use_facet< std::ctype >(locale); + + // Use the facet to convert each character of the input string + *output++ = facet.narrow(static_cast(codepoint), replacement); + + return output; + + #endif +} + + +//////////////////////////////////////////////////////////// +template +Out Utf<32>::encodeWide(Uint32 codepoint, Out output, wchar_t replacement) +{ + // The encoding of wide characters is not well defined and is left to the system; + // however we can safely assume that it is UCS-2 on Windows and + // UCS-4 on Unix systems. + // For UCS-2 we need to check if the source characters fits in (UCS-2 is a subset of UCS-4). + // For UCS-4 we can do a direct copy (UCS-4 *is* UTF-32). + + switch (sizeof(wchar_t)) + { + case 4: + { + *output++ = static_cast(codepoint); + break; + } + + default: + { + if ((codepoint <= 0xFFFF) && ((codepoint < 0xD800) || (codepoint > 0xDFFF))) + { + *output++ = static_cast(codepoint); + } + else if (replacement) + { + *output++ = replacement; + } + break; + } + } + + return output; +} diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.hpp new file mode 100644 index 0000000..5c3bb64 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.hpp @@ -0,0 +1,301 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR2_HPP +#define SFML_VECTOR2_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility template class for manipulating +/// 2-dimensional vectors +/// +//////////////////////////////////////////////////////////// +template +class Vector2 +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector2(0, 0). + /// + //////////////////////////////////////////////////////////// + Vector2(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// + //////////////////////////////////////////////////////////// + Vector2(T X, T Y); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Vector2(const Vector2& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of unary operator - +/// +/// \param right Vector to negate +/// +/// \return Memberwise opposite of the vector +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator += +/// +/// This operator performs a memberwise addition of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator +=(Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator -= +/// +/// This operator performs a memberwise subtraction of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator -=(Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator + +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise addition of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator +(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator - +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise subtraction of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator -(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise multiplication by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(const Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a scalar value) +/// \param right Right operand (a vector) +/// +/// \return Memberwise multiplication by \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator *(T left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator *= +/// +/// This operator performs a memberwise multiplication by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator *=(Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator / +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise division by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector2 operator /(const Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator /= +/// +/// This operator performs a memberwise division by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector2& operator /=(Vector2& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector2& left, const Vector2& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector2 +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector2& left, const Vector2& right); + +#include + +// Define the most common types +typedef Vector2 Vector2i; +typedef Vector2 Vector2u; +typedef Vector2 Vector2f; + +} // namespace sf + + +#endif // SFML_VECTOR2_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vector2 +/// \ingroup system +/// +/// sf::Vector2 is a simple class that defines a mathematical +/// vector with two coordinates (x and y). It can be used to +/// represent anything that has two dimensions: a size, a point, +/// a velocity, etc. +/// +/// The template parameter T is the type of the coordinates. It +/// can be any type that supports arithmetic operations (+, -, /, *) +/// and comparisons (==, !=), for example int or float. +/// +/// You generally don't have to care about the templated form (sf::Vector2), +/// the most common specializations have special typedefs: +/// \li sf::Vector2 is sf::Vector2f +/// \li sf::Vector2 is sf::Vector2i +/// \li sf::Vector2 is sf::Vector2u +/// +/// The sf::Vector2 class has a small and simple interface, its x and y members +/// can be accessed directly (there's no accessor like setX(), getX()) and it +/// contains no mathematical function like dot product, cross product, length, etc. +/// +/// Usage example: +/// \code +/// sf::Vector2f v1(16.5f, 24.f); +/// v1.x = 18.2f; +/// float y = v1.y; +/// +/// sf::Vector2f v2 = v1 * 5.f; +/// sf::Vector2f v3; +/// v3 = v1 + v2; +/// +/// bool different = (v2 != v3); +/// \endcode +/// +/// Note: for 3-dimensional vectors, see sf::Vector3. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.inl b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.inl new file mode 100644 index 0000000..e1a87ae --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector2.inl @@ -0,0 +1,161 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +inline Vector2::Vector2() : +x(0), +y(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2::Vector2(T X, T Y) : +x(X), +y(Y) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +inline Vector2::Vector2(const Vector2& vector) : +x(static_cast(vector.x)), +y(static_cast(vector.y)) +{ +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator -(const Vector2& right) +{ + return Vector2(-right.x, -right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator +=(Vector2& left, const Vector2& right) +{ + left.x += right.x; + left.y += right.y; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator -=(Vector2& left, const Vector2& right) +{ + left.x -= right.x; + left.y -= right.y; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator +(const Vector2& left, const Vector2& right) +{ + return Vector2(left.x + right.x, left.y + right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator -(const Vector2& left, const Vector2& right) +{ + return Vector2(left.x - right.x, left.y - right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator *(const Vector2& left, T right) +{ + return Vector2(left.x * right, left.y * right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator *(T left, const Vector2& right) +{ + return Vector2(right.x * left, right.y * left); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator *=(Vector2& left, T right) +{ + left.x *= right; + left.y *= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2 operator /(const Vector2& left, T right) +{ + return Vector2(left.x / right, left.y / right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector2& operator /=(Vector2& left, T right) +{ + left.x /= right; + left.y /= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Vector2& left, const Vector2& right) +{ + return (left.x == right.x) && (left.y == right.y); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Vector2& left, const Vector2& right) +{ + return (left.x != right.x) || (left.y != right.y); +} diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.hpp b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.hpp new file mode 100644 index 0000000..76a26cb --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.hpp @@ -0,0 +1,302 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VECTOR3_HPP +#define SFML_VECTOR3_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Utility template class for manipulating +/// 3-dimensional vectors +/// +//////////////////////////////////////////////////////////// +template +class Vector3 +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector3(0, 0, 0). + /// + //////////////////////////////////////////////////////////// + Vector3(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// \param Z Z coordinate + /// + //////////////////////////////////////////////////////////// + Vector3(T X, T Y, T Z); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template + explicit Vector3(const Vector3& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + T z; ///< Z coordinate of the vector +}; + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of unary operator - +/// +/// \param left Vector to negate +/// +/// \return Memberwise opposite of the vector +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& left); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator += +/// +/// This operator performs a memberwise addition of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator +=(Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator -= +/// +/// This operator performs a memberwise subtraction of both vectors, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator -=(Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator + +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise addition of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator +(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator - +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return Memberwise subtraction of both vectors +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator -(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise multiplication by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(const Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator * +/// +/// \param left Left operand (a scalar value) +/// \param right Right operand (a vector) +/// +/// \return Memberwise multiplication by \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator *(T left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator *= +/// +/// This operator performs a memberwise multiplication by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator *=(Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator / +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Memberwise division by \a right +/// +//////////////////////////////////////////////////////////// +template +Vector3 operator /(const Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator /= +/// +/// This operator performs a memberwise division by \a right, +/// and assigns the result to \a left. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a scalar value) +/// +/// \return Reference to \a left +/// +//////////////////////////////////////////////////////////// +template +Vector3& operator /=(Vector3& left, T right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator == +/// +/// This operator compares strict equality between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator ==(const Vector3& left, const Vector3& right); + +//////////////////////////////////////////////////////////// +/// \relates Vector3 +/// \brief Overload of binary operator != +/// +/// This operator compares strict difference between two vectors. +/// +/// \param left Left operand (a vector) +/// \param right Right operand (a vector) +/// +/// \return True if \a left is not equal to \a right +/// +//////////////////////////////////////////////////////////// +template +bool operator !=(const Vector3& left, const Vector3& right); + +#include + +// Define the most common types +typedef Vector3 Vector3i; +typedef Vector3 Vector3f; + +} // namespace sf + + +#endif // SFML_VECTOR3_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Vector3 +/// \ingroup system +/// +/// sf::Vector3 is a simple class that defines a mathematical +/// vector with three coordinates (x, y and z). It can be used to +/// represent anything that has three dimensions: a size, a point, +/// a velocity, etc. +/// +/// The template parameter T is the type of the coordinates. It +/// can be any type that supports arithmetic operations (+, -, /, *) +/// and comparisons (==, !=), for example int or float. +/// +/// You generally don't have to care about the templated form (sf::Vector3), +/// the most common specializations have special typedefs: +/// \li sf::Vector3 is sf::Vector3f +/// \li sf::Vector3 is sf::Vector3i +/// +/// The sf::Vector3 class has a small and simple interface, its x and y members +/// can be accessed directly (there's no accessor like setX(), getX()) and it +/// contains no mathematical function like dot product, cross product, length, etc. +/// +/// Usage example: +/// \code +/// sf::Vector3f v1(16.5f, 24.f, -8.2f); +/// v1.x = 18.2f; +/// float y = v1.y; +/// float z = v1.z; +/// +/// sf::Vector3f v2 = v1 * 5.f; +/// sf::Vector3f v3; +/// v3 = v1 + v2; +/// +/// bool different = (v2 != v3); +/// \endcode +/// +/// Note: for 2-dimensional vectors, see sf::Vector2. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.inl b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.inl new file mode 100644 index 0000000..cff1a30 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/System/Vector3.inl @@ -0,0 +1,168 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2012 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. +// +//////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////// +template +inline Vector3::Vector3() : +x(0), +y(0), +z(0) +{ + +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3::Vector3(T X, T Y, T Z) : +x(X), +y(Y), +z(Z) +{ + +} + + +//////////////////////////////////////////////////////////// +template +template +inline Vector3::Vector3(const Vector3& vector) : +x(static_cast(vector.x)), +y(static_cast(vector.y)), +z(static_cast(vector.z)) +{ +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator -(const Vector3& left) +{ + return Vector3(-left.x, -left.y, -left.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator +=(Vector3& left, const Vector3& right) +{ + left.x += right.x; + left.y += right.y; + left.z += right.z; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator -=(Vector3& left, const Vector3& right) +{ + left.x -= right.x; + left.y -= right.y; + left.z -= right.z; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator +(const Vector3& left, const Vector3& right) +{ + return Vector3(left.x + right.x, left.y + right.y, left.z + right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator -(const Vector3& left, const Vector3& right) +{ + return Vector3(left.x - right.x, left.y - right.y, left.z - right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator *(const Vector3& left, T right) +{ + return Vector3(left.x * right, left.y * right, left.z * right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator *(T left, const Vector3& right) +{ + return Vector3(right.x * left, right.y * left, right.z * left); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator *=(Vector3& left, T right) +{ + left.x *= right; + left.y *= right; + left.z *= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3 operator /(const Vector3& left, T right) +{ + return Vector3(left.x / right, left.y / right, left.z / right); +} + + +//////////////////////////////////////////////////////////// +template +inline Vector3& operator /=(Vector3& left, T right) +{ + left.x /= right; + left.y /= right; + left.z /= right; + + return left; +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator ==(const Vector3& left, const Vector3& right) +{ + return (left.x == right.x) && (left.y == right.y) && (left.z == right.z); +} + + +//////////////////////////////////////////////////////////// +template +inline bool operator !=(const Vector3& left, const Vector3& right) +{ + return (left.x != right.x) || (left.y != right.y) || (left.z != right.z); +} diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window.hpp new file mode 100644 index 0000000..5d51134 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window.hpp @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_SFML_WINDOW_HPP +#define SFML_SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif // SFML_SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +/// \defgroup window Window module +/// +/// Provides OpenGL-based windows, and abstractions for +/// events and input handling. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Context.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Context.hpp new file mode 100644 index 0000000..5f67164 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Context.hpp @@ -0,0 +1,140 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXT_HPP +#define SFML_CONTEXT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class GlContext; +} + +//////////////////////////////////////////////////////////// +/// \brief Class holding a valid drawing context +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Context : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// The constructor creates and activates the context + /// + //////////////////////////////////////////////////////////// + Context(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// The desctructor deactivates and destroys the context + /// + //////////////////////////////////////////////////////////// + ~Context(); + + //////////////////////////////////////////////////////////// + /// \brief Activate or deactivate explicitely the context + /// + /// \param active True to activate, false to deactivate + /// + /// \return True on success, false on failure + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active); + +public : + + //////////////////////////////////////////////////////////// + /// \brief Construct a in-memory context + /// + /// This constructor is for internal use, you don't need + /// to bother with it. + /// + /// \param settings Creation parameters + /// \param width Back buffer width + /// \param height Back buffer height + /// + //////////////////////////////////////////////////////////// + Context(const ContextSettings& settings, unsigned int width, unsigned int height); + +private : + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::GlContext* m_context; ///< Internal OpenGL context +}; + +} // namespace sf + + +#endif // SFML_CONTEXT_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::Context +/// \ingroup window +/// +/// If you need to make OpenGL calls without having an +/// active window (like in a thread), you can use an +/// instance of this class to get a valid context. +/// +/// Having a valid context is necessary for *every* OpenGL call. +/// +/// Note that a context is only active in its current thread, +/// if you create a new thread it will have no valid context +/// by default. +/// +/// To use a sf::Context instance, just construct it and let it +/// live as long as you need a valid context. No explicit activation +/// is needed, all it has to do is to exist. Its destructor +/// will take care of deactivating and freeing all the attached +/// resources. +/// +/// Usage example: +/// \code +/// void threadFunction(void*) +/// { +/// sf::Context context; +/// // from now on, you have a valid context +/// +/// // you can make OpenGL calls +/// glClear(GL_DEPTH_BUFFER_BIT); +/// } +/// // the context is automatically deactivated and destroyed +/// // by the sf::Context destructor +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/ContextSettings.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/ContextSettings.hpp new file mode 100644 index 0000000..1bd2b3e --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/ContextSettings.hpp @@ -0,0 +1,104 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_CONTEXTSETTINGS_HPP +#define SFML_CONTEXTSETTINGS_HPP + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Structure defining the settings of the OpenGL +/// context attached to a window +/// +//////////////////////////////////////////////////////////// +struct ContextSettings +{ + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// \param depth Depth buffer bits + /// \param stencil Stencil buffer bits + /// \param antialiasing Antialiasing level + /// \param major Major number of the context version + /// \param minor Minor number of the context version + /// + //////////////////////////////////////////////////////////// + explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) : + depthBits (depth), + stencilBits (stencil), + antialiasingLevel(antialiasing), + majorVersion (major), + minorVersion (minor) + { + } + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int depthBits; ///< Bits of the depth buffer + unsigned int stencilBits; ///< Bits of the stencil buffer + unsigned int antialiasingLevel; ///< Level of antialiasing + unsigned int majorVersion; ///< Major number of the context version to create + unsigned int minorVersion; ///< Minor number of the context version to create +}; + +} // namespace sf + + +#endif // SFML_CONTEXTSETTINGS_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::ContextSettings +/// \ingroup window +/// +/// ContextSettings allows to define several advanced settings +/// of the OpenGL context attached to a window. All these +/// settings have no impact on the regular SFML rendering +/// (graphics module) -- except the anti-aliasing level, so +/// you may need to use this structure only if you're using +/// SFML as a windowing system for custom OpenGL rendering. +/// +/// The depthBits and stencilBits members define the number +/// of bits per pixel requested for the (respectively) depth +/// and stencil buffers. +/// +/// antialiasingLevel represents the requested number of +/// multisampling levels for anti-aliasing. +/// +/// majorVersion and minorVersion define the version of the +/// OpenGL context that you want. Only versions greater or +/// equal to 3.0 are relevant; versions lesser than 3.0 are +/// all handled the same way (i.e. you can use any version +/// < 3.0 if you don't want an OpenGL 3 context). +/// +/// Please note that these values are only a hint. +/// No failure will be reported if one or more of these values +/// are not supported by the system; instead, SFML will try to +/// find the closest valid match. You can then retrieve the +/// settings that the window actually used to create its context, +/// with Window::getSettings(). +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Event.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Event.hpp new file mode 100644 index 0000000..e86c2bf --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Event.hpp @@ -0,0 +1,237 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_EVENT_HPP +#define SFML_EVENT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Defines a system event and its parameters +/// +//////////////////////////////////////////////////////////// +class Event +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Size events parameters (Resized) + /// + //////////////////////////////////////////////////////////// + struct SizeEvent + { + unsigned int width; ///< New width, in pixels + unsigned int height; ///< New height, in pixels + }; + + //////////////////////////////////////////////////////////// + /// \brief Keyboard event parameters (KeyPressed, KeyReleased) + /// + //////////////////////////////////////////////////////////// + struct KeyEvent + { + Keyboard::Key code; ///< Code of the key that has been pressed + bool alt; ///< Is the Alt key pressed? + bool control; ///< Is the Control key pressed? + bool shift; ///< Is the Shift key pressed? + bool system; ///< Is the System key pressed? + }; + + //////////////////////////////////////////////////////////// + /// \brief Text event parameters (TextEntered) + /// + //////////////////////////////////////////////////////////// + struct TextEvent + { + Uint32 unicode; ///< UTF-32 unicode value of the character + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse move event parameters (MouseMoved) + /// + //////////////////////////////////////////////////////////// + struct MouseMoveEvent + { + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse buttons events parameters + /// (MouseButtonPressed, MouseButtonReleased) + /// + //////////////////////////////////////////////////////////// + struct MouseButtonEvent + { + Mouse::Button button; ///< Code of the button that has been pressed + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Mouse wheel events parameters (MouseWheelMoved) + /// + //////////////////////////////////////////////////////////// + struct MouseWheelEvent + { + int delta; ///< Number of ticks the wheel has moved (positive is up, negative is down) + int x; ///< X position of the mouse pointer, relative to the left of the owner window + int y; ///< Y position of the mouse pointer, relative to the top of the owner window + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick connection events parameters + /// (JoystickConnected, JoystickDisconnected) + /// + //////////////////////////////////////////////////////////// + struct JoystickConnectEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick axis move event parameters (JoystickMoved) + /// + //////////////////////////////////////////////////////////// + struct JoystickMoveEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + Joystick::Axis axis; ///< Axis on which the joystick moved + float position; ///< New position on the axis (in range [-100 .. 100]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Joystick buttons events parameters + /// (JoystickButtonPressed, JoystickButtonReleased) + /// + //////////////////////////////////////////////////////////// + struct JoystickButtonEvent + { + unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1]) + unsigned int button; ///< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1]) + }; + + //////////////////////////////////////////////////////////// + /// \brief Enumeration of the different types of events + /// + //////////////////////////////////////////////////////////// + enum EventType + { + Closed, ///< The window requested to be closed (no data) + Resized, ///< The window was resized (data in event.size) + LostFocus, ///< The window lost the focus (no data) + GainedFocus, ///< The window gained the focus (no data) + TextEntered, ///< A character was entered (data in event.text) + KeyPressed, ///< A key was pressed (data in event.key) + KeyReleased, ///< A key was released (data in event.key) + MouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) + MouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton) + MouseButtonReleased, ///< A mouse button was released (data in event.mouseButton) + MouseMoved, ///< The mouse cursor moved (data in event.mouseMove) + MouseEntered, ///< The mouse cursor entered the area of the window (no data) + MouseLeft, ///< The mouse cursor left the area of the window (no data) + JoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton) + JoystickButtonReleased, ///< A joystick button was released (data in event.joystickButton) + JoystickMoved, ///< The joystick moved along an axis (data in event.joystickMove) + JoystickConnected, ///< A joystick was connected (data in event.joystickConnect) + JoystickDisconnected, ///< A joystick was disconnected (data in event.joystickConnect) + + Count ///< Keep last -- the total number of event types + }; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + EventType type; ///< Type of the event + + union + { + SizeEvent size; ///< Size event parameters (Event::Resized) + KeyEvent key; ///< Key event parameters (Event::KeyPressed, Event::KeyReleased) + TextEvent text; ///< Text event parameters (Event::TextEntered) + MouseMoveEvent mouseMove; ///< Mouse move event parameters (Event::MouseMoved) + MouseButtonEvent mouseButton; ///< Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased) + MouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (Event::MouseWheelMoved) + JoystickMoveEvent joystickMove; ///< Joystick move event parameters (Event::JoystickMoved) + JoystickButtonEvent joystickButton; ///< Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased) + JoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected) + }; +}; + +} // namespace sf + + +#endif // SFML_EVENT_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Event +/// \ingroup window +/// +/// sf::Event holds all the informations about a system event +/// that just happened. Events are retrieved using the +/// sf::Window::pollEvent and sf::Window::waitEvent functions. +/// +/// A sf::Event instance contains the type of the event +/// (mouse moved, key pressed, window closed, ...) as well +/// as the details about this particular event. Please note that +/// the event parameters are defined in a union, which means that +/// only the member matching the type of the event will be properly +/// filled; all other members will have undefined values and must not +/// be read if the type of the event doesn't match. For example, +/// if you received a KeyPressed event, then you must read the +/// event.key member, all other members such as event.MouseMove +/// or event.text will have undefined values. +/// +/// Usage example: +/// \code +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// +/// // The escape key was pressed +/// if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)) +/// window.close(); +/// +/// // The window was resized +/// if (event.type == sf::Event::Resized) +/// doSomethingWithTheNewSize(event.size.width, event.size.height); +/// +/// // etc ... +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Export.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Export.hpp new file mode 100644 index 0000000..ff06576 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Export.hpp @@ -0,0 +1,48 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_EXPORT_HPP +#define SFML_WINDOW_EXPORT_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +//////////////////////////////////////////////////////////// +// Define portable import / export macros +//////////////////////////////////////////////////////////// +#if defined(SFML_WINDOW_EXPORTS) + + #define SFML_WINDOW_API SFML_API_EXPORT + +#else + + #define SFML_WINDOW_API SFML_API_IMPORT + +#endif + + +#endif // SFML_WINDOW_EXPORT_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/GlResource.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/GlResource.hpp new file mode 100644 index 0000000..560a637 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/GlResource.hpp @@ -0,0 +1,76 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_GLRESOURCE_HPP +#define SFML_GLRESOURCE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Base class for classes that require an OpenGL context +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API GlResource +{ +protected : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + //////////////////////////////////////////////////////////// + GlResource(); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + //////////////////////////////////////////////////////////// + ~GlResource(); + + //////////////////////////////////////////////////////////// + /// \brief Make sure that a valid OpenGL context exists in the current thread + /// + //////////////////////////////////////////////////////////// + static void ensureGlContext(); +}; + +} // namespace sf + + +#endif // SFML_GLRESOURCE_HPP + +//////////////////////////////////////////////////////////// +/// \class sf::GlResource +/// \ingroup window +/// +/// This class is for internal use only, it must be the base +/// of every class that requires a valid OpenGL context in +/// order to work. +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Joystick.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Joystick.hpp new file mode 100644 index 0000000..8e65309 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Joystick.hpp @@ -0,0 +1,203 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_JOYSTICK_HPP +#define SFML_JOYSTICK_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the joysticks +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Joystick +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Constants related to joysticks capabilities + /// + //////////////////////////////////////////////////////////// + enum + { + Count = 8, ///< Maximum number of supported joysticks + ButtonCount = 32, ///< Maximum number of supported buttons + AxisCount = 8 ///< Maximum number of supported axes + }; + + //////////////////////////////////////////////////////////// + /// \brief Axes supported by SFML joysticks + /// + //////////////////////////////////////////////////////////// + enum Axis + { + X, ///< The X axis + Y, ///< The Y axis + Z, ///< The Z axis + R, ///< The R axis + U, ///< The U axis + V, ///< The V axis + PovX, ///< The X axis of the point-of-view hat + PovY ///< The Y axis of the point-of-view hat + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick is connected + /// + /// \param joystick Index of the joystick to check + /// + /// \return True if the joystick is connected, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isConnected(unsigned int joystick); + + //////////////////////////////////////////////////////////// + /// \brief Return the number of buttons supported by a joystick + /// + /// If the joystick is not connected, this function returns 0. + /// + /// \param joystick Index of the joystick + /// + /// \return Number of buttons supported by the joystick + /// + //////////////////////////////////////////////////////////// + static unsigned int getButtonCount(unsigned int joystick); + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick supports a given axis + /// + /// If the joystick is not connected, this function returns false. + /// + /// \param joystick Index of the joystick + /// \param axis Axis to check + /// + /// \return True if the joystick supports the axis, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool hasAxis(unsigned int joystick, Axis axis); + + //////////////////////////////////////////////////////////// + /// \brief Check if a joystick button is pressed + /// + /// If the joystick is not connected, this function returns false. + /// + /// \param joystick Index of the joystick + /// \param button Button to check + /// + /// \return True if the button is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isButtonPressed(unsigned int joystick, unsigned int button); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of a joystick axis + /// + /// If the joystick is not connected, this function returns 0. + /// + /// \param joystick Index of the joystick + /// \param axis Axis to check + /// + /// \return Current position of the axis, in range [-100 .. 100] + /// + //////////////////////////////////////////////////////////// + static float getAxisPosition(unsigned int joystick, Axis axis); + + //////////////////////////////////////////////////////////// + /// \brief Update the states of all joysticks + /// + /// This function is used internally by SFML, so you normally + /// don't have to call it explicitely. However, you may need to + /// call it if you have no window yet (or no window at all): + /// in this case the joysticks states are not updated automatically. + /// + //////////////////////////////////////////////////////////// + static void update(); +}; + +} // namespace sf + + +#endif // SFML_JOYSTICK_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Joystick +/// \ingroup window +/// +/// sf::Joystick provides an interface to the state of the +/// joysticks. It only contains static functions, so it's not +/// meant to be instanciated. Instead, each joystick is identified +/// by an index that is passed to the functions of this class. +/// +/// This class allows users to query the state of joysticks at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the JoystickMoved, JoystickButtonPressed +/// and JoystickButtonReleased events, sf::Joystick can retrieve the +/// state of axes and buttons of joysticks at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a button is pressed or released), and you +/// always get the real state of joysticks, even if they are +/// moved, pressed or released when your window is out of focus +/// and no event is triggered. +/// +/// SFML supports: +/// \li 8 joysticks (sf::Joystick::Count) +/// \li 32 buttons per joystick (sf::Joystick::ButtonCount) +/// \li 8 axes per joystick (sf::Joystick::AxisCount) +/// +/// Unlike the keyboard or mouse, the state of joysticks is sometimes +/// not directly available (depending on the OS), therefore an update() +/// function must be called in order to update the current state of +/// joysticks. When you have a window with event handling, this is done +/// automatically, you don't need to call anything. But if you have no +/// window, or if you want to check joysticks state before creating one, +/// you must call sf::Joystick::update explicitely. +/// +/// Usage example: +/// \code +/// // Is joystick #0 connected? +/// bool connected = sf::Joystick::isConnected(0); +/// +/// // How many buttons does joystick #0 support? +/// unsigned int buttons = sf::Joystick::getButtonCount(0); +/// +/// // Does joystick #0 define a X axis? +/// bool hasX = sf::Joystick::hasAxis(0, sf::Joystick::X); +/// +/// // Is button #2 pressed on joystick #0? +/// bool pressed = sf::Joystick::isButtonPressed(0, 2); +/// +/// // What's the current position of the Y axis on joystick #0? +/// float position = sf::Joystick::getAxisPosition(0, sf::Joystick::Y); +/// \endcode +/// +/// \see sf::Keyboard, sf::Mouse +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Keyboard.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Keyboard.hpp new file mode 100644 index 0000000..f10dc7c --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Keyboard.hpp @@ -0,0 +1,209 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_KEYBOARD_HPP +#define SFML_KEYBOARD_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the keyboard +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Keyboard +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Key codes + /// + //////////////////////////////////////////////////////////// + enum Key + { + Unknown = -1, ///< Unhandled key + A = 0, ///< The A key + B, ///< The B key + C, ///< The C key + D, ///< The D key + E, ///< The E key + F, ///< The F key + G, ///< The G key + H, ///< The H key + I, ///< The I key + J, ///< The J key + K, ///< The K key + L, ///< The L key + M, ///< The M key + N, ///< The N key + O, ///< The O key + P, ///< The P key + Q, ///< The Q key + R, ///< The R key + S, ///< The S key + T, ///< The T key + U, ///< The U key + V, ///< The V key + W, ///< The W key + X, ///< The X key + Y, ///< The Y key + Z, ///< The Z key + Num0, ///< The 0 key + Num1, ///< The 1 key + Num2, ///< The 2 key + Num3, ///< The 3 key + Num4, ///< The 4 key + Num5, ///< The 5 key + Num6, ///< The 6 key + Num7, ///< The 7 key + Num8, ///< The 8 key + Num9, ///< The 9 key + Escape, ///< The Escape key + LControl, ///< The left Control key + LShift, ///< The left Shift key + LAlt, ///< The left Alt key + LSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ... + RControl, ///< The right Control key + RShift, ///< The right Shift key + RAlt, ///< The right Alt key + RSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ... + Menu, ///< The Menu key + LBracket, ///< The [ key + RBracket, ///< The ] key + SemiColon, ///< The ; key + Comma, ///< The , key + Period, ///< The . key + Quote, ///< The ' key + Slash, ///< The / key + BackSlash, ///< The \ key + Tilde, ///< The ~ key + Equal, ///< The = key + Dash, ///< The - key + Space, ///< The Space key + Return, ///< The Return key + BackSpace, ///< The Backspace key + Tab, ///< The Tabulation key + PageUp, ///< The Page up key + PageDown, ///< The Page down key + End, ///< The End key + Home, ///< The Home key + Insert, ///< The Insert key + Delete, ///< The Delete key + Add, ///< The + key + Subtract, ///< The - key + Multiply, ///< The * key + Divide, ///< The / key + Left, ///< Left arrow + Right, ///< Right arrow + Up, ///< Up arrow + Down, ///< Down arrow + Numpad0, ///< The numpad 0 key + Numpad1, ///< The numpad 1 key + Numpad2, ///< The numpad 2 key + Numpad3, ///< The numpad 3 key + Numpad4, ///< The numpad 4 key + Numpad5, ///< The numpad 5 key + Numpad6, ///< The numpad 6 key + Numpad7, ///< The numpad 7 key + Numpad8, ///< The numpad 8 key + Numpad9, ///< The numpad 9 key + F1, ///< The F1 key + F2, ///< The F2 key + F3, ///< The F3 key + F4, ///< The F4 key + F5, ///< The F5 key + F6, ///< The F6 key + F7, ///< The F7 key + F8, ///< The F8 key + F9, ///< The F9 key + F10, ///< The F10 key + F11, ///< The F11 key + F12, ///< The F12 key + F13, ///< The F13 key + F14, ///< The F14 key + F15, ///< The F15 key + Pause, ///< The Pause key + + KeyCount ///< Keep last -- the total number of keyboard keys + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a key is pressed + /// + /// \param key Key to check + /// + /// \return True if the key is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isKeyPressed(Key key); +}; + +} // namespace sf + + +#endif // SFML_KEYBOARD_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Keyboard +/// \ingroup window +/// +/// sf::Keyboard provides an interface to the state of the +/// keyboard. It only contains static functions (a single +/// keyboard is assumed), so it's not meant to be instanciated. +/// +/// This class allows users to query the keyboard state at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the KeyPressed and KeyReleased events, +/// sf::Keyboard can retrieve the state of a key at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a key is pressed or released), and you +/// always get the real state of the keyboard, even if keys are +/// pressed or released when your window is out of focus and no +/// event is triggered. +/// +/// Usage example: +/// \code +/// if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) +/// { +/// // move left... +/// } +/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) +/// { +/// // move right... +/// } +/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) +/// { +/// // quit... +/// } +/// \endcode +/// +/// \see sf::Joystick, sf::Mouse +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Mouse.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Mouse.hpp new file mode 100644 index 0000000..dd26d1a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Mouse.hpp @@ -0,0 +1,167 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_MOUSE_HPP +#define SFML_MOUSE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +class Window; + +//////////////////////////////////////////////////////////// +/// \brief Give access to the real-time state of the mouse +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Mouse +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Mouse buttons + /// + //////////////////////////////////////////////////////////// + enum Button + { + Left, ///< The left mouse button + Right, ///< The right mouse button + Middle, ///< The middle (wheel) mouse button + XButton1, ///< The first extra mouse button + XButton2, ///< The second extra mouse button + + ButtonCount ///< Keep last -- the total number of mouse buttons + }; + + //////////////////////////////////////////////////////////// + /// \brief Check if a mouse button is pressed + /// + /// \param button Button to check + /// + /// \return True if the button is pressed, false otherwise + /// + //////////////////////////////////////////////////////////// + static bool isButtonPressed(Button button); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in desktop coordinates + /// + /// This function returns the global position of the mouse + /// cursor on the desktop. + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i getPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i getPosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the global position of the mouse + /// cursor on the desktop. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void setPosition(const Vector2i& position, const Window& relativeTo); +}; + +} // namespace sf + + +#endif // SFML_MOUSE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Mouse +/// \ingroup window +/// +/// sf::Mouse provides an interface to the state of the +/// mouse. It only contains static functions (a single +/// mouse is assumed), so it's not meant to be instanciated. +/// +/// This class allows users to query the mouse state at any +/// time and directly, without having to deal with a window and +/// its events. Compared to the MouseMoved, MouseButtonPressed +/// and MouseButtonReleased events, sf::Mouse can retrieve the +/// state of the cursor and the buttons at any time +/// (you don't need to store and update a boolean on your side +/// in order to know if a button is pressed or released), and you +/// always get the real state of the mouse, even if it is +/// moved, pressed or released when your window is out of focus +/// and no event is triggered. +/// +/// The setPosition and getPosition functions can be used to change +/// or retrieve the current position of the mouse pointer. There are +/// two versions: one that operates in global coordinates (relative +/// to the desktop) and one that operates in window coordinates +/// (relative to a specific window). +/// +/// Usage example: +/// \code +/// if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) +/// { +/// // left click... +/// } +/// +/// // get global mouse position +/// sf::Vector2i position = sf::Mouse::getPosition(); +/// +/// // set mouse position relative to a window +/// sf::Mouse::setPosition(sf::Vector2i(100, 200), window); +/// \endcode +/// +/// \see sf::Joystick, sf::Keyboard +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/VideoMode.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/VideoMode.hpp new file mode 100644 index 0000000..beec607 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/VideoMode.hpp @@ -0,0 +1,228 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_VIDEOMODE_HPP +#define SFML_VIDEOMODE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include + + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// \brief VideoMode defines a video mode (width, height, bpp) +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API VideoMode +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructors initializes all members to 0. + /// + //////////////////////////////////////////////////////////// + VideoMode(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the video mode with its attributes + /// + /// \param modeWidth Width in pixels + /// \param modeHeight Height in pixels + /// \param modeBitsPerPixel Pixel depths in bits per pixel + /// + //////////////////////////////////////////////////////////// + VideoMode(unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel = 32); + + //////////////////////////////////////////////////////////// + /// \brief Get the current desktop video mode + /// + /// \return Current desktop video mode + /// + //////////////////////////////////////////////////////////// + static VideoMode getDesktopMode(); + + //////////////////////////////////////////////////////////// + /// \brief Retrieve all the video modes supported in fullscreen mode + /// + /// When creating a fullscreen window, the video mode is restricted + /// to be compatible with what the graphics driver and monitor + /// support. This function returns the complete list of all video + /// modes that can be used in fullscreen mode. + /// The returned array is sorted from best to worst, so that + /// the first element will always give the best mode (higher + /// width, height and bits-per-pixel). + /// + /// \return Array containing all the supported fullscreen modes + /// + //////////////////////////////////////////////////////////// + static const std::vector& getFullscreenModes(); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the video mode is valid + /// + /// The validity of video modes is only relevant when using + /// fullscreen windows; otherwise any video mode can be used + /// with no restriction. + /// + /// \return True if the video mode is valid for fullscreen mode + /// + //////////////////////////////////////////////////////////// + bool isValid() const; + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + unsigned int width; ///< Video mode width, in pixels + unsigned int height; ///< Video mode height, in pixels + unsigned int bitsPerPixel; ///< Video mode pixel depth, in bits per pixels +}; + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of == operator to compare two video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if modes are equal +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator ==(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of != operator to compare two video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if modes are different +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator !=(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of < operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is lesser than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator <(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of > operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is greater than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator >(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of <= operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is lesser or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator <=(const VideoMode& left, const VideoMode& right); + +//////////////////////////////////////////////////////////// +/// \relates VideoMode +/// \brief Overload of >= operator to compare video modes +/// +/// \param left Left operand (a video mode) +/// \param right Right operand (a video mode) +/// +/// \return True if \a left is greater or equal than \a right +/// +//////////////////////////////////////////////////////////// +SFML_WINDOW_API bool operator >=(const VideoMode& left, const VideoMode& right); + +} // namespace sf + + +#endif // SFML_VIDEOMODE_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::VideoMode +/// \ingroup window +/// +/// A video mode is defined by a width and a height (in pixels) +/// and a depth (in bits per pixel). Video modes are used to +/// setup windows (sf::Window) at creation time. +/// +/// The main usage of video modes is for fullscreen mode: +/// indeed you must use one of the valid video modes +/// allowed by the OS (which are defined by what the monitor +/// and the graphics card support), otherwise your window +/// creation will just fail. +/// +/// sf::VideoMode provides a static function for retrieving +/// the list of all the video modes supported by the system: +/// getFullscreenModes(). +/// +/// A custom video mode can also be checked directly for +/// fullscreen compatibility with its isValid() function. +/// +/// Additionnally, sf::VideoMode provides a static function +/// to get the mode currently used by the desktop: getDesktopMode(). +/// This allows to build windows with the same size or pixel +/// depth as the current resolution. +/// +/// Usage example: +/// \code +/// // Display the list of all the video modes available for fullscreen +/// std::vector modes = sf::VideoMode::getFullscreenModes(); +/// for (std::size_t i = 0; i < modes.size(); ++i) +/// { +/// sf::VideoMode mode = modes[i]; +/// std::cout << "Mode #" << i << ": " +/// << mode.width << "x" << mode.height << " - " +/// << mode.bitsPerPixel << " bpp" << std::endl; +/// } +/// +/// // Create a window with the same pixel depth as the desktop +/// sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); +/// window.create(sf::VideoMode(1024, 768, desktop.bitsPerPixel), "SFML window"); +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/Window.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/Window.hpp new file mode 100644 index 0000000..21bb2c5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/Window.hpp @@ -0,0 +1,541 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOW_HPP +#define SFML_WINDOW_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace sf +{ +namespace priv +{ + class GlContext; + class WindowImpl; +} + +class Event; + +//////////////////////////////////////////////////////////// +/// \brief Window that serves as a target for OpenGL rendering +/// +//////////////////////////////////////////////////////////// +class SFML_WINDOW_API Window : GlResource, NonCopyable +{ +public : + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// This constructor doesn't actually create the window, + /// use the other constructors or call "create" to do so. + /// + //////////////////////////////////////////////////////////// + Window(); + + //////////////////////////////////////////////////////////// + /// \brief Construct a new window + /// + /// This constructor creates the window with the size and pixel + /// depth defined in \a mode. An optional style can be passed to + /// customize the look and behaviour of the window (borders, + /// title bar, resizable, closable, ...). If \a style contains + /// Style::Fullscreen, then \a mode must be a valid video mode. + /// + /// The fourth parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + Window(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Construct the window from an existing control + /// + /// Use this constructor if you want to create an OpenGL + /// rendering area into an already existing control. + /// + /// The second parameter is an optional structure specifying + /// advanced OpenGL context settings such as antialiasing, + /// depth-buffer bits, etc. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + explicit Window(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Destructor + /// + /// Closes the window and free all the resources attached to it. + /// + //////////////////////////////////////////////////////////// + virtual ~Window(); + + //////////////////////////////////////////////////////////// + /// \brief Create (or recreate) the window + /// + /// If the window was already created, it closes it first. + /// If \a style contains Style::Fullscreen, then \a mode + /// must be a valid video mode. + /// + /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) + /// \param title Title of the window + /// \param style Window style + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + void create(VideoMode mode, const String& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Create (or recreate) the window from an existing control + /// + /// Use this function if you want to create an OpenGL + /// rendering area into an already existing control. + /// If the window was already created, it closes it first. + /// + /// \param handle Platform-specific handle of the control + /// \param settings Additional settings for the underlying OpenGL context + /// + //////////////////////////////////////////////////////////// + void create(WindowHandle handle, const ContextSettings& settings = ContextSettings()); + + //////////////////////////////////////////////////////////// + /// \brief Close the window and destroy all the attached resources + /// + /// After calling this function, the sf::Window instance remains + /// valid and you can call create() to recreate the window. + /// All other functions such as pollEvent() or display() will + /// still work (i.e. you don't have to test isOpen() every time), + /// and will have no effect on closed windows. + /// + //////////////////////////////////////////////////////////// + void close(); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether or not the window is open + /// + /// This function returns whether or not the window exists. + /// Note that a hidden window (setVisible(false)) is open + /// (therefore this function would return true). + /// + /// \return True if the window is open, false if it has been closed + /// + //////////////////////////////////////////////////////////// + bool isOpen() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the settings of the OpenGL context of the window + /// + /// Note that these settings may be different from what was + /// passed to the constructor or the create() function, + /// if one or more settings were not supported. In this case, + /// SFML chose the closest match. + /// + /// \return Structure containing the OpenGL context settings + /// + //////////////////////////////////////////////////////////// + const ContextSettings& getSettings() const; + + //////////////////////////////////////////////////////////// + /// \brief Pop the event on top of the event queue, if any, and return it + /// + /// This function is not blocking: if there's no pending event then + /// it will return false and leave \a event unmodified. + /// Note that more than one event may be present in the event queue, + /// thus you should always call this function in a loop + /// to make sure that you process every pending event. + /// \code + /// sf::Event event; + /// while (window.pollEvent(event)) + /// { + /// // process event... + /// } + /// \endcode + /// + /// \param event Event to be returned + /// + /// \return True if an event was returned, or false if the event queue was empty + /// + /// \see waitEvent + /// + //////////////////////////////////////////////////////////// + bool pollEvent(Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Wait for an event and return it + /// + /// This function is blocking: if there's no pending event then + /// it will wait until an event is received. + /// After this function returns (and no error occured), + /// the \a event object is always valid and filled properly. + /// This function is typically used when you have a thread that + /// is dedicated to events handling: you want to make this thread + /// sleep as long as no new event is received. + /// \code + /// sf::Event event; + /// if (window.waitEvent(event)) + /// { + /// // process event... + /// } + /// \endcode + /// + /// \param event Event to be returned + /// + /// \return False if any error occured + /// + /// \see pollEvent + /// + //////////////////////////////////////////////////////////// + bool waitEvent(Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Get the position of the window + /// + /// \return Position of the window, in pixels + /// + /// \see setPosition + /// + //////////////////////////////////////////////////////////// + Vector2i getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the position of the window on screen + /// + /// This function only works for top-level windows + /// (i.e. it will be ignored for windows created from + /// the handle of a child window/control). + /// + /// \param position New position, in pixels + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + void setPosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rendering region of the window + /// + /// The size doesn't include the titlebar and borders + /// of the window. + /// + /// \return Size in pixels + /// + /// \see setSize + /// + //////////////////////////////////////////////////////////// + Vector2u getSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Change the size of the rendering region of the window + /// + /// \param size New size, in pixels + /// + /// \see getSize + /// + //////////////////////////////////////////////////////////// + void setSize(const Vector2u size); + + //////////////////////////////////////////////////////////// + /// \brief Change the title of the window + /// + /// \param title New title + /// + /// \see setIcon + /// + //////////////////////////////////////////////////////////// + void setTitle(const String& title); + + //////////////////////////////////////////////////////////// + /// \brief Change the window's icon + /// + /// \a pixels must be an array of \a width x \a height pixels + /// in 32-bits RGBA format. + /// + /// The OS default icon is used by default. + /// + /// \param width Icon's width, in pixels + /// \param height Icon's height, in pixels + /// \param pixels Pointer to the array of pixels in memory + /// + /// \see setTitle + /// + //////////////////////////////////////////////////////////// + void setIcon(unsigned int width, unsigned int height, const Uint8* pixels); + + //////////////////////////////////////////////////////////// + /// \brief Show or hide the window + /// + /// The window is shown by default. + /// + /// \param visible True to show the window, false to hide it + /// + //////////////////////////////////////////////////////////// + void setVisible(bool visible); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable vertical synchronization + /// + /// Activating vertical synchronization will limit the number + /// of frames displayed to the refresh rate of the monitor. + /// This can avoid some visual artifacts, and limit the framerate + /// to a good value (but not constant across different computers). + /// + /// Vertical synchronization is disabled by default. + /// + /// \param enabled True to enable v-sync, false to deactivate it + /// + //////////////////////////////////////////////////////////// + void setVerticalSyncEnabled(bool enabled); + + //////////////////////////////////////////////////////////// + /// \brief Show or hide the mouse cursor + /// + /// The mouse cursor is visible by default. + /// + /// \param visible True to show the mouse cursor, false to hide it + /// + //////////////////////////////////////////////////////////// + void setMouseCursorVisible(bool visible); + + //////////////////////////////////////////////////////////// + /// \brief Enable or disable automatic key-repeat + /// + /// If key repeat is enabled, you will receive repeated + /// KeyPressed events while keeping a key pressed. If it is disabled, + /// you will only get a single event when the key is pressed. + /// + /// Key repeat is enabled by default. + /// + /// \param enabled True to enable, false to disable + /// + //////////////////////////////////////////////////////////// + void setKeyRepeatEnabled(bool enabled); + + //////////////////////////////////////////////////////////// + /// \brief Limit the framerate to a maximum fixed frequency + /// + /// If a limit is set, the window will use a small delay after + /// each call to display() to ensure that the current frame + /// lasted long enough to match the framerate limit. + /// SFML will try to match the given limit as much as it can, + /// but since it internally uses sf::sleep, whose precision + /// depends on the underlying OS, the results may be a little + /// unprecise as well (for example, you can get 65 FPS when + /// requesting 60). + /// + /// \param limit Framerate limit, in frames per seconds (use 0 to disable limit) + /// + //////////////////////////////////////////////////////////// + void setFramerateLimit(unsigned int limit); + + //////////////////////////////////////////////////////////// + /// \brief Change the joystick threshold + /// + /// The joystick threshold is the value below which + /// no JoystickMoved event will be generated. + /// + /// The threshold value is 0.1 by default. + /// + /// \param threshold New threshold, in the range [0, 100] + /// + //////////////////////////////////////////////////////////// + void setJoystickThreshold(float threshold); + + //////////////////////////////////////////////////////////// + /// \brief Activate or deactivate the window as the current target + /// for OpenGL rendering + /// + /// A window is active only on the current thread, if you want to + /// make it active on another thread you have to deactivate it + /// on the previous thread first if it was active. + /// Only one window can be active on a thread at a time, thus + /// the window previously active (if any) automatically gets deactivated. + /// + /// \param active True to activate, false to deactivate + /// + /// \return True if operation was successful, false otherwise + /// + //////////////////////////////////////////////////////////// + bool setActive(bool active = true) const; + + //////////////////////////////////////////////////////////// + /// \brief Display on screen what has been rendered to the window so far + /// + /// This function is typically called after all OpenGL rendering + /// has been done for the current frame, in order to show + /// it on screen. + /// + //////////////////////////////////////////////////////////// + void display(); + + //////////////////////////////////////////////////////////// + /// \brief Get the OS-specific handle of the window + /// + /// The type of the returned handle is sf::WindowHandle, + /// which is a typedef to the handle type defined by the OS. + /// You shouldn't need to use this function, unless you have + /// very specific stuff to implement that SFML doesn't support, + /// or implement a temporary workaround until a bug is fixed. + /// + /// \return System handle of the window + /// + //////////////////////////////////////////////////////////// + WindowHandle getSystemHandle() const; + +protected : + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been created + /// + /// This function is called so that derived classes can + /// perform their own specific initialization as soon as + /// the window is created. + /// + //////////////////////////////////////////////////////////// + virtual void onCreate(); + + //////////////////////////////////////////////////////////// + /// \brief Function called after the window has been resized + /// + /// This function is called so that derived classes can + /// perform custom actions when the size of the window changes. + /// + //////////////////////////////////////////////////////////// + virtual void onResize(); + +private: + + //////////////////////////////////////////////////////////// + /// \brief Processes an event before it is sent to the user + /// + /// This function is called every time an event is received + /// from the internal window (through pollEvent or waitEvent). + /// It filters out unwanted events, and performs whatever internal + /// stuff the window needs before the event is returned to the + /// user. + /// + /// \param event Event to filter + /// + //////////////////////////////////////////////////////////// + bool filterEvent(const Event& event); + + //////////////////////////////////////////////////////////// + /// \brief Perform some common internal initializations + /// + //////////////////////////////////////////////////////////// + void initialize(); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + priv::WindowImpl* m_impl; ///< Platform-specific implementation of the window + priv::GlContext* m_context; ///< Platform-specific implementation of the OpenGL context + Clock m_clock; ///< Clock for measuring the elapsed time between frames + Time m_frameTimeLimit; ///< Current framerate limit + Vector2u m_size; ///< Current size of the window +}; + +} // namespace sf + + +#endif // SFML_WINDOW_HPP + + +//////////////////////////////////////////////////////////// +/// \class sf::Window +/// \ingroup window +/// +/// sf::Window is the main class of the Window module. It defines +/// an OS window that is able to receive an OpenGL rendering. +/// +/// A sf::Window can create its own new window, or be embedded into +/// an already existing control using the create(handle) function. +/// This can be useful for embedding an OpenGL rendering area into +/// a view which is part of a bigger GUI with existing windows, +/// controls, etc. It can also serve as embedding an OpenGL rendering +/// area into a window created by another (probably richer) GUI library +/// like Qt or wxWidgets. +/// +/// The sf::Window class provides a simple interface for manipulating +/// the window: move, resize, show/hide, control mouse cursor, etc. +/// It also provides event handling through its pollEvent() and waitEvent() +/// functions. +/// +/// Note that OpenGL experts can pass their own parameters (antialiasing +/// level, bits for the depth and stencil buffers, etc.) to the +/// OpenGL context attached to the window, with the sf::ContextSettings +/// structure which is passed as an optional argument when creating the +/// window. +/// +/// Usage example: +/// \code +/// // Declare and create a new window +/// sf::Window window(sf::VideoMode(800, 600), "SFML window"); +/// +/// // Limit the framerate to 60 frames per second (this step is optional) +/// window.setFramerateLimit(60); +/// +/// // The main loop - ends as soon as the window is closed +/// while (window.isOpen()) +/// { +/// // Event processing +/// sf::Event event; +/// while (window.pollEvent(event)) +/// { +/// // Request for closing the window +/// if (event.type == sf::Event::Closed) +/// window.close(); +/// } +/// +/// // Activate the window for OpenGL rendering +/// window.setActive(); +/// +/// // OpenGL drawing commands go here... +/// +/// // End the current frame and display its contents on screen +/// window.display(); +/// } +/// \endcode +/// +//////////////////////////////////////////////////////////// diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowHandle.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowHandle.hpp new file mode 100644 index 0000000..7fb2bb8 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowHandle.hpp @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWHANDLE_HPP +#define SFML_WINDOWHANDLE_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +// Windows' HWND is a typedef on struct HWND__* +#if defined(SFML_SYSTEM_WINDOWS) + struct HWND__; +#endif + +namespace sf +{ +//////////////////////////////////////////////////////////// +/// Define a low-level window handle type, specific to +/// each platform +//////////////////////////////////////////////////////////// +#if defined(SFML_SYSTEM_WINDOWS) + + // Window handle is HWND (HWND__*) on Windows + typedef HWND__* WindowHandle; + +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) + + // Window handle is Window (unsigned long) on Unix - X11 + typedef unsigned long WindowHandle; + +#elif defined(SFML_SYSTEM_MACOS) + + // Window handle is NSWindow (void*) on Mac OS X - Cocoa + typedef void* WindowHandle; + +#endif + +} // namespace sf + + +#endif // SFML_WINDOWHANDLE_HPP diff --git a/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowStyle.hpp b/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowStyle.hpp new file mode 100644 index 0000000..fa69d32 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/include/SFML/Window/WindowStyle.hpp @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com) +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef SFML_WINDOWSTYLE_HPP +#define SFML_WINDOWSTYLE_HPP + + +namespace sf +{ +namespace Style +{ + //////////////////////////////////////////////////////////// + /// \ingroup window + /// \brief Enumeration of the window styles + /// + //////////////////////////////////////////////////////////// + enum + { + None = 0, ///< No border / title bar (this flag and all others are mutually exclusive) + Titlebar = 1 << 0, ///< Title bar + fixed border + Resize = 1 << 1, ///< Titlebar + resizable border + maximize button + Close = 1 << 2, ///< Titlebar + close button + Fullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive) + + Default = Titlebar | Resize | Close ///< Default window style + }; +} + +} // namespace sf + + +#endif // SFML_WINDOWSTYLE_HPP diff --git a/SFML-2.1-osx-clang-universal/install.sh b/SFML-2.1-osx-clang-universal/install.sh new file mode 100755 index 0000000..2655fe7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/install.sh @@ -0,0 +1,157 @@ +#!/bin/sh + +### +### Install package for SFML 2.1 on OS X +### +### Author: Marco Antognini +### Date: 26/07/2013 +### + +### This script install the following: +### +### cmake/ into /usr/local/share/SFML/cmake/ +### doc/ into /usr/local/share/SFML/doc/ +### examples/ into /usr/local/share/SFML/examples/ +### extlibs/ into /Library/Frameworks/ +### Frameworks/ into /Library/Frameworks/ +### include/ into /usr/local/include/ +### lib/ into /usr/local/lib/ +### license.txt into /usr/local/share/SFML/ +### readme.txt into /usr/local/share/SFML/ +### templates/ into /Library/Developer/Xcode/Templates/ +### +### It will NOT remove any previous versions. +### Hence, if you have the frameworks of SFML 2.0 installed +### you will keep this runtime (the two verions will be merged). + +### +### USAGE +### +### $0 [package] +### +### Package is optional. It represent the path to a package. +### If not present, package is assumed to be $(dirname "$0") +### +### When installing frameworks the script will ask you for +### your password. +### + + +## +## HELPER FUNCTIONS +## + +## Echoes to stderr, and die +error () # $* message to display +{ + echo "$@" 1>&2 + exit 2 +} + +## Check that the number of parameters is correct +param_check () # $1 should be $# on call site, + # $2 the number of required params, + # $3 an id for the error message +{ + if [ $# -ne 3 ] + then + error "Internal error in param_error: the number of parameters is incorrect" + fi + + if [ $1 -ne $2 ] + then + error "Internal error in $3: the number of parameters is incorrect" + fi +} + +## Check that the number of parameters is enough +param_check_ge () # $1 should be $# on call site, + # $2 the minimal number of parames, + # $3 an id for the error message +{ + param_check $# 3 "param_check_ge" + + if [ $1 -lt $2 ] + then + error "Internal error in $3: the number of parameters is not enough" + fi +} + +## Assert $1 is true, or die +assert () # $1: boolean, $2: an error message +{ + param_check $# 2 "assert" + + if [ $1 -ne 0 ] + then + error "$2" + fi +} + +## Create directory, or die +# === mkdir -p $1 +create_dir () # $1: path +{ + param_check $# 1 "create_dir" + mkdir -p "$1" + assert $? "Couldn't create $1" +} + +## Destroy directory, or die +# === rm -fr $1 +destroy () # $1: path +{ + param_check $# 1 "destroy" + rm -fr "$1" + assert $? "Couldn't destroy $1" +} + +## Copy files/directories, recursively, or die +install () # $1...N: src, $N+1: dest +{ + param_check_ge $# 2 "install" + ditto "$@" + assert $? "Couldn't install $1" +} + +## [with root access] Copy files/directories, recursively, or die +sudo_install () # $1...N: src, $N+1: dest +{ + param_check_ge $# 2 "install" + sudo ditto "$@" + assert $? "Couldn't install $1" +} + + +## +## MAIN FUNCTION +## + +if [ -n "$1" ] +then + package="$1" +else + package=$(dirname "$0") +fi + +echo "INSTALLING PACKAGE $package" + +cd "$package" +assert $? "Couldn't go to the package directory $package" + +echo "Installing Frameworks [with root access]" +sudo_install "extlibs/" "Frameworks/" "/Library/Frameworks" + +echo "Installing dylibs" +install "lib/" "/usr/local/lib/" +install "include/" "/usr/local/include/" + +echo "Installing misc" +create_dir "/usr/local/share/SFML/" +install "cmake" "/usr/local/share/SFML/cmake/" +install "doc" "/usr/local/share/SFML/doc/" +install "examples" "/usr/local/share/SFML/examples/" +install "license.txt" "readme.txt" "/usr/local/share/SFML/" +install "templates/" "/Library/Developer/Xcode/Templates/" + +echo "Installation DONE" diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.1.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.1.dylib new file mode 100755 index 0000000..6ee2343 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.1.dylib differ diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.dylib new file mode 120000 index 0000000..7fba973 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.2.dylib @@ -0,0 +1 @@ +libsfml-audio.2.1.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-audio.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.dylib new file mode 120000 index 0000000..b3b98b3 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-audio.dylib @@ -0,0 +1 @@ +libsfml-audio.2.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.1.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.1.dylib new file mode 100755 index 0000000..ac7b9f8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.1.dylib differ diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.dylib new file mode 120000 index 0000000..2c08af5 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.2.dylib @@ -0,0 +1 @@ +libsfml-graphics.2.1.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.dylib new file mode 120000 index 0000000..3ca7288 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-graphics.dylib @@ -0,0 +1 @@ +libsfml-graphics.2.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.1.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.1.dylib new file mode 100755 index 0000000..be5bf78 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.1.dylib differ diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.dylib new file mode 120000 index 0000000..fa0181b --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-network.2.dylib @@ -0,0 +1 @@ +libsfml-network.2.1.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-network.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-network.dylib new file mode 120000 index 0000000..4bc569a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-network.dylib @@ -0,0 +1 @@ +libsfml-network.2.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.1.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.1.dylib new file mode 100755 index 0000000..c483a82 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.1.dylib differ diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.dylib new file mode 120000 index 0000000..dd1188d --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-system.2.dylib @@ -0,0 +1 @@ +libsfml-system.2.1.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-system.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-system.dylib new file mode 120000 index 0000000..ddf61d4 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-system.dylib @@ -0,0 +1 @@ +libsfml-system.2.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.1.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.1.dylib new file mode 100755 index 0000000..ad10829 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.1.dylib differ diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.dylib new file mode 120000 index 0000000..27f5365 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-window.2.dylib @@ -0,0 +1 @@ +libsfml-window.2.1.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/lib/libsfml-window.dylib b/SFML-2.1-osx-clang-universal/lib/libsfml-window.dylib new file mode 120000 index 0000000..058ae19 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/lib/libsfml-window.dylib @@ -0,0 +1 @@ +libsfml-window.2.dylib \ No newline at end of file diff --git a/SFML-2.1-osx-clang-universal/license.txt b/SFML-2.1-osx-clang-universal/license.txt new file mode 100644 index 0000000..b374541 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/license.txt @@ -0,0 +1,36 @@ +SFML +---- + +SFML - Copyright (C) 2007-2013 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. + + + +External libraries used by SFML +------------------------------- + +* OpenAL-Soft is under the LGPL license +* libsndfile is under the LGPL license +* libjpeg is public domain +* stb_image and stb_image_write are public domain +* freetype is under the FreeType license or the GPL license +* GLEW is under the modified BSD License, the Mesa 3-D License (MIT License), and the Khronos License (MIT License) diff --git a/SFML-2.1-osx-clang-universal/readme.txt b/SFML-2.1-osx-clang-universal/readme.txt new file mode 100644 index 0000000..10b80ca --- /dev/null +++ b/SFML-2.1-osx-clang-universal/readme.txt @@ -0,0 +1,40 @@ +SFML - Simple and Fast Multimedia Library +========================================= + +SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, +audio and network. +It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python. + +Authors +------- + +Laurent Gomila - main developer (laurent.gom@gmail.com) +Marco Antognini - OS X developer (antognini.marco@gmail.com) + +Download +-------- + +You can get the latest official release on SFML website (http://www.sfml-dev.org/download.php). +You can also get the current development version from the git repository (https://github.com/LaurentGomila/SFML). + +Install +------- + +Follow the instructions of the tutorials (http://www.sfml-dev.org/tutorials.php), there is one for each platform/compiler that SFML supports. + +Learn +----- + +There are several places to learn SFML: +* The official tutorials (http://www.sfml-dev.org/resources.php#tutorials) +* The online API documentation (http://www.sfml-dev.org/resources.php#documentation) +* The community wiki (https://github.com/LaurentGomila/SFML/wiki/) +* The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for french people) + +Contribute +---------- + +SFML is an open-source project, and it needs your help to go on growing and improving. +Don't hesitate to post suggestions or bug reports on the forum (http://en.sfml-dev.org/forums/), +submit patches by e-mail, or post new bugs/features requests on the task tracker (https://github.com/LaurentGomila/SFML/issues/). +You can even fork the project on github, maintain your own version and send us pull requests periodically to merge your work. diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.hpp b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.hpp new file mode 100644 index 0000000..10e8c60 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.hpp @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Marco Antognini (antognini.marco@gmail.com), +// Laurent Gomila (laurent.gom@gmail.com), +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef RESOURCE_PATH_HPP +#define RESOURCE_PATH_HPP + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include + +//////////////////////////////////////////////////////////// +/// \brief Return the path to the resource folder. +/// +/// \return The path to the resource folder associate +/// with the main bundle or an empty string is there is no bundle. +/// +//////////////////////////////////////////////////////////// +std::string resourcePath(void); + +#endif diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.mm b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.mm new file mode 100644 index 0000000..30d47c1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/ResourcePath.mm @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Marco Antognini (antognini.marco@gmail.com), +// Laurent Gomila (laurent.gom@gmail.com), +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "ResourcePath.hpp" +#import + +//////////////////////////////////////////////////////////// +std::string resourcePath(void) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + + std::string rpath; + NSBundle* bundle = [NSBundle mainBundle]; + + if (bundle == nil) { +#ifdef DEBUG + NSLog(@"bundle is nil... thus no resources path can be found."); +#endif + } else { + NSString* path = [bundle resourcePath]; + rpath = [path UTF8String] + std::string("/"); + } + + [pool drain]; + + return rpath; +} diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateIcon.icns b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateIcon.icns new file mode 100644 index 0000000..477431b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateIcon.icns differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..19033b1 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/TemplateInfo.plist @@ -0,0 +1,268 @@ + + + + + + + + + + + Identifier + org.sfml-dev.app + + Concrete + + + Description + This template creates a SFML Application Bundle. + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + Ancestors + + org.sfml-dev.bundle + org.sfml-dev.compiler + org.sfml-dev.linker + + + + Nodes + + ResourcePath.mm + ResourcePath.hpp + main.cpp + cute_image.jpg + nice_music.ogg + sansation.ttf + icon.png + + + + Definitions + + + ResourcePath.mm + + Path + ResourcePath.mm + + ResourcePath.hpp + + Path + ResourcePath.hpp + TargetIndices + + + + + main.cpp + + Path + main.cpp + + + + cute_image.jpg + + Path + cute_image.jpg + Group + Resources + + + nice_music.ogg + + Path + nice_music.ogg + Group + Resources + + + sansation.ttf + + Path + sansation.ttf + Group + Resources + + + icon.png + + Path + icon.png + Group + Resources + + + + + Targets + + + BuildPhases + + + Class + ShellScript + + ShellPath + /bin/sh + + ShellScript + # This shell script simply copies required sfml dylibs/frameworks into the application bundle frameworks folder. +# If you're using static libraries (which is not recommended) you should remove this script from your project. + +# Are we building a project that uses framework or dylibs ? +case "$SFML_BINARY_TYPE" in + DYLIBS) + frameworks="false" + ;; + *) + frameworks="true" + ;; +esac + +# Echoes to stderr +error () # $* message to display +{ + echo $* 1>&2 + exit 2 +} + +assert () # $1 is a boolean, $2...N is an error message +{ + if [ $# -lt 2 ] + then + error "Internal error in assert : not enough args" + fi + + if [ $1 -ne 0 ] + then + shift + error "$*" + fi +} + +force_remove () # $1 is a path +{ + test $# -eq 1 + assert $? "force_remove() requires one parameter" + rm -fr "$1" + assert $? "couldn't remove $1" +} + +copy () # $1 is a source, $2 is a destination +{ + test $# -eq 2 + assert $? "copy() requires two parameters" + ditto "$1" "$2" + assert $? "couldn't copy $1 to $2" +} + +require () # $1 is a SFML module like 'system' or 'audio' +{ + dest="$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks" + + if [ -z "$1" ] + then + error "require() requires one parameter!" + else + # clean potentially old stuff + force_remove "$dest/libsfml-$1.2.dylib" + force_remove "$dest/libsfml-$1-d.2.dylib" + force_remove "$dest/sfml-$1.framework" + + # copy SFML libraries + if [ "$frameworks" = "true" ] + then + copy "/Library/Frameworks/sfml-$1.framework" "$dest/sfml-$1.framework" + elif [ $CONFIGURATION = "Debug" ] && [ $SFML_LINK_DYLIBS_SUFFIX_DEBUG != "" ] + then + copy "/usr/local/lib/libsfml-$1-d.2.dylib" "$dest/libsfml-$1-d.2.dylib" + else + copy "/usr/local/lib/libsfml-$1.2.dylib" "$dest/libsfml-$1.2.dylib" + fi + + if [ "$1" = "audio" ] + then + # copy sndfile framework too + copy "/Library/Frameworks/sndfile.framework" "$dest/sndfile.framework" + fi + + if [ "$1" = "graphics" ] + then + # copy freetype framework too + copy "/Library/Frameworks/freetype.framework" "$dest/freetype.framework" + fi + fi +} + +if [ -n "$SFML_SYSTEM" ] +then + require "system" +fi + +if [ -n "$SFML_AUDIO" ] +then + require "audio" +fi + +if [ -n "$SFML_NETWORK" ] +then + require "network" +fi + +if [ -n "$SFML_WINDOW" ] +then + require "window" +fi + +if [ -n "$SFML_GRAPHICS" ] +then + require "graphics" +fi + + + + RunOnlyForDeploymentPostprocessing + NO + + + + + + + diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/cute_image.jpg b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/cute_image.jpg new file mode 100644 index 0000000..20724fa Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/cute_image.jpg differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/icon.png b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/icon.png new file mode 100644 index 0000000..ef62688 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/icon.png differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/main.cpp b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/main.cpp new file mode 100644 index 0000000..b1b45ab --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/main.cpp @@ -0,0 +1,91 @@ + +// +// Disclamer: +// ---------- +// +// This code will work only if you selected window, graphics and audio. +// +// Note that the "Run Script" build phase will copy the required frameworks +// or dylibs to your application bundle so you can execute it on any OS X +// computer. +// +// Your resource files (images, sounds, fonts, ...) are also copied to your +// application bundle. To get the path to these resource, use the helper +// method resourcePath() from ResourcePath.hpp +// + +#include +#include + +// Here is a small helper for you ! Have a look. +#include "ResourcePath.hpp" + +int main(int, char const**) +{ + // Create the main window + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); + + // Set the Icon + sf::Image icon; + if (!icon.loadFromFile(resourcePath() + "icon.png")) { + return EXIT_FAILURE; + } + window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr()); + + // Load a sprite to display + sf::Texture texture; + if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) { + return EXIT_FAILURE; + } + sf::Sprite sprite(texture); + + // Create a graphical text to display + sf::Font font; + if (!font.loadFromFile(resourcePath() + "sansation.ttf")) { + return EXIT_FAILURE; + } + sf::Text text("Hello SFML", font, 50); + text.setColor(sf::Color::Black); + + // Load a music to play + sf::Music music; + if (!music.openFromFile(resourcePath() + "nice_music.ogg")) { + return EXIT_FAILURE; + } + + // Play the music + music.play(); + + // Start the game loop + while (window.isOpen()) + { + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window : exit + if (event.type == sf::Event::Closed) { + window.close(); + } + + // Espace pressed : exit + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) { + window.close(); + } + } + + // Clear screen + window.clear(); + + // Draw the sprite + window.draw(sprite); + + // Draw the string + window.draw(text); + + // Update the window + window.display(); + } + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/nice_music.ogg b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/nice_music.ogg new file mode 100644 index 0000000..f764d61 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/nice_music.ogg differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/sansation.ttf b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML App.xctemplate/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML Base.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Base.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..13fab2a --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Base.xctemplate/TemplateInfo.plist @@ -0,0 +1,116 @@ + + + + + + + + + + + Identifier + org.sfml-dev.base + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + Platforms + + com.apple.platform.macosx + + + + Options + + + Identifier + productName + Required + + Name + Product Name + NotPersisted + + Description + Your new product's name + EmptyReplacement + ProductName + Type + text + + + + Identifier + organizationName + Name + Organization Name + Description + Your company's name + Type + text + Default + ___FULLUSERNAME___ + + + + Identifier + bundleIdentifierPrefix + Required + + Name + Company Identifier + Description + Your company's bundle identifier prefix + EmptyReplacement + com.yourcompany + Type + text + + + + Identifier + bundleIdentifier + Name + Bundle Identifier + NotPersisted + + Description + Your new product's bundle identifier + Default + ___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.___VARIABLE_productName:RFC1034Identifier___ + Type + static + + + + diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML Bundle.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Bundle.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..48138a7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Bundle.xctemplate/TemplateInfo.plist @@ -0,0 +1,132 @@ + + + + + + + + + + + Identifier + org.sfml-dev.bundle + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + Ancestors + + org.sfml-dev.base + + + + Nodes + + ___PACKAGENAME___-Info.plist:Content + + + + Definitions + + ___PACKAGENAME___-Info.plist:Content + <?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>CFBundleIdentifier</key> + <string>___VARIABLE_bundleIdentifierPrefix:bundleIdentifier___.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> +</dict> +</plist> + + + ___PACKAGENAME___-Info.plist + + Group + Supporting Files + TargetIndices + + SubstituteMacros + + + + + + Targets + + + BuildPhases + + + Class + Sources + + + Class + Frameworks + + + Class + Resources + + + + ProductType + com.apple.product-type.application + + SharedSettings + + INFOPLIST_FILE + ___PACKAGENAME___/___PACKAGENAME___-Info.plist + + + + + diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateIcon.icns b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateIcon.icns new file mode 100644 index 0000000..477431b Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateIcon.icns differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..2c481f7 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/TemplateInfo.plist @@ -0,0 +1,137 @@ + + + + + + + + + + + Identifier + org.sfml-dev.clt + + Concrete + + + Description + This template creates a SFML Command Line Tool. + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + Ancestors + + org.sfml-dev.base + org.sfml-dev.compiler + org.sfml-dev.linker + + + + Nodes + + main.cpp + cute_image.jpg + nice_music.ogg + sansation.ttf + icon.png + + + + Definitions + + + main.cpp + + Path + main.cpp + + + + cute_image.jpg + + Path + cute_image.jpg + Group + Resources + + + nice_music.ogg + + Path + nice_music.ogg + Group + Resources + + + sansation.ttf + + Path + sansation.ttf + Group + Resources + + + icon.png + + Path + icon.png + Group + Resources + + + + + Targets + + + BuildPhases + + + Class + Sources + + + Class + Frameworks + + + + ProductType + com.apple.product-type.tool + + + + + diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/cute_image.jpg b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/cute_image.jpg new file mode 100644 index 0000000..20724fa Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/cute_image.jpg differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/icon.png b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/icon.png new file mode 100644 index 0000000..ef62688 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/icon.png differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/main.cpp b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/main.cpp new file mode 100644 index 0000000..daeddf0 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/main.cpp @@ -0,0 +1,89 @@ + +// +// Disclamer: +// ---------- +// +// This code will work only if you selected window, graphics and audio. +// +// In order to load the resources like cute_image.png, you have to set up +// your target scheme : +// +// - Select "Edit Scheme…" in the "Product" menu; +// - Check the box "use custom working directory"; +// - Fill the text field with the folder path containing your resources; +// (e.g. your project folder) +// - Click OK. +// + +#include +#include + +int main(int argc, char const** argv) +{ + // Create the main window + sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); + + // Set the Icon + sf::Image icon; + if (!icon.loadFromFile("icon.png")) { + return EXIT_FAILURE; + } + window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr()); + + // Load a sprite to display + sf::Texture texture; + if (!texture.loadFromFile("cute_image.jpg")) { + return EXIT_FAILURE; + } + sf::Sprite sprite(texture); + + // Create a graphical text to display + sf::Font font; + if (!font.loadFromFile("sansation.ttf")) { + return EXIT_FAILURE; + } + sf::Text text("Hello SFML", font, 50); + text.setColor(sf::Color::Black); + + // Load a music to play + sf::Music music; + if (!music.openFromFile("nice_music.ogg")) { + return EXIT_FAILURE; + } + + // Play the music + music.play(); + + // Start the game loop + while (window.isOpen()) + { + // Process events + sf::Event event; + while (window.pollEvent(event)) + { + // Close window : exit + if (event.type == sf::Event::Closed) { + window.close(); + } + + // Espace pressed : exit + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) { + window.close(); + } + } + + // Clear screen + window.clear(); + + // Draw the sprite + window.draw(sprite); + + // Draw the string + window.draw(text); + + // Update the window + window.display(); + } + + return EXIT_SUCCESS; +} diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/nice_music.ogg b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/nice_music.ogg new file mode 100644 index 0000000..f764d61 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/nice_music.ogg differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/sansation.ttf b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/sansation.ttf new file mode 100644 index 0000000..d85fbc8 Binary files /dev/null and b/SFML-2.1-osx-clang-universal/templates/SFML/SFML CLT.xctemplate/sansation.ttf differ diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..fb1e2d6 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Compiler.xctemplate/TemplateInfo.plist @@ -0,0 +1,288 @@ + + + + + + + + + + + Identifier + org.sfml-dev.compiler + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + + Options + + + Identifier + compilerSettingsType + + Name + [ADVANCED] C++ Compiler and Standard Library + + Description + If you don't know what is it about, use the default value. Note that you'll need a version of SFML compiled with Clang and libc++ to use C++11 ! + + Default + C++98 with Clang and libstdc++ + + NotPersisted + + + Type + popup + + Units + + + C++98 with GCC and libstdc++ and target 10.5 + + Project + + SharedSettings + + GCC_VERSION + com.apple.compilers.llvmgcc42 + + MACOSX_DEPLOYMENT_TARGET + 10.5 + + + + Targets + + + Frameworks + + Foundation + + + + + + + C++98 with Clang and libstdc++ + + Project + + SharedSettings + + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + + CLANG_CXX_LANGUAGE_STANDARD + c++98 + + CLANG_CXX_LIBRARY + libstdc++ + + + + + + C++11 with Clang and libc++ + + Project + + SharedSettings + + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + + CLANG_CXX_LANGUAGE_STANDARD + c++0x + + CLANG_CXX_LIBRARY + libc++ + + + + + + + + Identifier + archType + + Name + [ADVANCED] Architectures + + Description + Choose which architecture(s) you want to support + + Default + Universal + + NotPersisted + + + Type + popup + + Units + + + Universal + + Project + + SharedSettings + + ARCHS + $(ARCHS_STANDARD_32_64_BIT) + + + + + + 64 bits + + Project + + SharedSettings + + ARCHS + $(ARCHS_STANDARD_64_BIT) + + + + + + 32 bits + + Project + + SharedSettings + + ARCHS + $(ARCHS_STANDARD_32_BIT) + + + + + + + + + Project + + SharedSettings + + SUPPORTED_PLATFORMS + macosx + + + + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_VARIABLE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CLANG_WARN_EMPTY_BODY + YES + + + FRAMEWORK_SEARCH_PATHS + /Library/Frameworks/ $(inherited) + + HEADER_SEARCH_PATHS + /usr/local/include/ $(inherited) + + LIBRARY_SEARCH_PATHS + /usr/local/lib/ $(inherited) + + + Configurations + + Debug + + GCC_OPTIMIZATION_LEVEL + 0 + + GCC_PREPROCESSOR_DEFINITIONS + DEBUG=1 $(inherited) + + + ONLY_ACTIVE_ARCH + NO + + + Release + + COPY_PHASE_STRIP + YES + + + ONLY_ACTIVE_ARCH + NO + + + + + + Targets + + + Name + ___PACKAGENAME___ + + SharedSettings + + PRODUCT_NAME + $(TARGET_NAME) + + + Configurations + + Debug + + Release + + + + + + diff --git a/SFML-2.1-osx-clang-universal/templates/SFML/SFML Linker.xctemplate/TemplateInfo.plist b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Linker.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..a636d30 --- /dev/null +++ b/SFML-2.1-osx-clang-universal/templates/SFML/SFML Linker.xctemplate/TemplateInfo.plist @@ -0,0 +1,363 @@ + + + + + + + + + + + Identifier + org.sfml-dev.linker + + Kind + Xcode.Xcode3.ProjectTemplateUnitKind + + + Options + + + + Identifier + binaryType + + Name + [ADVANCED] SFML binaries + + Description + Choose between dylibs and frameworks. If you're not sure, keep the default value. + + Default + Frameworks + + NotPersisted + + + Type + popup + + Units + + + Frameworks + + Project + + SharedSettings + + SFML_BINARY_TYPE + FRAMEWORKS + + SFML_LINK_DYLIBS_SUFFIX + + + + + + + Dylibs + + Project + + SharedSettings + + SFML_BINARY_TYPE + DYLIBS + + SFML_LINK_DYLIBS_SUFFIX + + + + + + + Dylibs (debug) + + Project + + SharedSettings + + SFML_BINARY_TYPE + DYLIBS + + + Configurations + + Debug + + SFML_LINK_DYLIBS_SUFFIX + -d + + + Release + + SFML_LINK_DYLIBS_SUFFIX + + + + + + + + + + + Identifier + windowModule + + Name + Use window module + + Description + Indicates whether window module should be used or not. + + Type + checkbox + + Default + true + + Units + + + true + + Project + + SharedSettings + + SFML_WINDOW + $(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX) + + + + + + false + + Project + + SharedSettings + + SFML_WINDOW + + + + + + + + + + Identifier + graphicsModule + + Name + Use graphics module + + Description + Indicates whether graphics module should be used or not. + + RequiredOptions + + windowModule + true + + + Type + checkbox + + Default + true + + Units + + + true + + Project + + SharedSettings + + SFML_GRAPHICS + $(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX) + + + + + + false + + Project + + SharedSettings + + SFML_GRAPHICS + + + + + + + + + + Identifier + audioModule + + Name + Use audio module + + Description + Indicates whether audio module should be used or not. + + Type + checkbox + + Default + true + + Units + + + true + + Project + + SharedSettings + + SFML_AUDIO + $(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX) + + + + + + false + + Project + + SharedSettings + + SFML_AUDIO + + + + + + + + + + Identifier + networkModule + + Name + Use network module + + Description + Indicates whether network module should be used or not. + + Type + checkbox + + Default + true + + Units + + + true + + Project + + SharedSettings + + SFML_NETWORK + $(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX) + + + + + + false + + Project + + SharedSettings + + SFML_NETWORK + + + + + + + + + + Project + + SharedSettings + + + SFML_LINK_DYLIBS_PREFIX + -l + + SFML_LINK_FRAMEWORKS_PREFIX + -framework + + SFML_LINK_FRAMEWORKS_SUFFIX + + + SFML_LINK_PREFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_PREFIX) + + SFML_LINK_SUFFIX + $(SFML_LINK_$(SFML_BINARY_TYPE)_SUFFIX) + + + SFML_SYSTEM + $(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX) + + + OTHER_LDFLAGS + $(inherited) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK) + + + + + diff --git a/assets/4V_figur2.png b/assets/4V_figur2.png new file mode 100644 index 0000000..0fc5802 Binary files /dev/null and b/assets/4V_figur2.png differ diff --git a/assets/6Ling_figur2.png b/assets/6Ling_figur2.png new file mode 100644 index 0000000..3a9cb15 Binary files /dev/null and b/assets/6Ling_figur2.png differ diff --git a/assets/hel_bakgrund.png b/assets/hel_bakgrund.png new file mode 100644 index 0000000..f59c5b7 Binary files /dev/null and b/assets/hel_bakgrund.png differ diff --git a/assets/kir_flaska2.png b/assets/kir_flaska2.png new file mode 100644 index 0000000..58a70bb Binary files /dev/null and b/assets/kir_flaska2.png differ diff --git "a/assets/s\303\244ck2.png" "b/assets/s\303\244ck2.png" new file mode 100644 index 0000000..1a76a18 Binary files /dev/null and "b/assets/s\303\244ck2.png" differ diff --git a/assets/y6_figur2.png b/assets/y6_figur2.png new file mode 100644 index 0000000..e9c31ab Binary files /dev/null and b/assets/y6_figur2.png differ diff --git "a/assets/\303\266l_burk2.png" "b/assets/\303\266l_burk2.png" new file mode 100644 index 0000000..69d4737 Binary files /dev/null and "b/assets/\303\266l_burk2.png" differ