summaryrefslogtreecommitdiff
path: root/include/SFML
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2018-05-15 13:58:15 +0100
committerJames Cowgill <jcowgill@debian.org>2018-05-15 13:58:15 +0100
commitb175eed3ca950204c9b52fdcebc897f337b7bf19 (patch)
tree0f50d921750c957f11bda18abc83f9228d010902 /include/SFML
parent31394fcd65a10f2d2c51c3d27afff5367bded901 (diff)
New upstream version 2.5.0+dfsg
Diffstat (limited to 'include/SFML')
-rw-r--r--include/SFML/Audio.hpp2
-rw-r--r--include/SFML/Audio/AlResource.hpp2
-rw-r--r--include/SFML/Audio/Export.hpp2
-rw-r--r--include/SFML/Audio/InputSoundFile.hpp37
-rw-r--r--include/SFML/Audio/Listener.hpp2
-rw-r--r--include/SFML/Audio/Music.hpp112
-rw-r--r--include/SFML/Audio/OutputSoundFile.hpp2
-rw-r--r--include/SFML/Audio/Sound.hpp2
-rw-r--r--include/SFML/Audio/SoundBuffer.hpp2
-rw-r--r--include/SFML/Audio/SoundBufferRecorder.hpp2
-rw-r--r--include/SFML/Audio/SoundFileFactory.hpp2
-rw-r--r--include/SFML/Audio/SoundFileFactory.inl2
-rw-r--r--include/SFML/Audio/SoundFileReader.hpp7
-rw-r--r--include/SFML/Audio/SoundFileWriter.hpp2
-rw-r--r--include/SFML/Audio/SoundRecorder.hpp2
-rw-r--r--include/SFML/Audio/SoundSource.hpp47
-rw-r--r--include/SFML/Audio/SoundStream.hpp47
-rw-r--r--include/SFML/Config.hpp11
-rw-r--r--include/SFML/GpuPreference.hpp74
-rw-r--r--include/SFML/Graphics.hpp3
-rw-r--r--include/SFML/Graphics/BlendMode.hpp2
-rw-r--r--include/SFML/Graphics/CircleShape.hpp2
-rw-r--r--include/SFML/Graphics/Color.hpp2
-rw-r--r--include/SFML/Graphics/ConvexShape.hpp2
-rw-r--r--include/SFML/Graphics/Drawable.hpp2
-rw-r--r--include/SFML/Graphics/Export.hpp2
-rw-r--r--include/SFML/Graphics/Font.hpp4
-rw-r--r--include/SFML/Graphics/Glsl.hpp2
-rw-r--r--include/SFML/Graphics/Glsl.inl2
-rw-r--r--include/SFML/Graphics/Glyph.hpp2
-rw-r--r--include/SFML/Graphics/Image.hpp5
-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.hpp2
-rw-r--r--include/SFML/Graphics/RenderStates.hpp2
-rw-r--r--include/SFML/Graphics/RenderTarget.hpp75
-rw-r--r--include/SFML/Graphics/RenderTexture.hpp48
-rw-r--r--include/SFML/Graphics/RenderWindow.hpp32
-rw-r--r--include/SFML/Graphics/Shader.hpp4
-rw-r--r--include/SFML/Graphics/Shape.hpp2
-rw-r--r--include/SFML/Graphics/Sprite.hpp2
-rw-r--r--include/SFML/Graphics/Text.hpp87
-rw-r--r--include/SFML/Graphics/Texture.hpp53
-rw-r--r--include/SFML/Graphics/Transform.hpp31
-rw-r--r--include/SFML/Graphics/Transformable.hpp2
-rw-r--r--include/SFML/Graphics/Vertex.hpp2
-rw-r--r--include/SFML/Graphics/VertexArray.hpp2
-rw-r--r--include/SFML/Graphics/VertexBuffer.hpp408
-rw-r--r--include/SFML/Graphics/View.hpp2
-rw-r--r--include/SFML/Main.hpp2
-rw-r--r--include/SFML/Network.hpp2
-rw-r--r--include/SFML/Network/Export.hpp2
-rw-r--r--include/SFML/Network/Ftp.hpp8
-rw-r--r--include/SFML/Network/Http.hpp2
-rw-r--r--include/SFML/Network/IpAddress.hpp2
-rw-r--r--include/SFML/Network/Packet.hpp126
-rw-r--r--include/SFML/Network/Socket.hpp2
-rw-r--r--include/SFML/Network/SocketHandle.hpp2
-rw-r--r--include/SFML/Network/SocketSelector.hpp2
-rw-r--r--include/SFML/Network/TcpListener.hpp16
-rw-r--r--include/SFML/Network/TcpSocket.hpp5
-rw-r--r--include/SFML/Network/UdpSocket.hpp7
-rw-r--r--include/SFML/OpenGL.hpp5
-rw-r--r--include/SFML/System.hpp2
-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.hpp2
-rw-r--r--include/SFML/System/InputStream.hpp2
-rw-r--r--include/SFML/System/Lock.hpp2
-rw-r--r--include/SFML/System/MemoryInputStream.hpp2
-rw-r--r--include/SFML/System/Mutex.hpp2
-rw-r--r--include/SFML/System/NativeActivity.hpp2
-rw-r--r--include/SFML/System/NonCopyable.hpp12
-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.inl10
-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.hpp4
-rw-r--r--include/SFML/Window/Clipboard.hpp108
-rw-r--r--include/SFML/Window/Context.hpp17
-rw-r--r--include/SFML/Window/ContextSettings.hpp3
-rw-r--r--include/SFML/Window/Cursor.hpp219
-rw-r--r--include/SFML/Window/Event.hpp4
-rw-r--r--include/SFML/Window/Export.hpp2
-rw-r--r--include/SFML/Window/GlResource.hpp18
-rw-r--r--include/SFML/Window/Joystick.hpp2
-rw-r--r--include/SFML/Window/Keyboard.hpp24
-rw-r--r--include/SFML/Window/Mouse.hpp2
-rw-r--r--include/SFML/Window/Sensor.hpp2
-rw-r--r--include/SFML/Window/Touch.hpp2
-rw-r--r--include/SFML/Window/VideoMode.hpp2
-rw-r--r--include/SFML/Window/Window.hpp36
-rw-r--r--include/SFML/Window/WindowHandle.hpp6
-rw-r--r--include/SFML/Window/WindowStyle.hpp2
107 files changed, 1628 insertions, 227 deletions
diff --git a/include/SFML/Audio.hpp b/include/SFML/Audio.hpp
index 2d3e5d7..3167927 100644
--- a/include/SFML/Audio.hpp
+++ b/include/SFML/Audio.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/AlResource.hpp b/include/SFML/Audio/AlResource.hpp
index 2cb48d0..dd7d44c 100644
--- a/include/SFML/Audio/AlResource.hpp
+++ b/include/SFML/Audio/AlResource.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Export.hpp b/include/SFML/Audio/Export.hpp
index 31e463e..9e5e09c 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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
index 672ea43..317b952 100644
--- a/include/SFML/Audio/InputSoundFile.hpp
+++ b/include/SFML/Audio/InputSoundFile.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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,6 +32,7 @@
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp>
#include <string>
+#include <algorithm>
namespace sf
@@ -100,18 +101,6 @@ public:
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
@@ -147,6 +136,22 @@ public:
Time getDuration() const;
////////////////////////////////////////////////////////////
+ /// \brief Get the read offset of the file in time
+ ///
+ /// \return Time position
+ ///
+ ////////////////////////////////////////////////////////////
+ Time getTimeOffset() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the read offset of the file in samples
+ ///
+ /// \return Sample position
+ ///
+ ////////////////////////////////////////////////////////////
+ Uint64 getSampleOffset() const;
+
+ ////////////////////////////////////////////////////////////
/// \brief Change the current read position to the given sample offset
///
/// This function takes a sample offset to provide maximum
@@ -154,8 +159,9 @@ public:
/// other overload.
///
/// The sample offset takes the channels into account.
- /// Offsets can be calculated like this:
- /// `sampleNumber * sampleRate * channelCount`
+ /// If you have a time offset instead, you can easily find
+ /// the corresponding sample offset with the following formula:
+ /// `timeInSeconds * sampleRate * channelCount`
/// If the given offset exceeds to total number of samples,
/// this function jumps to the end of the sound file.
///
@@ -203,6 +209,7 @@ private:
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_sampleOffset; ///< Sample Read Position
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
diff --git a/include/SFML/Audio/Listener.hpp b/include/SFML/Audio/Listener.hpp
index af83e25..9fb7fff 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Music.hpp b/include/SFML/Audio/Music.hpp
index 8114923..5351905 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -50,6 +50,43 @@ class SFML_AUDIO_API Music : public SoundStream
public:
////////////////////////////////////////////////////////////
+ /// \brief Structure defining a time range using the template type
+ ///
+ ////////////////////////////////////////////////////////////
+ template <typename T>
+ struct Span
+ {
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ ////////////////////////////////////////////////////////////
+ Span()
+ {
+
+ }
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Initialization constructor
+ ///
+ /// \param off Initial Offset
+ /// \param len Initial Length
+ ///
+ ////////////////////////////////////////////////////////////
+ Span(T off, T len):
+ offset(off),
+ length(len)
+ {
+
+ }
+
+ T offset; ///< The beginning offset of the time range
+ T length; ///< The length of the time range
+ };
+
+ // Define the relevant Span types
+ typedef Span<Time> TimeSpan;
+
+ ////////////////////////////////////////////////////////////
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
@@ -134,6 +171,45 @@ public:
////////////////////////////////////////////////////////////
Time getDuration() const;
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the positions of the of the sound's looping sequence
+ ///
+ /// \return Loop Time position class.
+ ///
+ /// \warning Since setLoopPoints() performs some adjustments on the
+ /// provided values and rounds them to internal samples, a call to
+ /// getLoopPoints() is not guaranteed to return the same times passed
+ /// into a previous call to setLoopPoints(). However, it is guaranteed
+ /// to return times that will map to the valid internal samples of
+ /// this Music if they are later passed to setLoopPoints().
+ ///
+ /// \see setLoopPoints
+ ///
+ ////////////////////////////////////////////////////////////
+ TimeSpan getLoopPoints() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
+ ///
+ /// Loop points allow one to specify a pair of positions such that, when the music
+ /// is enabled for looping, it will seamlessly seek to the beginning whenever it
+ /// encounters the end. Valid ranges for timePoints.offset and timePoints.length are
+ /// [0, Dur) and (0, Dur-offset] respectively, where Dur is the value returned by getDuration().
+ /// Note that the EOF "loop point" from the end to the beginning of the stream is still honored,
+ /// in case the caller seeks to a point after the end of the loop range. This function can be
+ /// safely called at any point after a stream is opened, and will be applied to a playing sound
+ /// without affecting the current playing offset.
+ ///
+ /// \warning Setting the loop points while the stream's status is Paused
+ /// will set its status to Stopped. The playing offset will be unaffected.
+ ///
+ /// \param timePoints The definition of the loop. Can be any time points within the sound's length
+ ///
+ /// \see getLoopPoints
+ ///
+ ////////////////////////////////////////////////////////////
+ void setLoopPoints(TimeSpan timePoints);
+
protected:
////////////////////////////////////////////////////////////
@@ -157,6 +233,18 @@ protected:
////////////////////////////////////////////////////////////
virtual void onSeek(Time timeOffset);
+ ////////////////////////////////////////////////////////////
+ /// \brief Change the current playing position in the stream source to the loop offset
+ ///
+ /// This is called by the underlying SoundStream whenever it needs us to reset
+ /// the seek position for a loop. We then determine whether we are looping on a
+ /// loop point or the end-of-file, perform the seek, and return the new position.
+ ///
+ /// \return The seek position after looping (or -1 if there's no loop)
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 onLoop();
+
private:
////////////////////////////////////////////////////////////
@@ -166,12 +254,32 @@ private:
void initialize();
////////////////////////////////////////////////////////////
+ /// \brief Helper to convert an sf::Time to a sample position
+ ///
+ /// \param position Time to convert to samples
+ ///
+ /// \return The number of samples elapsed at the given time
+ ///
+ ////////////////////////////////////////////////////////////
+ Uint64 timeToSamples(Time position) const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Helper to convert a sample position to an sf::Time
+ ///
+ /// \param samples Sample count to convert to Time
+ ///
+ /// \return The Time position of the given sample
+ ///
+ ////////////////////////////////////////////////////////////
+ Time samplesToTime(Uint64 samples) const;
+
+ ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
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
+ Span<Uint64> m_loopSpan; ///< Loop Range Specifier
};
} // namespace sf
diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp
index 325b38f..5da374b 100644
--- a/include/SFML/Audio/OutputSoundFile.hpp
+++ b/include/SFML/Audio/OutputSoundFile.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Sound.hpp b/include/SFML/Audio/Sound.hpp
index 3b20024..f8e2e14 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 6303cfb..5aaa4ca 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/SoundBufferRecorder.hpp b/include/SFML/Audio/SoundBufferRecorder.hpp
index b5b6436..266603d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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
index b4eadf0..e3719c8 100644
--- a/include/SFML/Audio/SoundFileFactory.hpp
+++ b/include/SFML/Audio/SoundFileFactory.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.inl b/include/SFML/Audio/SoundFileFactory.inl
index a552ba8..6c499f3 100644
--- a/include/SFML/Audio/SoundFileFactory.inl
+++ b/include/SFML/Audio/SoundFileFactory.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/SoundFileReader.hpp b/include/SFML/Audio/SoundFileReader.hpp
index 006ce65..a040db9 100644
--- a/include/SFML/Audio/SoundFileReader.hpp
+++ b/include/SFML/Audio/SoundFileReader.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -80,8 +80,9 @@ public:
/// \brief Change the current read position to the given sample offset
///
/// The sample offset takes the channels into account.
- /// Offsets can be calculated like this:
- /// `sampleNumber * sampleRate * channelCount`
+ /// If you have a time offset instead, you can easily find
+ /// the corresponding sample offset with the following formula:
+ /// `timeInSeconds * sampleRate * channelCount`
/// If the given offset exceeds to total number of samples,
/// this function must jump to the end of the file.
///
diff --git a/include/SFML/Audio/SoundFileWriter.hpp b/include/SFML/Audio/SoundFileWriter.hpp
index 8a35a0d..8651ddc 100644
--- a/include/SFML/Audio/SoundFileWriter.hpp
+++ b/include/SFML/Audio/SoundFileWriter.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp
index 33c80b1..d4dc74f 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/SoundSource.hpp b/include/SFML/Audio/SoundSource.hpp
index edcaaa2..fcc9c79 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -250,15 +250,40 @@ public:
////////////////////////////////////////////////////////////
SoundSource& operator =(const SoundSource& right);
-protected:
+ ////////////////////////////////////////////////////////////
+ /// \brief Start or resume playing the sound source
+ ///
+ /// This function starts the source if it was stopped, resumes
+ /// it if it was paused, and restarts it from the beginning if
+ /// it was already playing.
+ ///
+ /// \see pause, stop
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void play() = 0;
////////////////////////////////////////////////////////////
- /// \brief Default constructor
+ /// \brief Pause the sound source
///
- /// This constructor is meant to be called by derived classes only.
+ /// This function pauses the source if it was playing,
+ /// otherwise (source already paused or stopped) it has no effect.
+ ///
+ /// \see play, stop
///
////////////////////////////////////////////////////////////
- SoundSource();
+ virtual void pause() = 0;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Stop playing the sound source
+ ///
+ /// This function stops the source if it was playing or paused,
+ /// and does nothing if it was already stopped.
+ /// It also resets the playing position (unlike pause()).
+ ///
+ /// \see play, pause
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void stop() = 0;
////////////////////////////////////////////////////////////
/// \brief Get the current status of the sound (stopped, paused, playing)
@@ -266,7 +291,17 @@ protected:
/// \return Current status of the sound
///
////////////////////////////////////////////////////////////
- Status getStatus() const;
+ virtual Status getStatus() const;
+
+protected:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ /// This constructor is meant to be called by derived classes only.
+ ///
+ ////////////////////////////////////////////////////////////
+ SoundSource();
////////////////////////////////////////////////////////////
// Member data
diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp
index 06856ed..bed8311 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -180,6 +180,11 @@ public:
protected:
+ enum
+ {
+ NoLoop = -1 ///< "Invalid" endSeeks value, telling us to continue uninterrupted
+ };
+
////////////////////////////////////////////////////////////
/// \brief Default constructor
///
@@ -234,6 +239,18 @@ protected:
////////////////////////////////////////////////////////////
virtual void onSeek(Time timeOffset) = 0;
+ ////////////////////////////////////////////////////////////
+ /// \brief Change the current playing position in the stream source to the beginning of the loop
+ ///
+ /// This function can be overridden by derived classes to
+ /// allow implementation of custom loop points. Otherwise,
+ /// it just calls onSeek(Time::Zero) and returns 0.
+ ///
+ /// \return The seek position after looping (or -1 if there's no loop)
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual Int64 onLoop();
+
private:
////////////////////////////////////////////////////////////
@@ -254,11 +271,12 @@ private:
/// playing queue.
///
/// \param bufferNum Number of the buffer to fill (in [0, BufferCount])
+ /// \param immediateLoop Treat empty buffers as spent, and act on loops immediately
///
/// \return True if the stream source has requested to stop, false otherwise
///
////////////////////////////////////////////////////////////
- bool fillAndPushBuffer(unsigned int bufferNum);
+ bool fillAndPushBuffer(unsigned int bufferNum, bool immediateLoop = false);
////////////////////////////////////////////////////////////
/// \brief Fill the audio buffers and put them all into the playing queue
@@ -281,23 +299,24 @@ private:
enum
{
- BufferCount = 3 ///< Number of audio buffers used by the streaming loop
+ BufferCount = 3, ///< Number of audio buffers used by the streaming loop
+ BufferRetries = 2 ///< Number of retries (excluding initial try) for onGetData()
};
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- Thread m_thread; ///< Thread running the background tasks
- mutable Mutex m_threadMutex; ///< Thread mutex
- Status m_threadStartState; ///< State the thread starts in (Playing, Paused, Stopped)
- bool m_isStreaming; ///< Streaming state (true = playing, false = stopped)
- unsigned int m_buffers[BufferCount]; ///< Sound buffers used to store temporary audio data
- unsigned int m_channelCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
- unsigned int m_sampleRate; ///< Frequency (samples / second)
- Uint32 m_format; ///< Format of the internal sound buffers
- bool m_loop; ///< Loop flag (true to loop, false to play once)
- Uint64 m_samplesProcessed; ///< Number of buffers processed since beginning of the stream
- bool m_endBuffers[BufferCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation
+ Thread m_thread; ///< Thread running the background tasks
+ mutable Mutex m_threadMutex; ///< Thread mutex
+ Status m_threadStartState; ///< State the thread starts in (Playing, Paused, Stopped)
+ bool m_isStreaming; ///< Streaming state (true = playing, false = stopped)
+ unsigned int m_buffers[BufferCount]; ///< Sound buffers used to store temporary audio data
+ unsigned int m_channelCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
+ unsigned int m_sampleRate; ///< Frequency (samples / second)
+ Uint32 m_format; ///< Format of the internal sound buffers
+ bool m_loop; ///< Loop flag (true to loop, false to play once)
+ Uint64 m_samplesProcessed; ///< Number of buffers processed since beginning of the stream
+ Int64 m_bufferSeeks[BufferCount]; ///< If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset calculation.
};
} // namespace sf
diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp
index 5a8a87c..aae5f54 100644
--- a/include/SFML/Config.hpp
+++ b/include/SFML/Config.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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,8 +30,8 @@
// Define the SFML version
////////////////////////////////////////////////////////////
#define SFML_VERSION_MAJOR 2
-#define SFML_VERSION_MINOR 4
-#define SFML_VERSION_PATCH 2
+#define SFML_VERSION_MINOR 5
+#define SFML_VERSION_PATCH 0
////////////////////////////////////////////////////////////
@@ -86,6 +86,11 @@
// FreeBSD
#define SFML_SYSTEM_FREEBSD
+ #elif defined(__OpenBSD__)
+
+ // OpenBSD
+ #define SFML_SYSTEM_OPENBSD
+
#else
// Unsupported UNIX system
diff --git a/include/SFML/GpuPreference.hpp b/include/SFML/GpuPreference.hpp
new file mode 100644
index 0000000..cde4f9f
--- /dev/null
+++ b/include/SFML/GpuPreference.hpp
@@ -0,0 +1,74 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2018 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_GPUPREFERENCE_HPP
+#define SFML_GPUPREFERENCE_HPP
+
+
+////////////////////////////////////////////////////////////
+/// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Config.hpp>
+
+
+////////////////////////////////////////////////////////////
+/// \file
+///
+/// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE
+///
+////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////
+/// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE
+///
+/// \brief A macro to encourage usage of the discrete GPU
+///
+/// In order to inform the Nvidia/AMD driver that an SFML
+/// application could benefit from using the more powerful
+/// discrete GPU, special symbols have to be publicly
+/// exported from the final executable.
+///
+/// SFML defines a helper macro to easily do this.
+///
+/// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the
+/// global scope of a source file that will be linked into
+/// the final executable. Typically it is best to place it
+/// where the main function is also defined.
+///
+////////////////////////////////////////////////////////////
+#if defined(SFML_SYSTEM_WINDOWS)
+
+ #define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \
+ extern "C" __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \
+ extern "C" __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1;
+
+#else
+
+ #define SFML_DEFINE_DISCRETE_GPU_PREFERENCE
+
+#endif
+
+
+#endif // SFML_GPUPREFERENCE_HPP
diff --git a/include/SFML/Graphics.hpp b/include/SFML/Graphics.hpp
index 5bb622a..252c6e9 100644
--- a/include/SFML/Graphics.hpp
+++ b/include/SFML/Graphics.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 @@
#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
+#include <SFML/Graphics/VertexBuffer.hpp>
#include <SFML/Graphics/View.hpp>
diff --git a/include/SFML/Graphics/BlendMode.hpp b/include/SFML/Graphics/BlendMode.hpp
index 3ba0a40..15da7d1 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/CircleShape.hpp b/include/SFML/Graphics/CircleShape.hpp
index 9f68969..896c893 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Color.hpp b/include/SFML/Graphics/Color.hpp
index 1f81feb..43357aa 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/ConvexShape.hpp b/include/SFML/Graphics/ConvexShape.hpp
index 117f843..e770299 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp
index a409cf7..852b22d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 de164a1..0b47b39 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 19c0308..e753866 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -91,7 +91,7 @@ public:
///
/// The supported font formats are: TrueType, Type 1, CFF,
/// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.
- /// Note that this function know nothing about the standard
+ /// Note that this function knows nothing about the standard
/// fonts installed on the user's system, thus you can't
/// load them directly.
///
diff --git a/include/SFML/Graphics/Glsl.hpp b/include/SFML/Graphics/Glsl.hpp
index 7bf1604..e3943e7 100644
--- a/include/SFML/Graphics/Glsl.hpp
+++ b/include/SFML/Graphics/Glsl.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Glsl.inl b/include/SFML/Graphics/Glsl.inl
index 8e72871..9c9f0ae 100644
--- a/include/SFML/Graphics/Glsl.inl
+++ b/include/SFML/Graphics/Glsl.inl
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 8c632af..59deb9b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 a9010c0..c1d672a 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -265,9 +265,6 @@ private:
////////////////////////////////////////////////////////////
Vector2u m_size; ///< Image size
std::vector<Uint8> m_pixels; ///< Pixels of the image
- #ifdef SFML_SYSTEM_ANDROID
- void* m_stream; ///< Asset file streamer (if loaded from file)
- #endif
};
} // namespace sf
diff --git a/include/SFML/Graphics/PrimitiveType.hpp b/include/SFML/Graphics/PrimitiveType.hpp
index 33f9e46..28cf58d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 b88e9b2..17f20a5 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 c1bb9bb..7a82e46 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 f9754f6..4f2c4d9 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/RenderStates.hpp b/include/SFML/Graphics/RenderStates.hpp
index 870b275..9bcde9b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 ba842fb..0d16746 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -43,6 +43,7 @@
namespace sf
{
class Drawable;
+class VertexBuffer;
////////////////////////////////////////////////////////////
/// \brief Base class for all render targets (window, texture, ...)
@@ -248,6 +249,26 @@ public:
PrimitiveType type, const RenderStates& states = RenderStates::Default);
////////////////////////////////////////////////////////////
+ /// \brief Draw primitives defined by a vertex buffer
+ ///
+ /// \param vertexBuffer Vertex buffer
+ /// \param states Render states to use for drawing
+ ///
+ ////////////////////////////////////////////////////////////
+ void draw(const VertexBuffer& vertexBuffer, const RenderStates& states = RenderStates::Default);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Draw primitives defined by a vertex buffer
+ ///
+ /// \param vertexBuffer Vertex buffer
+ /// \param firstVertex Index of the first vertex to render
+ /// \param vertexCount Number of vertices to render
+ /// \param states Render states to use for drawing
+ ///
+ ////////////////////////////////////////////////////////////
+ void draw(const VertexBuffer& vertexBuffer, std::size_t firstVertex, std::size_t vertexCount, const RenderStates& states = RenderStates::Default);
+
+ ////////////////////////////////////////////////////////////
/// \brief Return the size of the rendering region of the target
///
/// \return Size in pixels
@@ -256,6 +277,28 @@ public:
virtual Vector2u getSize() const = 0;
////////////////////////////////////////////////////////////
+ /// \brief Activate or deactivate the render target for rendering
+ ///
+ /// This function makes the render target's context current for
+ /// future OpenGL rendering operations (so you shouldn't care
+ /// about it if you're not doing direct OpenGL stuff).
+ /// A render target's context is active only on the current thread,
+ /// if you want to make it active on another thread you have
+ /// to deactivate it on the previous thread first if it was active.
+ /// Only one context can be current in a thread, so if you
+ /// want to draw OpenGL geometry to another render target
+ /// don't forget to activate it again. Activating a render
+ /// target will automatically deactivate the previously active
+ /// context (if any).
+ ///
+ /// \param active True to activate, false to deactivate
+ ///
+ /// \return True if operation was successful, false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual bool setActive(bool active = true);
+
+ ////////////////////////////////////////////////////////////
/// \brief Save the current OpenGL render states and matrices
///
/// This function can be used when you mix SFML drawing
@@ -381,18 +424,31 @@ private:
void applyShader(const Shader* shader);
////////////////////////////////////////////////////////////
- /// \brief Activate the target for rendering
+ /// \brief Setup environment for drawing
///
- /// This function must be implemented by derived classes to make
- /// their OpenGL context current; it is called by the base class
- /// everytime it's going to use OpenGL calls.
+ /// \param useVertexCache Are we going to use the vertex cache?
+ /// \param states Render states to use for drawing
///
- /// \param active True to make the target active, false to deactivate it
+ ////////////////////////////////////////////////////////////
+ void setupDraw(bool useVertexCache, const RenderStates& states);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Draw the primitives
+ ///
+ /// \param type Type of primitives to draw
+ /// \param firstVertex Index of the first vertex to use when drawing
+ /// \param vertexCount Number of vertices to use when drawing
+ ///
+ ////////////////////////////////////////////////////////////
+ void drawPrimitives(PrimitiveType type, std::size_t firstVertex, std::size_t vertexCount);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Clean up environment after drawing
///
- /// \return True if the function succeeded
+ /// \param states Render states used for drawing
///
////////////////////////////////////////////////////////////
- virtual bool activate(bool active) = 0;
+ void cleanupDraw(const RenderStates& states);
////////////////////////////////////////////////////////////
/// \brief Render states cache
@@ -402,10 +458,12 @@ private:
{
enum {VertexCacheSize = 4};
+ bool enable; ///< Is the cache enabled?
bool glStatesSet; ///< Are our internal GL states set yet?
bool viewChanged; ///< Has the current view changed since last draw?
BlendMode lastBlendMode; ///< Cached blending mode
Uint64 lastTextureId; ///< Cached texture
+ bool texCoordsArrayEnabled; ///< Is GL_TEXTURE_COORD_ARRAY client state enabled?
bool useVertexCache; ///< Did we previously use the vertex cache?
Vertex vertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache
};
@@ -416,6 +474,7 @@ private:
View m_defaultView; ///< Default view
View m_view; ///< Current view
StatesCache m_cache; ///< Render states cache
+ Uint64 m_id; ///< Unique number that identifies the RenderTarget
};
} // namespace sf
diff --git a/include/SFML/Graphics/RenderTexture.hpp b/include/SFML/Graphics/RenderTexture.hpp
index db3f91e..a26d94b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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,6 +31,7 @@
#include <SFML/Graphics/Export.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
+#include <SFML/Window/ContextSettings.hpp>
namespace sf
@@ -82,8 +83,38 @@ public:
///
/// \return True if creation has been successful
///
+ /// \deprecated Use create(unsigned int, unsigned int, const ContextSettings&) instead.
+ ///
+ ////////////////////////////////////////////////////////////
+ SFML_DEPRECATED bool create(unsigned int width, unsigned int height, bool depthBuffer);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Create the render-texture
+ ///
+ /// Before calling this function, the render-texture is in
+ /// an invalid state, thus it is mandatory to call it before
+ /// doing anything with the render-texture.
+ /// The last parameter, \a settings, is useful if you want to enable
+ /// multi-sampling or use the render-texture for OpenGL rendering that
+ /// requires a depth or stencil buffer. Otherwise it is unnecessary, and
+ /// you should leave this parameter at its default value.
+ ///
+ /// \param width Width of the render-texture
+ /// \param height Height of the render-texture
+ /// \param settings Additional settings for the underlying OpenGL texture and context
+ ///
+ /// \return True if creation has been successful
+ ///
////////////////////////////////////////////////////////////
- bool create(unsigned int width, unsigned int height, bool depthBuffer = false);
+ bool create(unsigned int width, unsigned int height, const ContextSettings& settings = ContextSettings());
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the maximum anti-aliasing level supported by the system
+ ///
+ /// \return The maximum anti-aliasing level supported by the system
+ ///
+ ////////////////////////////////////////////////////////////
+ static unsigned int getMaximumAntialiasingLevel();
////////////////////////////////////////////////////////////
/// \brief Enable or disable texture smoothing
@@ -205,19 +236,6 @@ public:
private:
////////////////////////////////////////////////////////////
- /// \brief Activate the target for rendering
- ///
- /// This function is called by the base class
- /// everytime it's going to use OpenGL calls.
- ///
- /// \param active True to make the target active, false to deactivate it
- ///
- /// \return True if the function succeeded
- ///
- ////////////////////////////////////////////////////////////
- virtual bool activate(bool active);
-
- ////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::RenderTextureImpl* m_impl; ///< Platform/hardware specific implementation
diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp
index 8b24e1e..2b3b6bc 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -113,6 +113,24 @@ public:
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
+ /// \brief Activate or deactivate the window as the current target
+ /// for OpenGL rendering
+ ///
+ /// A window is active only on the current thread, if you want to
+ /// make it active on another thread you have to deactivate it
+ /// on the previous thread first if it was active.
+ /// Only one window can be active on a thread at a time, thus
+ /// the window previously active (if any) automatically gets deactivated.
+ /// This is not to be confused with requestFocus().
+ ///
+ /// \param active True to activate, false to deactivate
+ ///
+ /// \return True if operation was successful, false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ bool setActive(bool active = true);
+
+ ////////////////////////////////////////////////////////////
/// \brief Copy the current contents of the window to an image
///
/// \deprecated
@@ -159,18 +177,6 @@ protected:
///
////////////////////////////////////////////////////////////
virtual void onResize();
-
-private:
-
- ////////////////////////////////////////////////////////////
- /// \brief Activate the target for rendering
- ///
- /// \param active True to make the target active, false to deactivate it
- ///
- /// \return True if the function succeeded
- ///
- ////////////////////////////////////////////////////////////
- virtual bool activate(bool active);
};
} // namespace sf
diff --git a/include/SFML/Graphics/Shader.hpp b/include/SFML/Graphics/Shader.hpp
index 9fe9c60..664dd86 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -822,7 +822,7 @@ private:
/// object being drawn (which cannot be known in advance).
///
/// To apply a shader to a drawable, you must pass it as an
-/// additional parameter to the \ref Window::draw() draw() function:
+/// additional parameter to the \ref RenderWindow::draw function:
/// \code
/// window.draw(sprite, &shader);
/// \endcode
diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp
index b257ddc..79ac528 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp
index 51bba30..55cc898 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Text.hpp b/include/SFML/Graphics/Text.hpp
index f3e389f..dae6ef2 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -145,6 +145,39 @@ public:
void setCharacterSize(unsigned int size);
////////////////////////////////////////////////////////////
+ /// \brief Set the line spacing factor
+ ///
+ /// The default spacing between lines is defined by the font.
+ /// This method enables you to set a factor for the spacing
+ /// between lines. By default the line spacing factor is 1.
+ ///
+ /// \param spacingFactor New line spacing factor
+ ///
+ /// \see getLineSpacing
+ ///
+ ////////////////////////////////////////////////////////////
+ void setLineSpacing(float spacingFactor);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Set the letter spacing factor
+ ///
+ /// The default spacing between letters is defined by the font.
+ /// This factor doesn't directly apply to the existing
+ /// spacing between each character, it rather adds a fixed
+ /// space between them which is calculated from the font
+ /// metrics and the character size.
+ /// Note that factors below 1 (including negative numbers) bring
+ /// characters closer to each other.
+ /// By default the letter spacing factor is 1.
+ ///
+ /// \param spacingFactor New letter spacing factor
+ ///
+ /// \see getLetterSpacing
+ ///
+ ////////////////////////////////////////////////////////////
+ void setLetterSpacing(float spacingFactor);
+
+ ////////////////////////////////////////////////////////////
/// \brief Set the text's style
///
/// You can pass a combination of one or more styles, for
@@ -261,6 +294,26 @@ public:
unsigned int getCharacterSize() const;
////////////////////////////////////////////////////////////
+ /// \brief Get the size of the letter spacing factor
+ ///
+ /// \return Size of the letter spacing factor
+ ///
+ /// \see setLetterSpacing
+ ///
+ ////////////////////////////////////////////////////////////
+ float getLetterSpacing() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the size of the line spacing factor
+ ///
+ /// \return Size of the line spacing factor
+ ///
+ /// \see setLineSpacing
+ ///
+ ////////////////////////////////////////////////////////////
+ float getLineSpacing() const;
+
+ ////////////////////////////////////////////////////////////
/// \brief Get the text's style
///
/// \return Text's style
@@ -382,17 +435,20 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
- String m_string; ///< String to display
- const Font* m_font; ///< Font used to display the string
- unsigned int m_characterSize; ///< Base size of characters, in pixels
- Uint32 m_style; ///< Text style (see Style enum)
- Color m_fillColor; ///< Text fill color
- Color m_outlineColor; ///< Text outline color
- float m_outlineThickness; ///< Thickness of the text's outline
- mutable VertexArray m_vertices; ///< Vertex array containing the fill geometry
- mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
- mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates)
- mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed?
+ String m_string; ///< String to display
+ const Font* m_font; ///< Font used to display the string
+ unsigned int m_characterSize; ///< Base size of characters, in pixels
+ float m_letterSpacingFactor; ///< Spacing factor between letters
+ float m_lineSpacingFactor; ///< Spacing factor between lines
+ Uint32 m_style; ///< Text style (see Style enum)
+ Color m_fillColor; ///< Text fill color
+ Color m_outlineColor; ///< Text outline color
+ float m_outlineThickness; ///< Thickness of the text's outline
+ mutable VertexArray m_vertices; ///< Vertex array containing the fill geometry
+ mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
+ mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates)
+ mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed?
+ mutable Uint64 m_fontTextureId; ///< The font texture id
};
} // namespace sf
@@ -411,8 +467,9 @@ private:
/// It inherits all the functions from sf::Transformable:
/// position, rotation, scale, origin. It also adds text-specific
/// properties such as the font to use, the character size,
-/// the font style (bold, italic, underlined, strike through), the
-/// global color and the text to display of course.
+/// the font style (bold, italic, underlined and strike through), the
+/// text color, the outline thickness, the outline color, the character
+/// spacing, the line spacing and the text to display of course.
/// It also provides convenience functions to calculate the
/// graphical size of the text, or to get the global position
/// of a given character.
@@ -445,7 +502,7 @@ private:
/// sf::Text text("hello", font);
/// text.setCharacterSize(30);
/// text.setStyle(sf::Text::Bold);
-/// text.setColor(sf::Color::Red);
+/// text.setFillColor(sf::Color::Red);
///
/// // Draw it
/// window.draw(text);
diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp
index f88c582..c292856 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -35,10 +35,11 @@
namespace sf
{
-class Window;
+class InputStream;
class RenderTarget;
class RenderTexture;
-class InputStream;
+class Text;
+class Window;
////////////////////////////////////////////////////////////
/// \brief Image living on the graphics card that can be used for drawing
@@ -277,6 +278,43 @@ public:
void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
+ /// \brief Update a part of this texture from another texture
+ ///
+ /// Although the source texture can be smaller than this texture,
+ /// this function is usually used for updating the whole texture.
+ /// The other overload, which has (x, y) additional arguments,
+ /// is more convenient for updating a sub-area of this texture.
+ ///
+ /// No additional check is performed on the size of the passed
+ /// texture, passing a texture bigger than this texture
+ /// will lead to an undefined behavior.
+ ///
+ /// This function does nothing if either texture was not
+ /// previously created.
+ ///
+ /// \param texture Source texture to copy to this texture
+ ///
+ ////////////////////////////////////////////////////////////
+ void update(const Texture& texture);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Update a part of this texture from another texture
+ ///
+ /// No additional check is performed on the size of the texture,
+ /// passing an invalid combination of texture size and offset
+ /// will lead to an undefined behavior.
+ ///
+ /// This function does nothing if either texture was not
+ /// previously created.
+ ///
+ /// \param texture Source texture to copy to this texture
+ /// \param x X offset in this texture where to copy the source texture
+ /// \param y Y offset in this texture where to copy the source texture
+ ///
+ ////////////////////////////////////////////////////////////
+ void update(const Texture& texture, unsigned int x, unsigned int y);
+
+ ////////////////////////////////////////////////////////////
/// \brief Update the texture from an image
///
/// Although the source image can be smaller than the texture,
@@ -481,6 +519,14 @@ public:
Texture& operator =(const Texture& right);
////////////////////////////////////////////////////////////
+ /// \brief Swap the contents of this texture with those of another
+ ///
+ /// \param right Instance to swap with
+ ///
+ ////////////////////////////////////////////////////////////
+ void swap(Texture& right);
+
+ ////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the texture.
///
/// You shouldn't need to use this function, unless you have
@@ -539,6 +585,7 @@ public:
private:
+ friend class Text;
friend class RenderTexture;
friend class RenderTarget;
diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp
index ab0307c..c77d08a 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -403,6 +403,35 @@ SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right
////////////////////////////////////////////////////////////
SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& right);
+////////////////////////////////////////////////////////////
+/// \relates sf::Transform
+/// \brief Overload of binary operator == to compare two transforms
+///
+/// Performs an element-wise comparison of the elements of the
+/// left transform with the elements of the right transform.
+///
+/// \param left Left operand (the first transform)
+/// \param right Right operand (the second transform)
+///
+/// \return true if the transforms are equal, false otherwise
+///
+////////////////////////////////////////////////////////////
+SFML_GRAPHICS_API bool operator ==(const Transform& left, const Transform& right);
+
+////////////////////////////////////////////////////////////
+/// \relates sf::Transform
+/// \brief Overload of binary operator != to compare two transforms
+///
+/// This call is equivalent to !(left == right).
+///
+/// \param left Left operand (the first transform)
+/// \param right Right operand (the second transform)
+///
+/// \return true if the transforms are not equal, false otherwise
+///
+////////////////////////////////////////////////////////////
+SFML_GRAPHICS_API bool operator !=(const Transform& left, const Transform& right);
+
} // namespace sf
diff --git a/include/SFML/Graphics/Transformable.hpp b/include/SFML/Graphics/Transformable.hpp
index 4e46cc6..67a5656 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp
index a9a8820..bb24448 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 109a7e8..5229065 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/VertexBuffer.hpp b/include/SFML/Graphics/VertexBuffer.hpp
new file mode 100644
index 0000000..a91a08f
--- /dev/null
+++ b/include/SFML/Graphics/VertexBuffer.hpp
@@ -0,0 +1,408 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2018 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_VERTEXBUFFER_HPP
+#define SFML_VERTEXBUFFER_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Graphics/Export.hpp>
+#include <SFML/Graphics/PrimitiveType.hpp>
+#include <SFML/Graphics/Drawable.hpp>
+#include <SFML/Window/GlResource.hpp>
+
+
+namespace sf
+{
+class RenderTarget;
+class Vertex;
+
+////////////////////////////////////////////////////////////
+/// \brief Vertex buffer storage for one or more 2D primitives
+///
+////////////////////////////////////////////////////////////
+class SFML_GRAPHICS_API VertexBuffer : public Drawable, private GlResource
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Usage specifiers
+ ///
+ /// If data is going to be updated once or more every frame,
+ /// set the usage to Stream. If data is going to be set once
+ /// and used for a long time without being modified, set the
+ /// usage to Static. For everything else Dynamic should be a
+ /// good compromise.
+ ///
+ ////////////////////////////////////////////////////////////
+ enum Usage
+ {
+ Stream, ///< Constantly changing data
+ Dynamic, ///< Occasionally changing data
+ Static ///< Rarely changing data
+ };
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ /// Creates an empty vertex buffer.
+ ///
+ ////////////////////////////////////////////////////////////
+ VertexBuffer();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Construct a VertexBuffer with a specific PrimitiveType
+ ///
+ /// Creates an empty vertex buffer and sets its primitive type to \p type.
+ ///
+ /// \param type Type of primitive
+ ///
+ ////////////////////////////////////////////////////////////
+ explicit VertexBuffer(PrimitiveType type);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Construct a VertexBuffer with a specific usage specifier
+ ///
+ /// Creates an empty vertex buffer and sets its usage to \p usage.
+ ///
+ /// \param usage Usage specifier
+ ///
+ ////////////////////////////////////////////////////////////
+ explicit VertexBuffer(Usage usage);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Construct a VertexBuffer with a specific PrimitiveType and usage specifier
+ ///
+ /// Creates an empty vertex buffer and sets its primitive type
+ /// to \p type and usage to \p usage.
+ ///
+ /// \param type Type of primitive
+ /// \param usage Usage specifier
+ ///
+ ////////////////////////////////////////////////////////////
+ VertexBuffer(PrimitiveType type, Usage usage);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Copy constructor
+ ///
+ /// \param copy instance to copy
+ ///
+ ////////////////////////////////////////////////////////////
+ VertexBuffer(const VertexBuffer& copy);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Destructor
+ ///
+ ////////////////////////////////////////////////////////////
+ ~VertexBuffer();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Create the vertex buffer
+ ///
+ /// Creates the vertex buffer and allocates enough graphics
+ /// memory to hold \p vertexCount vertices. Any previously
+ /// allocated memory is freed in the process.
+ ///
+ /// In order to deallocate previously allocated memory pass 0
+ /// as \p vertexCount. Don't forget to recreate with a non-zero
+ /// value when graphics memory should be allocated again.
+ ///
+ /// \param vertexCount Number of vertices worth of memory to allocate
+ ///
+ /// \return True if creation was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool create(std::size_t vertexCount);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Return the vertex count
+ ///
+ /// \return Number of vertices in the vertex buffer
+ ///
+ ////////////////////////////////////////////////////////////
+ std::size_t getVertexCount() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Update the whole buffer from an array of vertices
+ ///
+ /// The \a vertex array is assumed to have the same size as
+ /// the \a created buffer.
+ ///
+ /// No additional check is performed on the size of the vertex
+ /// array, passing invalid arguments will lead to undefined
+ /// behavior.
+ ///
+ /// This function does nothing if \a vertices is null or if the
+ /// buffer was not previously created.
+ ///
+ /// \param vertices Array of vertices to copy to the buffer
+ ///
+ /// \return True if the update was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool update(const Vertex* vertices);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Update a part of the buffer from an array of vertices
+ ///
+ /// \p offset is specified as the number of vertices to skip
+ /// from the beginning of the buffer.
+ ///
+ /// If \p offset is 0 and \p vertexCount is equal to the size of
+ /// the currently created buffer, its whole contents are replaced.
+ ///
+ /// If \p offset is 0 and \p vertexCount is greater than the
+ /// size of the currently created buffer, a new buffer is created
+ /// containing the vertex data.
+ ///
+ /// If \p offset is 0 and \p vertexCount is less than the size of
+ /// the currently created buffer, only the corresponding region
+ /// is updated.
+ ///
+ /// If \p offset is not 0 and \p offset + \p vertexCount is greater
+ /// than the size of the currently created buffer, the update fails.
+ ///
+ /// No additional check is performed on the size of the vertex
+ /// array, passing invalid arguments will lead to undefined
+ /// behavior.
+ ///
+ /// \param vertices Array of vertices to copy to the buffer
+ /// \param vertexCount Number of vertices to copy
+ /// \param offset Offset in the buffer to copy to
+ ///
+ /// \return True if the update was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool update(const Vertex* vertices, std::size_t vertexCount, unsigned int offset);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Copy the contents of another buffer into this buffer
+ ///
+ /// \param vertexBuffer Vertex buffer whose contents to copy into this vertex buffer
+ ///
+ /// \return True if the copy was successful
+ ///
+ ////////////////////////////////////////////////////////////
+ bool update(const VertexBuffer& vertexBuffer);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Overload of assignment operator
+ ///
+ /// \param right Instance to assign
+ ///
+ /// \return Reference to self
+ ///
+ ////////////////////////////////////////////////////////////
+ VertexBuffer& operator =(const VertexBuffer& right);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Swap the contents of this vertex buffer with those of another
+ ///
+ /// \param right Instance to swap with
+ ///
+ ////////////////////////////////////////////////////////////
+ void swap(VertexBuffer& right);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the underlying OpenGL handle of the vertex buffer.
+ ///
+ /// 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 vertex buffer or 0 if not yet created
+ ///
+ ////////////////////////////////////////////////////////////
+ unsigned int getNativeHandle() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Set the type of primitives to draw
+ ///
+ /// This function defines how the vertices must be interpreted
+ /// when it's time to draw them.
+ ///
+ /// The default primitive type is sf::Points.
+ ///
+ /// \param type Type of primitive
+ ///
+ ////////////////////////////////////////////////////////////
+ void setPrimitiveType(PrimitiveType type);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the type of primitives drawn by the vertex buffer
+ ///
+ /// \return Primitive type
+ ///
+ ////////////////////////////////////////////////////////////
+ PrimitiveType getPrimitiveType() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Set the usage specifier of this vertex buffer
+ ///
+ /// This function provides a hint about how this vertex buffer is
+ /// going to be used in terms of data update frequency.
+ ///
+ /// After changing the usage specifier, the vertex buffer has
+ /// to be updated with new data for the usage specifier to
+ /// take effect.
+ ///
+ /// The default primitive type is sf::VertexBuffer::Stream.
+ ///
+ /// \param usage Usage specifier
+ ///
+ ////////////////////////////////////////////////////////////
+ void setUsage(Usage usage);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the usage specifier of this vertex buffer
+ ///
+ /// \return Usage specifier
+ ///
+ ////////////////////////////////////////////////////////////
+ Usage getUsage() const;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Bind a vertex buffer for rendering
+ ///
+ /// This function is not part of the graphics API, it mustn't be
+ /// used when drawing SFML entities. It must be used only if you
+ /// mix sf::VertexBuffer with OpenGL code.
+ ///
+ /// \code
+ /// sf::VertexBuffer vb1, vb2;
+ /// ...
+ /// sf::VertexBuffer::bind(&vb1);
+ /// // draw OpenGL stuff that use vb1...
+ /// sf::VertexBuffer::bind(&vb2);
+ /// // draw OpenGL stuff that use vb2...
+ /// sf::VertexBuffer::bind(NULL);
+ /// // draw OpenGL stuff that use no vertex buffer...
+ /// \endcode
+ ///
+ /// \param vertexBuffer Pointer to the vertex buffer to bind, can be null to use no vertex buffer
+ ///
+ ////////////////////////////////////////////////////////////
+ static void bind(const VertexBuffer* vertexBuffer);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Tell whether or not the system supports vertex buffers
+ ///
+ /// This function should always be called before using
+ /// the vertex buffer features. If it returns false, then
+ /// any attempt to use sf::VertexBuffer will fail.
+ ///
+ /// \return True if vertex buffers are supported, false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ static bool isAvailable();
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Draw the vertex buffer to a render target
+ ///
+ /// \param target Render target to draw to
+ /// \param states Current render states
+ ///
+ ////////////////////////////////////////////////////////////
+ virtual void draw(RenderTarget& target, RenderStates states) const;
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ unsigned int m_buffer; ///< Internal buffer identifier
+ std::size_t m_size; ///< Size in Vertexes of the currently allocated buffer
+ PrimitiveType m_primitiveType; ///< Type of primitives to draw
+ Usage m_usage; ///< How this vertex buffer is to be used
+};
+
+} // namespace sf
+
+
+#endif // SFML_VERTEXBUFFER_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::VertexBuffer
+/// \ingroup graphics
+///
+/// sf::VertexBuffer is a simple wrapper around a dynamic
+/// buffer of vertices and a primitives type.
+///
+/// Unlike sf::VertexArray, the vertex data is stored in
+/// graphics memory.
+///
+/// In situations where a large amount of vertex data would
+/// have to be transferred from system memory to graphics memory
+/// every frame, using sf::VertexBuffer can help. By using a
+/// sf::VertexBuffer, data that has not been changed between frames
+/// does not have to be re-transferred from system to graphics
+/// memory as would be the case with sf::VertexArray. If data transfer
+/// is a bottleneck, this can lead to performance gains.
+///
+/// Using sf::VertexBuffer, the user also has the ability to only modify
+/// a portion of the buffer in graphics memory. This way, a large buffer
+/// can be allocated at the start of the application and only the
+/// applicable portions of it need to be updated during the course of
+/// the application. This allows the user to take full control of data
+/// transfers between system and graphics memory if they need to.
+///
+/// In special cases, the user can make use of multiple threads to update
+/// vertex data in multiple distinct regions of the buffer simultaneously.
+/// This might make sense when e.g. the position of multiple objects has to
+/// be recalculated very frequently. The computation load can be spread
+/// across multiple threads as long as there are no other data dependencies.
+///
+/// Simultaneous updates to the vertex buffer are not guaranteed to be
+/// carried out by the driver in any specific order. Updating the same
+/// region of the buffer from multiple threads will not cause undefined
+/// behaviour, however the final state of the buffer will be unpredictable.
+///
+/// Simultaneous updates of distinct non-overlapping regions of the buffer
+/// are also not guaranteed to complete in a specific order. However, in
+/// this case the user can make sure to synchronize the writer threads at
+/// well-defined points in their code. The driver will make sure that all
+/// pending data transfers complete before the vertex buffer is sourced
+/// by the rendering pipeline.
+///
+/// It inherits sf::Drawable, but unlike other drawables it
+/// is not transformable.
+///
+/// Example:
+/// \code
+/// sf::Vertex vertices[15];
+/// ...
+/// sf::VertexBuffer triangles(sf::Triangles);
+/// triangles.create(15);
+/// triangles.update(vertices);
+/// ...
+/// window.draw(triangles);
+/// \endcode
+///
+/// \see sf::Vertex, sf::VertexArray
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp
index d49cb49..a3faa6e 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Main.hpp b/include/SFML/Main.hpp
index f8ac048..c28a7e1 100644
--- a/include/SFML/Main.hpp
+++ b/include/SFML/Main.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 3216c5c..ccc9f7c 100644
--- a/include/SFML/Network.hpp
+++ b/include/SFML/Network.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Export.hpp b/include/SFML/Network/Export.hpp
index 4a8d800..e7ebdd4 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 3600a9d..ee779cc 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -475,16 +475,20 @@ public:
/// remote path is relative to the current directory of the
/// FTP server.
///
+ /// The append parameter controls whether the remote file is
+ /// appended to or overwritten if it already exists.
+ ///
/// \param localFile Path of the local file to upload
/// \param remotePath The directory in which to put the file on the server
/// \param mode Transfer mode
+ /// \param append Pass true to append to or false to overwrite the remote file if it already exists
///
/// \return Server response to the request
///
/// \see download
///
////////////////////////////////////////////////////////////
- Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary);
+ Response upload(const std::string& localFile, const std::string& remotePath, TransferMode mode = Binary, bool append = false);
////////////////////////////////////////////////////////////
/// \brief Send a command to the FTP server
diff --git a/include/SFML/Network/Http.hpp b/include/SFML/Network/Http.hpp
index d165a7c..44fe67d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 4940f2b..9ec13c4 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 ac97692..9f0edab 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -171,45 +171,165 @@ public:
operator BoolType() const;
////////////////////////////////////////////////////////////
- /// Overloads of operator >> to read data from the packet
+ /// Overload of operator >> to read data from the packet
///
////////////////////////////////////////////////////////////
Packet& operator >>(bool& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Int8& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Uint8& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Int16& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Uint16& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Int32& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Uint32& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Int64& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(Uint64& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(float& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(double& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(char* data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(std::string& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(wchar_t* data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(std::wstring& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator >>(String& data);
////////////////////////////////////////////////////////////
- /// Overloads of operator << to write data into the packet
+ /// Overload of operator << to write data into the packet
///
////////////////////////////////////////////////////////////
Packet& operator <<(bool data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Int8 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Uint8 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Int16 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Uint16 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Int32 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Uint32 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Int64 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(Uint64 data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(float data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(double data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(const char* data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(const std::string& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(const wchar_t* data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(const std::wstring& data);
+
+ ////////////////////////////////////////////////////////////
+ /// \overload
+ ////////////////////////////////////////////////////////////
Packet& operator <<(const String& data);
protected:
diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp
index 0b11171..d260174 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/SocketHandle.hpp b/include/SFML/Network/SocketHandle.hpp
index d5b395d..270201b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 92dcbad..106d708 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 720ebf1..e0e05d6 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -65,14 +65,16 @@ public:
unsigned short getLocalPort() const;
////////////////////////////////////////////////////////////
- /// \brief Start listening for connections
+ /// \brief Start listening for incoming connection attempts
///
- /// This functions makes the socket listen to the specified
- /// port, waiting for new connections.
- /// If the socket was previously listening to another port,
- /// it will be stopped first and bound to the new port.
+ /// This function makes the socket start listening on the
+ /// specified port, waiting for incoming connection attempts.
///
- /// \param port Port to listen for new connections
+ /// If the socket is already listening on a port when this
+ /// function is called, it will stop listening on the old
+ /// port before starting to listen on the new port.
+ ///
+ /// \param port Port to listen on for incoming connection attempts
/// \param address Address of the interface to listen on
///
/// \return Status code
diff --git a/include/SFML/Network/TcpSocket.hpp b/include/SFML/Network/TcpSocket.hpp
index da6b549..6c0ab98 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -97,7 +97,8 @@ public:
/// In blocking mode, this function may take a while, especially
/// if the remote peer is not reachable. The last parameter allows
/// you to stop trying to connect after a given timeout.
- /// If the socket was previously connected, it is first disconnected.
+ /// If the socket is already connected, the connection is
+ /// forcibly disconnected before attempting to connect again.
///
/// \param remoteAddress Address of the remote peer
/// \param remotePort Port of the remote peer
diff --git a/include/SFML/Network/UdpSocket.hpp b/include/SFML/Network/UdpSocket.hpp
index 6ee191c..7ce3fe5 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -82,6 +82,11 @@ public:
/// system to automatically pick an available port, and then
/// call getLocalPort to retrieve the chosen port.
///
+ /// Since the socket can only be bound to a single port at
+ /// any given moment, if it is already bound when this
+ /// function is called, it will be unbound from the previous
+ /// port before being bound to the new one.
+ ///
/// \param port Port to bind the socket to
/// \param address Address of the interface to bind to
///
diff --git a/include/SFML/OpenGL.hpp b/include/SFML/OpenGL.hpp
index 39e97b6..6db5d01 100644
--- a/include/SFML/OpenGL.hpp
+++ b/include/SFML/OpenGL.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -45,7 +45,7 @@
#include <GL/gl.h>
-#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
+#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)
#if defined(SFML_OPENGL_ES)
#include <GLES/gl.h>
@@ -69,6 +69,7 @@
#include <GLES/glext.h>
// We're not using OpenGL ES 2+ yet, but we can use the sRGB extension
+ #include <GLES2/gl2platform.h>
#include <GLES2/gl2ext.h>
#endif
diff --git a/include/SFML/System.hpp b/include/SFML/System.hpp
index 5f18f76..fa4f9c9 100644
--- a/include/SFML/System.hpp
+++ b/include/SFML/System.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Clock.hpp b/include/SFML/System/Clock.hpp
index 0e57d60..391e2c4 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 56505a9..a701fef 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 0387c2e..e9c8ef8 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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
index b1a8c62..43618da 100644
--- a/include/SFML/System/FileInputStream.hpp
+++ b/include/SFML/System/FileInputStream.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/InputStream.hpp b/include/SFML/System/InputStream.hpp
index 4419a0b..495a4b9 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Lock.hpp b/include/SFML/System/Lock.hpp
index eb420a8..906016c 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/MemoryInputStream.hpp b/include/SFML/System/MemoryInputStream.hpp
index c26f823..4b7f9ef 100644
--- a/include/SFML/System/MemoryInputStream.hpp
+++ b/include/SFML/System/MemoryInputStream.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Mutex.hpp b/include/SFML/System/Mutex.hpp
index 18349e4..eda6909 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/NativeActivity.hpp b/include/SFML/System/NativeActivity.hpp
index 7927620..e8a3b17 100644
--- a/include/SFML/System/NativeActivity.hpp
+++ b/include/SFML/System/NativeActivity.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/NonCopyable.hpp b/include/SFML/System/NonCopyable.hpp
index 7a483bc..dbe1eeb 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -51,6 +51,16 @@ protected:
///
////////////////////////////////////////////////////////////
NonCopyable() {}
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default destructor
+ ///
+ /// By declaring a protected destructor it's impossible to
+ /// call delete on a pointer of sf::NonCopyable, thus
+ /// preventing possible resource leaks.
+ ///
+ ////////////////////////////////////////////////////////////
+ ~NonCopyable() {}
private:
diff --git a/include/SFML/System/Sleep.hpp b/include/SFML/System/Sleep.hpp
index e943aa1..ac3144b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 8b0da3f..5d047e2 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 1be1266..b8893e7 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 65c9127..15ae4a5 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 b707aa3..1f2e8de 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 6975e52..1ace1ba 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 751a9b5..bee944d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 5652f56..12c7690 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 4dff928..43d7548 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 819d8ff..e1e78f6 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 6ffceda..67fad8b 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -26,10 +26,10 @@
////////////////////////////////////////////////////////////
// References:
//
-// http://www.unicode.org/
-// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c
-// http://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h
-// http://people.w3.org/rishida/scripts/uniview/conversion
+// https://www.unicode.org/
+// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.c
+// https://www.unicode.org/Public/PROGRAMS/CVTUTF/ConvertUTF.h
+// https://people.w3.org/rishida/scripts/uniview/conversion
//
////////////////////////////////////////////////////////////
diff --git a/include/SFML/System/Vector2.hpp b/include/SFML/System/Vector2.hpp
index d5e1744..237f214 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 081b211..29ad76f 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 61d0dc7..b12b2f5 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 2f5eea8..b532fe0 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 eefe267..836f13a 100644
--- a/include/SFML/Window.hpp
+++ b/include/SFML/Window.hpp
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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,8 +30,10 @@
////////////////////////////////////////////////////////////
#include <SFML/System.hpp>
+#include <SFML/Window/Clipboard.hpp>
#include <SFML/Window/Context.hpp>
#include <SFML/Window/ContextSettings.hpp>
+#include <SFML/Window/Cursor.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Window/Joystick.hpp>
#include <SFML/Window/Keyboard.hpp>
diff --git a/include/SFML/Window/Clipboard.hpp b/include/SFML/Window/Clipboard.hpp
new file mode 100644
index 0000000..436da8f
--- /dev/null
+++ b/include/SFML/Window/Clipboard.hpp
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2018 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_CLIPBOARD_HPP
+#define SFML_CLIPBOARD_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Window/Export.hpp>
+#include <SFML/System/String.hpp>
+
+
+namespace sf
+{
+////////////////////////////////////////////////////////////
+/// \brief Give access to the system clipboard
+///
+////////////////////////////////////////////////////////////
+class SFML_WINDOW_API Clipboard
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get the content of the clipboard as string data
+ ///
+ /// This function returns the content of the clipboard
+ /// as a string. If the clipboard does not contain string
+ /// it returns an empty sf::String object.
+ ///
+ /// \return Clipboard contents as sf::String object
+ ///
+ ////////////////////////////////////////////////////////////
+ static String getString();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Set the content of the clipboard as string data
+ ///
+ /// This function sets the content of the clipboard as a
+ /// string.
+ ///
+ /// \param text sf::String containing the data to be sent
+ /// to the clipboard
+ ///
+ ////////////////////////////////////////////////////////////
+ static void setString(const String& text);
+};
+
+} // namespace sf
+
+
+#endif // SFML_CLIPBOARD_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::Clipboard
+/// \ingroup window
+///
+/// sf::Clipboard provides an interface for getting and
+/// setting the contents of the system clipboard.
+///
+/// Usage example:
+/// \code
+/// // get the clipboard content as a string
+/// sf::String string = sf::Clipboard::getString();
+///
+/// // or use it in the event loop
+/// sf::Event event;
+/// while(window.pollEvent(event))
+/// {
+/// if(event.type == sf::Event::Closed)
+/// window.close();
+/// if(event.type == sf::Event::KeyPressed)
+/// {
+/// // Using Ctrl + V to paste a string into SFML
+/// if(event.key.control && event.key.code == sf::Keyboard::V)
+/// string = sf::Clipboard::getString();
+/// }
+/// }
+///
+/// // set the clipboard to a string
+/// sf::Clipboard::setString("Hello World!");
+/// \endcode
+///
+/// \see sf::String, sf::Event
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp
index 9e1eedd..71e2c0a 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -112,12 +112,27 @@ public:
////////////////////////////////////////////////////////////
/// \brief Get the currently active context
///
+ /// This function will only return sf::Context objects.
+ /// Contexts created e.g. by RenderTargets or for internal
+ /// use will not be returned by this function.
+ ///
/// \return The currently active context or NULL if none is active
///
////////////////////////////////////////////////////////////
static const Context* getActiveContext();
////////////////////////////////////////////////////////////
+ /// \brief Get the currently active context's ID
+ ///
+ /// The context ID is used to identify contexts when
+ /// managing unshareable OpenGL resources.
+ ///
+ /// \return The active context's ID or 0 if no context is currently active
+ ///
+ ////////////////////////////////////////////////////////////
+ static Uint64 getActiveContextId();
+
+ ////////////////////////////////////////////////////////////
/// \brief Construct a in-memory context
///
/// This constructor is for internal use, you don't need
diff --git a/include/SFML/Window/ContextSettings.hpp b/include/SFML/Window/ContextSettings.hpp
index 2774302..00afbc4 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -25,6 +25,7 @@
#ifndef SFML_CONTEXTSETTINGS_HPP
#define SFML_CONTEXTSETTINGS_HPP
+#include <SFML/Config.hpp>
namespace sf
{
diff --git a/include/SFML/Window/Cursor.hpp b/include/SFML/Window/Cursor.hpp
new file mode 100644
index 0000000..30aebd4
--- /dev/null
+++ b/include/SFML/Window/Cursor.hpp
@@ -0,0 +1,219 @@
+////////////////////////////////////////////////////////////
+//
+// SFML - Simple and Fast Multimedia Library
+// Copyright (C) 2007-2018 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_CURSOR_HPP
+#define SFML_CURSOR_HPP
+
+////////////////////////////////////////////////////////////
+// Headers
+////////////////////////////////////////////////////////////
+#include <SFML/Window/Export.hpp>
+#include <SFML/System/NonCopyable.hpp>
+#include <SFML/System/Vector2.hpp>
+
+namespace sf
+{
+namespace priv
+{
+ class CursorImpl;
+}
+
+////////////////////////////////////////////////////////////
+/// \brief Cursor defines the appearance of a system cursor
+///
+////////////////////////////////////////////////////////////
+class SFML_WINDOW_API Cursor : NonCopyable
+{
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Enumeration of the native system cursor types
+ ///
+ /// Refer to the following table to determine which cursor
+ /// is available on which platform.
+ ///
+ /// Type | Linux | Mac OS X | Windows |
+ /// ------------------------------------|:-----:|:--------:|:--------:|
+ /// sf::Cursor::Arrow | yes | yes | yes |
+ /// sf::Cursor::ArrowWait | no | no | yes |
+ /// sf::Cursor::Wait | yes | no | yes |
+ /// sf::Cursor::Text | yes | yes | yes |
+ /// sf::Cursor::Hand | yes | yes | yes |
+ /// sf::Cursor::SizeHorizontal | yes | yes | yes |
+ /// sf::Cursor::SizeVertical | yes | yes | yes |
+ /// sf::Cursor::SizeTopLeftBottomRight | no | no | yes |
+ /// sf::Cursor::SizeBottomLeftTopRight | no | no | yes |
+ /// sf::Cursor::SizeAll | yes | no | yes |
+ /// sf::Cursor::Cross | yes | yes | yes |
+ /// sf::Cursor::Help | yes | no | yes |
+ /// sf::Cursor::NotAllowed | yes | yes | yes |
+ ///
+ ////////////////////////////////////////////////////////////
+ enum Type
+ {
+ Arrow, ///< Arrow cursor (default)
+ ArrowWait, ///< Busy arrow cursor
+ Wait, ///< Busy cursor
+ Text, ///< I-beam, cursor when hovering over a field allowing text entry
+ Hand, ///< Pointing hand cursor
+ SizeHorizontal, ///< Horizontal double arrow cursor
+ SizeVertical, ///< Vertical double arrow cursor
+ SizeTopLeftBottomRight, ///< Double arrow cursor going from top-left to bottom-right
+ SizeBottomLeftTopRight, ///< Double arrow cursor going from bottom-left to top-right
+ SizeAll, ///< Combination of SizeHorizontal and SizeVertical
+ Cross, ///< Crosshair cursor
+ Help, ///< Help cursor
+ NotAllowed ///< Action not allowed cursor
+ };
+
+public:
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Default constructor
+ ///
+ /// This constructor doesn't actually create the cursor;
+ /// initially the new instance is invalid and must not be
+ /// used until either loadFromPixels() or loadFromSystem()
+ /// is called and successfully created a cursor.
+ ///
+ ////////////////////////////////////////////////////////////
+ Cursor();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Destructor
+ ///
+ /// This destructor releases the system resources
+ /// associated with this cursor, if any.
+ ///
+ ////////////////////////////////////////////////////////////
+ ~Cursor();
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Create a cursor with the provided image
+ ///
+ /// \a pixels must be an array of \a width by \a height pixels
+ /// in 32-bit RGBA format. If not, this will cause undefined behavior.
+ ///
+ /// If \a pixels is null or either \a width or \a height are 0,
+ /// the current cursor is left unchanged and the function will
+ /// return false.
+ ///
+ /// In addition to specifying the pixel data, you can also
+ /// specify the location of the hotspot of the cursor. The
+ /// hotspot is the pixel coordinate within the cursor image
+ /// which will be located exactly where the mouse pointer
+ /// position is. Any mouse actions that are performed will
+ /// return the window/screen location of the hotspot.
+ ///
+ /// \warning On Unix, the pixels are mapped into a monochrome
+ /// bitmap: pixels with an alpha channel to 0 are
+ /// transparent, black if the RGB channel are close
+ /// to zero, and white otherwise.
+ ///
+ /// \param pixels Array of pixels of the image
+ /// \param size Width and height of the image
+ /// \param hotspot (x,y) location of the hotspot
+ /// \return true if the cursor was successfully loaded;
+ /// false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ bool loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot);
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Create a native system cursor
+ ///
+ /// Refer to the list of cursor available on each system
+ /// (see sf::Cursor::Type) to know whether a given cursor is
+ /// expected to load successfully or is not supported by
+ /// the operating system.
+ ///
+ /// \param type Native system cursor type
+ /// \return true if and only if the corresponding cursor is
+ /// natively supported by the operating system;
+ /// false otherwise
+ ///
+ ////////////////////////////////////////////////////////////
+ bool loadFromSystem(Type type);
+
+private:
+
+ friend class Window;
+
+ ////////////////////////////////////////////////////////////
+ /// \brief Get access to the underlying implementation
+ ///
+ /// This is primarily designed for sf::Window::setMouseCursor,
+ /// hence the friendship.
+ ///
+ /// \return a reference to the OS-specific implementation
+ ///
+ ////////////////////////////////////////////////////////////
+ const priv::CursorImpl& getImpl() const;
+
+private:
+
+ ////////////////////////////////////////////////////////////
+ // Member data
+ ////////////////////////////////////////////////////////////
+ priv::CursorImpl* m_impl; ///< Platform-specific implementation of the cursor
+};
+
+} // namespace sf
+
+
+#endif // SFML_CURSOR_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::Cursor
+/// \ingroup window
+///
+/// \warning Features related to Cursor are not supported on
+/// iOS and Android.
+///
+/// This class abstracts the operating system resources
+/// associated with either a native system cursor or a custom
+/// cursor.
+///
+/// After loading the cursor the graphical appearance
+/// with either loadFromPixels() or loadFromSystem(), the
+/// cursor can be changed with sf::Window::setMouseCursor().
+///
+/// The behaviour is undefined if the cursor is destroyed while
+/// in use by the window.
+///
+/// Usage example:
+/// \code
+/// sf::Window window;
+///
+/// // ... create window as usual ...
+///
+/// sf::Cursor cursor;
+/// if (cursor.loadFromSystem(sf::Cursor::Hand))
+/// window.setMouseCursor(cursor);
+/// \endcode
+///
+/// \see sf::Window::setMouseCursor
+///
+////////////////////////////////////////////////////////////
diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp
index 7bfd610..9261785 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -257,7 +257,7 @@ public:
/// filled; all other members will have undefined values and must not
/// be read if the type of the event doesn't match. For example,
/// if you received a KeyPressed event, then you must read the
-/// event.key member, all other members such as event.MouseMove
+/// event.key member, all other members such as event.mouseMove
/// or event.text will have undefined values.
///
/// Usage example:
diff --git a/include/SFML/Window/Export.hpp b/include/SFML/Window/Export.hpp
index a890bee..37826a2 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 d386c08..f701242 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -37,6 +37,8 @@ namespace sf
class Context;
+typedef void(*ContextDestroyCallback)(void*);
+
////////////////////////////////////////////////////////////
/// \brief Base class for classes that require an OpenGL context
///
@@ -58,10 +60,17 @@ protected:
~GlResource();
////////////////////////////////////////////////////////////
- /// \brief Empty function for ABI compatibility, use acquireTransientContext instead
+ /// \brief Register a function to be called when a context is destroyed
+ ///
+ /// This is used for internal purposes in order to properly
+ /// clean up OpenGL resources that cannot be shared between
+ /// contexts.
+ ///
+ /// \param callback Function to be called when a context is destroyed
+ /// \param arg Argument to pass when calling the function
///
////////////////////////////////////////////////////////////
- static void ensureGlContext();
+ static void registerContextDestroyCallback(ContextDestroyCallback callback, void* arg);
////////////////////////////////////////////////////////////
/// \brief RAII helper class to temporarily lock an available context for use
@@ -81,9 +90,6 @@ protected:
///
////////////////////////////////////////////////////////////
~TransientContextLock();
-
- private:
- Context* m_context; ///< Temporary context, in case we needed to create one
};
};
diff --git a/include/SFML/Window/Joystick.hpp b/include/SFML/Window/Joystick.hpp
index dda7369..ab49c74 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Keyboard.hpp b/include/SFML/Window/Keyboard.hpp
index b35c7a0..7c59c57 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -96,18 +96,18 @@ public:
Menu, ///< The Menu key
LBracket, ///< The [ key
RBracket, ///< The ] key
- SemiColon, ///< The ; key
+ Semicolon, ///< The ; key
Comma, ///< The , key
Period, ///< The . key
Quote, ///< The ' key
Slash, ///< The / key
- BackSlash, ///< The \ key
+ Backslash, ///< The \ key
Tilde, ///< The ~ key
Equal, ///< The = key
- Dash, ///< The - key
+ Hyphen, ///< The - key (hyphen)
Space, ///< The Space key
- Return, ///< The Return key
- BackSpace, ///< The Backspace key
+ Enter, ///< The Enter/Return keys
+ Backspace, ///< The Backspace key
Tab, ///< The Tabulation key
PageUp, ///< The Page up key
PageDown, ///< The Page down key
@@ -116,7 +116,7 @@ public:
Insert, ///< The Insert key
Delete, ///< The Delete key
Add, ///< The + key
- Subtract, ///< The - key
+ Subtract, ///< The - key (minus, usually from numpad)
Multiply, ///< The * key
Divide, ///< The / key
Left, ///< Left arrow
@@ -150,7 +150,15 @@ public:
F15, ///< The F15 key
Pause, ///< The Pause key
- KeyCount ///< Keep last -- the total number of keyboard keys
+ KeyCount, ///< Keep last -- the total number of keyboard keys
+
+ // Deprecated values:
+
+ Dash = Hyphen, ///< \deprecated Use Hyphen instead
+ BackSpace = Backspace, ///< \deprecated Use Backspace instead
+ BackSlash = Backslash, ///< \deprecated Use Backslash instead
+ SemiColon = Semicolon, ///< \deprecated Use Semicolon instead
+ Return = Enter ///< \deprecated Use Enter instead
};
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Window/Mouse.hpp b/include/SFML/Window/Mouse.hpp
index 53d5281..0d1e470 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Sensor.hpp b/include/SFML/Window/Sensor.hpp
index 9bef970..6915fa0 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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/Touch.hpp b/include/SFML/Window/Touch.hpp
index 92c42df..1c2b3fe 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 fee45ae..24797f6 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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 7135fdf..7ff81e2 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -28,16 +28,17 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
-#include <SFML/Window/Export.hpp>
#include <SFML/Window/ContextSettings.hpp>
+#include <SFML/Window/Cursor.hpp>
+#include <SFML/Window/Export.hpp>
+#include <SFML/Window/GlResource.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowStyle.hpp>
-#include <SFML/Window/GlResource.hpp>
#include <SFML/System/Clock.hpp>
-#include <SFML/System/Vector2.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/String.hpp>
+#include <SFML/System/Vector2.hpp>
namespace sf
@@ -362,6 +363,25 @@ public:
void setMouseCursorGrabbed(bool grabbed);
////////////////////////////////////////////////////////////
+ /// \brief Set the displayed cursor to a native system cursor
+ ///
+ /// Upon window creation, the arrow cursor is used by default.
+ ///
+ /// \warning The cursor must not be destroyed while in use by
+ /// the window.
+ ///
+ /// \warning Features related to Cursor are not supported on
+ /// iOS and Android.
+ ///
+ /// \param cursor Native system cursor type to display
+ ///
+ /// \see sf::Cursor::loadFromSystem
+ /// \see sf::Cursor::loadFromPixels
+ ///
+ ////////////////////////////////////////////////////////////
+ void setMouseCursor(const Cursor& cursor);
+
+ ////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat
///
/// If key repeat is enabled, you will receive repeated
@@ -561,6 +581,14 @@ private:
/// structure which is passed as an optional argument when creating the
/// window.
///
+/// On dual-graphics systems consisting of a low-power integrated GPU
+/// and a powerful discrete GPU, the driver picks which GPU will run an
+/// SFML application. In order to inform the driver that an SFML application
+/// can benefit from being run on the more powerful discrete GPU,
+/// #SFML_DEFINE_DISCRETE_GPU_PREFERENCE can be placed in a source file
+/// that is compiled and linked into the final application. The macro
+/// should be placed outside of any scopes in the global namespace.
+///
/// Usage example:
/// \code
/// // Declare and create a new window
diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp
index bfb4dc5..daad047 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.
@@ -42,7 +42,7 @@ namespace sf
// Window handle is HWND (HWND__*) on Windows
typedef HWND__* WindowHandle;
-#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
+#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)
// Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle;
@@ -65,7 +65,7 @@ namespace sf
#elif defined(SFML_DOXYGEN)
// Define typedef symbol so that Doxygen can attach some documentation to it
- typedef "platform–specific" WindowHandle;
+ typedef "platform-specific" WindowHandle;
#endif
diff --git a/include/SFML/Window/WindowStyle.hpp b/include/SFML/Window/WindowStyle.hpp
index 8623d1f..53e2c9d 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-2017 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2018 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.