Aktualizacja do SFML 2.6.2

This commit is contained in:
2024-11-22 13:40:21 +01:00
parent d0e29b36b8
commit 86ad380275
691 changed files with 1541 additions and 95839 deletions

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,7 +32,7 @@
#include <SFML/System/NonCopyable.hpp>
#include <SFML/System/Time.hpp>
#include <string>
#include <algorithm>
#include <cstddef>
namespace sf
@@ -63,9 +63,14 @@ public:
////////////////////////////////////////////////////////////
/// \brief Open a sound file from the disk for reading
///
/// The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC.
/// The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC, MP3.
/// The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit.
///
/// Because of minimp3_ex limitation, for MP3 files with big (>16kb) APEv2 tag,
/// it may not be properly removed, tag data will be treated as MP3 data
/// and there is a low chance of garbage decoded at the end of file.
/// See also: https://github.com/lieff/minimp3
///
/// \param filename Path of the sound file to load
///
/// \return True if the file was successfully opened
@@ -195,24 +200,24 @@ public:
////////////////////////////////////////////////////////////
Uint64 read(Int16* samples, Uint64 maxCount);
private:
////////////////////////////////////////////////////////////
/// \brief Close the current file
///
////////////////////////////////////////////////////////////
void close();
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
SoundFileReader* m_reader; ///< Reader that handles I/O on the file's format
InputStream* m_stream; ///< Input stream used to access the file's data
bool m_streamOwned; ///< Is the stream internal or external?
Uint64 m_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
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
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -79,8 +79,8 @@ public:
}
T offset; ///< The beginning offset of the time range
T length; ///< The length of the time range
T offset; //!< The beginning offset of the time range
T length; //!< The length of the time range
};
// Define the relevant Span types
@@ -189,11 +189,11 @@ public:
TimeSpan getLoopPoints() const;
////////////////////////////////////////////////////////////
/// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
/// \brief Sets the beginning and duration of the sound's looping sequence using sf::Time
///
/// Loop points allow one to specify a pair of positions such that, when the music
/// setLoopPoints() allows for specifying the beginning offset and the duration of the loop 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
/// encounters the end of the duration. 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
@@ -276,10 +276,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
InputSoundFile m_file; ///< The streamed music file
std::vector<Int16> m_samples; ///< Temporary buffer of samples
Mutex m_mutex; ///< Mutex protecting the data
Span<Uint64> m_loopSpan; ///< Loop Range Specifier
InputSoundFile m_file; //!< The streamed music file
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

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,18 +82,18 @@ public:
////////////////////////////////////////////////////////////
void write(const Int16* samples, Uint64 count);
private:
////////////////////////////////////////////////////////////
/// \brief Close the current file
///
////////////////////////////////////////////////////////////
void close();
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
SoundFileWriter* m_writer; ///< Writer that handles I/O on the file's format
SoundFileWriter* m_writer; //!< Writer that handles I/O on the file's format
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -217,7 +217,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
const SoundBuffer* m_buffer; ///< Sound buffer bound to the source
const SoundBuffer* m_buffer; //!< Sound buffer bound to the source
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -267,15 +267,15 @@ private:
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////
typedef std::set<Sound*> SoundList; ///< Set of unique sound instances
typedef std::set<Sound*> SoundList; //!< Set of unique sound instances
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int m_buffer; ///< OpenAL buffer identifier
std::vector<Int16> m_samples; ///< Samples buffer
Time m_duration; ///< Sound duration
mutable SoundList m_sounds; ///< List of sounds that are using this buffer
unsigned int m_buffer; //!< OpenAL buffer identifier
std::vector<Int16> m_samples; //!< Samples buffer
Time m_duration; //!< Sound duration
mutable SoundList m_sounds; //!< List of sounds that are using this buffer
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,8 +96,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<Int16> m_samples; ///< Temporary sample buffer to hold the recorded data
SoundBuffer m_buffer; ///< Sound buffer that will contain the recorded data
std::vector<Int16> m_samples; //!< Temporary sample buffer to hold the recorded data
SoundBuffer m_buffer; //!< Sound buffer that will contain the recorded data
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -160,8 +160,8 @@ private:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static ReaderFactoryArray s_readers; ///< List of all registered readers
static WriterFactoryArray s_writers; ///< List of all registered writers
static ReaderFactoryArray s_readers; //!< List of all registered readers
static WriterFactoryArray s_writers; //!< List of all registered writers
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,9 +50,9 @@ public:
////////////////////////////////////////////////////////////
struct Info
{
Uint64 sampleCount; ///< Total number of samples in the file
unsigned int channelCount; ///< Number of channels of the sound
unsigned int sampleRate; ///< Samples rate of the sound, in samples per second
Uint64 sampleCount; //!< Total number of samples in the file
unsigned int channelCount; //!< Number of channels of the sound
unsigned int sampleRate; //!< Samples rate of the sound, in samples per second
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -285,13 +285,13 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Thread m_thread; ///< Thread running the background recording task
std::vector<Int16> m_samples; ///< Buffer to store captured samples
unsigned int m_sampleRate; ///< Sample rate
Time m_processingInterval; ///< Time period between calls to onProcessSamples
bool m_isCapturing; ///< Capturing state
std::string m_deviceName; ///< Name of the audio capture device
unsigned int m_channelCount; ///< Number of recording channels
Thread m_thread; //!< Thread running the background recording task
std::vector<Int16> m_samples; //!< Buffer to store captured samples
unsigned int m_sampleRate; //!< Sample rate
Time m_processingInterval; //!< Time period between calls to onProcessSamples
bool m_isCapturing; //!< Capturing state
std::string m_deviceName; //!< Name of the audio capture device
unsigned int m_channelCount; //!< Number of recording channels
};
} // namespace sf
@@ -359,12 +359,14 @@ private:
/// \code
/// class CustomRecorder : public sf::SoundRecorder
/// {
/// public:
/// ~CustomRecorder()
/// {
/// // Make sure to stop the recording thread
/// stop();
/// }
///
/// private:
/// virtual bool onStart() // optional
/// {
/// // Initialize whatever has to be done before the capture starts
@@ -374,7 +376,7 @@ private:
/// return true;
/// }
///
/// virtual bool onProcessSamples(const Int16* samples, std::size_t sampleCount)
/// virtual bool onProcessSamples(const sf::Int16* samples, std::size_t sampleCount)
/// {
/// // Do something with the new chunk of samples (store them, send them, ...)
/// ...
@@ -388,7 +390,7 @@ private:
/// // Clean up whatever has to be done after the capture ends
/// ...
/// }
/// }
/// };
///
/// // Usage
/// if (CustomRecorder::isAvailable())

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -49,9 +49,9 @@ public:
////////////////////////////////////////////////////////////
enum Status
{
Stopped, ///< Sound is not playing
Paused, ///< Sound is paused
Playing ///< Sound is playing
Stopped, //!< Sound is not playing
Paused, //!< Sound is paused
Playing //!< Sound is playing
};
////////////////////////////////////////////////////////////
@@ -306,7 +306,7 @@ protected:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int m_source; ///< OpenAL source identifier
unsigned int m_source; //!< OpenAL source identifier
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -52,8 +52,8 @@ public:
////////////////////////////////////////////////////////////
struct Chunk
{
const Int16* samples; ///< Pointer to the audio samples
std::size_t sampleCount; ///< Number of samples pointed by Samples
const Int16* samples; //!< Pointer to the audio samples
std::size_t sampleCount; //!< Number of samples pointed by Samples
};
////////////////////////////////////////////////////////////
@@ -182,7 +182,7 @@ protected:
enum
{
NoLoop = -1 ///< "Invalid" endSeeks value, telling us to continue uninterrupted
NoLoop = -1 //!< "Invalid" endSeeks value, telling us to continue uninterrupted
};
////////////////////////////////////////////////////////////
@@ -251,6 +251,20 @@ protected:
////////////////////////////////////////////////////////////
virtual Int64 onLoop();
////////////////////////////////////////////////////////////
/// \brief Set the processing interval
///
/// The processing interval controls the period at which the
/// audio buffers are filled by calls to onGetData. A smaller
/// interval may be useful for low-latency streams. Note that
/// the given period is only a hint and the actual period may
/// vary. The default processing interval is 10 ms.
///
/// \param interval Processing interval
///
////////////////////////////////////////////////////////////
void setProcessingInterval(Time interval);
private:
////////////////////////////////////////////////////////////
@@ -299,24 +313,25 @@ private:
enum
{
BufferCount = 3, ///< Number of audio buffers used by the streaming loop
BufferRetries = 2 ///< Number of retries (excluding initial try) for onGetData()
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
Int64 m_bufferSeeks[BufferCount]; ///< If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset 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)
Int32 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 samples 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.
Time m_processingInterval; //!< Interval for checking and filling the internal sound buffers.
};
} // namespace sf
@@ -387,12 +402,12 @@ private:
/// return true;
/// }
///
/// virtual void onSeek(Uint32 timeOffset)
/// virtual void onSeek(sf::Time timeOffset)
/// {
/// // Change the current position in the stream source
/// ...
/// }
/// }
/// };
///
/// // Usage
/// CustomStream stream;

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,13 +30,13 @@
// Define the SFML version
////////////////////////////////////////////////////////////
#define SFML_VERSION_MAJOR 2
#define SFML_VERSION_MINOR 5
#define SFML_VERSION_PATCH 1
#define SFML_VERSION_MINOR 6
#define SFML_VERSION_PATCH 2
////////////////////////////////////////////////////////////
// Identify the operating system
// see http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system
// see https://sourceforge.net/p/predef/wiki/Home/
////////////////////////////////////////////////////////////
#if defined(_WIN32)
@@ -91,6 +91,11 @@
// OpenBSD
#define SFML_SYSTEM_OPENBSD
#elif defined(__NetBSD__)
// NetBSD
#define SFML_SYSTEM_NETBSD
#else
// Unsupported UNIX system
@@ -226,8 +231,15 @@ namespace sf
typedef signed __int64 Int64;
typedef unsigned __int64 Uint64;
#else
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++11-long-long"
#endif
typedef signed long long Int64;
typedef unsigned long long Uint64;
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#endif
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -48,16 +48,16 @@ struct SFML_GRAPHICS_API BlendMode
////////////////////////////////////////////////////////
enum Factor
{
Zero, ///< (0, 0, 0, 0)
One, ///< (1, 1, 1, 1)
SrcColor, ///< (src.r, src.g, src.b, src.a)
OneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
DstColor, ///< (dst.r, dst.g, dst.b, dst.a)
OneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
SrcAlpha, ///< (src.a, src.a, src.a, src.a)
OneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
DstAlpha, ///< (dst.a, dst.a, dst.a, dst.a)
OneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
Zero, //!< (0, 0, 0, 0)
One, //!< (1, 1, 1, 1)
SrcColor, //!< (src.r, src.g, src.b, src.a)
OneMinusSrcColor, //!< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
DstColor, //!< (dst.r, dst.g, dst.b, dst.a)
OneMinusDstColor, //!< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
SrcAlpha, //!< (src.a, src.a, src.a, src.a)
OneMinusSrcAlpha, //!< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
DstAlpha, //!< (dst.a, dst.a, dst.a, dst.a)
OneMinusDstAlpha //!< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
};
////////////////////////////////////////////////////////
@@ -68,9 +68,11 @@ struct SFML_GRAPHICS_API BlendMode
////////////////////////////////////////////////////////
enum Equation
{
Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
Subtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
ReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor
Add, //!< Pixel = Src * SrcFactor + Dst * DstFactor
Subtract, //!< Pixel = Src * SrcFactor - Dst * DstFactor
ReverseSubtract, //!< Pixel = Dst * DstFactor - Src * SrcFactor
Min, //!< Pixel = min(Dst, Src)
Max //!< Pixel = max(Dst, Src)
};
////////////////////////////////////////////////////////////
@@ -112,12 +114,12 @@ struct SFML_GRAPHICS_API BlendMode
////////////////////////////////////////////////////////////
// Member Data
////////////////////////////////////////////////////////////
Factor colorSrcFactor; ///< Source blending factor for the color channels
Factor colorDstFactor; ///< Destination blending factor for the color channels
Equation colorEquation; ///< Blending equation for the color channels
Factor alphaSrcFactor; ///< Source blending factor for the alpha channel
Factor alphaDstFactor; ///< Destination blending factor for the alpha channel
Equation alphaEquation; ///< Blending equation for the alpha channel
Factor colorSrcFactor; //!< Source blending factor for the color channels
Factor colorDstFactor; //!< Destination blending factor for the color channels
Equation colorEquation; //!< Blending equation for the color channels
Factor alphaSrcFactor; //!< Source blending factor for the alpha channel
Factor alphaDstFactor; //!< Destination blending factor for the alpha channel
Equation alphaEquation; //!< Blending equation for the alpha channel
};
////////////////////////////////////////////////////////////
@@ -147,10 +149,12 @@ SFML_GRAPHICS_API bool operator !=(const BlendMode& left, const BlendMode& right
////////////////////////////////////////////////////////////
// Commonly used blending modes
////////////////////////////////////////////////////////////
SFML_GRAPHICS_API extern const BlendMode BlendAlpha; ///< Blend source and dest according to dest alpha
SFML_GRAPHICS_API extern const BlendMode BlendAdd; ///< Add source to dest
SFML_GRAPHICS_API extern const BlendMode BlendMultiply; ///< Multiply source and dest
SFML_GRAPHICS_API extern const BlendMode BlendNone; ///< Overwrite dest with source
SFML_GRAPHICS_API extern const BlendMode BlendAlpha; //!< Blend source and dest according to dest alpha
SFML_GRAPHICS_API extern const BlendMode BlendAdd; //!< Add source to dest
SFML_GRAPHICS_API extern const BlendMode BlendMultiply; //!< Multiply source and dest
SFML_GRAPHICS_API extern const BlendMode BlendMin; //!< Take minimum between source and dest
SFML_GRAPHICS_API extern const BlendMode BlendMax; //!< Take maximum between source and dest
SFML_GRAPHICS_API extern const BlendMode BlendNone; //!< Overwrite dest with source
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -111,8 +111,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
float m_radius; ///< Radius of the circle
std::size_t m_pointCount; ///< Number of points composing the circle
float m_radius; //!< Radius of the circle
std::size_t m_pointCount; //!< Number of points composing the circle
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,23 +80,23 @@ public:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const Color Black; ///< Black predefined color
static const Color White; ///< White predefined color
static const Color Red; ///< Red predefined color
static const Color Green; ///< Green predefined color
static const Color Blue; ///< Blue predefined color
static const Color Yellow; ///< Yellow predefined color
static const Color Magenta; ///< Magenta predefined color
static const Color Cyan; ///< Cyan predefined color
static const Color Transparent; ///< Transparent (black) predefined color
static const Color Black; //!< Black predefined color
static const Color White; //!< White predefined color
static const Color Red; //!< Red predefined color
static const Color Green; //!< Green predefined color
static const Color Blue; //!< Blue predefined color
static const Color Yellow; //!< Yellow predefined color
static const Color Magenta; //!< Magenta predefined color
static const Color Cyan; //!< Cyan predefined color
static const Color Transparent; //!< Transparent (black) predefined color
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Uint8 r; ///< Red component
Uint8 g; ///< Green component
Uint8 b; ///< Blue component
Uint8 a; ///< Alpha (opacity) component
Uint8 r; //!< Red component
Uint8 g; //!< Green component
Uint8 b; //!< Blue component
Uint8 a; //!< Alpha (opacity) component
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,7 +112,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<Vector2f> m_points; ///< Points composing the convex polygon
std::vector<Vector2f> m_points; //!< Points composing the convex polygon
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,8 +32,6 @@
#include <SFML/Graphics/Glyph.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/String.hpp>
#include <map>
#include <string>
#include <vector>
@@ -57,7 +55,7 @@ public:
////////////////////////////////////////////////////////////
struct Info
{
std::string family; ///< The font family
std::string family; //!< The font family
};
public:
@@ -166,6 +164,10 @@ public:
/// might be available. If the glyph is not available at the
/// requested size, an empty glyph is returned.
///
/// You may want to use \ref hasGlyph to determine if the
/// glyph exists before requesting it. If the glyph does not
/// exist, a font specific default is returned.
///
/// Be aware that using a negative value for the outline
/// thickness will cause distorted rendering.
///
@@ -179,6 +181,24 @@ public:
////////////////////////////////////////////////////////////
const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness = 0) const;
////////////////////////////////////////////////////////////
/// \brief Determine if this font has a glyph representing the requested code point
///
/// Most fonts only include a very limited selection of glyphs from
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
///
/// While code points without representation will return a font specific
/// default character, it might be useful to verify whether specific
/// code points are included to determine whether a font is suited
/// to display text in a specific language.
///
/// \param codePoint Unicode code point to check
///
/// \return True if the codepoint has a glyph representation, false otherwise
///
////////////////////////////////////////////////////////////
bool hasGlyph(Uint32 codePoint) const;
////////////////////////////////////////////////////////////
/// \brief Get the kerning offset of two glyphs
///
@@ -195,7 +215,7 @@ public:
/// \return Kerning value for \a first and \a second, in pixels
///
////////////////////////////////////////////////////////////
float getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
float getKerning(Uint32 first, Uint32 second, unsigned int characterSize, bool bold = false) const;
////////////////////////////////////////////////////////////
/// \brief Get the line spacing
@@ -253,6 +273,32 @@ public:
////////////////////////////////////////////////////////////
const Texture& getTexture(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Enable or disable the smooth filter
///
/// When the filter is activated, the font appears smoother
/// so that pixels are less noticeable. However if you want
/// the font to look exactly the same as its source file,
/// you should disable it.
/// The smooth filter is enabled by default.
///
/// \param smooth True to enable smoothing, false to disable it
///
/// \see isSmooth
///
////////////////////////////////////////////////////////////
void setSmooth(bool smooth);
////////////////////////////////////////////////////////////
/// \brief Tell whether the smooth filter is enabled or not
///
/// \return True if smoothing is enabled, false if it is disabled
///
/// \see setSmooth
///
////////////////////////////////////////////////////////////
bool isSmooth() const;
////////////////////////////////////////////////////////////
/// \brief Overload of assignment operator
///
@@ -273,15 +319,15 @@ private:
{
Row(unsigned int rowTop, unsigned int rowHeight) : width(0), top(rowTop), height(rowHeight) {}
unsigned int width; ///< Current width of the row
unsigned int top; ///< Y position of the row into the texture
unsigned int height; ///< Height of the row
unsigned int width; //!< Current width of the row
unsigned int top; //!< Y position of the row into the texture
unsigned int height; //!< Height of the row
};
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////
typedef std::map<Uint64, Glyph> GlyphTable; ///< Table mapping a codepoint to its glyph
typedef std::map<Uint64, Glyph> GlyphTable; //!< Table mapping a codepoint to its glyph
////////////////////////////////////////////////////////////
/// \brief Structure defining a page of glyphs
@@ -289,12 +335,12 @@ private:
////////////////////////////////////////////////////////////
struct Page
{
Page();
explicit Page(bool smooth);
GlyphTable glyphs; ///< Table mapping code points to their corresponding glyph
Texture texture; ///< Texture containing the pixels of the glyphs
unsigned int nextRow; ///< Y position of the next new row in the texture
std::vector<Row> rows; ///< List containing the position of all the existing rows
GlyphTable glyphs; //!< Table mapping code points to their corresponding glyph
Texture texture; //!< Texture containing the pixels of the glyphs
unsigned int nextRow; //!< Y position of the next new row in the texture
std::vector<Row> rows; //!< List containing the position of all the existing rows
};
////////////////////////////////////////////////////////////
@@ -303,6 +349,16 @@ private:
////////////////////////////////////////////////////////////
void cleanup();
////////////////////////////////////////////////////////////
/// \brief Find or create the glyphs page corresponding to the given character size
///
/// \param characterSize Reference character size
///
/// \return The glyphs page corresponding to \a characterSize
///
////////////////////////////////////////////////////////////
Page& loadPage(unsigned int characterSize) const;
////////////////////////////////////////////////////////////
/// \brief Load a new glyph and store it in the cache
///
@@ -341,21 +397,22 @@ private:
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////
typedef std::map<unsigned int, Page> PageTable; ///< Table mapping a character size to its page (texture)
typedef std::map<unsigned int, Page> PageTable; //!< Table mapping a character size to its page (texture)
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
void* m_library; ///< Pointer to the internal library interface (it is typeless to avoid exposing implementation details)
void* m_face; ///< Pointer to the internal font face (it is typeless to avoid exposing implementation details)
void* m_streamRec; ///< Pointer to the stream rec instance (it is typeless to avoid exposing implementation details)
void* m_stroker; ///< Pointer to the stroker (it is typeless to avoid exposing implementation details)
int* m_refCount; ///< Reference counter used by implicit sharing
Info m_info; ///< Information about the font
mutable PageTable m_pages; ///< Table containing the glyphs pages by character size
mutable std::vector<Uint8> m_pixelBuffer; ///< Pixel buffer holding a glyph's pixels before being written to the texture
void* m_library; //!< Pointer to the internal library interface (it is typeless to avoid exposing implementation details)
void* m_face; //!< Pointer to the internal font face (it is typeless to avoid exposing implementation details)
void* m_streamRec; //!< Pointer to the stream rec instance (it is typeless to avoid exposing implementation details)
void* m_stroker; //!< Pointer to the stroker (it is typeless to avoid exposing implementation details)
int* m_refCount; //!< Reference counter used by implicit sharing
bool m_isSmooth; //!< Status of the smooth filter
Info m_info; //!< Information about the font
mutable PageTable m_pages; //!< Table containing the glyphs pages by character size
mutable std::vector<Uint8> m_pixelBuffer; //!< Pixel buffer holding a glyph's pixels before being written to the texture
#ifdef SFML_SYSTEM_ANDROID
void* m_stream; ///< Asset file streamer (if loaded from file)
void* m_stream; //!< Asset file streamer (if loaded from file)
#endif
};

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -81,7 +81,7 @@ struct Matrix
copyMatrix(transform, *this);
}
float array[Columns * Rows]; ///< Array holding matrix data
float array[Columns * Rows]; //!< Array holding matrix data
};
////////////////////////////////////////////////////////////
@@ -148,8 +148,8 @@ struct Vector4
copyVector(color, *this);
}
T x; ///< 1st component (X) of the 4D vector
T y; ///< 2nd component (Y) of the 4D vector
T z; ///< 3rd component (Z) of the 4D vector
T w; ///< 4th component (W) of the 4D vector
T x; //!< 1st component (X) of the 4D vector
T y; //!< 2nd component (Y) of the 4D vector
T z; //!< 3rd component (Z) of the 4D vector
T w; //!< 4th component (W) of the 4D vector
};

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -46,14 +46,16 @@ public:
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
Glyph() : advance(0) {}
Glyph() : advance(0), lsbDelta(0), rsbDelta(0) {}
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
float advance; ///< Offset to move horizontally to the next character
FloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture
float advance; //!< Offset to move horizontally to the next character
int lsbDelta; //!< Left offset after forced autohint. Internally used by getKerning()
int rsbDelta; //!< Right offset after forced autohint. Internally used by getKerning()
FloatRect bounds; //!< Bounding rectangle of the glyph, in coordinates relative to the baseline
IntRect textureRect; //!< Texture coordinates of the glyph inside the font's texture
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -90,8 +90,8 @@ public:
/// \brief Load the image from a file on disk
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// psd, hdr, pic and pnm. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// If this function fails, the image is left unchanged.
///
/// \param filename Path of the image file to load
@@ -107,8 +107,8 @@ public:
/// \brief Load the image from a file in memory
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// psd, hdr, pic and pnm. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// If this function fails, the image is left unchanged.
///
/// \param data Pointer to the file data in memory
@@ -125,8 +125,8 @@ public:
/// \brief Load the image from a custom stream
///
/// The supported image formats are bmp, png, tga, jpg, gif,
/// psd, hdr and pic. Some format options are not supported,
/// like progressive jpeg.
/// psd, hdr, pic and pnm. Some format options are not supported,
/// like jpeg with arithmetic coding or ASCII pnm.
/// If this function fails, the image is left unchanged.
///
/// \param stream Source stream to read from
@@ -155,6 +155,24 @@ public:
////////////////////////////////////////////////////////////
bool saveToFile(const std::string& filename) const;
////////////////////////////////////////////////////////////
/// \brief Save the image to a buffer in memory
///
/// The format of the image must be specified.
/// The supported image formats are bmp, png, tga and jpg.
/// This function fails if the image is empty, or if
/// the format was invalid.
///
/// \param output Buffer to fill with encoded data
/// \param format Encoding format to use
///
/// \return True if saving was successful
///
/// \see create, loadFromFile, loadFromMemory, saveToFile
///
////////////////////////////////////////////////////////////
bool saveToMemory(std::vector<sf::Uint8>& output, const std::string& format) const;
////////////////////////////////////////////////////////////
/// \brief Return the size (width and height) of the image
///
@@ -185,9 +203,13 @@ public:
/// kind of feature in real-time you'd better use sf::RenderTexture.
///
/// If \a sourceRect is empty, the whole image is copied.
/// If \a applyAlpha is set to true, the transparency of
/// source pixels is applied. If it is false, the pixels are
/// copied unchanged with their alpha value.
/// If \a applyAlpha is set to true, alpha blending is
/// applied from the source pixels to the destination pixels
/// using the \b over operator. If it is false, the source
/// pixels are copied unchanged with their alpha value.
///
/// See https://en.wikipedia.org/wiki/Alpha_compositing for
/// details on the \b over operator.
///
/// \param source Source image to copy
/// \param destX X coordinate of the destination position
@@ -263,8 +285,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2u m_size; ///< Image size
std::vector<Uint8> m_pixels; ///< Pixels of the image
Vector2u m_size; //!< Image size
std::vector<Uint8> m_pixels; //!< Pixels of the image
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -38,18 +38,18 @@ namespace sf
////////////////////////////////////////////////////////////
enum PrimitiveType
{
Points, ///< List of individual points
Lines, ///< List of individual lines
LineStrip, ///< List of connected lines, a point uses the previous point to form a line
Triangles, ///< List of individual triangles
TriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
TriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
Quads, ///< List of individual quads (deprecated, don't work with OpenGL ES)
Points, //!< List of individual points
Lines, //!< List of individual lines
LineStrip, //!< List of connected lines, a point uses the previous point to form a line
Triangles, //!< List of individual triangles
TriangleStrip, //!< List of connected triangles, a point uses the two previous points to form a triangle
TriangleFan, //!< List of connected triangles, a point uses the common center and the previous point to form a triangle
Quads, //!< List of individual quads (deprecated, don't work with OpenGL ES)
// Deprecated names
LinesStrip = LineStrip, ///< \deprecated Use LineStrip instead
TrianglesStrip = TriangleStrip, ///< \deprecated Use TriangleStrip instead
TrianglesFan = TriangleFan ///< \deprecated Use TriangleFan instead
LinesStrip = LineStrip, //!< \deprecated Use LineStrip instead
TrianglesStrip = TriangleStrip, //!< \deprecated Use TriangleStrip instead
TrianglesFan = TriangleFan //!< \deprecated Use TriangleFan instead
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -151,13 +151,33 @@ public:
////////////////////////////////////////////////////////////
bool intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
////////////////////////////////////////////////////////////
/// \brief Get the position of the rectangle's top-left corner
///
/// \return Position of rectangle
///
/// \see getSize
///
////////////////////////////////////////////////////////////
sf::Vector2<T> getPosition() const;
////////////////////////////////////////////////////////////
/// \brief Get the size of the rectangle
///
/// \return Size of rectangle
///
/// \see getPosition
///
////////////////////////////////////////////////////////////
sf::Vector2<T> getSize() const;
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
T left; ///< Left coordinate of the rectangle
T top; ///< Top coordinate of the rectangle
T width; ///< Width of the rectangle
T height; ///< Height of the rectangle
T left; //!< Left coordinate of the rectangle
T top; //!< Top coordinate of the rectangle
T width; //!< Width of the rectangle
T height; //!< Height of the rectangle
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -141,6 +141,18 @@ bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
}
}
template <typename T>
sf::Vector2<T> Rect<T>::getPosition() const
{
return sf::Vector2<T>(left, top);
}
template <typename T>
sf::Vector2<T> Rect<T>::getSize() const
{
return sf::Vector2<T>(width, height);
}
////////////////////////////////////////////////////////////
template <typename T>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -99,7 +99,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f m_size; ///< Size of the rectangle
Vector2f m_size; //!< Size of the rectangle
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -107,15 +107,15 @@ public:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const RenderStates Default; ///< Special instance holding the default render states
static const RenderStates Default; //!< Special instance holding the default render states
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
BlendMode blendMode; ///< Blending mode
Transform transform; ///< Transform
const Texture* texture; ///< Texture
const Shader* shader; ///< Shader
BlendMode blendMode; //!< Blending mode
Transform transform; //!< Transform
const Texture* texture; //!< Texture
const Shader* shader; //!< Shader
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -276,6 +276,14 @@ public:
////////////////////////////////////////////////////////////
virtual Vector2u getSize() const = 0;
////////////////////////////////////////////////////////////
/// \brief Tell if the render target will use sRGB encoding when drawing on it
///
/// \return True if the render target use sRGB encoding, false otherwise
///
////////////////////////////////////////////////////////////
virtual bool isSrgb() const;
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate the render target for rendering
///
@@ -458,23 +466,23 @@ 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
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
};
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
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
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

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -72,11 +72,15 @@ public:
/// Before calling this function, the render-texture is in
/// an invalid state, thus it is mandatory to call it before
/// doing anything with the render-texture.
///
/// The last parameter, \a depthBuffer, is useful if you want
/// to use the render-texture for 3D OpenGL rendering that requires
/// a depth buffer. Otherwise it is unnecessary, and you should
/// leave this parameter to false (which is its default value).
///
/// After creation, the contents of the render-texture are undefined.
/// Call `RenderTexture::clear` first to ensure a single color fill.
///
/// \param width Width of the render-texture
/// \param height Height of the render-texture
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
@@ -94,11 +98,15 @@ public:
/// 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.
///
/// After creation, the contents of the render-texture are undefined.
/// Call `RenderTexture::clear` first to ensure a single color fill.
///
/// \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
@@ -217,6 +225,18 @@ public:
////////////////////////////////////////////////////////////
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Tell if the render-texture will use sRGB encoding when drawing on it
///
/// You can request sRGB encoding for a render-texture
/// by having the sRgbCapable flag set for the context parameter of create() method
///
/// \return True if the render-texture use sRGB encoding, false otherwise
///
////////////////////////////////////////////////////////////
virtual bool isSrgb() const;
////////////////////////////////////////////////////////////
/// \brief Get a read-only reference to the target texture
///
@@ -238,8 +258,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::RenderTextureImpl* m_impl; ///< Platform/hardware specific implementation
Texture m_texture; ///< Target texture to draw on
priv::RenderTextureImpl* m_impl; //!< Platform/hardware specific implementation
Texture m_texture; //!< Target texture to draw on
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,6 +112,17 @@ public:
////////////////////////////////////////////////////////////
virtual Vector2u getSize() const;
////////////////////////////////////////////////////////////
/// \brief Tell if the window will use sRGB encoding when drawing on it
///
/// You can request sRGB encoding for a window by having the sRgbCapable flag set in the ContextSettings
///
/// \return True if the window use sRGB encoding, false otherwise
///
////////////////////////////////////////////////////////////
virtual bool isSrgb() const;
////////////////////////////////////////////////////////////
/// \brief Activate or deactivate the window as the current target
/// for OpenGL rendering
@@ -177,6 +188,13 @@ protected:
///
////////////////////////////////////////////////////////////
virtual void onResize();
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int m_defaultFrameBuffer; //!< Framebuffer to bind when targeting this window
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -59,9 +59,9 @@ public:
////////////////////////////////////////////////////////////
enum Type
{
Vertex, ///< %Vertex shader
Geometry, ///< Geometry shader
Fragment ///< Fragment (pixel) shader
Vertex, //!< %Vertex shader
Geometry, //!< Geometry shader
Fragment //!< Fragment (pixel) shader
};
////////////////////////////////////////////////////////////
@@ -745,10 +745,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int m_shaderProgram; ///< OpenGL identifier for the program
int m_currentTexture; ///< Location of the current texture in the shader
TextureTable m_textures; ///< Texture variables in the shader, mapped to their location
UniformTable m_uniforms; ///< Parameters location cache
unsigned int m_shaderProgram; //!< OpenGL identifier for the program
int m_currentTexture; //!< Location of the current texture in the shader
TextureTable m_textures; //!< Texture variables in the shader, mapped to their location
UniformTable m_uniforms; //!< Parameters location cache
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -305,15 +305,15 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
const Texture* m_texture; ///< Texture of the shape
IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display
Color m_fillColor; ///< Fill color
Color m_outlineColor; ///< Outline color
float m_outlineThickness; ///< Thickness of the shape's outline
VertexArray m_vertices; ///< Vertex array containing the fill geometry
VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
FloatRect m_insideBounds; ///< Bounding rectangle of the inside (fill)
FloatRect m_bounds; ///< Bounding rectangle of the whole shape (outline + fill)
const Texture* m_texture; //!< Texture of the shape
IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display
Color m_fillColor; //!< Fill color
Color m_outlineColor; //!< Outline color
float m_outlineThickness; //!< Thickness of the shape's outline
VertexArray m_vertices; //!< Vertex array containing the fill geometry
VertexArray m_outlineVertices; //!< Vertex array containing the outline geometry
FloatRect m_insideBounds; //!< Bounding rectangle of the inside (fill)
FloatRect m_bounds; //!< Bounding rectangle of the whole shape (outline + fill)
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -215,9 +215,9 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vertex m_vertices[4]; ///< Vertices defining the sprite's geometry
const Texture* m_texture; ///< Texture of the sprite
IntRect m_textureRect; ///< Rectangle defining the area of the source texture to display
Vertex m_vertices[4]; //!< Vertices defining the sprite's geometry
const Texture* m_texture; //!< Texture of the sprite
IntRect m_textureRect; //!< Rectangle defining the area of the source texture to display
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -55,11 +55,11 @@ public:
////////////////////////////////////////////////////////////
enum Style
{
Regular = 0, ///< Regular characters, no style
Bold = 1 << 0, ///< Bold characters
Italic = 1 << 1, ///< Italic characters
Underlined = 1 << 2, ///< Underlined characters
StrikeThrough = 1 << 3 ///< Strike through characters
Regular = 0, //!< Regular characters, no style
Bold = 1 << 0, //!< Bold characters
Italic = 1 << 1, //!< Italic characters
Underlined = 1 << 2, //!< Underlined characters
StrikeThrough = 1 << 3 //!< Strike through characters
};
////////////////////////////////////////////////////////////
@@ -435,20 +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
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
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

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -55,8 +55,8 @@ public:
////////////////////////////////////////////////////////////
enum CoordinateType
{
Normalized, ///< Texture coordinates in range [0 .. 1]
Pixels ///< Texture coordinates in range [0 .. size]
Normalized, //!< Texture coordinates in range [0 .. 1]
Pixels //!< Texture coordinates in range [0 .. size]
};
public:
@@ -616,16 +616,16 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2u m_size; ///< Public texture size
Vector2u m_actualSize; ///< Actual texture size (can be greater than public size because of padding)
unsigned int m_texture; ///< Internal texture identifier
bool m_isSmooth; ///< Status of the smooth filter
bool m_sRgb; ///< Should the texture source be converted from sRGB?
bool m_isRepeated; ///< Is the texture in repeat mode?
mutable bool m_pixelsFlipped; ///< To work around the inconsistency in Y orientation
bool m_fboAttachment; ///< Is this texture owned by a framebuffer object?
bool m_hasMipmap; ///< Has the mipmap been generated?
Uint64 m_cacheId; ///< Unique number that identifies the texture to the render target's cache
Vector2u m_size; //!< Public texture size
Vector2u m_actualSize; //!< Actual texture size (can be greater than public size because of padding)
unsigned int m_texture; //!< Internal texture identifier
bool m_isSmooth; //!< Status of the smooth filter
bool m_sRgb; //!< Should the texture source be converted from sRGB?
bool m_isRepeated; //!< Is the texture in repeat mode?
mutable bool m_pixelsFlipped; //!< To work around the inconsistency in Y orientation
bool m_fboAttachment; //!< Is this texture owned by a framebuffer object?
bool m_hasMipmap; //!< Has the mipmap been generated?
Uint64 m_cacheId; //!< Unique number that identifies the texture to the render target's cache
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -100,6 +100,12 @@ public:
////////////////////////////////////////////////////////////
/// \brief Transform a 2D point
///
/// These two statements are equivalent:
/// \code
/// sf::Vector2f transformedPoint = matrix.transformPoint(x, y);
/// sf::Vector2f transformedPoint = matrix * sf::Vector2f(x, y);
/// \endcode
///
/// \param x X coordinate of the point to transform
/// \param y Y coordinate of the point to transform
///
@@ -111,6 +117,12 @@ public:
////////////////////////////////////////////////////////////
/// \brief Transform a 2D point
///
/// These two statements are equivalent:
/// \code
/// sf::Vector2f transformedPoint = matrix.transformPoint(point);
/// sf::Vector2f transformedPoint = matrix * point;
/// \endcode
///
/// \param point Point to transform
///
/// \return Transformed point
@@ -138,8 +150,14 @@ public:
/// \brief Combine the current transform with another one
///
/// The result is a transform that is equivalent to applying
/// *this followed by \a transform. Mathematically, it is
/// equivalent to a matrix multiplication.
/// \a transform followed by *this. Mathematically, it is
/// equivalent to a matrix multiplication (*this) * transform.
///
/// These two statements are equivalent:
/// \code
/// left.combine(right);
/// left *= right;
/// \endcode
///
/// \param transform Transform to combine with this transform
///
@@ -351,14 +369,14 @@ public:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const Transform Identity; ///< The identity transform (does nothing)
static const Transform Identity; //!< The identity transform (does nothing)
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
float m_matrix[16]; ///< 4x4 matrix defining the transformation
float m_matrix[16]; //!< 4x4 matrix defining the transformation
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -203,7 +203,7 @@ public:
////////////////////////////////////////////////////////////
const Vector2f& getOrigin() const;
virtual ////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// \brief Move the object by a given offset
///
/// This function adds to the current position of the object,
@@ -316,14 +316,14 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f m_origin; ///< Origin of translation/rotation/scaling of the object
Vector2f m_position; ///< Position of the object in the 2D world
float m_rotation; ///< Orientation of the object, in degrees
Vector2f m_scale; ///< Scale of the object
mutable Transform m_transform; ///< Combined transformation of the object
mutable bool m_transformNeedUpdate; ///< Does the transform need to be recomputed?
mutable Transform m_inverseTransform; ///< Combined transformation of the object
mutable bool m_inverseTransformNeedUpdate; ///< Does the transform need to be recomputed?
Vector2f m_origin; //!< Origin of translation/rotation/scaling of the object
Vector2f m_position; //!< Position of the object in the 2D world
float m_rotation; //!< Orientation of the object, in degrees
Vector2f m_scale; //!< Scale of the object
mutable Transform m_transform; //!< Combined transformation of the object
mutable bool m_transformNeedUpdate; //!< Does the transform need to be recomputed?
mutable Transform m_inverseTransform; //!< Combined transformation of the object
mutable bool m_inverseTransformNeedUpdate; //!< Does the transform need to be recomputed?
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -94,9 +94,9 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f position; ///< 2D position of the vertex
Color color; ///< Color of the vertex
Vector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex
Vector2f position; //!< 2D position of the vertex
Color color; //!< Color of the vertex
Vector2f texCoords; //!< Coordinates of the texture's pixel to map to the vertex
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -187,8 +187,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<Vertex> m_vertices; ///< Vertices contained in the array
PrimitiveType m_primitiveType; ///< Type of primitives to draw
std::vector<Vertex> m_vertices; //!< Vertices contained in the array
PrimitiveType m_primitiveType; //!< Type of primitives to draw
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -59,9 +59,9 @@ public:
////////////////////////////////////////////////////////////
enum Usage
{
Stream, ///< Constantly changing data
Dynamic, ///< Occasionally changing data
Static ///< Rarely changing data
Stream, //!< Constantly changing data
Dynamic, //!< Occasionally changing data
Static //!< Rarely changing data
};
////////////////////////////////////////////////////////////
@@ -334,10 +334,10 @@ 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
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

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -269,14 +269,14 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Vector2f m_center; ///< Center of the view, in scene coordinates
Vector2f m_size; ///< Size of the view, in scene coordinates
float m_rotation; ///< Angle of rotation of the view rectangle, in degrees
FloatRect m_viewport; ///< Viewport rectangle, expressed as a factor of the render-target's size
mutable Transform m_transform; ///< Precomputed projection transform corresponding to the view
mutable Transform m_inverseTransform; ///< Precomputed inverse projection transform corresponding to the view
mutable bool m_transformUpdated; ///< Internal state telling if the transform needs to be updated
mutable bool m_invTransformUpdated; ///< Internal state telling if the inverse transform needs to be updated
Vector2f m_center; //!< Center of the view, in scene coordinates
Vector2f m_size; //!< Size of the view, in scene coordinates
float m_rotation; //!< Angle of rotation of the view rectangle, in degrees
FloatRect m_viewport; //!< Viewport rectangle, expressed as a factor of the render-target's size
mutable Transform m_transform; //!< Precomputed projection transform corresponding to the view
mutable Transform m_inverseTransform; //!< Precomputed inverse projection transform corresponding to the view
mutable bool m_transformUpdated; //!< Internal state telling if the transform needs to be updated
mutable bool m_invTransformUpdated; //!< Internal state telling if the inverse transform needs to be updated
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,9 +54,9 @@ public:
////////////////////////////////////////////////////////////
enum TransferMode
{
Binary, ///< Binary mode (file is transfered as a sequence of bytes)
Ascii, ///< Text mode using ASCII encoding
Ebcdic ///< Text mode using EBCDIC encoding
Binary, //!< Binary mode (file is transfered as a sequence of bytes)
Ascii, //!< Text mode using ASCII encoding
Ebcdic //!< Text mode using EBCDIC encoding
};
////////////////////////////////////////////////////////////
@@ -75,62 +75,62 @@ public:
{
// 1xx: the requested action is being initiated,
// expect another reply before proceeding with a new command
RestartMarkerReply = 110, ///< Restart marker reply
ServiceReadySoon = 120, ///< Service ready in N minutes
DataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting
OpeningDataConnection = 150, ///< File status ok, about to open data connection
RestartMarkerReply = 110, //!< Restart marker reply
ServiceReadySoon = 120, //!< Service ready in N minutes
DataConnectionAlreadyOpened = 125, //!< Data connection already opened, transfer starting
OpeningDataConnection = 150, //!< File status ok, about to open data connection
// 2xx: the requested action has been successfully completed
Ok = 200, ///< Command ok
PointlessCommand = 202, ///< Command not implemented
SystemStatus = 211, ///< System status, or system help reply
DirectoryStatus = 212, ///< Directory status
FileStatus = 213, ///< File status
HelpMessage = 214, ///< Help message
SystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
ServiceReady = 220, ///< Service ready for new user
ClosingConnection = 221, ///< Service closing control connection
DataConnectionOpened = 225, ///< Data connection open, no transfer in progress
ClosingDataConnection = 226, ///< Closing data connection, requested file action successful
EnteringPassiveMode = 227, ///< Entering passive mode
LoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate
FileActionOk = 250, ///< Requested file action ok
DirectoryOk = 257, ///< PATHNAME created
Ok = 200, //!< Command ok
PointlessCommand = 202, //!< Command not implemented
SystemStatus = 211, //!< System status, or system help reply
DirectoryStatus = 212, //!< Directory status
FileStatus = 213, //!< File status
HelpMessage = 214, //!< Help message
SystemType = 215, //!< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
ServiceReady = 220, //!< Service ready for new user
ClosingConnection = 221, //!< Service closing control connection
DataConnectionOpened = 225, //!< Data connection open, no transfer in progress
ClosingDataConnection = 226, //!< Closing data connection, requested file action successful
EnteringPassiveMode = 227, //!< Entering passive mode
LoggedIn = 230, //!< User logged in, proceed. Logged out if appropriate
FileActionOk = 250, //!< Requested file action ok
DirectoryOk = 257, //!< PATHNAME created
// 3xx: the command has been accepted, but the requested action
// is dormant, pending receipt of further information
NeedPassword = 331, ///< User name ok, need password
NeedAccountToLogIn = 332, ///< Need account for login
NeedInformation = 350, ///< Requested file action pending further information
NeedPassword = 331, //!< User name ok, need password
NeedAccountToLogIn = 332, //!< Need account for login
NeedInformation = 350, //!< Requested file action pending further information
// 4xx: the command was not accepted and the requested action did not take place,
// but the error condition is temporary and the action may be requested again
ServiceUnavailable = 421, ///< Service not available, closing control connection
DataConnectionUnavailable = 425, ///< Can't open data connection
TransferAborted = 426, ///< Connection closed, transfer aborted
FileActionAborted = 450, ///< Requested file action not taken
LocalError = 451, ///< Requested action aborted, local error in processing
InsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
ServiceUnavailable = 421, //!< Service not available, closing control connection
DataConnectionUnavailable = 425, //!< Can't open data connection
TransferAborted = 426, //!< Connection closed, transfer aborted
FileActionAborted = 450, //!< Requested file action not taken
LocalError = 451, //!< Requested action aborted, local error in processing
InsufficientStorageSpace = 452, //!< Requested action not taken; insufficient storage space in system, file unavailable
// 5xx: the command was not accepted and
// the requested action did not take place
CommandUnknown = 500, ///< Syntax error, command unrecognized
ParametersUnknown = 501, ///< Syntax error in parameters or arguments
CommandNotImplemented = 502, ///< Command not implemented
BadCommandSequence = 503, ///< Bad sequence of commands
ParameterNotImplemented = 504, ///< Command not implemented for that parameter
NotLoggedIn = 530, ///< Not logged in
NeedAccountToStore = 532, ///< Need account for storing files
FileUnavailable = 550, ///< Requested action not taken, file unavailable
PageTypeUnknown = 551, ///< Requested action aborted, page type unknown
NotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation
FilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed
CommandUnknown = 500, //!< Syntax error, command unrecognized
ParametersUnknown = 501, //!< Syntax error in parameters or arguments
CommandNotImplemented = 502, //!< Command not implemented
BadCommandSequence = 503, //!< Bad sequence of commands
ParameterNotImplemented = 504, //!< Command not implemented for that parameter
NotLoggedIn = 530, //!< Not logged in
NeedAccountToStore = 532, //!< Need account for storing files
FileUnavailable = 550, //!< Requested action not taken, file unavailable
PageTypeUnknown = 551, //!< Requested action aborted, page type unknown
NotEnoughMemory = 552, //!< Requested file action aborted, exceeded storage allocation
FilenameNotAllowed = 553, //!< Requested action not taken, file name not allowed
// 10xx: SFML custom codes
InvalidResponse = 1000, ///< Not part of the FTP standard, generated by SFML when a received response cannot be parsed
ConnectionFailed = 1001, ///< Not part of the FTP standard, generated by SFML when the low-level socket connection with the server fails
ConnectionClosed = 1002, ///< Not part of the FTP standard, generated by SFML when the low-level socket connection is unexpectedly closed
InvalidFile = 1003 ///< Not part of the FTP standard, generated by SFML when a local file cannot be read or written
InvalidResponse = 1000, //!< Not part of the FTP standard, generated by SFML when a received response cannot be parsed
ConnectionFailed = 1001, //!< Not part of the FTP standard, generated by SFML when the low-level socket connection with the server fails
ConnectionClosed = 1002, //!< Not part of the FTP standard, generated by SFML when the low-level socket connection is unexpectedly closed
InvalidFile = 1003 //!< Not part of the FTP standard, generated by SFML when a local file cannot be read or written
};
////////////////////////////////////////////////////////////
@@ -177,8 +177,8 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Status m_status; ///< Status code returned from the server
std::string m_message; ///< Last message received from the server
Status m_status; //!< Status code returned from the server
std::string m_message; //!< Last message received from the server
};
////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::string m_directory; ///< Directory extracted from the response message
std::string m_directory; //!< Directory extracted from the response message
};
@@ -244,7 +244,7 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<std::string> m_listing; ///< Directory/file names extracted from the data
std::vector<std::string> m_listing; //!< Directory/file names extracted from the data
};
@@ -533,8 +533,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
TcpSocket m_commandSocket; ///< Socket holding the control connection with the server
std::string m_receiveBuffer; ///< Received command data that is yet to be processed
TcpSocket m_commandSocket; //!< Socket holding the control connection with the server
std::string m_receiveBuffer; //!< Received command data that is yet to be processed
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -61,11 +61,11 @@ public:
////////////////////////////////////////////////////////////
enum Method
{
Get, ///< Request in get mode, standard method to retrieve a page
Post, ///< Request in post mode, usually to send data to a page
Head, ///< Request a page's header only
Put, ///< Request in put mode, useful for a REST API
Delete ///< Request in delete mode, useful for a REST API
Get, //!< Request in get mode, standard method to retrieve a page
Post, //!< Request in post mode, usually to send data to a page
Head, //!< Request a page's header only
Put, //!< Request in put mode, useful for a REST API
Delete //!< Request in delete mode, useful for a REST API
};
////////////////////////////////////////////////////////////
@@ -178,12 +178,12 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
FieldTable m_fields; ///< Fields of the header associated to their value
Method m_method; ///< Method to use for the request
std::string m_uri; ///< Target URI of the request
unsigned int m_majorVersion; ///< Major HTTP version
unsigned int m_minorVersion; ///< Minor HTTP version
std::string m_body; ///< Body of the request
FieldTable m_fields; //!< Fields of the header associated to their value
Method m_method; //!< Method to use for the request
std::string m_uri; //!< Target URI of the request
unsigned int m_majorVersion; //!< Major HTTP version
unsigned int m_minorVersion; //!< Minor HTTP version
std::string m_body; //!< Body of the request
};
////////////////////////////////////////////////////////////
@@ -201,37 +201,37 @@ public:
enum Status
{
// 2xx: success
Ok = 200, ///< Most common code returned when operation was successful
Created = 201, ///< The resource has successfully been created
Accepted = 202, ///< The request has been accepted, but will be processed later by the server
NoContent = 204, ///< The server didn't send any data in return
ResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent
PartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request
Ok = 200, //!< Most common code returned when operation was successful
Created = 201, //!< The resource has successfully been created
Accepted = 202, //!< The request has been accepted, but will be processed later by the server
NoContent = 204, //!< The server didn't send any data in return
ResetContent = 205, //!< The server informs the client that it should clear the view (form) that caused the request to be sent
PartialContent = 206, //!< The server has sent a part of the resource, as a response to a partial GET request
// 3xx: redirection
MultipleChoices = 300, ///< The requested page can be accessed from several locations
MovedPermanently = 301, ///< The requested page has permanently moved to a new location
MovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
NotModified = 304, ///< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
MultipleChoices = 300, //!< The requested page can be accessed from several locations
MovedPermanently = 301, //!< The requested page has permanently moved to a new location
MovedTemporarily = 302, //!< The requested page has temporarily moved to a new location
NotModified = 304, //!< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
// 4xx: client error
BadRequest = 400, ///< The server couldn't understand the request (syntax error)
Unauthorized = 401, ///< The requested page needs an authentication to be accessed
Forbidden = 403, ///< The requested page cannot be accessed at all, even with authentication
NotFound = 404, ///< The requested page doesn't exist
RangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field)
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
NotFound = 404, //!< The requested page doesn't exist
RangeNotSatisfiable = 407, //!< The server can't satisfy the partial GET request (with a "Range" header field)
// 5xx: server error
InternalServerError = 500, ///< The server encountered an unexpected error
NotImplemented = 501, ///< The server doesn't implement a requested feature
BadGateway = 502, ///< The gateway server has received an error from the source server
ServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...)
GatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server
VersionNotSupported = 505, ///< The server doesn't support the requested HTTP version
InternalServerError = 500, //!< The server encountered an unexpected error
NotImplemented = 501, //!< The server doesn't implement a requested feature
BadGateway = 502, //!< The gateway server has received an error from the source server
ServiceNotAvailable = 503, //!< The server is temporarily unavailable (overloaded, in maintenance, ...)
GatewayTimeout = 504, //!< The gateway server couldn't receive a response from the source server
VersionNotSupported = 505, //!< The server doesn't support the requested HTTP version
// 10xx: SFML custom codes
InvalidResponse = 1000, ///< Response is not a valid HTTP one
ConnectionFailed = 1001 ///< Connection with server failed
InvalidResponse = 1000, //!< Response is not a valid HTTP one
ConnectionFailed = 1001 //!< Connection with server failed
};
////////////////////////////////////////////////////////////
@@ -338,11 +338,11 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
FieldTable m_fields; ///< Fields of the header
Status m_status; ///< Status code
unsigned int m_majorVersion; ///< Major HTTP version
unsigned int m_minorVersion; ///< Minor HTTP version
std::string m_body; ///< Body of the response
FieldTable m_fields; //!< Fields of the header
Status m_status; //!< Status code
unsigned int m_majorVersion; //!< Major HTTP version
unsigned int m_minorVersion; //!< Minor HTTP version
std::string m_body; //!< Body of the response
};
////////////////////////////////////////////////////////////
@@ -409,10 +409,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
TcpSocket m_connection; ///< Connection to the host
IpAddress m_host; ///< Web host address
std::string m_hostName; ///< Web host name
unsigned short m_port; ///< Port used for connection with host
TcpSocket m_connection; //!< Connection to the host
IpAddress m_host; //!< Web host address
std::string m_hostName; //!< Web host name
unsigned short m_port; //!< Port used for connection with host
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -181,10 +181,10 @@ public:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const IpAddress None; ///< Value representing an empty/invalid address
static const IpAddress Any; ///< Value representing any address (0.0.0.0)
static const IpAddress LocalHost; ///< The "localhost" address (for connecting a computer to itself locally)
static const IpAddress Broadcast; ///< The "broadcast" address (for sending UDP messages to everyone on a local network)
static const IpAddress None; //!< Value representing an empty/invalid address
static const IpAddress Any; //!< Value representing any address (0.0.0.0)
static const IpAddress LocalHost; //!< The "localhost" address (for connecting a computer to itself locally)
static const IpAddress Broadcast; //!< The "broadcast" address (for sending UDP messages to everyone on a local network)
private:
@@ -201,8 +201,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Uint32 m_address; ///< Address stored as an unsigned 32 bits integer
bool m_valid; ///< Is the address valid?
Uint32 m_address; //!< Address stored as an unsigned 32 bits integer
bool m_valid; //!< Is the address valid?
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -72,10 +72,23 @@ public:
/// \param sizeInBytes Number of bytes to append
///
/// \see clear
/// \see getReadPosition
///
////////////////////////////////////////////////////////////
void append(const void* data, std::size_t sizeInBytes);
////////////////////////////////////////////////////////////
/// \brief Get the current reading position in the packet
///
/// The next read operation will read data from this position
///
/// \return The byte offset of the current read position
///
/// \see append
///
////////////////////////////////////////////////////////////
std::size_t getReadPosition() const;
////////////////////////////////////////////////////////////
/// \brief Clear the packet
///
@@ -400,10 +413,10 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<char> m_data; ///< Data stored in the packet
std::size_t m_readPos; ///< Current reading position in the packet
std::size_t m_sendPos; ///< Current send position in the packet (for handling partial sends)
bool m_isValid; ///< Reading state of the packet
std::vector<char> m_data; //!< Data stored in the packet
std::size_t m_readPos; //!< Current reading position in the packet
std::size_t m_sendPos; //!< Current send position in the packet (for handling partial sends)
bool m_isValid; //!< Reading state of the packet
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -52,11 +52,11 @@ public:
////////////////////////////////////////////////////////////
enum Status
{
Done, ///< The socket has sent / received the data
NotReady, ///< The socket is not ready to send / receive data yet
Partial, ///< The socket sent a part of the data
Disconnected, ///< The TCP socket has been disconnected
Error ///< An unexpected error happened
Done, //!< The socket has sent / received the data
NotReady, //!< The socket is not ready to send / receive data yet
Partial, //!< The socket sent a part of the data
Disconnected, //!< The TCP socket has been disconnected
Error //!< An unexpected error happened
};
////////////////////////////////////////////////////////////
@@ -65,7 +65,7 @@ public:
////////////////////////////////////////////////////////////
enum
{
AnyPort = 0 ///< Special value that tells the system to pick any available port
AnyPort = 0 //!< Special value that tells the system to pick any available port
};
public:
@@ -113,8 +113,8 @@ protected:
////////////////////////////////////////////////////////////
enum Type
{
Tcp, ///< TCP protocol
Udp ///< UDP protocol
Tcp, //!< TCP protocol
Udp //!< UDP protocol
};
////////////////////////////////////////////////////////////
@@ -173,9 +173,9 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Type m_type; ///< Type of the socket (TCP or UDP)
SocketHandle m_socket; ///< Socket descriptor
bool m_isBlocking; ///< Current blocking mode of the socket
Type m_type; //!< Type of the socket (TCP or UDP)
SocketHandle m_socket; //!< Socket descriptor
bool m_isBlocking; //!< Current blocking mode of the socket
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -158,7 +158,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
SocketSelectorImpl* m_impl; ///< Opaque pointer to the implementation (which requires OS-specific types)
SocketSelectorImpl* m_impl; //!< Opaque pointer to the implementation (which requires OS-specific types)
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -74,6 +74,10 @@ public:
/// function is called, it will stop listening on the old
/// port before starting to listen on the new port.
///
/// When providing sf::Socket::AnyPort as port, the listener
/// will request an available port from the system.
/// The chosen port can be retrieved by calling getLocalPort().
///
/// \param port Port to listen on for incoming connection attempts
/// \param address Address of the interface to listen on
///

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -68,7 +68,7 @@ public:
////////////////////////////////////////////////////////////
/// \brief Get the address of the connected peer
///
/// It the socket is not connected, this function returns
/// If the socket is not connected, this function returns
/// sf::IpAddress::None.
///
/// \return Address of the remote peer
@@ -220,15 +220,15 @@ private:
{
PendingPacket();
Uint32 Size; ///< Data of packet size
std::size_t SizeReceived; ///< Number of size bytes received so far
std::vector<char> Data; ///< Data of the packet
Uint32 Size; //!< Data of packet size
std::size_t SizeReceived; //!< Number of size bytes received so far
std::vector<char> Data; //!< Data of the packet
};
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
PendingPacket m_pendingPacket; ///< Temporary data of the packet currently being received
PendingPacket m_pendingPacket; //!< Temporary data of the packet currently being received
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,7 +51,7 @@ public:
////////////////////////////////////////////////////////////
enum
{
MaxDatagramSize = 65507 ///< The maximum number of bytes that can be sent in a single UDP datagram
MaxDatagramSize = 65507 //!< The maximum number of bytes that can be sent in a single UDP datagram
};
////////////////////////////////////////////////////////////
@@ -78,9 +78,10 @@ public:
///
/// Binding the socket to a port is necessary for being
/// able to receive data on that port.
/// You can use the special value Socket::AnyPort to tell the
/// system to automatically pick an available port, and then
/// call getLocalPort to retrieve the chosen port.
///
/// When providing sf::Socket::AnyPort as port, the listener
/// will request an available port from the system.
/// The chosen port can be retrieved by calling getLocalPort().
///
/// Since the socket can only be bound to a single port at
/// any given moment, if it is already bound when this
@@ -193,7 +194,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::vector<char> m_buffer; ///< Temporary buffer holding the received data in Receive(Packet)
std::vector<char> m_buffer; //!< Temporary buffer holding the received data in Receive(Packet)
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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) || defined(SFML_SYSTEM_OPENBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD)
#if defined(SFML_OPENGL_ES)
#include <GLES/gl.h>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -78,7 +78,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Time m_startTime; ///< Time of last reset, in microseconds
Time m_startTime; //!< Time of last reset, in microseconds
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -125,7 +125,7 @@ private:
#ifdef SFML_SYSTEM_ANDROID
priv::ResourceStream* m_file;
#else
std::FILE* m_file; ///< stdio file stream
std::FILE* m_file; //!< stdio file stream
#endif
};

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -67,7 +67,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Mutex& m_mutex; ///< Mutex to lock / unlock
Mutex& m_mutex; //!< Mutex to lock / unlock
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -104,9 +104,9 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
const char* m_data; ///< Pointer to the data in memory
Int64 m_size; ///< Total size of the data
Int64 m_offset; ///< Current reading position
const char* m_data; //!< Pointer to the data in memory
Int64 m_size; //!< Total size of the data
Int64 m_offset; //!< Current reading position
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -85,7 +85,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::MutexImpl* m_mutexImpl; ///< OS-specific implementation
priv::MutexImpl* m_mutexImpl; //!< OS-specific implementation
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -49,13 +49,13 @@ public:
////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////
typedef std::basic_string<Uint32>::iterator Iterator; ///< Iterator type
typedef std::basic_string<Uint32>::const_iterator ConstIterator; ///< Read-only iterator type
typedef std::basic_string<Uint32>::iterator Iterator; //!< Iterator type
typedef std::basic_string<Uint32>::const_iterator ConstIterator; //!< Read-only iterator type
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const std::size_t InvalidPos; ///< Represents an invalid position in the string
static const std::size_t InvalidPos; //!< Represents an invalid position in the string
////////////////////////////////////////////////////////////
/// \brief Default constructor
@@ -524,7 +524,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::basic_string<Uint32> m_string; ///< Internal string of UTF-32 characters
std::basic_string<Uint32> m_string; //!< Internal string of UTF-32 characters
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -186,8 +186,8 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::ThreadImpl* m_impl; ///< OS-specific implementation of the thread
priv::ThreadFunc* m_entryPoint; ///< Abstraction of the function to run
priv::ThreadImpl* m_impl; //!< OS-specific implementation of the thread
priv::ThreadFunc* m_entryPoint; //!< Abstraction of the function to run
};
#include <SFML/System/Thread.inl>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -83,7 +83,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::ThreadLocalImpl* m_impl; ///< Pointer to the OS specific implementation
priv::ThreadLocalImpl* m_impl; //!< Pointer to the OS specific implementation
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,7 +82,7 @@ public:
////////////////////////////////////////////////////////////
// Static member data
////////////////////////////////////////////////////////////
static const Time Zero; ///< Predefined "zero" time value
static const Time Zero; //!< Predefined "zero" time value
private:
@@ -106,7 +106,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
Int64 m_microseconds; ///< Time value stored as microseconds
Int64 m_microseconds; //!< Time value stored as microseconds
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -62,11 +62,11 @@ In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
output = 0;
switch (trailingBytes)
{
case 5: output += static_cast<Uint8>(*begin++); output <<= 6;
case 4: output += static_cast<Uint8>(*begin++); output <<= 6;
case 3: output += static_cast<Uint8>(*begin++); output <<= 6;
case 2: output += static_cast<Uint8>(*begin++); output <<= 6;
case 1: output += static_cast<Uint8>(*begin++); output <<= 6;
case 5: output += static_cast<Uint8>(*begin++); output <<= 6; // fallthrough
case 4: output += static_cast<Uint8>(*begin++); output <<= 6; // fallthrough
case 3: output += static_cast<Uint8>(*begin++); output <<= 6; // fallthrough
case 2: output += static_cast<Uint8>(*begin++); output <<= 6; // fallthrough
case 1: output += static_cast<Uint8>(*begin++); output <<= 6; // fallthrough
case 0: output += static_cast<Uint8>(*begin++);
}
output -= offsets[trailingBytes];
@@ -97,7 +97,7 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
{
// Invalid character
if (replacement)
*output++ = replacement;
output = std::copy(&replacement, &replacement + 1, output);
}
else
{
@@ -114,9 +114,9 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
Uint8 bytes[4];
switch (bytestoWrite)
{
case 4: bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 3: bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 2: bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6;
case 4: bytes[3] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; // fallthrough
case 3: bytes[2] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; // fallthrough
case 2: bytes[1] = static_cast<Uint8>((input | 0x80) & 0xBF); input >>= 6; // fallthrough
case 1: bytes[0] = static_cast<Uint8> (input | firstBytes[bytestoWrite]);
}
@@ -293,7 +293,7 @@ In Utf<16>::decode(In begin, In end, Uint32& output, Uint32 replacement)
if ((second >= 0xDC00) && (second <= 0xDFFF))
{
// The second element is valid: convert the two elements to a UTF-32 character
output = static_cast<Uint32>(((first - 0xD800) << 10) + (second - 0xDC00) + 0x0010000);
output = ((first - 0xD800u) << 10) + (second - 0xDC00) + 0x0010000;
}
else
{
@@ -675,7 +675,7 @@ Uint32 Utf<32>::decodeWide(In input)
// In both cases, a simple copy is enough (UCS-2 is a subset of UCS-4,
// and UCS-4 *is* UTF-32).
return input;
return static_cast<Uint32>(input);
}

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -72,8 +72,8 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
T x; ///< X coordinate of the vector
T y; ///< Y coordinate of the vector
T x; //!< X coordinate of the vector
T y; //!< Y coordinate of the vector
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -73,9 +73,9 @@ public:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
T x; ///< X coordinate of the vector
T y; ///< Y coordinate of the vector
T z; ///< Z coordinate of the vector
T x; //!< X coordinate of the vector
T y; //!< Y coordinate of the vector
T z; //!< Z coordinate of the vector
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -150,7 +150,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::GlContext* m_context; ///< Internal OpenGL context
priv::GlContext* m_context; //!< Internal OpenGL context
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,9 +42,9 @@ struct ContextSettings
////////////////////////////////////////////////////////////
enum Attribute
{
Default = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
Core = 1 << 0, ///< Core attribute
Debug = 1 << 2 ///< Debug attribute
Default = 0, //!< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
Core = 1 << 0, //!< Core attribute
Debug = 1 << 2 //!< Debug attribute
};
////////////////////////////////////////////////////////////
@@ -73,13 +73,13 @@ struct ContextSettings
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
unsigned int depthBits; ///< Bits of the depth buffer
unsigned int stencilBits; ///< Bits of the stencil buffer
unsigned int antialiasingLevel; ///< Level of antialiasing
unsigned int majorVersion; ///< Major number of the context version to create
unsigned int minorVersion; ///< Minor number of the context version to create
Uint32 attributeFlags; ///< The attribute flags to create the context with
bool sRgbCapable; ///< Whether the context framebuffer is sRGB capable
unsigned int depthBits; //!< Bits of the depth buffer
unsigned int stencilBits; //!< Bits of the stencil buffer
unsigned int antialiasingLevel; //!< Level of antialiasing
unsigned int majorVersion; //!< Major number of the context version to create
unsigned int minorVersion; //!< Minor number of the context version to create
Uint32 attributeFlags; //!< The attribute flags to create the context with
bool sRgbCapable; //!< Whether the context framebuffer is sRGB capable
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -64,6 +64,14 @@ public:
/// sf::Cursor::SizeVertical | yes | yes | yes |
/// sf::Cursor::SizeTopLeftBottomRight | no | yes* | yes |
/// sf::Cursor::SizeBottomLeftTopRight | no | yes* | yes |
/// sf::Cursor::SizeLeft | yes | yes** | yes** |
/// sf::Cursor::SizeRight | yes | yes** | yes** |
/// sf::Cursor::SizeTop | yes | yes** | yes** |
/// sf::Cursor::SizeBottom | yes | yes** | yes** |
/// sf::Cursor::SizeTopLeft | yes | yes** | yes** |
/// sf::Cursor::SizeTopRight | yes | yes** | yes** |
/// sf::Cursor::SizeBottomLeft | yes | yes** | yes** |
/// sf::Cursor::SizeBottomRight | yes | yes** | yes** |
/// sf::Cursor::SizeAll | yes | no | yes |
/// sf::Cursor::Cross | yes | yes | yes |
/// sf::Cursor::Help | yes | yes* | yes |
@@ -72,22 +80,32 @@ public:
/// * These cursor types are undocumented so may not
/// be available on all versions, but have been tested on 10.13
///
/// ** On Windows and macOS, double-headed arrows are used
///
////////////////////////////////////////////////////////////
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
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
SizeLeft, //!< Left arrow cursor on Linux, same as SizeHorizontal on other platforms
SizeRight, //!< Right arrow cursor on Linux, same as SizeHorizontal on other platforms
SizeTop, //!< Up arrow cursor on Linux, same as SizeVertical on other platforms
SizeBottom, //!< Down arrow cursor on Linux, same as SizeVertical on other platforms
SizeTopLeft, //!< Top-left arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms
SizeBottomRight, //!< Bottom-right arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms
SizeBottomLeft, //!< Bottom-left arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms
SizeTopRight, //!< Top-right arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms
SizeAll, //!< Combination of SizeHorizontal and SizeVertical
Cross, //!< Crosshair cursor
Help, //!< Help cursor
NotAllowed //!< Action not allowed cursor
};
public:
@@ -129,7 +147,8 @@ public:
/// 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
/// \warning On Unix platforms which do not support colored
/// cursors, 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.
@@ -161,7 +180,7 @@ public:
private:
friend class Window;
friend class WindowBase;
////////////////////////////////////////////////////////////
/// \brief Get access to the underlying implementation
@@ -179,7 +198,7 @@ private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
priv::CursorImpl* m_impl; ///< Platform-specific implementation of the cursor
priv::CursorImpl* m_impl; //!< Platform-specific implementation of the cursor
};
} // namespace sf

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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,8 +51,8 @@ public:
////////////////////////////////////////////////////////////
struct SizeEvent
{
unsigned int width; ///< New width, in pixels
unsigned int height; ///< New height, in pixels
unsigned int width; //!< New width, in pixels
unsigned int height; //!< New height, in pixels
};
////////////////////////////////////////////////////////////
@@ -61,11 +61,12 @@ public:
////////////////////////////////////////////////////////////
struct KeyEvent
{
Keyboard::Key code; ///< Code of the key that has been pressed
bool alt; ///< Is the Alt key pressed?
bool control; ///< Is the Control key pressed?
bool shift; ///< Is the Shift key pressed?
bool system; ///< Is the System key pressed?
Keyboard::Key code; //!< Code of the key that has been pressed
Keyboard::Scancode scancode; //!< Physical code of the key that has been pressed
bool alt; //!< Is the Alt key pressed?
bool control; //!< Is the Control key pressed?
bool shift; //!< Is the Shift key pressed?
bool system; //!< Is the System key pressed?
};
////////////////////////////////////////////////////////////
@@ -74,7 +75,7 @@ public:
////////////////////////////////////////////////////////////
struct TextEvent
{
Uint32 unicode; ///< UTF-32 Unicode value of the character
Uint32 unicode; //!< UTF-32 Unicode value of the character
};
////////////////////////////////////////////////////////////
@@ -83,8 +84,8 @@ public:
////////////////////////////////////////////////////////////
struct MouseMoveEvent
{
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
int x; //!< X position of the mouse pointer, relative to the left of the owner window
int y; //!< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@@ -94,9 +95,9 @@ public:
////////////////////////////////////////////////////////////
struct MouseButtonEvent
{
Mouse::Button button; ///< Code of the button that has been pressed
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
Mouse::Button button; //!< Code of the button that has been pressed
int x; //!< X position of the mouse pointer, relative to the left of the owner window
int y; //!< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@@ -108,9 +109,9 @@ public:
////////////////////////////////////////////////////////////
struct MouseWheelEvent
{
int delta; ///< Number of ticks the wheel has moved (positive is up, negative is down)
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
int delta; //!< Number of ticks the wheel has moved (positive is up, negative is down)
int x; //!< X position of the mouse pointer, relative to the left of the owner window
int y; //!< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@@ -119,10 +120,10 @@ public:
////////////////////////////////////////////////////////////
struct MouseWheelScrollEvent
{
Mouse::Wheel wheel; ///< Which wheel (for mice with multiple ones)
float delta; ///< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
int x; ///< X position of the mouse pointer, relative to the left of the owner window
int y; ///< Y position of the mouse pointer, relative to the top of the owner window
Mouse::Wheel wheel; //!< Which wheel (for mice with multiple ones)
float delta; //!< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
int x; //!< X position of the mouse pointer, relative to the left of the owner window
int y; //!< Y position of the mouse pointer, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@@ -132,7 +133,7 @@ public:
////////////////////////////////////////////////////////////
struct JoystickConnectEvent
{
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int joystickId; //!< Index of the joystick (in range [0 .. Joystick::Count - 1])
};
////////////////////////////////////////////////////////////
@@ -141,9 +142,9 @@ public:
////////////////////////////////////////////////////////////
struct JoystickMoveEvent
{
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick::Axis axis; ///< Axis on which the joystick moved
float position; ///< New position on the axis (in range [-100 .. 100])
unsigned int joystickId; //!< Index of the joystick (in range [0 .. Joystick::Count - 1])
Joystick::Axis axis; //!< Axis on which the joystick moved
float position; //!< New position on the axis (in range [-100 .. 100])
};
////////////////////////////////////////////////////////////
@@ -153,8 +154,8 @@ public:
////////////////////////////////////////////////////////////
struct JoystickButtonEvent
{
unsigned int joystickId; ///< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int button; ///< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])
unsigned int joystickId; //!< Index of the joystick (in range [0 .. Joystick::Count - 1])
unsigned int button; //!< Index of the button that has been pressed (in range [0 .. Joystick::ButtonCount - 1])
};
////////////////////////////////////////////////////////////
@@ -163,9 +164,9 @@ public:
////////////////////////////////////////////////////////////
struct TouchEvent
{
unsigned int finger; ///< Index of the finger in case of multi-touch events
int x; ///< X position of the touch, relative to the left of the owner window
int y; ///< Y position of the touch, relative to the top of the owner window
unsigned int finger; //!< Index of the finger in case of multi-touch events
int x; //!< X position of the touch, relative to the left of the owner window
int y; //!< Y position of the touch, relative to the top of the owner window
};
////////////////////////////////////////////////////////////
@@ -174,10 +175,10 @@ public:
////////////////////////////////////////////////////////////
struct SensorEvent
{
Sensor::Type type; ///< Type of the sensor
float x; ///< Current value of the sensor on X axis
float y; ///< Current value of the sensor on Y axis
float z; ///< Current value of the sensor on Z axis
Sensor::Type type; //!< Type of the sensor
float x; //!< Current value of the sensor on X axis
float y; //!< Current value of the sensor on Y axis
float z; //!< Current value of the sensor on Z axis
};
////////////////////////////////////////////////////////////
@@ -186,52 +187,52 @@ public:
////////////////////////////////////////////////////////////
enum EventType
{
Closed, ///< The window requested to be closed (no data)
Resized, ///< The window was resized (data in event.size)
LostFocus, ///< The window lost the focus (no data)
GainedFocus, ///< The window gained the focus (no data)
TextEntered, ///< A character was entered (data in event.text)
KeyPressed, ///< A key was pressed (data in event.key)
KeyReleased, ///< A key was released (data in event.key)
MouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
MouseWheelScrolled, ///< The mouse wheel was scrolled (data in event.mouseWheelScroll)
MouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton)
MouseButtonReleased, ///< A mouse button was released (data in event.mouseButton)
MouseMoved, ///< The mouse cursor moved (data in event.mouseMove)
MouseEntered, ///< The mouse cursor entered the area of the window (no data)
MouseLeft, ///< The mouse cursor left the area of the window (no data)
JoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton)
JoystickButtonReleased, ///< A joystick button was released (data in event.joystickButton)
JoystickMoved, ///< The joystick moved along an axis (data in event.joystickMove)
JoystickConnected, ///< A joystick was connected (data in event.joystickConnect)
JoystickDisconnected, ///< A joystick was disconnected (data in event.joystickConnect)
TouchBegan, ///< A touch event began (data in event.touch)
TouchMoved, ///< A touch moved (data in event.touch)
TouchEnded, ///< A touch event ended (data in event.touch)
SensorChanged, ///< A sensor value changed (data in event.sensor)
Closed, //!< The window requested to be closed (no data)
Resized, //!< The window was resized (data in event.size)
LostFocus, //!< The window lost the focus (no data)
GainedFocus, //!< The window gained the focus (no data)
TextEntered, //!< A character was entered (data in event.text)
KeyPressed, //!< A key was pressed (data in event.key)
KeyReleased, //!< A key was released (data in event.key)
MouseWheelMoved, //!< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated)
MouseWheelScrolled, //!< The mouse wheel was scrolled (data in event.mouseWheelScroll)
MouseButtonPressed, //!< A mouse button was pressed (data in event.mouseButton)
MouseButtonReleased, //!< A mouse button was released (data in event.mouseButton)
MouseMoved, //!< The mouse cursor moved (data in event.mouseMove)
MouseEntered, //!< The mouse cursor entered the area of the window (no data)
MouseLeft, //!< The mouse cursor left the area of the window (no data)
JoystickButtonPressed, //!< A joystick button was pressed (data in event.joystickButton)
JoystickButtonReleased, //!< A joystick button was released (data in event.joystickButton)
JoystickMoved, //!< The joystick moved along an axis (data in event.joystickMove)
JoystickConnected, //!< A joystick was connected (data in event.joystickConnect)
JoystickDisconnected, //!< A joystick was disconnected (data in event.joystickConnect)
TouchBegan, //!< A touch event began (data in event.touch)
TouchMoved, //!< A touch moved (data in event.touch)
TouchEnded, //!< A touch event ended (data in event.touch)
SensorChanged, //!< A sensor value changed (data in event.sensor)
Count ///< Keep last -- the total number of event types
Count //!< Keep last -- the total number of event types
};
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
EventType type; ///< Type of the event
EventType type; //!< Type of the event
union
{
SizeEvent size; ///< Size event parameters (Event::Resized)
KeyEvent key; ///< Key event parameters (Event::KeyPressed, Event::KeyReleased)
TextEvent text; ///< Text event parameters (Event::TextEntered)
MouseMoveEvent mouseMove; ///< Mouse move event parameters (Event::MouseMoved)
MouseButtonEvent mouseButton; ///< Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)
MouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (Event::MouseWheelMoved) (deprecated)
MouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters (Event::MouseWheelScrolled)
JoystickMoveEvent joystickMove; ///< Joystick move event parameters (Event::JoystickMoved)
JoystickButtonEvent joystickButton; ///< Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased)
JoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected)
TouchEvent touch; ///< Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded)
SensorEvent sensor; ///< Sensor event parameters (Event::SensorChanged)
SizeEvent size; //!< Size event parameters (Event::Resized)
KeyEvent key; //!< Key event parameters (Event::KeyPressed, Event::KeyReleased)
TextEvent text; //!< Text event parameters (Event::TextEntered)
MouseMoveEvent mouseMove; //!< Mouse move event parameters (Event::MouseMoved)
MouseButtonEvent mouseButton; //!< Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)
MouseWheelEvent mouseWheel; //!< Mouse wheel event parameters (Event::MouseWheelMoved) (deprecated)
MouseWheelScrollEvent mouseWheelScroll; //!< Mouse wheel event parameters (Event::MouseWheelScrolled)
JoystickMoveEvent joystickMove; //!< Joystick move event parameters (Event::JoystickMoved)
JoystickButtonEvent joystickButton; //!< Joystick button event parameters (Event::JoystickButtonPressed, Event::JoystickButtonReleased)
JoystickConnectEvent joystickConnect; //!< Joystick (dis)connect event parameters (Event::JoystickConnected, Event::JoystickDisconnected)
TouchEvent touch; //!< Touch events parameters (Event::TouchBegan, Event::TouchMoved, Event::TouchEnded)
SensorEvent sensor; //!< Sensor event parameters (Event::SensorChanged)
};
};

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 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.
@@ -48,9 +48,9 @@ public:
////////////////////////////////////////////////////////////
enum
{
Count = 8, ///< Maximum number of supported joysticks
ButtonCount = 32, ///< Maximum number of supported buttons
AxisCount = 8 ///< Maximum number of supported axes
Count = 8, //!< Maximum number of supported joysticks
ButtonCount = 32, //!< Maximum number of supported buttons
AxisCount = 8 //!< Maximum number of supported axes
};
////////////////////////////////////////////////////////////
@@ -59,14 +59,14 @@ public:
////////////////////////////////////////////////////////////
enum Axis
{
X, ///< The X axis
Y, ///< The Y axis
Z, ///< The Z axis
R, ///< The R axis
U, ///< The U axis
V, ///< The V axis
PovX, ///< The X axis of the point-of-view hat
PovY ///< The Y axis of the point-of-view hat
X, //!< The X axis
Y, //!< The Y axis
Z, //!< The Z axis
R, //!< The R axis
U, //!< The U axis
V, //!< The V axis
PovX, //!< The X axis of the point-of-view hat
PovY //!< The Y axis of the point-of-view hat
};
////////////////////////////////////////////////////////////
@@ -77,9 +77,9 @@ public:
{
Identification();
String name; ///< Name of the joystick
unsigned int vendorId; ///< Manufacturer identifier
unsigned int productId; ///< Product identifier
String name; //!< Name of the joystick
unsigned int vendorId; //!< Manufacturer identifier
unsigned int productId; //!< Product identifier
};
////////////////////////////////////////////////////////////

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -33,6 +33,8 @@
namespace sf
{
class String;
////////////////////////////////////////////////////////////
/// \brief Give access to the real-time state of the keyboard
///
@@ -44,123 +46,315 @@ public:
////////////////////////////////////////////////////////////
/// \brief Key codes
///
/// The enumerators refer to the "localized" key; i.e. depending
/// on the layout set by the operating system, a key can be mapped
/// to `Y` or `Z`.
///
////////////////////////////////////////////////////////////
enum Key
{
Unknown = -1, ///< Unhandled key
A = 0, ///< The A key
B, ///< The B key
C, ///< The C key
D, ///< The D key
E, ///< The E key
F, ///< The F key
G, ///< The G key
H, ///< The H key
I, ///< The I key
J, ///< The J key
K, ///< The K key
L, ///< The L key
M, ///< The M key
N, ///< The N key
O, ///< The O key
P, ///< The P key
Q, ///< The Q key
R, ///< The R key
S, ///< The S key
T, ///< The T key
U, ///< The U key
V, ///< The V key
W, ///< The W key
X, ///< The X key
Y, ///< The Y key
Z, ///< The Z key
Num0, ///< The 0 key
Num1, ///< The 1 key
Num2, ///< The 2 key
Num3, ///< The 3 key
Num4, ///< The 4 key
Num5, ///< The 5 key
Num6, ///< The 6 key
Num7, ///< The 7 key
Num8, ///< The 8 key
Num9, ///< The 9 key
Escape, ///< The Escape key
LControl, ///< The left Control key
LShift, ///< The left Shift key
LAlt, ///< The left Alt key
LSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
RControl, ///< The right Control key
RShift, ///< The right Shift key
RAlt, ///< The right Alt key
RSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
Menu, ///< The Menu key
LBracket, ///< The [ key
RBracket, ///< The ] key
Semicolon, ///< The ; key
Comma, ///< The , key
Period, ///< The . key
Quote, ///< The ' key
Slash, ///< The / key
Backslash, ///< The \ key
Tilde, ///< The ~ key
Equal, ///< The = key
Hyphen, ///< The - key (hyphen)
Space, ///< The Space key
Enter, ///< The Enter/Return keys
Backspace, ///< The Backspace key
Tab, ///< The Tabulation key
PageUp, ///< The Page up key
PageDown, ///< The Page down key
End, ///< The End key
Home, ///< The Home key
Insert, ///< The Insert key
Delete, ///< The Delete key
Add, ///< The + key
Subtract, ///< The - key (minus, usually from numpad)
Multiply, ///< The * key
Divide, ///< The / key
Left, ///< Left arrow
Right, ///< Right arrow
Up, ///< Up arrow
Down, ///< Down arrow
Numpad0, ///< The numpad 0 key
Numpad1, ///< The numpad 1 key
Numpad2, ///< The numpad 2 key
Numpad3, ///< The numpad 3 key
Numpad4, ///< The numpad 4 key
Numpad5, ///< The numpad 5 key
Numpad6, ///< The numpad 6 key
Numpad7, ///< The numpad 7 key
Numpad8, ///< The numpad 8 key
Numpad9, ///< The numpad 9 key
F1, ///< The F1 key
F2, ///< The F2 key
F3, ///< The F3 key
F4, ///< The F4 key
F5, ///< The F5 key
F6, ///< The F6 key
F7, ///< The F7 key
F8, ///< The F8 key
F9, ///< The F9 key
F10, ///< The F10 key
F11, ///< The F11 key
F12, ///< The F12 key
F13, ///< The F13 key
F14, ///< The F14 key
F15, ///< The F15 key
Pause, ///< The Pause key
Unknown = -1, //!< Unhandled key
A = 0, //!< The A key
B, //!< The B key
C, //!< The C key
D, //!< The D key
E, //!< The E key
F, //!< The F key
G, //!< The G key
H, //!< The H key
I, //!< The I key
J, //!< The J key
K, //!< The K key
L, //!< The L key
M, //!< The M key
N, //!< The N key
O, //!< The O key
P, //!< The P key
Q, //!< The Q key
R, //!< The R key
S, //!< The S key
T, //!< The T key
U, //!< The U key
V, //!< The V key
W, //!< The W key
X, //!< The X key
Y, //!< The Y key
Z, //!< The Z key
Num0, //!< The 0 key
Num1, //!< The 1 key
Num2, //!< The 2 key
Num3, //!< The 3 key
Num4, //!< The 4 key
Num5, //!< The 5 key
Num6, //!< The 6 key
Num7, //!< The 7 key
Num8, //!< The 8 key
Num9, //!< The 9 key
Escape, //!< The Escape key
LControl, //!< The left Control key
LShift, //!< The left Shift key
LAlt, //!< The left Alt key
LSystem, //!< The left OS specific key: window (Windows and Linux), apple (macOS), ...
RControl, //!< The right Control key
RShift, //!< The right Shift key
RAlt, //!< The right Alt key
RSystem, //!< The right OS specific key: window (Windows and Linux), apple (macOS), ...
Menu, //!< The Menu key
LBracket, //!< The [ key
RBracket, //!< The ] key
Semicolon, //!< The ; key
Comma, //!< The , key
Period, //!< The . key
Apostrophe, //!< The ' key
Slash, //!< The / key
Backslash, //!< The \ key
Grave, //!< The ` key
Equal, //!< The = key
Hyphen, //!< The - key (hyphen)
Space, //!< The Space key
Enter, //!< The Enter/Return keys
Backspace, //!< The Backspace key
Tab, //!< The Tabulation key
PageUp, //!< The Page up key
PageDown, //!< The Page down key
End, //!< The End key
Home, //!< The Home key
Insert, //!< The Insert key
Delete, //!< The Delete key
Add, //!< The + key
Subtract, //!< The - key (minus, usually from numpad)
Multiply, //!< The * key
Divide, //!< The / key
Left, //!< Left arrow
Right, //!< Right arrow
Up, //!< Up arrow
Down, //!< Down arrow
Numpad0, //!< The numpad 0 key
Numpad1, //!< The numpad 1 key
Numpad2, //!< The numpad 2 key
Numpad3, //!< The numpad 3 key
Numpad4, //!< The numpad 4 key
Numpad5, //!< The numpad 5 key
Numpad6, //!< The numpad 6 key
Numpad7, //!< The numpad 7 key
Numpad8, //!< The numpad 8 key
Numpad9, //!< The numpad 9 key
F1, //!< The F1 key
F2, //!< The F2 key
F3, //!< The F3 key
F4, //!< The F4 key
F5, //!< The F5 key
F6, //!< The F6 key
F7, //!< The F7 key
F8, //!< The F8 key
F9, //!< The F9 key
F10, //!< The F10 key
F11, //!< The F11 key
F12, //!< The F12 key
F13, //!< The F13 key
F14, //!< The F14 key
F15, //!< The F15 key
Pause, //!< The Pause key
KeyCount, ///< Keep last -- the total number of keyboard keys
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
Tilde = Grave, //!< \deprecated Use Grave instead
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
Quote = Apostrophe //!< \deprecated Use Apostrophe instead
};
////////////////////////////////////////////////////////////
/// \brief Scancodes
///
/// The enumerators are bound to a physical key and do not depend on
/// the keyboard layout used by the operating system. Usually, the AT-101
/// keyboard can be used as reference for the physical position of the keys.
///
////////////////////////////////////////////////////////////
struct Scan
{
// TODO: replace with enum class in SFML 3.
// Clang warns us rightfully that Scancode names shadow Key names.
// A safer solution would be to use a C++11 scoped enumeration (enum class),
// but it is not possible in SFML 2 which uses C++03.
// For now, we just ignore those warnings.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
#endif
enum Scancode
{
Unknown = -1, //!< Represents any scancode not present in this enum
A = 0, //!< Keyboard a and A key
B, //!< Keyboard b and B key
C, //!< Keyboard c and C key
D, //!< Keyboard d and D key
E, //!< Keyboard e and E key
F, //!< Keyboard f and F key
G, //!< Keyboard g and G key
H, //!< Keyboard h and H key
I, //!< Keyboard i and I key
J, //!< Keyboard j and J key
K, //!< Keyboard k and K key
L, //!< Keyboard l and L key
M, //!< Keyboard m and M key
N, //!< Keyboard n and N key
O, //!< Keyboard o and O key
P, //!< Keyboard p and P key
Q, //!< Keyboard q and Q key
R, //!< Keyboard r and R key
S, //!< Keyboard s and S key
T, //!< Keyboard t and T key
U, //!< Keyboard u and U key
V, //!< Keyboard v and V key
W, //!< Keyboard w and W key
X, //!< Keyboard x and X key
Y, //!< Keyboard y and Y key
Z, //!< Keyboard z and Z key
Num1, //!< Keyboard 1 and ! key
Num2, //!< Keyboard 2 and @ key
Num3, //!< Keyboard 3 and # key
Num4, //!< Keyboard 4 and $ key
Num5, //!< Keyboard 5 and % key
Num6, //!< Keyboard 6 and ^ key
Num7, //!< Keyboard 7 and & key
Num8, //!< Keyboard 8 and * key
Num9, //!< Keyboard 9 and ) key
Num0, //!< Keyboard 0 and ) key
Enter, //!< Keyboard Enter/Return key
Escape, //!< Keyboard Escape key
Backspace, //!< Keyboard Backspace key
Tab, //!< Keyboard Tab key
Space, //!< Keyboard Space key
Hyphen, //!< Keyboard - and _ key
Equal, //!< Keyboard = and +
LBracket, //!< Keyboard [ and { key
RBracket, //!< Keyboard ] and } key
// For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification)
// For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification)
// Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}]
Backslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards
Semicolon, //!< Keyboard ; and : key
Apostrophe, //!< Keyboard ' and " key
Grave, //!< Keyboard ` and ~ key
Comma, //!< Keyboard , and < key
Period, //!< Keyboard . and > key
Slash, //!< Keyboard / and ? key
F1, //!< Keyboard F1 key
F2, //!< Keyboard F2 key
F3, //!< Keyboard F3 key
F4, //!< Keyboard F4 key
F5, //!< Keyboard F5 key
F6, //!< Keyboard F6 key
F7, //!< Keyboard F7 key
F8, //!< Keyboard F8 key
F9, //!< Keyboard F9 key
F10, //!< Keyboard F10 key
F11, //!< Keyboard F11 key
F12, //!< Keyboard F12 key
F13, //!< Keyboard F13 key
F14, //!< Keyboard F14 key
F15, //!< Keyboard F15 key
F16, //!< Keyboard F16 key
F17, //!< Keyboard F17 key
F18, //!< Keyboard F18 key
F19, //!< Keyboard F19 key
F20, //!< Keyboard F20 key
F21, //!< Keyboard F21 key
F22, //!< Keyboard F22 key
F23, //!< Keyboard F23 key
F24, //!< Keyboard F24 key
CapsLock, //!< Keyboard Caps %Lock key
PrintScreen, //!< Keyboard Print Screen key
ScrollLock, //!< Keyboard Scroll %Lock key
Pause, //!< Keyboard Pause key
Insert, //!< Keyboard Insert key
Home, //!< Keyboard Home key
PageUp, //!< Keyboard Page Up key
Delete, //!< Keyboard Delete Forward key
End, //!< Keyboard End key
PageDown, //!< Keyboard Page Down key
Right, //!< Keyboard Right Arrow key
Left, //!< Keyboard Left Arrow key
Down, //!< Keyboard Down Arrow key
Up, //!< Keyboard Up Arrow key
NumLock, //!< Keypad Num %Lock and Clear key
NumpadDivide, //!< Keypad / key
NumpadMultiply, //!< Keypad * key
NumpadMinus, //!< Keypad - key
NumpadPlus, //!< Keypad + key
NumpadEqual, //!< keypad = key
NumpadEnter, //!< Keypad Enter/Return key
NumpadDecimal, //!< Keypad . and Delete key
Numpad1, //!< Keypad 1 and End key
Numpad2, //!< Keypad 2 and Down Arrow key
Numpad3, //!< Keypad 3 and Page Down key
Numpad4, //!< Keypad 4 and Left Arrow key
Numpad5, //!< Keypad 5 key
Numpad6, //!< Keypad 6 and Right Arrow key
Numpad7, //!< Keypad 7 and Home key
Numpad8, //!< Keypad 8 and Up Arrow key
Numpad9, //!< Keypad 9 and Page Up key
Numpad0, //!< Keypad 0 and Insert key
// For US keyboards doesn't exist
// For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification)
// Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|.
NonUsBackslash, //!< Keyboard Non-US \ and | key
Application, //!< Keyboard Application key
Execute, //!< Keyboard Execute key
ModeChange, //!< Keyboard Mode Change key
Help, //!< Keyboard Help key
Menu, //!< Keyboard Menu key
Select, //!< Keyboard Select key
Redo, //!< Keyboard Redo key
Undo, //!< Keyboard Undo key
Cut, //!< Keyboard Cut key
Copy, //!< Keyboard Copy key
Paste, //!< Keyboard Paste key
VolumeMute, //!< Keyboard Volume Mute key
VolumeUp, //!< Keyboard Volume Up key
VolumeDown, //!< Keyboard Volume Down key
MediaPlayPause, //!< Keyboard Media Play Pause key
MediaStop, //!< Keyboard Media Stop key
MediaNextTrack, //!< Keyboard Media Next Track key
MediaPreviousTrack, //!< Keyboard Media Previous Track key
LControl, //!< Keyboard Left Control key
LShift, //!< Keyboard Left Shift key
LAlt, //!< Keyboard Left Alt key
LSystem, //!< Keyboard Left System key
RControl, //!< Keyboard Right Control key
RShift, //!< Keyboard Right Shift key
RAlt, //!< Keyboard Right Alt key
RSystem, //!< Keyboard Right System key
Back, //!< Keyboard Back key
Forward, //!< Keyboard Forward key
Refresh, //!< Keyboard Refresh key
Stop, //!< Keyboard Stop key
Search, //!< Keyboard Search key
Favorites, //!< Keyboard Favorites key
HomePage, //!< Keyboard Home Page key
LaunchApplication1, //!< Keyboard Launch Application 1 key
LaunchApplication2, //!< Keyboard Launch Application 2 key
LaunchMail, //!< Keyboard Launch Mail key
LaunchMediaSelect, //!< Keyboard Launch Media Select key
ScancodeCount //!< Keep last -- the total number of scancodes
};
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
};
typedef Scan::Scancode Scancode;
////////////////////////////////////////////////////////////
/// \brief Check if a key is pressed
///
@@ -171,12 +365,73 @@ public:
////////////////////////////////////////////////////////////
static bool isKeyPressed(Key key);
////////////////////////////////////////////////////////////
/// \brief Check if a key is pressed
///
/// \param code Scancode to check
///
/// \return True if the physical key is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool isKeyPressed(Scancode code);
////////////////////////////////////////////////////////////
/// \brief Localize a physical key to a logical one
///
/// \param code Scancode to localize
///
/// \return The key corresponding to the scancode under the current
/// keyboard layout used by the operating system, or
/// sf::Keyboard::Unknown when the scancode cannot be mapped
/// to a Key.
///
/// \see delocalize
///
////////////////////////////////////////////////////////////
static Key localize(Scancode code);
////////////////////////////////////////////////////////////
/// \brief Identify the physical key corresponding to a logical one
///
/// \param key Key to "delocalize"
///
/// \return The scancode corresponding to the key under the current
/// keyboard layout used by the operating system, or
/// sf::Keyboard::Scan::Unknown when the key cannot be mapped
/// to a sf::Keyboard::Scancode.
///
/// \see localize
///
////////////////////////////////////////////////////////////
static Scancode delocalize(Key key);
////////////////////////////////////////////////////////////
/// \brief Provide a string representation for a given scancode
///
/// The returned string is a short, non-technical description of
/// the key represented with the given scancode. Most effectively
/// used in user interfaces, as the description for the key takes
/// the users keyboard layout into consideration.
///
/// \warning The result is OS-dependent: for example, sf::Keyboard::Scan::LSystem
/// is "Left Meta" on Linux, "Left Windows" on Windows and
/// "Left Command" on macOS.
///
/// The current keyboard layout set by the operating system is used to
/// interpret the scancode: for example, sf::Keyboard::Semicolon is
/// mapped to ";" for layout and to "é" for others.
///
/// \return The localized description of the code
///
////////////////////////////////////////////////////////////
static String getDescription(Scancode code);
////////////////////////////////////////////////////////////
/// \brief Show or hide the virtual keyboard
///
/// Warning: the virtual keyboard is not supported on all
/// systems. It will typically be implemented on mobile OSes
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
/// \warning The virtual keyboard is not supported on all
/// systems. It will typically be implemented on mobile OSes
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
///
/// If the virtual keyboard is not available, this function does
/// nothing.
@@ -225,6 +480,10 @@ public:
/// {
/// // quit...
/// }
/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Scan::Grave))
/// {
/// // open in-game command line (if it's not already open)
/// }
/// \endcode
///
/// \see sf::Joystick, sf::Mouse, sf::Touch

Some files were not shown because too many files have changed in this diff Show More