summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2015-05-08 21:14:39 +0100
committerJames Cowgill <james410@cowgill.org.uk>2015-05-08 21:14:39 +0100
commitebd1b636e5bf0f8fa6d210690582757e8b47f141 (patch)
tree02dc3aacf1c6f351154432247be0b4347fb14330 /include
parentfa21c65d0c764705cfc377bf0d0de08fac26874e (diff)
Imported Upstream version 2.3+dfsg
Diffstat (limited to 'include')
-rw-r--r--include/SFML/Audio.hpp10
-rw-r--r--include/SFML/Audio/AlResource.hpp70
-rw-r--r--include/SFML/Audio/Export.hpp2
-rw-r--r--include/SFML/Audio/InputSoundFile.hpp250
-rw-r--r--include/SFML/Audio/Listener.hpp4
-rw-r--r--include/SFML/Audio/Music.hpp33
-rw-r--r--include/SFML/Audio/OutputSoundFile.hpp133
-rw-r--r--include/SFML/Audio/Sound.hpp2
-rw-r--r--include/SFML/Audio/SoundBuffer.hpp49
-rw-r--r--include/SFML/Audio/SoundBufferRecorder.hpp2
-rw-r--r--include/SFML/Audio/SoundFileFactory.hpp197
-rw-r--r--include/SFML/Audio/SoundFileFactory.inl100
-rw-r--r--include/SFML/Audio/SoundFileReader.hpp161
-rw-r--r--include/SFML/Audio/SoundFileWriter.hpp125
-rw-r--r--include/SFML/Audio/SoundRecorder.hpp5
-rw-r--r--include/SFML/Audio/SoundSource.hpp5
-rw-r--r--include/SFML/Audio/SoundStream.hpp2
-rw-r--r--include/SFML/Config.hpp4
-rw-r--r--include/SFML/Graphics.hpp13
-rw-r--r--include/SFML/Graphics/BlendMode.hpp8
-rw-r--r--include/SFML/Graphics/CircleShape.hpp14
-rw-r--r--include/SFML/Graphics/Color.hpp18
-rw-r--r--include/SFML/Graphics/ConvexShape.hpp12
-rw-r--r--include/SFML/Graphics/Drawable.hpp2
-rw-r--r--include/SFML/Graphics/Export.hpp2
-rw-r--r--include/SFML/Graphics/Font.hpp2
-rw-r--r--include/SFML/Graphics/Glyph.hpp2
-rw-r--r--include/SFML/Graphics/Image.hpp4
-rw-r--r--include/SFML/Graphics/PrimitiveType.hpp2
-rw-r--r--include/SFML/Graphics/Rect.hpp2
-rw-r--r--include/SFML/Graphics/Rect.inl2
-rw-r--r--include/SFML/Graphics/RectangleShape.hpp6
-rw-r--r--include/SFML/Graphics/RenderStates.hpp2
-rw-r--r--include/SFML/Graphics/RenderTarget.hpp4
-rw-r--r--include/SFML/Graphics/RenderTexture.hpp2
-rw-r--r--include/SFML/Graphics/RenderWindow.hpp2
-rw-r--r--include/SFML/Graphics/Shader.hpp14
-rw-r--r--include/SFML/Graphics/Shape.hpp19
-rw-r--r--include/SFML/Graphics/Sprite.hpp6
-rw-r--r--include/SFML/Graphics/Text.hpp10
-rw-r--r--include/SFML/Graphics/Texture.hpp14
-rw-r--r--include/SFML/Graphics/Transform.hpp2
-rw-r--r--include/SFML/Graphics/Transformable.hpp6
-rw-r--r--include/SFML/Graphics/Vertex.hpp2
-rw-r--r--include/SFML/Graphics/VertexArray.hpp16
-rw-r--r--include/SFML/Graphics/View.hpp4
-rw-r--r--include/SFML/Main.hpp2
-rw-r--r--include/SFML/Network.hpp4
-rw-r--r--include/SFML/Network/Export.hpp2
-rw-r--r--include/SFML/Network/Ftp.hpp15
-rw-r--r--include/SFML/Network/Http.hpp2
-rw-r--r--include/SFML/Network/IpAddress.hpp2
-rw-r--r--include/SFML/Network/Packet.hpp3
-rw-r--r--include/SFML/Network/Socket.hpp3
-rw-r--r--include/SFML/Network/SocketHandle.hpp2
-rw-r--r--include/SFML/Network/SocketSelector.hpp2
-rw-r--r--include/SFML/Network/TcpListener.hpp2
-rw-r--r--include/SFML/Network/TcpSocket.hpp25
-rw-r--r--include/SFML/Network/UdpSocket.hpp4
-rw-r--r--include/SFML/OpenGL.hpp7
-rw-r--r--include/SFML/System.hpp8
-rw-r--r--include/SFML/System/Clock.hpp2
-rw-r--r--include/SFML/System/Err.hpp2
-rw-r--r--include/SFML/System/Export.hpp2
-rw-r--r--include/SFML/System/FileInputStream.hpp169
-rw-r--r--include/SFML/System/InputStream.hpp15
-rw-r--r--include/SFML/System/Lock.hpp16
-rw-r--r--include/SFML/System/MemoryInputStream.hpp148
-rw-r--r--include/SFML/System/Mutex.hpp4
-rw-r--r--include/SFML/System/NonCopyable.hpp2
-rw-r--r--include/SFML/System/Sleep.hpp2
-rw-r--r--include/SFML/System/String.hpp2
-rw-r--r--include/SFML/System/String.inl2
-rw-r--r--include/SFML/System/Thread.hpp2
-rw-r--r--include/SFML/System/Thread.inl2
-rw-r--r--include/SFML/System/ThreadLocal.hpp2
-rw-r--r--include/SFML/System/ThreadLocalPtr.hpp2
-rw-r--r--include/SFML/System/ThreadLocalPtr.inl2
-rw-r--r--include/SFML/System/Time.hpp2
-rw-r--r--include/SFML/System/Utf.hpp2
-rw-r--r--include/SFML/System/Utf.inl2
-rw-r--r--include/SFML/System/Vector2.hpp2
-rw-r--r--include/SFML/System/Vector2.inl2
-rw-r--r--include/SFML/System/Vector3.hpp2
-rw-r--r--include/SFML/System/Vector3.inl2
-rw-r--r--include/SFML/Window.hpp5
-rw-r--r--include/SFML/Window/Context.hpp13
-rw-r--r--include/SFML/Window/ContextSettings.hpp55
-rw-r--r--include/SFML/Window/Event.hpp53
-rw-r--r--include/SFML/Window/Export.hpp2
-rw-r--r--include/SFML/Window/GlResource.hpp2
-rw-r--r--include/SFML/Window/Joystick.hpp4
-rw-r--r--include/SFML/Window/Keyboard.hpp2
-rw-r--r--include/SFML/Window/Mouse.hpp12
-rw-r--r--include/SFML/Window/Sensor.hpp12
-rw-r--r--include/SFML/Window/Touch.hpp2
-rw-r--r--include/SFML/Window/VideoMode.hpp2
-rw-r--r--include/SFML/Window/Window.hpp2
-rw-r--r--include/SFML/Window/WindowHandle.hpp2
-rw-r--r--include/SFML/Window/WindowStyle.hpp2
100 files changed, 1750 insertions, 239 deletions
diff --git a/include/SFML/Audio.hpp b/include/SFML/Audio.hpp
index 15a079f..41737cf 100644
--- a/include/SFML/Audio.hpp
+++ b/include/SFML/Audio.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -30,12 +30,18 @@
////////////////////////////////////////////////////////////
#include <SFML/System.hpp>
+#include <SFML/Audio/InputSoundFile.hpp>
#include <SFML/Audio/Listener.hpp>
#include <SFML/Audio/Music.hpp>
+#include <SFML/Audio/OutputSoundFile.hpp>
#include <SFML/Audio/Sound.hpp>
#include <SFML/Audio/SoundBuffer.hpp>
#include <SFML/Audio/SoundBufferRecorder.hpp>
+#include <SFML/Audio/SoundFileFactory.hpp>
+#include <SFML/Audio/SoundFileReader.hpp>
+#include <SFML/Audio/SoundFileWriter.hpp>
#include <SFML/Audio/SoundRecorder.hpp>
+#include <SFML/Audio/SoundSource.hpp>
#include <SFML/Audio/SoundStream.hpp>
@@ -46,5 +52,5 @@
///
/// Sounds, streaming (musics or custom sources), recording,
/// spatialization.
-///
+///
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/AlResource.hpp b/include/SFML/Audio/AlResource.hpp
new file mode 100644
index 0000000..ca5d2c0
--- /dev/null
+++ b/include/SFML/Audio/AlResource.hpp
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_ALRESOURCE_HPP
+#define SFML_ALRESOURCE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// \brief Base class for classes that require an OpenAL context
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API AlResource
+{
+protected:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ AlResource();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ ~AlResource();
+};
+
+} // namespace sf
+
+
+#endif // SFML_ALRESOURCE_HPP
+
+////////////////////////////////////////////////////////////
+/// \class sf::AlResource
+/// \ingroup audio
+///
+/// This class is for internal use only, it must be the base
+/// of every class that requires a valid OpenAL context in
+/// order to work.
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/Export.hpp b/include/SFML/Audio/Export.hpp
index 0cd99ac..1ea6f42 100644
--- a/include/SFML/Audio/Export.hpp
+++ b/include/SFML/Audio/Export.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp
new file mode 100644
index 0000000..5e306ae
--- /dev/null
+++ b/include/SFML/Audio/InputSoundFile.hpp
@@ -0,0 +1,250 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_INPUTSOUNDFILE_HPP
+#define SFML_INPUTSOUNDFILE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+#include <SFML/System/NonCopyable.hpp>
+#include <SFML/System/Time.hpp>
+#include <string>
+
+
+namespace sf
+{
+class InputStream;
+class SoundFileReader;
+
+////////////////////////////////////////////////////////////
+/// \brief Provide read access to sound files
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API InputSoundFile : NonCopyable
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ InputSoundFile();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ ~InputSoundFile();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open a sound file from the disk for reading
+ ///
+ /// The supported audio formats are: WAV, OGG/Vorbis, FLAC.
+ ///
+ /// \param filename Path of the sound file to load
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ bool openFromFile(const std::string& filename);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open a sound file in memory for reading
+ ///
+ /// The supported audio formats are: WAV, OGG/Vorbis, FLAC.
+ ///
+ /// \param data Pointer to the file data in memory
+ /// \param sizeInBytes Size of the data to load, in bytes
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ bool openFromMemory(const void* data, std::size_t sizeInBytes);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open a sound file from a custom stream for reading
+ ///
+ /// The supported audio formats are: WAV, OGG/Vorbis, FLAC.
+ ///
+ /// \param stream Source stream to read from
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ bool openFromStream(InputStream& stream);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open the sound file from the disk for writing
+ ///
+ /// \param filename Path of the sound file to write
+ /// \param channelCount Number of channels in the sound
+ /// \param sampleRate Sample rate of the sound
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ bool openForWriting(const std::string& filename, unsigned int channelCount, unsigned int sampleRate);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the total number of audio samples in the file
+ ///
+ /// \return Number of samples
+ ///
+ ////////////////////////////////////////////////////////////
+ Uint64 getSampleCount() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the number of channels used by the sound
+ ///
+ /// \return Number of channels (1 = mono, 2 = stereo)
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int getChannelCount() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the sample rate of the sound
+ ///
+ /// \return Sample rate, in samples per second
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int getSampleRate() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the total duration of the sound file
+ ///
+ /// This function is provided for convenience, the duration is
+ /// deduced from the other sound file attributes.
+ ///
+ /// \return Duration of the sound file
+ ///
+ ////////////////////////////////////////////////////////////
+ Time getDuration() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Change the current read position to the given sample offset
+ ///
+ /// This function takes a sample offset to provide maximum
+ /// precision. If you need to jump to a given time, use the
+ /// other overload.
+ ///
+ /// If the given offset exceeds to total number of samples,
+ /// this function jumps to the end of the sound file.
+ ///
+ /// \param sampleOffset Index of the sample to jump to, relative to the beginning
+ ///
+ ////////////////////////////////////////////////////////////
+ void seek(Uint64 sampleOffset);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Change the current read position to the given time offset
+ ///
+ /// Using a time offset is handy but imprecise. If you need an accurate
+ /// result, consider using the overload which takes a sample offset.
+ ///
+ /// If the given time exceeds to total duration, this function jumps
+ /// to the end of the sound file.
+ ///
+ /// \param timeOffset Time to jump to, relative to the beginning
+ ///
+ ////////////////////////////////////////////////////////////
+ void seek(Time timeOffset);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Read audio samples from the open file
+ ///
+ /// \param samples Pointer to the sample array to fill
+ /// \param maxCount Maximum number of samples to read
+ ///
+ /// \return Number of samples actually read (may be less than \a maxCount)
+ ///
+ ////////////////////////////////////////////////////////////
+ Uint64 read(Int16* samples, Uint64 maxCount);
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Close the current file
+ ///
+ ////////////////////////////////////////////////////////////
+ void close();
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ SoundFileReader* m_reader; ///< Reader that handles I/O on the file's format
+ InputStream* m_stream; ///< Input stream used to access the file's data
+ bool m_streamOwned; ///< Is the stream internal or external?
+ Uint64 m_sampleCount; ///< Total number of samples in the file
+ unsigned int m_channelCount; ///< Number of channels of the sound
+ unsigned int m_sampleRate; ///< Number of samples per second
+};
+
+} // namespace sf
+
+
+#endif // SFML_INPUTSOUNDFILE_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::InputSoundFile
+/// \ingroup audio
+///
+/// This class decodes audio samples from a sound file. It is
+/// used internally by higher-level classes such as sf::SoundBuffer
+/// and sf::Music, but can also be useful if you want to process
+/// or analyze audio files without playing them, or if you want to
+/// implement your own version of sf::Music with more specific
+/// features.
+///
+/// Usage example:
+/// \code
+/// // Open a sound file
+/// sf::InputSoundFile file;
+/// if (!file.openFromFile("music.ogg"))
+/// /* error */;
+///
+/// // Print the sound attributes
+/// std::cout << "duration: " << file.getDuration().asSeconds() << std::endl;
+/// std::cout << "channels: " << file.getChannelCount() << std::endl;
+/// std::cout << "sample rate: " << file.getSampleRate() << std::endl;
+/// std::cout << "sample count: " << file.getSampleCount() << std::endl;
+///
+/// // Read and process batches of samples until the end of file is reached
+/// sf::Int16 samples[1024];
+/// sf::Uint64 count;
+/// do
+/// {
+/// count = file.read(samples, 1024);
+///
+/// // process, analyze, play, convert, or whatever
+/// // you want to do with the samples...
+/// }
+/// while (count > 0);
+/// \endcode
+///
+/// \see sf::SoundFileReader, sf::OutputSoundFile
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp
index 2ab203e..04e4af3 100644
--- a/include/SFML/Audio/Listener.hpp
+++ b/include/SFML/Audio/Listener.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -210,7 +210,7 @@ public:
/// 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.).
+/// same position, orientation, etc.).
///
/// sf::Listener is a simple interface, which allows to setup the
/// listener in the 3D audio environment (position, direction and
diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp
index 99b7dac..a502724 100644
--- a/include/SFML/Audio/Music.hpp
+++ b/include/SFML/Audio/Music.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>
#include <SFML/Audio/SoundStream.hpp>
+#include <SFML/Audio/InputSoundFile.hpp>
#include <SFML/System/Mutex.hpp>
#include <SFML/System/Time.hpp>
#include <string>
@@ -38,11 +39,6 @@
namespace sf
{
-namespace priv
-{
- class SoundFile;
-}
-
class InputStream;
////////////////////////////////////////////////////////////
@@ -70,9 +66,8 @@ public:
///
/// 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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
///
/// \param filename Path of the music file to open
///
@@ -88,9 +83,8 @@ public:
///
/// 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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
/// Since the music is not loaded completely but rather streamed
/// continuously, the \a data must remain available as long as the
/// music is playing (i.e. you can't deallocate it right after calling
@@ -111,9 +105,8 @@ public:
///
/// 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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
/// Since the music is not loaded completely but rather streamed
/// continuously, the \a stream must remain alive as long as the
/// music is playing (i.e. you can't destroy it right after calling
@@ -170,7 +163,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- priv::SoundFile* m_file; ///< Sound file
+ InputSoundFile m_file; ///< The streamed music file
Time m_duration; ///< Music duration
std::vector<Int16> m_samples; ///< Temporary buffer of samples
Mutex m_mutex; ///< Mutex protecting the data
@@ -186,13 +179,13 @@ private:
/// \class sf::Music
/// \ingroup audio
///
-/// Music objects are sounds that are streamed rather than
-/// completely loaded in memory. This is especially useful for
-/// compressed music that usually takes hundreds of MB when it is
+/// 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, sf::Music has almost the same features as
+/// 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.
diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp
new file mode 100644
index 0000000..8f60498
--- /dev/null
+++ b/include/SFML/Audio/OutputSoundFile.hpp
@@ -0,0 +1,133 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_OUTPUTSOUNDFILE_HPP
+#define SFML_OUTPUTSOUNDFILE_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+#include <SFML/System/NonCopyable.hpp>
+#include <string>
+
+
+namespace sf
+{
+class SoundFileWriter;
+
+////////////////////////////////////////////////////////////
+/// \brief Provide write access to sound files
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API OutputSoundFile : NonCopyable
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ OutputSoundFile();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Destructor
+ ///
+ /// Closes the file if it was still open.
+ ///
+ ////////////////////////////////////////////////////////////
+ ~OutputSoundFile();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open the sound file from the disk for writing
+ ///
+ /// The supported audio formats are: WAV, OGG/Vorbis, FLAC.
+ ///
+ /// \param filename Path of the sound file to write
+ /// \param sampleRate Sample rate of the sound
+ /// \param channelCount Number of channels in the sound
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ bool openFromFile(const std::string& filename, unsigned int sampleRate, unsigned int channelCount);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Write audio samples to the file
+ ///
+ /// \param samples Pointer to the sample array to write
+ /// \param count Number of samples to write
+ ///
+ ////////////////////////////////////////////////////////////
+ void write(const Int16* samples, Uint64 count);
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Close the current file
+ ///
+ ////////////////////////////////////////////////////////////
+ void close();
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ SoundFileWriter* m_writer; ///< Writer that handles I/O on the file's format
+};
+
+} // namespace sf
+
+
+#endif // SFML_OUTPUTSOUNDFILE_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::OutputSoundFile
+/// \ingroup audio
+///
+/// This class encodes audio samples to a sound file. It is
+/// used internally by higher-level classes such as sf::SoundBuffer,
+/// but can also be useful if you want to create audio files from
+/// custom data sources, like generated audio samples.
+///
+/// Usage example:
+/// \code
+/// // Create a sound file, ogg/vorbis format, 44100 Hz, stereo
+/// sf::OutputSoundFile file;
+/// if (!file.openFromFile("music.ogg", 44100, 2))
+/// /* error */;
+///
+/// while (...)
+/// {
+/// // Read or generate audio samples from your custom source
+/// std::vector<sf::Int16> samples = ...;
+///
+/// // Write them to the file
+/// file.write(samples.data(), samples.size());
+/// }
+/// \endcode
+///
+/// \see sf::SoundFileWriter, sf::InputSoundFile
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp
index dbd5869..8b0771d 100644
--- a/include/SFML/Audio/Sound.hpp
+++ b/include/SFML/Audio/Sound.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp
index 392b461..42eda6f 100644
--- a/include/SFML/Audio/SoundBuffer.hpp
+++ b/include/SFML/Audio/SoundBuffer.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>
+#include <SFML/Audio/AlResource.hpp>
#include <SFML/System/Time.hpp>
#include <string>
#include <vector>
@@ -37,19 +38,15 @@
namespace sf
{
-namespace priv
-{
- class SoundFile;
-}
-
class Sound;
+class InputSoundFile;
class InputStream;
////////////////////////////////////////////////////////////
/// \brief Storage for audio samples defining a sound
///
////////////////////////////////////////////////////////////
-class SFML_AUDIO_API SoundBuffer
+class SFML_AUDIO_API SoundBuffer : AlResource
{
public:
@@ -76,9 +73,8 @@ public:
////////////////////////////////////////////////////////////
/// \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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
///
/// \param filename Path of the sound file to load
///
@@ -92,9 +88,8 @@ public:
////////////////////////////////////////////////////////////
/// \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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
///
/// \param data Pointer to the file data in memory
/// \param sizeInBytes Size of the data to load, in bytes
@@ -109,9 +104,8 @@ public:
////////////////////////////////////////////////////////////
/// \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.
+ /// See the documentation of sf::InputSoundFile for the list
+ /// of supported formats.
///
/// \param stream Source stream to read from
///
@@ -138,14 +132,13 @@ public:
/// \see loadFromFile, loadFromMemory, saveToFile
///
////////////////////////////////////////////////////////////
- bool loadFromSamples(const Int16* samples, std::size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
+ bool loadFromSamples(const Int16* samples, Uint64 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.
+ /// See the documentation of sf::OutputSoundFile for the list
+ /// of supported formats.
///
/// \param filename Path of the sound file to write
///
@@ -181,7 +174,7 @@ public:
/// \see getSamples
///
////////////////////////////////////////////////////////////
- std::size_t getSampleCount() const;
+ Uint64 getSampleCount() const;
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of the sound
@@ -239,10 +232,10 @@ private:
///
/// \param file Sound file providing access to the new loaded sound
///
- /// \return True on succesful initialization, false on failure
+ /// \return True on successful initialization, false on failure
///
////////////////////////////////////////////////////////////
- bool initialize(priv::SoundFile& file);
+ bool initialize(InputSoundFile& file);
////////////////////////////////////////////////////////////
/// \brief Update the internal buffer with the cached audio samples
@@ -298,7 +291,7 @@ private:
/// 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
+/// The sound is then reconstituted 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
@@ -331,20 +324,20 @@ private:
/// \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);
diff --git a/include/SFML/Audio/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp
index cb174b0..7715ac5 100644
--- a/include/SFML/Audio/SoundBufferRecorder.hpp
+++ b/include/SFML/Audio/SoundBufferRecorder.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Audio/SoundFileFactory.hpp b/include/SFML/Audio/SoundFileFactory.hpp
new file mode 100644
index 0000000..bd346cc
--- /dev/null
+++ b/include/SFML/Audio/SoundFileFactory.hpp
@@ -0,0 +1,197 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_SOUNDFILEFACTORY_HPP
+#define SFML_SOUNDFILEFACTORY_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+#include <string>
+#include <vector>
+
+
+namespace sf
+{
+class InputStream;
+class SoundFileReader;
+class SoundFileWriter;
+
+////////////////////////////////////////////////////////////
+/// \brief Manages and instantiates sound file readers and writers
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API SoundFileFactory
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Register a new reader
+ ///
+ /// \see unregisterReader
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename T>
+ static void registerReader();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Unregister a reader
+ ///
+ /// \see registerReader
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename T>
+ static void unregisterReader();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Register a new writer
+ ///
+ /// \see unregisterWriter
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename T>
+ static void registerWriter();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Unregister a writer
+ ///
+ /// \see registerWriter
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename T>
+ static void unregisterWriter();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Instantiate the right reader for the given file on disk
+ ///
+ /// It's up to the caller to release the returned reader
+ ///
+ /// \param filename Path of the sound file
+ ///
+ /// \return A new sound file reader that can read the given file, or null if no reader can handle it
+ ///
+ /// \see createReaderFromMemory, createReaderFromStream
+ ///
+ ////////////////////////////////////////////////////////////
+ static SoundFileReader* createReaderFromFilename(const std::string& filename);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Instantiate the right codec for the given file in memory
+ ///
+ /// It's up to the caller to release the returned reader
+ ///
+ /// \param data Pointer to the file data in memory
+ /// \param sizeInBytes Total size of the file data, in bytes
+ ///
+ /// \return A new sound file codec that can read the given file, or null if no codec can handle it
+ ///
+ /// \see createReaderFromFilename, createReaderFromStream
+ ///
+ ////////////////////////////////////////////////////////////
+ static SoundFileReader* createReaderFromMemory(const void* data, std::size_t sizeInBytes);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Instantiate the right codec for the given file in stream
+ ///
+ /// It's up to the caller to release the returned reader
+ ///
+ /// \param stream Source stream to read from
+ ///
+ /// \return A new sound file codec that can read the given file, or null if no codec can handle it
+ ///
+ /// \see createReaderFromFilename, createReaderFromMemory
+ ///
+ ////////////////////////////////////////////////////////////
+ static SoundFileReader* createReaderFromStream(InputStream& stream);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Instantiate the right writer for the given file on disk
+ ///
+ /// It's up to the caller to release the returned writer
+ ///
+ /// \param filename Path of the sound file
+ ///
+ /// \return A new sound file writer that can write given file, or null if no writer can handle it
+ ///
+ ////////////////////////////////////////////////////////////
+ static SoundFileWriter* createWriterFromFilename(const std::string& filename);
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ // Types
+ ////////////////////////////////////////////////////////////
+ struct ReaderFactory
+ {
+ bool (*check)(InputStream&);
+ SoundFileReader* (*create)();
+ };
+ typedef std::vector<ReaderFactory> ReaderFactoryArray;
+
+ struct WriterFactory
+ {
+ bool (*check)(const std::string&);
+ SoundFileWriter* (*create)();
+ };
+ typedef std::vector<WriterFactory> WriterFactoryArray;
+
+ ////////////////////////////////////////////////////////////
+ // Static member data
+ ////////////////////////////////////////////////////////////
+ static ReaderFactoryArray s_readers; ///< List of all registered readers
+ static WriterFactoryArray s_writers; ///< List of all registered writers
+};
+
+} // namespace sf
+
+#include <SFML/Audio/SoundFileFactory.inl>
+
+#endif // SFML_SOUNDFILEFACTORY_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::SoundFileFactory
+/// \ingroup audio
+///
+/// This class is where all the sound file readers and writers are
+/// registered. You should normally only need to use its registration
+/// and unregistration functions; readers/writers creation and manipulation
+/// are wrapped into the higher-level classes sf::InputSoundFile and
+/// sf::OutputSoundFile.
+///
+/// To register a new reader (writer) use the sf::SoundFileFactory::registerReader
+/// (registerWriter) static function. You don't have to call the unregisterReader
+/// (unregisterWriter) function, unless you want to unregister a format before your
+/// application ends (typically, when a plugin is unloaded).
+///
+/// Usage example:
+/// \code
+/// sf::SoundFileFactory::registerReader<MySoundFileReader>();
+/// sf::SoundFileFactory::registerWriter<MySoundFileWriter>();
+/// \endcode
+///
+/// \see sf::InputSoundFile, sf::OutputSoundFile, sf::SoundFileReader, sf::SoundFileWriter
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/SoundFileFactory.inl b/include/SFML/Audio/SoundFileFactory.inl
new file mode 100644
index 0000000..19d334b
--- /dev/null
+++ b/include/SFML/Audio/SoundFileFactory.inl
@@ -0,0 +1,100 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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
+////////////////////////////////////////////////////////////
+
+
+namespace sf
+{
+namespace priv
+{
+ template <typename T> SoundFileReader* createReader() {return new T;}
+ template <typename T> SoundFileWriter* createWriter() {return new T;}
+}
+
+////////////////////////////////////////////////////////////
+template <typename T>
+void SoundFileFactory::registerReader()
+{
+ // Make sure the same class won't be registered twice
+ unregisterReader<T>();
+
+ // Create a new factory with the functions provided by the class
+ ReaderFactory factory;
+ factory.check = &T::check;
+ factory.create = &priv::createReader<T>;
+
+ // Add it
+ s_readers.push_back(factory);
+}
+
+
+////////////////////////////////////////////////////////////
+template <typename T>
+void SoundFileFactory::unregisterReader()
+{
+ // Remove the instance(s) of the reader from the array of factories
+ for (ReaderFactoryArray::iterator it = s_readers.begin(); it != s_readers.end(); )
+ {
+ if (it->create == &priv::createReader<T>)
+ it = s_readers.erase(it);
+ else
+ ++it;
+ }
+}
+
+////////////////////////////////////////////////////////////
+template <typename T>
+void SoundFileFactory::registerWriter()
+{
+ // Make sure the same class won't be registered twice
+ unregisterWriter<T>();
+
+ // Create a new factory with the functions provided by the class
+ WriterFactory factory;
+ factory.check = &T::check;
+ factory.create = &priv::createWriter<T>;
+
+ // Add it
+ s_writers.push_back(factory);
+}
+
+
+////////////////////////////////////////////////////////////
+template <typename T>
+void SoundFileFactory::unregisterWriter()
+{
+ // Remove the instance(s) of the writer from the array of factories
+ for (WriterFactoryArray::iterator it = s_writers.begin(); it != s_writers.end(); )
+ {
+ if (it->create == &priv::createWriter<T>)
+ it = s_writers.erase(it);
+ else
+ ++it;
+ }
+}
+
+} // namespace sf
diff --git a/include/SFML/Audio/SoundFileReader.hpp b/include/SFML/Audio/SoundFileReader.hpp
new file mode 100644
index 0000000..549f50b
--- /dev/null
+++ b/include/SFML/Audio/SoundFileReader.hpp
@@ -0,0 +1,161 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_SOUNDFILEREADER_HPP
+#define SFML_SOUNDFILEREADER_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+#include <string>
+
+
+namespace sf
+{
+class InputStream;
+
+////////////////////////////////////////////////////////////
+/// \brief Abstract base class for sound file decoding
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API SoundFileReader
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Structure holding the audio properties of a sound file
+ ///
+ ////////////////////////////////////////////////////////////
+ struct Info
+ {
+ Uint64 sampleCount; ///< Total number of samples in the file
+ unsigned int channelCount; ///< Number of channels of the sound
+ unsigned int sampleRate; ///< Samples rate of the sound, in samples per second
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Virtual destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~SoundFileReader() {}
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open a sound file for reading
+ ///
+ /// The provided stream reference is valid as long as the
+ /// SoundFileReader is alive, so it is safe to use/store it
+ /// during the whole lifetime of the reader.
+ ///
+ /// \param stream Source stream to read from
+ /// \param info Structure to fill with the properties of the loaded sound
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual bool open(InputStream& stream, Info& info) = 0;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Change the current read position to the given sample offset
+ ///
+ /// If the given offset exceeds to total number of samples,
+ /// this function must jump to the end of the file.
+ ///
+ /// \param sampleOffset Index of the sample to jump to, relative to the beginning
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void seek(Uint64 sampleOffset) = 0;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Read audio samples from the open file
+ ///
+ /// \param samples Pointer to the sample array to fill
+ /// \param maxCount Maximum number of samples to read
+ ///
+ /// \return Number of samples actually read (may be less than \a maxCount)
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Uint64 read(Int16* samples, Uint64 maxCount) = 0;
+};
+
+} // namespace sf
+
+
+#endif // SFML_SOUNDFILEREADER_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::SoundFileReader
+/// \ingroup audio
+///
+/// This class allows users to read audio file formats not natively
+/// supported by SFML, and thus extend the set of supported readable
+/// audio formats.
+///
+/// A valid sound file reader must override the open, seek and write functions,
+/// as well as providing a static check function; the latter is used by
+/// SFML to find a suitable writer for a given input file.
+///
+/// To register a new reader, use the sf::SoundFileFactory::registerReader
+/// template function.
+///
+/// Usage example:
+/// \code
+/// class MySoundFileReader : public sf::SoundFileReader
+/// {
+/// public:
+///
+/// static bool check(sf::InputStream& stream)
+/// {
+/// // typically, read the first few header bytes and check fields that identify the format
+/// // return true if the reader can handle the format
+/// }
+///
+/// virtual bool open(sf::InputStream& stream, Info& info)
+/// {
+/// // read the sound file header and fill the sound attributes
+/// // (channel count, sample count and sample rate)
+/// // return true on success
+/// }
+///
+/// virtual void seek(sf::Uint64 sampleOffset)
+/// {
+/// // advance to the sampleOffset-th sample from the beginning of the sound
+/// }
+///
+/// virtual sf::Uint64 read(sf::Int16* samples, sf::Uint64 maxCount)
+/// {
+/// // read up to 'maxCount' samples into the 'samples' array,
+/// // convert them (for example from normalized float) if they are not stored
+/// // as 16-bits signed integers in the file
+/// // return the actual number of samples read
+/// }
+/// };
+///
+/// sf::SoundFileFactory::registerReader<MySoundFileReader>();
+/// \endcode
+///
+/// \see sf::InputSoundFile, sf::SoundFileFactory, sf::SoundFileWriter
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/SoundFileWriter.hpp b/include/SFML/Audio/SoundFileWriter.hpp
new file mode 100644
index 0000000..36a2678
--- /dev/null
+++ b/include/SFML/Audio/SoundFileWriter.hpp
@@ -0,0 +1,125 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_SOUNDFILEWRITER_HPP
+#define SFML_SOUNDFILEWRITER_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Audio/Export.hpp>
+#include <string>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// \brief Abstract base class for sound file encoding
+///
+////////////////////////////////////////////////////////////
+class SFML_AUDIO_API SoundFileWriter
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Virtual destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~SoundFileWriter() {}
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open a sound file for writing
+ ///
+ /// \param filename Path of the file to open
+ /// \param sampleRate Sample rate of the sound
+ /// \param channelCount Number of channels of the sound
+ ///
+ /// \return True if the file was successfully opened
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual bool open(const std::string& filename, unsigned int sampleRate, unsigned int channelCount) = 0;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Write audio samples to the open file
+ ///
+ /// \param samples Pointer to the sample array to write
+ /// \param count Number of samples to write
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void write(const Int16* samples, Uint64 count) = 0;
+};
+
+} // namespace sf
+
+
+#endif // SFML_SOUNDFILEWRITER_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::SoundFileWriter
+/// \ingroup audio
+///
+/// This class allows users to write audio file formats not natively
+/// supported by SFML, and thus extend the set of supported writable
+/// audio formats.
+///
+/// A valid sound file writer must override the open and write functions,
+/// as well as providing a static check function; the latter is used by
+/// SFML to find a suitable writer for a given filename.
+///
+/// To register a new writer, use the sf::SoundFileFactory::registerWriter
+/// template function.
+///
+/// Usage example:
+/// \code
+/// class MySoundFileWriter : public sf::SoundFileWriter
+/// {
+/// public:
+///
+/// static bool check(const std::string& filename)
+/// {
+/// // typically, check the extension
+/// // return true if the writer can handle the format
+/// }
+///
+/// virtual bool open(const std::string& filename, unsigned int sampleRate, unsigned int channelCount)
+/// {
+/// // open the file 'filename' for writing,
+/// // write the given sample rate and channel count to the file header
+/// // return true on success
+/// }
+///
+/// virtual void write(const sf::Int16* samples, sf::Uint64 count)
+/// {
+/// // write 'count' samples stored at address 'samples',
+/// // convert them (for example to normalized float) if the format requires it
+/// }
+/// };
+///
+/// sf::SoundFileFactory::registerWriter<MySoundFileWriter>();
+/// \endcode
+///
+/// \see sf::OutputSoundFile, sf::SoundFileFactory, sf::SoundFileReader
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp
index 733fd32..ab0eb24 100644
--- a/include/SFML/Audio/SoundRecorder.hpp
+++ b/include/SFML/Audio/SoundRecorder.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>
+#include <SFML/Audio/AlResource.hpp>
#include <SFML/System/Thread.hpp>
#include <SFML/System/Time.hpp>
#include <vector>
@@ -41,7 +42,7 @@ namespace sf
/// \brief Abstract base class for capturing sound data
///
////////////////////////////////////////////////////////////
-class SFML_AUDIO_API SoundRecorder
+class SFML_AUDIO_API SoundRecorder : AlResource
{
public:
diff --git a/include/SFML/Audio/SoundSource.hpp b/include/SFML/Audio/SoundSource.hpp
index f8ba48a..cde0a3b 100644
--- a/include/SFML/Audio/SoundSource.hpp
+++ b/include/SFML/Audio/SoundSource.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>
+#include <SFML/Audio/AlResource.hpp>
#include <SFML/System/Vector3.hpp>
@@ -38,7 +39,7 @@ namespace sf
/// \brief Base class defining a sound's properties
///
////////////////////////////////////////////////////////////
-class SFML_AUDIO_API SoundSource
+class SFML_AUDIO_API SoundSource : AlResource
{
public:
diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp
index e79d879..22ae8cd 100644
--- a/include/SFML/Audio/SoundStream.hpp
+++ b/include/SFML/Audio/SoundStream.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp
index a5ad154..58e9797 100644
--- a/include/SFML/Config.hpp
+++ b/include/SFML/Config.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -30,7 +30,7 @@
// Define the SFML version
////////////////////////////////////////////////////////////
#define SFML_VERSION_MAJOR 2
-#define SFML_VERSION_MINOR 2
+#define SFML_VERSION_MINOR 3
#define SFML_VERSION_PATCH 0
diff --git a/include/SFML/Graphics.hpp b/include/SFML/Graphics.hpp
index ac5231c..7a7f4da 100644
--- a/include/SFML/Graphics.hpp
+++ b/include/SFML/Graphics.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -31,22 +31,27 @@
#include <SFML/Window.hpp>
#include <SFML/Graphics/BlendMode.hpp>
+#include <SFML/Graphics/CircleShape.hpp>
#include <SFML/Graphics/Color.hpp>
+#include <SFML/Graphics/ConvexShape.hpp>
+#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Glyph.hpp>
#include <SFML/Graphics/Image.hpp>
+#include <SFML/Graphics/PrimitiveType.hpp>
+#include <SFML/Graphics/Rect.hpp>
+#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/RenderStates.hpp>
+#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/RenderTexture.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Shader.hpp>
#include <SFML/Graphics/Shape.hpp>
-#include <SFML/Graphics/CircleShape.hpp>
-#include <SFML/Graphics/RectangleShape.hpp>
-#include <SFML/Graphics/ConvexShape.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Transform.hpp>
+#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/View.hpp>
diff --git a/include/SFML/Graphics/BlendMode.hpp b/include/SFML/Graphics/BlendMode.hpp
index 412286d..7f5803b 100644
--- a/include/SFML/Graphics/BlendMode.hpp
+++ b/include/SFML/Graphics/BlendMode.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -146,7 +146,7 @@ SFML_GRAPHICS_API bool operator !=(const BlendMode& left, const BlendMode& right
////////////////////////////////////////////////////////////
// Commonly used blending modes
////////////////////////////////////////////////////////////
-SFML_GRAPHICS_API extern const BlendMode BlendAlpha; ///< Blend source and dest according to dest alpha
+SFML_GRAPHICS_API extern const BlendMode BlendAlpha; ///< Blend source and dest according to dest alpha
SFML_GRAPHICS_API extern const BlendMode BlendAdd; ///< Add source to dest
SFML_GRAPHICS_API extern const BlendMode BlendMultiply; ///< Multiply source and dest
SFML_GRAPHICS_API extern const BlendMode BlendNone; ///< Overwrite dest with source
@@ -164,7 +164,7 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone; ///< Overwrite dest with
/// sf::BlendMode is a class that represents a blend mode. A blend
/// mode determines how the colors of an object you draw are
/// mixed with the colors that are already in the buffer.
-///
+///
/// The class is composed of 6 components, each of which has its
/// own public member variable:
/// \li %Color Source Factor (@ref colorSrcFactor)
@@ -173,7 +173,7 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone; ///< Overwrite dest with
/// \li Alpha Source Factor (@ref alphaSrcFactor)
/// \li Alpha Destination Factor (@ref alphaDstFactor)
/// \li Alpha Blend Equation (@ref alphaEquation)
-///
+///
/// The source factor specifies how the pixel you are drawing contributes
/// to the final color. The destination factor specifies how the pixel
/// already drawn in the buffer contributes to the final color.
diff --git a/include/SFML/Graphics/CircleShape.hpp b/include/SFML/Graphics/CircleShape.hpp
index 07e35ca..2d5ac00 100644
--- a/include/SFML/Graphics/CircleShape.hpp
+++ b/include/SFML/Graphics/CircleShape.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -49,7 +49,7 @@ public:
/// \param pointCount Number of points composing the circle
///
////////////////////////////////////////////////////////////
- explicit CircleShape(float radius = 0, unsigned int pointCount = 30);
+ explicit CircleShape(float radius = 0, std::size_t pointCount = 30);
////////////////////////////////////////////////////////////
/// \brief Set the radius of the circle
@@ -79,7 +79,7 @@ public:
/// \see getPointCount
///
////////////////////////////////////////////////////////////
- void setPointCount(unsigned int count);
+ void setPointCount(std::size_t count);
////////////////////////////////////////////////////////////
/// \brief Get the number of points of the circle
@@ -89,7 +89,7 @@ public:
/// \see setPointCount
///
////////////////////////////////////////////////////////////
- virtual unsigned int getPointCount() const;
+ virtual std::size_t getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a point of the circle
@@ -104,15 +104,15 @@ public:
/// \return index-th point of the shape
///
////////////////////////////////////////////////////////////
- virtual Vector2f getPoint(unsigned int index) const;
+ virtual Vector2f getPoint(std::size_t index) const;
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- float m_radius; ///< Radius of the circle
- unsigned int m_pointCount; ///< Number of points composing the circle
+ float m_radius; ///< Radius of the circle
+ std::size_t m_pointCount; ///< Number of points composing the circle
};
} // namespace sf
diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp
index 8c81e3c..87a1598 100644
--- a/include/SFML/Graphics/Color.hpp
+++ b/include/SFML/Graphics/Color.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -62,6 +62,22 @@ public:
Color(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 255);
////////////////////////////////////////////////////////////
+ /// \brief Construct the color from 32-bit unsigned integer
+ ///
+ /// \param color Number containing the RGBA components (in that order)
+ ///
+ ////////////////////////////////////////////////////////////
+ explicit Color(Uint32 color);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Retrieve the color as a 32-bit unsigned integer
+ ///
+ /// \return Color represented as a 32-bit unsigned integer
+ ///
+ ////////////////////////////////////////////////////////////
+ Uint32 toInteger() const;
+
+ ////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const Color Black; ///< Black predefined color
diff --git a/include/SFML/Graphics/ConvexShape.hpp b/include/SFML/Graphics/ConvexShape.hpp
index 080ca04..82991a7 100644
--- a/include/SFML/Graphics/ConvexShape.hpp
+++ b/include/SFML/Graphics/ConvexShape.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -49,7 +49,7 @@ public:
/// \param pointCount Number of points of the polygon
///
////////////////////////////////////////////////////////////
- explicit ConvexShape(unsigned int pointCount = 0);
+ explicit ConvexShape(std::size_t pointCount = 0);
////////////////////////////////////////////////////////////
/// \brief Set the number of points of the polygon
@@ -61,7 +61,7 @@ public:
/// \see getPointCount
///
////////////////////////////////////////////////////////////
- void setPointCount(unsigned int count);
+ void setPointCount(std::size_t count);
////////////////////////////////////////////////////////////
/// \brief Get the number of points of the polygon
@@ -71,7 +71,7 @@ public:
/// \see setPointCount
///
////////////////////////////////////////////////////////////
- virtual unsigned int getPointCount() const;
+ virtual std::size_t getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Set the position of a point
@@ -88,7 +88,7 @@ public:
/// \see getPoint
///
////////////////////////////////////////////////////////////
- void setPoint(unsigned int index, const Vector2f& point);
+ void setPoint(std::size_t index, const Vector2f& point);
////////////////////////////////////////////////////////////
/// \brief Get the position of a point
@@ -105,7 +105,7 @@ public:
/// \see setPoint
///
////////////////////////////////////////////////////////////
- virtual Vector2f getPoint(unsigned int index) const;
+ virtual Vector2f getPoint(std::size_t index) const;
private:
diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp
index 8e30a6d..5ddf2da 100644
--- a/include/SFML/Graphics/Drawable.hpp
+++ b/include/SFML/Graphics/Drawable.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Export.hpp b/include/SFML/Graphics/Export.hpp
index 3109fcd..624f1eb 100644
--- a/include/SFML/Graphics/Export.hpp
+++ b/include/SFML/Graphics/Export.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp
index 8b360c9..84eee27 100644
--- a/include/SFML/Graphics/Font.hpp
+++ b/include/SFML/Graphics/Font.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Glyph.hpp b/include/SFML/Graphics/Glyph.hpp
index bdc3357..0068872 100644
--- a/include/SFML/Graphics/Glyph.hpp
+++ b/include/SFML/Graphics/Glyph.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Image.hpp b/include/SFML/Graphics/Image.hpp
index 82f77ef..11dc8f7 100644
--- a/include/SFML/Graphics/Image.hpp
+++ b/include/SFML/Graphics/Image.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -193,7 +193,7 @@ public:
/// \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?
+ /// \param applyAlpha Should the copy take into 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);
diff --git a/include/SFML/Graphics/PrimitiveType.hpp b/include/SFML/Graphics/PrimitiveType.hpp
index 16e7d35..9dae947 100644
--- a/include/SFML/Graphics/PrimitiveType.hpp
+++ b/include/SFML/Graphics/PrimitiveType.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp
index 06abfb8..f11a920 100644
--- a/include/SFML/Graphics/Rect.hpp
+++ b/include/SFML/Graphics/Rect.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl
index 849fc82..9ac4870 100644
--- a/include/SFML/Graphics/Rect.inl
+++ b/include/SFML/Graphics/Rect.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/RectangleShape.hpp b/include/SFML/Graphics/RectangleShape.hpp
index 8677cc6..3195dc3 100644
--- a/include/SFML/Graphics/RectangleShape.hpp
+++ b/include/SFML/Graphics/RectangleShape.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -77,7 +77,7 @@ public:
/// shapes, this number is always 4.
///
////////////////////////////////////////////////////////////
- virtual unsigned int getPointCount() const;
+ virtual std::size_t getPointCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a point of the rectangle
@@ -92,7 +92,7 @@ public:
/// \return index-th point of the shape
///
////////////////////////////////////////////////////////////
- virtual Vector2f getPoint(unsigned int index) const;
+ virtual Vector2f getPoint(std::size_t index) const;
private:
diff --git a/include/SFML/Graphics/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp
index 2a5ac9a..b23a778 100644
--- a/include/SFML/Graphics/RenderStates.hpp
+++ b/include/SFML/Graphics/RenderStates.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp
index 01c11e9..eb02355 100644
--- a/include/SFML/Graphics/RenderTarget.hpp
+++ b/include/SFML/Graphics/RenderTarget.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -244,7 +244,7 @@ public:
/// \param states Render states to use for drawing
///
////////////////////////////////////////////////////////////
- void draw(const Vertex* vertices, unsigned int vertexCount,
+ void draw(const Vertex* vertices, std::size_t vertexCount,
PrimitiveType type, const RenderStates& states = RenderStates::Default);
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Graphics/RenderTexture.hpp b/include/SFML/Graphics/RenderTexture.hpp
index ff7ae1d..5d38562 100644
--- a/include/SFML/Graphics/RenderTexture.hpp
+++ b/include/SFML/Graphics/RenderTexture.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp
index 5ff4a68..98e5b9a 100644
--- a/include/SFML/Graphics/RenderWindow.hpp
+++ b/include/SFML/Graphics/RenderWindow.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp
index c60db27..d3278f9 100644
--- a/include/SFML/Graphics/Shader.hpp
+++ b/include/SFML/Graphics/Shader.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -457,6 +457,18 @@ public:
void setParameter(const std::string& name, CurrentTextureType);
////////////////////////////////////////////////////////////
+ /// \brief Get the underlying OpenGL handle of the shader.
+ ///
+ /// 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 OpenGL handle of the shader or 0 if not yet loaded
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int getNativeHandle() const;
+
+ ////////////////////////////////////////////////////////////
/// \brief Bind a shader for rendering
///
/// This function is not part of the graphics API, it mustn't be
diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp
index fd5491c..5983a9d 100644
--- a/include/SFML/Graphics/Shape.hpp
+++ b/include/SFML/Graphics/Shape.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -193,7 +193,7 @@ public:
/// \see getPoint
///
////////////////////////////////////////////////////////////
- virtual unsigned int getPointCount() const = 0;
+ virtual std::size_t getPointCount() const = 0;
////////////////////////////////////////////////////////////
/// \brief Get a point of the shape
@@ -210,7 +210,7 @@ public:
/// \see getPointCount
///
////////////////////////////////////////////////////////////
- virtual Vector2f getPoint(unsigned int index) const = 0;
+ virtual Vector2f getPoint(std::size_t index) const = 0;
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of the entity
@@ -227,13 +227,20 @@ public:
FloatRect getLocalBounds() const;
////////////////////////////////////////////////////////////
- /// \brief Get the global bounding rectangle of the entity
+ /// \brief Get the global (non-minimal) bounding rectangle of the entity
///
/// The returned rectangle is in global coordinates, which means
- /// that it takes in account the transformations (translation,
+ /// that it takes into 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.
+ /// shape in the global 2D world's coordinate system.
+ ///
+ /// This function does not necessarily return the \a minimal
+ /// bounding rectangle. It merely ensures that the returned
+ /// rectangle covers all the vertices (but possibly more).
+ /// This allows for a fast approximation of the bounds as a
+ /// first check; you may want to use more precise checks
+ /// on top of that.
///
/// \return Global bounding rectangle of the entity
///
diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp
index 2b48384..c7447df 100644
--- a/include/SFML/Graphics/Sprite.hpp
+++ b/include/SFML/Graphics/Sprite.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -179,7 +179,7 @@ public:
/// \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,
+ /// that it takes into 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.
@@ -262,7 +262,7 @@ private:
/// // Declare and load a texture
/// sf::Texture texture;
/// texture.loadFromFile("texture.png");
-///
+///
/// // Create a sprite
/// sf::Sprite sprite;
/// sprite.setTexture(texture);
diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp
index 919a2f7..c31ec61 100644
--- a/include/SFML/Graphics/Text.hpp
+++ b/include/SFML/Graphics/Text.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -268,10 +268,10 @@ public:
/// \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,
+ /// that it takes into 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.
+ /// text in the global 2D world's coordinate system.
///
/// \return Global bounding rectangle of the entity
///
@@ -291,7 +291,7 @@ private:
////////////////////////////////////////////////////////////
/// \brief Make sure the text's geometry is updated
- ///
+ ///
/// All the attributes related to rendering are cached, such
/// that the geometry is only updated when necessary.
///
@@ -356,7 +356,7 @@ private:
/// // Declare and load a font
/// sf::Font font;
/// font.loadFromFile("arial.ttf");
-///
+///
/// // Create a text
/// sf::Text text("hello", font);
/// text.setCharacterSize(30);
diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp
index a68b076..421861e 100644
--- a/include/SFML/Graphics/Texture.hpp
+++ b/include/SFML/Graphics/Texture.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -421,6 +421,18 @@ public:
Texture& operator =(const Texture& right);
////////////////////////////////////////////////////////////
+ /// \brief Get the underlying OpenGL handle of the texture.
+ ///
+ /// 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 OpenGL handle of the texture or 0 if not yet created
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int getNativeHandle() const;
+
+ ////////////////////////////////////////////////////////////
/// \brief Bind a texture for rendering
///
/// This function is not part of the graphics API, it mustn't be
diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp
index 41155fb..a555a33 100644
--- a/include/SFML/Graphics/Transform.hpp
+++ b/include/SFML/Graphics/Transform.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/Transformable.hpp b/include/SFML/Graphics/Transformable.hpp
index d1a92ae..e4b86cf 100644
--- a/include/SFML/Graphics/Transformable.hpp
+++ b/include/SFML/Graphics/Transformable.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -413,7 +413,7 @@ private:
/// \endcode
///
/// A note on coordinates and undistorted rendering: \n
-/// By default, SFML (or more exactly, OpenGL) may interpolate drawable objects
+/// By default, SFML (or more exactly, OpenGL) may interpolate drawable objects
/// such as sprites or texts when rendering. While this allows transitions
/// like slow movements or rotations to appear smoothly, it can lead to
/// unwanted results in some cases, for example blurred or distorted objects.
@@ -423,7 +423,7 @@ private:
/// * The object's position, origin and scale have no fractional part
/// * The object's and the view's rotation are a multiple of 90 degrees
/// * The view's center and size have no fractional part
-///
+///
/// \see sf::Transform
///
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Graphics/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp
index cdd606b..2509976 100644
--- a/include/SFML/Graphics/Vertex.hpp
+++ b/include/SFML/Graphics/Vertex.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp
index 6faca07..f0820a5 100644
--- a/include/SFML/Graphics/VertexArray.hpp
+++ b/include/SFML/Graphics/VertexArray.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -61,7 +61,7 @@ public:
/// \param vertexCount Initial number of vertices in the array
///
////////////////////////////////////////////////////////////
- explicit VertexArray(PrimitiveType type, unsigned int vertexCount = 0);
+ explicit VertexArray(PrimitiveType type, std::size_t vertexCount = 0);
////////////////////////////////////////////////////////////
/// \brief Return the vertex count
@@ -69,7 +69,7 @@ public:
/// \return Number of vertices in the array
///
////////////////////////////////////////////////////////////
- unsigned int getVertexCount() const;
+ std::size_t getVertexCount() const;
////////////////////////////////////////////////////////////
/// \brief Get a read-write access to a vertex by its index
@@ -85,7 +85,7 @@ public:
/// \see getVertexCount
///
////////////////////////////////////////////////////////////
- Vertex& operator [](unsigned int index);
+ Vertex& operator [](std::size_t index);
////////////////////////////////////////////////////////////
/// \brief Get a read-only access to a vertex by its index
@@ -101,7 +101,7 @@ public:
/// \see getVertexCount
///
////////////////////////////////////////////////////////////
- const Vertex& operator [](unsigned int index) const;
+ const Vertex& operator [](std::size_t index) const;
////////////////////////////////////////////////////////////
/// \brief Clear the vertex array
@@ -126,7 +126,7 @@ public:
/// \param vertexCount New size of the array (number of vertices)
///
////////////////////////////////////////////////////////////
- void resize(unsigned int vertexCount);
+ void resize(std::size_t vertexCount);
////////////////////////////////////////////////////////////
/// \brief Add a vertex to the array
@@ -163,8 +163,8 @@ public:
////////////////////////////////////////////////////////////
/// \brief Compute the bounding rectangle of the vertex array
///
- /// This function returns the axis-aligned rectangle that
- /// contains all the vertices of the array.
+ /// This function returns the minimal axis-aligned rectangle
+ /// that contains all the vertices of the array.
///
/// \return Bounding rectangle of the vertex array
///
diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp
index f4ff818..4bd62d8 100644
--- a/include/SFML/Graphics/View.hpp
+++ b/include/SFML/Graphics/View.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -313,7 +313,7 @@ private:
/// \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));
///
diff --git a/include/SFML/Main.hpp b/include/SFML/Main.hpp
index 254ad7d..23973d0 100644
--- a/include/SFML/Main.hpp
+++ b/include/SFML/Main.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network.hpp b/include/SFML/Network.hpp
index e5e5d06..68507af 100644
--- a/include/SFML/Network.hpp
+++ b/include/SFML/Network.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -34,6 +34,8 @@
#include <SFML/Network/Http.hpp>
#include <SFML/Network/IpAddress.hpp>
#include <SFML/Network/Packet.hpp>
+#include <SFML/Network/Socket.hpp>
+#include <SFML/Network/SocketHandle.hpp>
#include <SFML/Network/SocketSelector.hpp>
#include <SFML/Network/TcpListener.hpp>
#include <SFML/Network/TcpSocket.hpp>
diff --git a/include/SFML/Network/Export.hpp b/include/SFML/Network/Export.hpp
index 030b8d5..6c880f6 100644
--- a/include/SFML/Network/Export.hpp
+++ b/include/SFML/Network/Export.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/Ftp.hpp b/include/SFML/Network/Ftp.hpp
index 4dd242b..c62db7b 100644
--- a/include/SFML/Network/Ftp.hpp
+++ b/include/SFML/Network/Ftp.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -127,10 +127,10 @@ public:
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
+ InvalidResponse = 1000, ///< Not part of the FTP standard, generated by SFML when a received response cannot be parsed
+ ConnectionFailed = 1001, ///< Not part of the FTP standard, generated by SFML when the low-level socket connection with the server fails
+ ConnectionClosed = 1002, ///< Not part of the FTP standard, generated by SFML when the low-level socket connection is unexpectedly closed
+ InvalidFile = 1003 ///< Not part of the FTP standard, generated by SFML when a local file cannot be read or written
};
////////////////////////////////////////////////////////////
@@ -559,7 +559,10 @@ private:
/// return additional data, and use a class derived from
/// sf::Ftp::Response to provide this data. The most often used
/// commands are directly provided as member functions, but it is
-/// also possible to use specific commands with the sendCommand() method.
+/// also possible to use specific commands with the sendCommand() function.
+///
+/// Note that response statuses >= 1000 are not part of the FTP standard,
+/// they are generated by SFML when an internal error occurs.
///
/// All commands, especially upload and download, may take some
/// time to complete. This is important to know if you don't want
diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp
index fec109c..057b86b 100644
--- a/include/SFML/Network/Http.hpp
+++ b/include/SFML/Network/Http.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/IpAddress.hpp b/include/SFML/Network/IpAddress.hpp
index 77b0cf5..8205e9f 100644
--- a/include/SFML/Network/IpAddress.hpp
+++ b/include/SFML/Network/IpAddress.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp
index a400aae..0b7da9f 100644
--- a/include/SFML/Network/Packet.hpp
+++ b/include/SFML/Network/Packet.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -282,6 +282,7 @@ private:
////////////////////////////////////////////////////////////
std::vector<char> m_data; ///< Data stored in the packet
std::size_t m_readPos; ///< Current reading position in the packet
+ std::size_t m_sendPos; ///< Current send position in the packet (for handling partial sends)
bool m_isValid; ///< Reading state of the packet
};
diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp
index 8b66453..d63f55e 100644
--- a/include/SFML/Network/Socket.hpp
+++ b/include/SFML/Network/Socket.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -54,6 +54,7 @@ public:
{
Done, ///< The socket has sent / received the data
NotReady, ///< The socket is not ready to send / receive data yet
+ Partial, ///< The socket sent a part of the data
Disconnected, ///< The TCP socket has been disconnected
Error ///< An unexpected error happened
};
diff --git a/include/SFML/Network/SocketHandle.hpp b/include/SFML/Network/SocketHandle.hpp
index 83c2422..7808ab5 100644
--- a/include/SFML/Network/SocketHandle.hpp
+++ b/include/SFML/Network/SocketHandle.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/SocketSelector.hpp b/include/SFML/Network/SocketSelector.hpp
index 336b301..4d334c6 100644
--- a/include/SFML/Network/SocketSelector.hpp
+++ b/include/SFML/Network/SocketSelector.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/TcpListener.hpp b/include/SFML/Network/TcpListener.hpp
index db93a6c..a46ef29 100644
--- a/include/SFML/Network/TcpListener.hpp
+++ b/include/SFML/Network/TcpListener.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Network/TcpSocket.hpp b/include/SFML/Network/TcpSocket.hpp
index 03a69ec..a402506 100644
--- a/include/SFML/Network/TcpSocket.hpp
+++ b/include/SFML/Network/TcpSocket.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -124,6 +124,9 @@ public:
////////////////////////////////////////////////////////////
/// \brief Send raw data to the remote peer
///
+ /// To be able to handle partial sends over non-blocking
+ /// sockets, use the send(const void*, std::size_t, std::size_t&)
+ /// overload instead.
/// This function will fail if the socket is not connected.
///
/// \param data Pointer to the sequence of bytes to send
@@ -137,6 +140,22 @@ public:
Status send(const void* data, std::size_t size);
////////////////////////////////////////////////////////////
+ /// \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
+ /// \param sent The number of bytes sent will be written here
+ ///
+ /// \return Status code
+ ///
+ /// \see receive
+ ///
+ ////////////////////////////////////////////////////////////
+ Status send(const void* data, std::size_t size, std::size_t& sent);
+
+ ////////////////////////////////////////////////////////////
/// \brief Receive raw data from the remote peer
///
/// In blocking mode, this function will wait until some
@@ -157,6 +176,10 @@ public:
////////////////////////////////////////////////////////////
/// \brief Send a formatted packet of data to the remote peer
///
+ /// In non-blocking mode, if this function returns sf::Socket::Partial,
+ /// you \em must retry sending the same unmodified packet before sending
+ /// anything else in order to guarantee the packet arrives at the remote
+ /// peer uncorrupted.
/// This function will fail if the socket is not connected.
///
/// \param packet Packet to send
diff --git a/include/SFML/Network/UdpSocket.hpp b/include/SFML/Network/UdpSocket.hpp
index 268edd0..f00c257 100644
--- a/include/SFML/Network/UdpSocket.hpp
+++ b/include/SFML/Network/UdpSocket.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -207,7 +207,7 @@ private:
/// 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
diff --git a/include/SFML/OpenGL.hpp b/include/SFML/OpenGL.hpp
index 00bdd8e..a5d964f 100644
--- a/include/SFML/OpenGL.hpp
+++ b/include/SFML/OpenGL.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -33,7 +33,7 @@
////////////////////////////////////////////////////////////
-/// This file just includes the OpenGL (GL and GLU) headers,
+/// This file just includes the OpenGL headers,
/// which have actually different paths on each system
////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS)
@@ -44,7 +44,6 @@
#endif
#include <GL/gl.h>
- #include <GL/glu.h>
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
@@ -53,13 +52,11 @@
#include <GLES/glext.h>
#else
#include <GL/gl.h>
- #include <GL/glu.h>
#endif
#elif defined(SFML_SYSTEM_MACOS)
#include <OpenGL/gl.h>
- #include <OpenGL/glu.h>
#elif defined (SFML_SYSTEM_IOS)
diff --git a/include/SFML/System.hpp b/include/SFML/System.hpp
index eca81a3..6af0652 100644
--- a/include/SFML/System.hpp
+++ b/include/SFML/System.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -32,14 +32,18 @@
#include <SFML/Config.hpp>
#include <SFML/System/Clock.hpp>
#include <SFML/System/Err.hpp>
+#include <SFML/System/FileInputStream.hpp>
#include <SFML/System/InputStream.hpp>
#include <SFML/System/Lock.hpp>
+#include <SFML/System/MemoryInputStream.hpp>
#include <SFML/System/Mutex.hpp>
+#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Sleep.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Thread.hpp>
#include <SFML/System/ThreadLocal.hpp>
#include <SFML/System/ThreadLocalPtr.hpp>
+#include <SFML/System/Time.hpp>
#include <SFML/System/Utf.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/Vector3.hpp>
@@ -52,5 +56,5 @@
/// Base module of SFML, defining various utilities. It provides
/// vector classes, Unicode strings and conversion functions,
/// threads and mutexes, timing classes.
-///
+///
////////////////////////////////////////////////////////////
diff --git a/include/SFML/System/Clock.hpp b/include/SFML/System/Clock.hpp
index 1ff63cb..684c616 100644
--- a/include/SFML/System/Clock.hpp
+++ b/include/SFML/System/Clock.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Err.hpp b/include/SFML/System/Err.hpp
index 74d56f2..1c5b468 100644
--- a/include/SFML/System/Err.hpp
+++ b/include/SFML/System/Err.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Export.hpp b/include/SFML/System/Export.hpp
index ba52091..f4adc10 100644
--- a/include/SFML/System/Export.hpp
+++ b/include/SFML/System/Export.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/FileInputStream.hpp b/include/SFML/System/FileInputStream.hpp
new file mode 100644
index 0000000..1afa939
--- /dev/null
+++ b/include/SFML/System/FileInputStream.hpp
@@ -0,0 +1,169 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_FILEINPUTSTREAM_HPP
+#define SFML_FILEINPUTSTREAM_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/Export.hpp>
+#include <SFML/System/InputStream.hpp>
+#include <SFML/System/NonCopyable.hpp>
+#include <cstdio>
+#include <string>
+
+#ifdef ANDROID
+namespace sf
+{
+namespace priv
+{
+class SFML_SYSTEM_API ResourceStream;
+}
+}
+#endif
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// \brief Implementation of input stream based on a file
+///
+////////////////////////////////////////////////////////////
+class SFML_SYSTEM_API FileInputStream : public InputStream, NonCopyable
+{
+public:
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ FileInputStream();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual ~FileInputStream();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open the stream from a file path
+ ///
+ /// \param filename Name of the file to open
+ ///
+ /// \return True on success, false on error
+ ///
+ ////////////////////////////////////////////////////////////
+ bool open(const std::string& filename);
+
+ ////////////////////////////////////////////////////////////
+ /// \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);
+
+ ////////////////////////////////////////////////////////////
+ /// \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);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the current reading position in the stream
+ ///
+ /// \return The current position, or -1 on error.
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 tell();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Return the size of the stream
+ ///
+ /// \return The total number of bytes available in the stream, or -1 on error
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 getSize();
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+#ifdef ANDROID
+ sf::priv::ResourceStream *m_file;
+#else
+ std::FILE* m_file; ///< stdio file stream
+#endif
+};
+
+} // namespace sf
+
+
+#endif // SFML_FILEINPUTSTREAM_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class FileInputStream
+/// \ingroup system
+///
+/// This class is a specialization of InputStream that
+/// reads from a file on disk.
+///
+/// It wraps a file in the common InputStream interface
+/// and therefore allows to use generic classes or functions
+/// that accept such a stream, with a file on disk as the data
+/// source.
+///
+/// In addition to the virtual functions inherited from
+/// InputStream, FileInputStream adds a function to
+/// specify the file to open.
+///
+/// SFML resource classes can usually be loaded directly from
+/// a filename, so this class shouldn't be useful to you unless
+/// you create your own algorithms that operate on a InputStream.
+///
+/// Usage example:
+/// \code
+/// void process(InputStream& stream);
+///
+/// FileStream stream;
+/// if (stream.open("some_file.dat"))
+/// process(stream);
+/// \endcode
+///
+/// InputStream, MemoryStream
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/System/InputStream.hpp b/include/SFML/System/InputStream.hpp
index ccf1d9f..e5694fa 100644
--- a/include/SFML/System/InputStream.hpp
+++ b/include/SFML/System/InputStream.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
+#include <SFML/System/Export.hpp>
namespace sf
@@ -37,7 +38,7 @@ namespace sf
/// \brief Abstract class for custom file input streams
///
////////////////////////////////////////////////////////////
-class InputStream
+class SFML_SYSTEM_API InputStream
{
public:
@@ -70,7 +71,7 @@ public:
///
////////////////////////////////////////////////////////////
virtual Int64 seek(Int64 position) = 0;
-
+
////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the stream
///
@@ -115,17 +116,17 @@ public:
/// 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:
diff --git a/include/SFML/System/Lock.hpp b/include/SFML/System/Lock.hpp
index 1eec342..05dac10 100644
--- a/include/SFML/System/Lock.hpp
+++ b/include/SFML/System/Lock.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -94,16 +94,16 @@ private:
/// 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
///
@@ -116,15 +116,15 @@ private:
///
/// \code
/// sf::Mutex mutex;
-///
+///
/// void function()
/// {
/// {
/// sf::Lock lock(mutex);
/// codeThatRequiresProtection();
-///
+///
/// } // mutex is unlocked here
-///
+///
/// codeThatDoesntCareAboutTheMutex();
/// }
/// \endcode
diff --git a/include/SFML/System/MemoryInputStream.hpp b/include/SFML/System/MemoryInputStream.hpp
new file mode 100644
index 0000000..250466c
--- /dev/null
+++ b/include/SFML/System/MemoryInputStream.hpp
@@ -0,0 +1,148 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
+//
+// 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_MEMORYINPUTSTREAM_HPP
+#define SFML_MEMORYINPUTSTREAM_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+#include <SFML/System/InputStream.hpp>
+#include <SFML/System/Export.hpp>
+#include <cstdlib>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// \brief Implementation of input stream based on a memory chunk
+///
+////////////////////////////////////////////////////////////
+class SFML_SYSTEM_API MemoryInputStream : public InputStream
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ MemoryInputStream();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Open the stream from its data
+ ///
+ /// \param data Pointer to the data in memory
+ /// \param sizeInBytes Size of the data, in bytes
+ ///
+ ////////////////////////////////////////////////////////////
+ void open(const void* data, std::size_t sizeInBytes);
+
+ ////////////////////////////////////////////////////////////
+ /// \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);
+
+ ////////////////////////////////////////////////////////////
+ /// \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);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the current reading position in the stream
+ ///
+ /// \return The current position, or -1 on error.
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 tell();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Return the size of the stream
+ ///
+ /// \return The total number of bytes available in the stream, or -1 on error
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 getSize();
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ const char* m_data; ///< Pointer to the data in memory
+ Int64 m_size; ///< Total size of the data
+ Int64 m_offset; ///< Current reading position
+};
+
+} // namespace sf
+
+
+#endif // SFML_MEMORYINPUTSTREAM_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class MemoryeInputStream
+/// \ingroup system
+///
+/// This class is a specialization of InputStream that
+/// reads from data in memory.
+///
+/// It wraps a memory chunk in the common InputStream interface
+/// and therefore allows to use generic classes or functions
+/// that accept such a stream, with content already loaded in memory.
+///
+/// In addition to the virtual functions inherited from
+/// InputStream, MemoryInputStream adds a function to
+/// specify the pointer and size of the data in memory.
+///
+/// SFML resource classes can usually be loaded directly from
+/// memory, so this class shouldn't be useful to you unless
+/// you create your own algorithms that operate on a InputStream.
+///
+/// Usage example:
+/// \code
+/// void process(InputStream& stream);
+///
+/// MemoryStream stream;
+/// stream.open(thePtr, theSize);
+/// process(stream);
+/// \endcode
+///
+/// InputStream, FileStream
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/System/Mutex.hpp b/include/SFML/System/Mutex.hpp
index 2bee74d..67a8473 100644
--- a/include/SFML/System/Mutex.hpp
+++ b/include/SFML/System/Mutex.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -119,7 +119,7 @@ private:
/// 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
diff --git a/include/SFML/System/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp
index e11b0d5..9eb291c 100644
--- a/include/SFML/System/NonCopyable.hpp
+++ b/include/SFML/System/NonCopyable.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp
index fd7fb5a..3c0d04a 100644
--- a/include/SFML/System/Sleep.hpp
+++ b/include/SFML/System/Sleep.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/String.hpp b/include/SFML/System/String.hpp
index 6ef4822..5a8c576 100644
--- a/include/SFML/System/String.hpp
+++ b/include/SFML/System/String.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/String.inl b/include/SFML/System/String.inl
index 9f8f1b4..2b22efa 100644
--- a/include/SFML/System/String.inl
+++ b/include/SFML/System/String.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Thread.hpp b/include/SFML/System/Thread.hpp
index 63bb1a4..3321615 100644
--- a/include/SFML/System/Thread.hpp
+++ b/include/SFML/System/Thread.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Thread.inl b/include/SFML/System/Thread.inl
index 9df4d2c..8e0236f 100644
--- a/include/SFML/System/Thread.inl
+++ b/include/SFML/System/Thread.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/ThreadLocal.hpp b/include/SFML/System/ThreadLocal.hpp
index 00703a7..d1f9e4f 100644
--- a/include/SFML/System/ThreadLocal.hpp
+++ b/include/SFML/System/ThreadLocal.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/ThreadLocalPtr.hpp b/include/SFML/System/ThreadLocalPtr.hpp
index e703dac..3ee7abf 100644
--- a/include/SFML/System/ThreadLocalPtr.hpp
+++ b/include/SFML/System/ThreadLocalPtr.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/ThreadLocalPtr.inl b/include/SFML/System/ThreadLocalPtr.inl
index e378c62..1d735bf 100644
--- a/include/SFML/System/ThreadLocalPtr.inl
+++ b/include/SFML/System/ThreadLocalPtr.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Time.hpp b/include/SFML/System/Time.hpp
index 1268afc..95a0a35 100644
--- a/include/SFML/System/Time.hpp
+++ b/include/SFML/System/Time.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Utf.hpp b/include/SFML/System/Utf.hpp
index 8ffae99..9e9d153 100644
--- a/include/SFML/System/Utf.hpp
+++ b/include/SFML/System/Utf.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Utf.inl b/include/SFML/System/Utf.inl
index 8711ca0..a69ca07 100644
--- a/include/SFML/System/Utf.inl
+++ b/include/SFML/System/Utf.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp
index 07b3e96..6284026 100644
--- a/include/SFML/System/Vector2.hpp
+++ b/include/SFML/System/Vector2.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Vector2.inl b/include/SFML/System/Vector2.inl
index 07b96f5..5cc67ca 100644
--- a/include/SFML/System/Vector2.inl
+++ b/include/SFML/System/Vector2.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Vector3.hpp b/include/SFML/System/Vector3.hpp
index 28d0c07..51704b8 100644
--- a/include/SFML/System/Vector3.hpp
+++ b/include/SFML/System/Vector3.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/System/Vector3.inl b/include/SFML/System/Vector3.inl
index af8dae3..3c69f2c 100644
--- a/include/SFML/System/Vector3.inl
+++ b/include/SFML/System/Vector3.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window.hpp b/include/SFML/Window.hpp
index 30b317b..103f888 100644
--- a/include/SFML/Window.hpp
+++ b/include/SFML/Window.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -36,10 +36,11 @@
#include <SFML/Window/Joystick.hpp>
#include <SFML/Window/Keyboard.hpp>
#include <SFML/Window/Mouse.hpp>
-#include <SFML/Window/Touch.hpp>
#include <SFML/Window/Sensor.hpp>
+#include <SFML/Window/Touch.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Window.hpp>
+#include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowStyle.hpp>
diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp
index 595d4d6..29df67c 100644
--- a/include/SFML/Window/Context.hpp
+++ b/include/SFML/Window/Context.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -41,6 +41,8 @@ namespace priv
class GlContext;
}
+typedef void (*GlFunctionPointer)();
+
////////////////////////////////////////////////////////////
/// \brief Class holding a valid drawing context
///
@@ -76,6 +78,15 @@ public:
bool setActive(bool active);
public:
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the address of an OpenGL function
+ ///
+ /// \param name Name of the function to get the address of
+ ///
+ /// \return Address of the OpenGL function, 0 on failure
+ ///
+ ////////////////////////////////////////////////////////////
+ static GlFunctionPointer getFunction(const char* name);
////////////////////////////////////////////////////////////
/// \brief Construct a in-memory context
diff --git a/include/SFML/Window/ContextSettings.hpp b/include/SFML/Window/ContextSettings.hpp
index da89b2f..26ea910 100644
--- a/include/SFML/Window/ContextSettings.hpp
+++ b/include/SFML/Window/ContextSettings.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -36,6 +36,17 @@ namespace sf
struct ContextSettings
{
////////////////////////////////////////////////////////////
+ /// \brief Enumeration of the context attribute flags
+ ///
+ ////////////////////////////////////////////////////////////
+ enum Attribute
+ {
+ Default = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
+ Core = 1 << 0, ///< Core attribute
+ Debug = 1 << 2 ///< Debug attribute
+ };
+
+ ////////////////////////////////////////////////////////////
/// \brief Default constructor
///
/// \param depth Depth buffer bits
@@ -43,14 +54,16 @@ struct ContextSettings
/// \param antialiasing Antialiasing level
/// \param major Major number of the context version
/// \param minor Minor number of the context version
+ /// \param attributes Attribute flags of the context
///
////////////////////////////////////////////////////////////
- explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 2, unsigned int minor = 0) :
+ explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default) :
depthBits (depth),
stencilBits (stencil),
antialiasingLevel(antialiasing),
majorVersion (major),
- minorVersion (minor)
+ minorVersion (minor),
+ attributeFlags (attributes)
{
}
@@ -62,6 +75,7 @@ struct ContextSettings
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
+ Uint32 attributeFlags; ///< The attribute flags to create the context with
};
} // namespace sf
@@ -76,10 +90,11 @@ struct ContextSettings
///
/// 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.
+/// settings with the exception of the compatibility flag
+/// and anti-aliasing level have no impact on the regular
+/// SFML rendering (graphics module), 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
@@ -94,6 +109,32 @@ struct ContextSettings
/// all handled the same way (i.e. you can use any version
/// < 3.0 if you don't want an OpenGL 3 context).
///
+/// When requesting a context with a version greater or equal
+/// to 3.2, you have the option of specifying whether the
+/// context should follow the core or compatibility profile
+/// of all newer (>= 3.2) OpenGL specifications. For versions
+/// 3.0 and 3.1 there is only the core profile. By default
+/// a compatibility context is created. You only need to specify
+/// the core flag if you want a core profile context to use with
+/// your own OpenGL rendering.
+/// <b>Warning: The graphics module will not function if you
+/// request a core profile context. Make sure the attributes are
+/// set to Default if you want to use the graphics module.</b>
+///
+/// Setting the debug attribute flag will request a context with
+/// additional debugging features enabled. Depending on the
+/// system, this might be required for advanced OpenGL debugging.
+/// OpenGL debugging is disabled by default.
+///
+/// <b>Special Note for OS X:</b>
+/// Apple only supports choosing between either a legacy context
+/// (OpenGL 2.1) or a core context (OpenGL version depends on the
+/// operating system version but is at least 3.2). Compatibility
+/// contexts are not supported. Further information is available on the
+/// <a href="https://developer.apple.com/opengl/capabilities/index.html">
+/// OpenGL Capabilities Tables</a> page. OS X also currently does
+/// not support debug contexts.
+///
/// 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
diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp
index 7499a05..5fc9a10 100644
--- a/include/SFML/Window/Event.hpp
+++ b/include/SFML/Window/Event.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -102,6 +102,9 @@ public:
////////////////////////////////////////////////////////////
/// \brief Mouse wheel events parameters (MouseWheelMoved)
///
+ /// \deprecated This event is deprecated and potentially inaccurate.
+ /// Use MouseWheelScrollEvent instead.
+ ///
////////////////////////////////////////////////////////////
struct MouseWheelEvent
{
@@ -111,6 +114,18 @@ public:
};
////////////////////////////////////////////////////////////
+ /// \brief Mouse wheel events parameters (MouseWheelScrolled)
+ ///
+ ////////////////////////////////////////////////////////////
+ struct MouseWheelScrollEvent
+ {
+ Mouse::Wheel wheel; ///< Which wheel (for mice with multiple ones)
+ float delta; ///< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
+ 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)
///
@@ -152,17 +167,17 @@ public:
int x; ///< X position of the touch, relative to the left of the owner window
int y; ///< Y position of the touch, relative to the top of the owner window
};
-
+
////////////////////////////////////////////////////////////
/// \brief Sensor event parameters (SensorChanged)
///
////////////////////////////////////////////////////////////
struct SensorEvent
{
- Sensor::Type type; ///< Type of the sensor
- float x; ///< Current value of the sensor on X axis
- float y; ///< Current value of the sensor on Y axis
- float z; ///< Current value of the sensor on Z axis
+ Sensor::Type type; ///< Type of the sensor
+ float x; ///< Current value of the sensor on X axis
+ float y; ///< Current value of the sensor on Y axis
+ float z; ///< Current value of the sensor on Z axis
};
////////////////////////////////////////////////////////////
@@ -178,7 +193,8 @@ public:
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)
+ MouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
+ MouseWheelScrolled, ///< The mouse wheel was scrolled (data in event.mouseWheelScroll)
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)
@@ -204,17 +220,18 @@ public:
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)
- TouchEvent touch; ///< Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded)
- SensorEvent sensor; ///< Sensor event parameters (Event::SensorChanged)
+ 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) (deprecated)
+ MouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters (Event::MouseWheelScrolled)
+ 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)
+ TouchEvent touch; ///< Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded)
+ SensorEvent sensor; ///< Sensor event parameters (Event::SensorChanged)
};
};
diff --git a/include/SFML/Window/Export.hpp b/include/SFML/Window/Export.hpp
index 8df4d51..4a708ec 100644
--- a/include/SFML/Window/Export.hpp
+++ b/include/SFML/Window/Export.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/GlResource.hpp b/include/SFML/Window/GlResource.hpp
index 47970fb..a341f64 100644
--- a/include/SFML/Window/GlResource.hpp
+++ b/include/SFML/Window/GlResource.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/Joystick.hpp b/include/SFML/Window/Joystick.hpp
index dc6261b..185fd76 100644
--- a/include/SFML/Window/Joystick.hpp
+++ b/include/SFML/Window/Joystick.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -73,7 +73,7 @@ public:
/// \brief Structure holding a joystick's identification
///
////////////////////////////////////////////////////////////
- struct Identification
+ struct SFML_WINDOW_API Identification
{
Identification();
diff --git a/include/SFML/Window/Keyboard.hpp b/include/SFML/Window/Keyboard.hpp
index 5dd0d63..b3186e9 100644
--- a/include/SFML/Window/Keyboard.hpp
+++ b/include/SFML/Window/Keyboard.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/Mouse.hpp b/include/SFML/Window/Mouse.hpp
index 022ecc5..0056f8c 100644
--- a/include/SFML/Window/Mouse.hpp
+++ b/include/SFML/Window/Mouse.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -60,6 +60,16 @@ public:
};
////////////////////////////////////////////////////////////
+ /// \brief Mouse wheels
+ ///
+ ////////////////////////////////////////////////////////////
+ enum Wheel
+ {
+ VerticalWheel, ///< The vertical mouse wheel
+ HorizontalWheel ///< The horizontal mouse wheel
+ };
+
+ ////////////////////////////////////////////////////////////
/// \brief Check if a mouse button is pressed
///
/// \param button Button to check
diff --git a/include/SFML/Window/Sensor.hpp b/include/SFML/Window/Sensor.hpp
index 099dca7..6078881 100644
--- a/include/SFML/Window/Sensor.hpp
+++ b/include/SFML/Window/Sensor.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
@@ -49,11 +49,11 @@ public:
////////////////////////////////////////////////////////////
enum Type
{
- Accelerometer, ///< Measures the raw acceleration (m/sē)
+ Accelerometer, ///< Measures the raw acceleration (m/s^2)
Gyroscope, ///< Measures the raw rotation rates (degrees/s)
Magnetometer, ///< Measures the ambient magnetic field (micro-teslas)
- Gravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/sē)
- UserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/sē)
+ Gravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
+ UserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
Orientation, ///< Measures the absolute 3D orientation (degrees)
Count ///< Keep last -- the total number of sensor types
@@ -72,7 +72,7 @@ public:
////////////////////////////////////////////////////////////
/// \brief Enable or disable a sensor
///
- /// All sensors are disabled by default, to avoid consuming too
+ /// All sensors are disabled by default, to avoid consuming too
/// much battery power. Once a sensor is enabled, it starts
/// sending events of the corresponding type.
///
@@ -122,7 +122,7 @@ public:
///
/// You may wonder why some sensor types look so similar, for example
/// Accelerometer and Gravity / UserAcceleration. The first one
-/// is the raw measurement of the acceleration, and takes in account
+/// is the raw measurement of the acceleration, and takes into account
/// both the earth gravity and the user movement. The others are
/// more precise: they provide these components separately, which is
/// usually more useful. In fact they are not direct sensors, they
diff --git a/include/SFML/Window/Touch.hpp b/include/SFML/Window/Touch.hpp
index 8d61f1a..bf44f43 100644
--- a/include/SFML/Window/Touch.hpp
+++ b/include/SFML/Window/Touch.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/VideoMode.hpp b/include/SFML/Window/VideoMode.hpp
index fcced93..5eb268c 100644
--- a/include/SFML/Window/VideoMode.hpp
+++ b/include/SFML/Window/VideoMode.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp
index 88942dc..44f0752 100644
--- a/include/SFML/Window/Window.hpp
+++ b/include/SFML/Window/Window.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp
index b7c67a5..9da3042 100644
--- a/include/SFML/Window/WindowHandle.hpp
+++ b/include/SFML/Window/WindowHandle.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
diff --git a/include/SFML/Window/WindowStyle.hpp b/include/SFML/Window/WindowStyle.hpp
index cd721b3..b9253db 100644
--- a/include/SFML/Window/WindowStyle.hpp
+++ b/include/SFML/Window/WindowStyle.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.