SFML
Simple and Fast Multimedia Library
Loading...
Searching...
No Matches
sf Namespace Reference

Namespaces

namespace  priv
namespace  Glsl
 Namespace with GLSL types.
namespace  Clipboard
 Give access to the system clipboard.
namespace  Joystick
 Give access to the real-time state of the joysticks.
namespace  Keyboard
 Give access to the real-time state of the keyboard.
namespace  Mouse
 Give access to the real-time state of the mouse.
namespace  Sensor
 Give access to the real-time state of the sensors.
namespace  Touch
 Give access to the real-time state of the touches.
namespace  Vulkan
 Vulkan helper functions.
namespace  Style
namespace  Literals
namespace  Listener
 The audio listener is the point in the scene from where all the sounds are heard.
namespace  PlaybackDevice

Classes

class  BlendMode
 Blending modes for drawing. More...
class  CircleShape
 Specialized shape representing a circle. More...
class  Color
 Utility class for manipulating RGBA colors. More...
class  ConvexShape
 Specialized shape representing a convex polygon. More...
class  Drawable
 Abstract base class for objects that can be drawn to a render target. More...
class  Font
 Class for loading and manipulating character fonts. More...
struct  Glyph
 Structure describing a glyph. More...
class  Image
 Class for loading, manipulating and saving images. More...
class  Rect
 Utility class for manipulating 2D axis aligned rectangles. More...
class  RectangleShape
 Specialized shape representing a rectangle. More...
class  RenderStates
 Define the states used for drawing to a RenderTarget. More...
class  RenderTarget
 Base class for all render targets (window, texture, ...). More...
class  RenderTexture
 Target for off-screen 2D rendering into a texture. More...
class  RenderWindow
 Window that can serve as a target for 2D drawing. More...
class  Shader
 Shader class (vertex, geometry and fragment). More...
class  Shape
 Base class for textured shapes with outline. More...
class  Sprite
 Drawable representation of a texture, with its own transformations, color, etc. More...
struct  StencilValue
 Stencil value type (also used as a mask). More...
class  StencilMode
 Stencil modes for drawing. More...
class  Text
 Graphical text that can be drawn to a render target. More...
class  Texture
 Image living on the graphics card that can be used for drawing. More...
class  Transform
 Define a 3x3 transform matrix. More...
class  Transformable
 Decomposed transform defined by a position, a rotation and a scale. More...
struct  Vertex
 Define a point with color and texture coordinates. More...
class  VertexArray
 Define a set of one or more 2D primitives. More...
class  VertexBuffer
 Vertex buffer storage for one or more 2D primitives. More...
class  View
 2D camera that defines what region is shown on screen More...
class  Context
 Class holding a valid drawing context. More...
class  ContextSettings
 Structure defining the settings of the OpenGL context attached to a window. More...
class  Cursor
 Cursor defines the appearance of a system cursor. More...
class  Event
 Defines a system event and its parameters. More...
class  GlResource
 Base class for classes that require an OpenGL context. More...
class  VideoMode
 VideoMode defines a video mode (width, height, bpp). More...
class  Window
 Window that serves as a target for OpenGL rendering. More...
class  WindowBase
 Window that serves as a base for other windows. More...
class  Angle
 Represents an angle value. More...
class  Clock
 Utility class that measures the elapsed time. More...
class  Exception
 Library-specific exception type. More...
class  FileInputStream
 Implementation of input stream based on a file. More...
class  InputStream
 Abstract class for custom file input streams. More...
class  MemoryInputStream
 Implementation of input stream based on a memory chunk. More...
struct  U8StringCharTraits
 Character traits for std::uint8_t. More...
class  String
 Utility string class that automatically handles conversions between types and encodings. More...
struct  SuspendAwareClock
 Android, chrono-compatible, suspend-aware clock. More...
class  Time
 Represents a time value. More...
class  Utf
class  Utf< 8 >
 Specialization of the Utf template for UTF-8. More...
class  Utf< 16 >
 Specialization of the Utf template for UTF-16. More...
class  Utf< 32 >
 Specialization of the Utf template for UTF-32. More...
class  Vector2
 Class template for manipulating 2-dimensional vectors. More...
class  Vector3
 Utility template class for manipulating 3-dimensional vectors. More...
class  AudioResource
 Base class for classes that require an audio device. More...
class  InputSoundFile
 Provide read access to sound files. More...
class  Music
 Streamed music played from an audio file. More...
class  OutputSoundFile
 Provide write access to sound files. More...
class  Sound
 Regular sound that can be played in the audio environment. More...
class  SoundBuffer
 Storage for audio samples defining a sound. More...
class  SoundBufferRecorder
 Specialized SoundRecorder which stores the captured audio data into a sound buffer. More...
class  SoundFileFactory
 Manages and instantiates sound file readers and writers. More...
class  SoundFileReader
 Abstract base class for sound file decoding. More...
class  SoundFileWriter
 Abstract base class for sound file encoding. More...
class  SoundRecorder
 Abstract base class for capturing sound data. More...
class  SoundSource
 Base class defining a sound's properties. More...
class  SoundStream
 Abstract base class for streamed audio sources. More...
class  Ftp
 A FTP client. More...
class  Http
 A HTTP client. More...
class  IpAddress
 Encapsulate an IPv4 network address. More...
class  Packet
 Utility class to build blocks of data to transfer over the network. More...
class  Socket
 Base class for all the socket types. More...
class  SocketSelector
 Multiplexer that allows to read from multiple sockets. More...
class  TcpListener
 Socket that listens to new TCP connections. More...
class  TcpSocket
 Specialized socket using the TCP protocol. More...
class  UdpSocket
 Specialized socket using the UDP protocol. More...

Typedefs

using IntRect = Rect<int>
using FloatRect = Rect<float>
using GlFunctionPointer = void (*)()
using ContextDestroyCallback = void (*)(void*)
using VulkanFunctionPointer = void (*)()
using U8String = std::basic_string<std::uint8_t, U8StringCharTraits>
 Portable replacement for std::basic_string<std::uint8_t>.
using Utf8 = Utf<8>
using Utf16 = Utf<16>
using Utf32 = Utf<32>
using Vector2i = Vector2<int>
using Vector2u = Vector2<unsigned int>
using Vector2f = Vector2<float>
using Vector3i = Vector3<int>
using Vector3f = Vector3<float>
using SocketHandle = int

Enumerations

enum class  CoordinateType { Normalized , Pixels }
 Types of texture coordinates that can be used for rendering. More...
enum class  PrimitiveType {
  Points , Lines , LineStrip , Triangles ,
  TriangleStrip , TriangleFan
}
 Types of primitives that a sf::VertexArray can render. More...
enum class  StencilComparison {
  Never , Less , LessEqual , Greater ,
  GreaterEqual , Equal , NotEqual , Always
}
 Enumeration of the stencil test comparisons that can be performed. More...
enum class  StencilUpdateOperation {
  Keep , Zero , Replace , Increment ,
  Decrement , Invert
}
 Enumeration of the stencil buffer update operations. More...
enum class  State { Windowed , Fullscreen }
 Enumeration of the window states. More...
enum class  SoundChannel {
  Unspecified , Mono , FrontLeft , FrontRight ,
  FrontCenter , FrontLeftOfCenter , FrontRightOfCenter , LowFrequencyEffects ,
  BackLeft , BackRight , BackCenter , SideLeft ,
  SideRight , TopCenter , TopFrontLeft , TopFrontRight ,
  TopFrontCenter , TopBackLeft , TopBackRight , TopBackCenter
}
 Types of sound channels that can be read/written from sound buffers/files. More...

Functions

SFML_GRAPHICS_API void swap (Texture &left, Texture &right) noexcept
 Swap the contents of one texture with those of another.
SFML_GRAPHICS_API void swap (VertexBuffer &left, VertexBuffer &right) noexcept
 Swap the contents of one vertex buffer with those of another.
constexpr Angle degrees (float angle)
 Construct an angle value from a number of degrees.
constexpr Angle radians (float angle)
 Construct an angle value from a number of radians.
SFML_SYSTEM_API std::ostream & err ()
 Standard stream used by SFML to output warnings and errors.
SFML_SYSTEM_API ANativeActivity * getNativeActivity ()
 Return a pointer to the Android native activity.
void SFML_SYSTEM_API sleep (Time duration)
 Make the current thread sleep for a given duration.
SFML_NETWORK_API bool operator== (IpAddress left, IpAddress right)
 Overload of == operator to compare two IP addresses.
SFML_NETWORK_API bool operator!= (IpAddress left, IpAddress right)
 Overload of != operator to compare two IP addresses.
SFML_NETWORK_API bool operator< (IpAddress left, IpAddress right)
 Overload of < operator to compare two IP addresses.
SFML_NETWORK_API bool operator> (IpAddress left, IpAddress right)
 Overload of > operator to compare two IP addresses.
SFML_NETWORK_API bool operator<= (IpAddress left, IpAddress right)
 Overload of <= operator to compare two IP addresses.
SFML_NETWORK_API bool operator>= (IpAddress left, IpAddress right)
 Overload of >= operator to compare two IP addresses.
SFML_NETWORK_API std::istream & operator>> (std::istream &stream, std::optional< IpAddress > &address)
 Overload of >> operator to extract an IP address from an input stream.
SFML_NETWORK_API std::ostream & operator<< (std::ostream &stream, IpAddress address)
 Overload of << operator to print an IP address to an output stream.
SFML_GRAPHICS_API bool operator== (const BlendMode &left, const BlendMode &right)
 Overload of the == operator.
SFML_GRAPHICS_API bool operator!= (const BlendMode &left, const BlendMode &right)
 Overload of the != operator.
constexpr bool operator== (Color left, Color right)
 Overload of the == operator.
constexpr bool operator!= (Color left, Color right)
 Overload of the != operator.
constexpr Color operator+ (Color left, Color right)
 Overload of the binary + operator.
constexpr Color operator- (Color left, Color right)
 Overload of the binary - operator.
constexpr Color operator* (Color left, Color right)
 Overload of the binary * operator.
constexpr Coloroperator+= (Color &left, Color right)
 Overload of the binary += operator.
constexpr Coloroperator-= (Color &left, Color right)
 Overload of the binary -= operator.
constexpr Coloroperator*= (Color &left, Color right)
 Overload of the binary *= operator.
template<typename T>
constexpr bool operator== (const Rect< T > &lhs, const Rect< T > &rhs)
 Overload of binary operator ==.
template<typename T>
constexpr bool operator!= (const Rect< T > &lhs, const Rect< T > &rhs)
 Overload of binary operator !=.
SFML_GRAPHICS_API bool operator== (const StencilMode &left, const StencilMode &right)
 Overload of the == operator.
SFML_GRAPHICS_API bool operator!= (const StencilMode &left, const StencilMode &right)
 Overload of the != operator.
constexpr Transform operator* (const Transform &left, const Transform &right)
 Overload of binary operator * to combine two transforms.
constexpr Transformoperator*= (Transform &left, const Transform &right)
 Overload of binary operator *= to combine two transforms.
constexpr Vector2f operator* (const Transform &left, Vector2f right)
 Overload of binary operator * to transform a point.
constexpr bool operator== (const Transform &left, const Transform &right)
 Overload of binary operator == to compare two transforms.
constexpr bool operator!= (const Transform &left, const Transform &right)
 Overload of binary operator != to compare two transforms.
SFML_WINDOW_API bool operator== (const VideoMode &left, const VideoMode &right)
 Overload of == operator to compare two video modes.
SFML_WINDOW_API bool operator!= (const VideoMode &left, const VideoMode &right)
 Overload of != operator to compare two video modes.
SFML_WINDOW_API bool operator< (const VideoMode &left, const VideoMode &right)
 Overload of < operator to compare video modes.
SFML_WINDOW_API bool operator> (const VideoMode &left, const VideoMode &right)
 Overload of > operator to compare video modes.
SFML_WINDOW_API bool operator<= (const VideoMode &left, const VideoMode &right)
 Overload of <= operator to compare video modes.
SFML_WINDOW_API bool operator>= (const VideoMode &left, const VideoMode &right)
 Overload of >= operator to compare video modes.
constexpr bool operator== (Angle left, Angle right)
 Overload of == operator to compare two angle values.
constexpr bool operator!= (Angle left, Angle right)
 Overload of != operator to compare two angle values.
constexpr bool operator< (Angle left, Angle right)
 Overload of < operator to compare two angle values.
constexpr bool operator> (Angle left, Angle right)
 Overload of > operator to compare two angle values.
constexpr bool operator<= (Angle left, Angle right)
 Overload of <= operator to compare two angle values.
constexpr bool operator>= (Angle left, Angle right)
 Overload of >= operator to compare two angle values.
constexpr Angle operator- (Angle right)
 Overload of unary - operator to negate an angle value.
constexpr Angle operator+ (Angle left, Angle right)
 Overload of binary + operator to add two angle values.
constexpr Angleoperator+= (Angle &left, Angle right)
 Overload of binary += operator to add/assign two angle values.
constexpr Angle operator- (Angle left, Angle right)
 Overload of binary - operator to subtract two angle values.
constexpr Angleoperator-= (Angle &left, Angle right)
 Overload of binary -= operator to subtract/assign two angle values.
constexpr Angle operator* (Angle left, float right)
 Overload of binary * operator to scale an angle value.
constexpr Angle operator* (float left, Angle right)
 Overload of binary * operator to scale an angle value.
constexpr Angleoperator*= (Angle &left, float right)
 Overload of binary *= operator to scale/assign an angle value.
constexpr Angle operator/ (Angle left, float right)
 Overload of binary / operator to scale an angle value.
constexpr Angleoperator/= (Angle &left, float right)
 Overload of binary /= operator to scale/assign an angle value.
constexpr float operator/ (Angle left, Angle right)
 Overload of binary / operator to compute the ratio of two angle values.
constexpr Angle operator% (Angle left, Angle right)
 Overload of binary % operator to compute modulo of an angle value.
constexpr Angleoperator%= (Angle &left, Angle right)
 Overload of binary %= operator to compute/assign remainder of an angle value.
constexpr Angle operator""_deg (long double angle)
 User defined literal for angles in degrees, e.g. 10.5_deg.
constexpr Angle operator""_deg (unsigned long long int angle)
 User defined literal for angles in degrees, e.g. 90_deg.
constexpr Angle operator""_rad (long double angle)
 User defined literal for angles in radians, e.g. 0.1_rad.
constexpr Angle operator""_rad (unsigned long long int angle)
 User defined literal for angles in radians, e.g. 2_rad.
SFML_SYSTEM_API bool operator== (const String &left, const String &right)
 Overload of == operator to compare two UTF-32 strings.
SFML_SYSTEM_API bool operator!= (const String &left, const String &right)
 Overload of != operator to compare two UTF-32 strings.
SFML_SYSTEM_API bool operator< (const String &left, const String &right)
 Overload of < operator to compare two UTF-32 strings.
SFML_SYSTEM_API bool operator> (const String &left, const String &right)
 Overload of > operator to compare two UTF-32 strings.
SFML_SYSTEM_API bool operator<= (const String &left, const String &right)
 Overload of <= operator to compare two UTF-32 strings.
SFML_SYSTEM_API bool operator>= (const String &left, const String &right)
 Overload of >= operator to compare two UTF-32 strings.
SFML_SYSTEM_API String operator+ (const String &left, const String &right)
 Overload of binary + operator to concatenate two strings.
constexpr Time seconds (float amount)
 Construct a time value from a number of seconds.
constexpr Time milliseconds (std::int32_t amount)
 Construct a time value from a number of milliseconds.
constexpr Time microseconds (std::int64_t amount)
 Construct a time value from a number of microseconds.
constexpr bool operator== (Time left, Time right)
 Overload of == operator to compare two time values.
constexpr bool operator!= (Time left, Time right)
 Overload of != operator to compare two time values.
constexpr bool operator< (Time left, Time right)
 Overload of < operator to compare two time values.
constexpr bool operator> (Time left, Time right)
 Overload of > operator to compare two time values.
constexpr bool operator<= (Time left, Time right)
 Overload of <= operator to compare two time values.
constexpr bool operator>= (Time left, Time right)
 Overload of >= operator to compare two time values.
constexpr Time operator- (Time right)
 Overload of unary - operator to negate a time value.
constexpr Time operator+ (Time left, Time right)
 Overload of binary + operator to add two time values.
constexpr Timeoperator+= (Time &left, Time right)
 Overload of binary += operator to add/assign two time values.
constexpr Time operator- (Time left, Time right)
 Overload of binary - operator to subtract two time values.
constexpr Timeoperator-= (Time &left, Time right)
 Overload of binary -= operator to subtract/assign two time values.
constexpr Time operator* (Time left, float right)
 Overload of binary * operator to scale a time value.
constexpr Time operator* (Time left, std::int64_t right)
 Overload of binary * operator to scale a time value.
constexpr Time operator* (float left, Time right)
 Overload of binary * operator to scale a time value.
constexpr Time operator* (std::int64_t left, Time right)
 Overload of binary * operator to scale a time value.
constexpr Timeoperator*= (Time &left, float right)
 Overload of binary *= operator to scale/assign a time value.
constexpr Timeoperator*= (Time &left, std::int64_t right)
 Overload of binary *= operator to scale/assign a time value.
constexpr Time operator/ (Time left, float right)
 Overload of binary / operator to scale a time value.
constexpr Time operator/ (Time left, std::int64_t right)
 Overload of binary / operator to scale a time value.
constexpr Timeoperator/= (Time &left, float right)
 Overload of binary /= operator to scale/assign a time value.
constexpr Timeoperator/= (Time &left, std::int64_t right)
 Overload of binary /= operator to scale/assign a time value.
constexpr float operator/ (Time left, Time right)
 Overload of binary / operator to compute the ratio of two time values.
constexpr Time operator% (Time left, Time right)
 Overload of binary % operator to compute remainder of a time value.
constexpr Timeoperator%= (Time &left, Time right)
 Overload of binary %= operator to compute/assign remainder of a time value.
template<typename T>
constexpr Vector2< T > operator- (Vector2< T > right)
 Overload of unary operator -.
template<typename T>
constexpr Vector2< T > & operator+= (Vector2< T > &left, Vector2< T > right)
 Overload of binary operator +=.
template<typename T>
constexpr Vector2< T > & operator-= (Vector2< T > &left, Vector2< T > right)
 Overload of binary operator -=.
template<typename T>
constexpr Vector2< T > operator+ (Vector2< T > left, Vector2< T > right)
 Overload of binary operator +.
template<typename T>
constexpr Vector2< T > operator- (Vector2< T > left, Vector2< T > right)
 Overload of binary operator -.
template<typename T>
constexpr Vector2< T > operator* (Vector2< T > left, T right)
 Overload of binary operator *.
template<typename T>
constexpr Vector2< T > operator* (T left, Vector2< T > right)
 Overload of binary operator *.
template<typename T>
constexpr Vector2< T > & operator*= (Vector2< T > &left, T right)
 Overload of binary operator *=.
template<typename T>
constexpr Vector2< T > operator/ (Vector2< T > left, T right)
 Overload of binary operator /.
template<typename T>
constexpr Vector2< T > & operator/= (Vector2< T > &left, T right)
 Overload of binary operator /=.
template<typename T>
constexpr bool operator== (Vector2< T > left, Vector2< T > right)
 Overload of binary operator ==.
template<typename T>
constexpr bool operator!= (Vector2< T > left, Vector2< T > right)
 Overload of binary operator !=.
template<typename T>
constexpr Vector3< T > operator- (const Vector3< T > &left)
 Overload of unary operator -.
template<typename T>
constexpr Vector3< T > & operator+= (Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator +=.
template<typename T>
constexpr Vector3< T > & operator-= (Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator -=.
template<typename T>
constexpr Vector3< T > operator+ (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator +.
template<typename T>
constexpr Vector3< T > operator- (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator -.
template<typename T>
constexpr Vector3< T > operator* (const Vector3< T > &left, T right)
 Overload of binary operator *.
template<typename T>
constexpr Vector3< T > operator* (T left, const Vector3< T > &right)
 Overload of binary operator *.
template<typename T>
constexpr Vector3< T > & operator*= (Vector3< T > &left, T right)
 Overload of binary operator *=.
template<typename T>
constexpr Vector3< T > operator/ (const Vector3< T > &left, T right)
 Overload of binary operator /.
template<typename T>
constexpr Vector3< T > & operator/= (Vector3< T > &left, T right)
 Overload of binary operator /=.
template<typename T>
constexpr bool operator== (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator ==.
template<typename T>
constexpr bool operator!= (const Vector3< T > &left, const Vector3< T > &right)
 Overload of binary operator !=.

Variables

SFML_GRAPHICS_API const BlendMode BlendAlpha
 Blend source and dest according to dest alpha.
SFML_GRAPHICS_API const BlendMode BlendAdd
 Add source to dest.
SFML_GRAPHICS_API const BlendMode BlendMultiply
 Multiply source and dest.
SFML_GRAPHICS_API const BlendMode BlendMin
 Take minimum between source and dest.
SFML_GRAPHICS_API const BlendMode BlendMax
 Take maximum between source and dest.
SFML_GRAPHICS_API const BlendMode BlendNone
 Overwrite dest with source.

Typedef Documentation

◆ ContextDestroyCallback

using sf::ContextDestroyCallback = void (*)(void*)

◆ FloatRect

using sf::FloatRect = Rect<float>

◆ GlFunctionPointer

using sf::GlFunctionPointer = void (*)()

◆ IntRect

using sf::IntRect = Rect<int>

◆ SocketHandle

using sf::SocketHandle = int

◆ U8String

using sf::U8String = std::basic_string<std::uint8_t, U8StringCharTraits>

Portable replacement for std::basic_string<std::uint8_t>.

While all major C++ implementations happen to define this as of early 2024, this specialization is not strictly speaking standard C++. Thus we can't depend on its continued existence.

◆ Utf16

using sf::Utf16 = Utf<16>

◆ Utf32

using sf::Utf32 = Utf<32>

◆ Utf8

using sf::Utf8 = Utf<8>

◆ Vector2f

using sf::Vector2f = Vector2<float>

◆ Vector2i

using sf::Vector2i = Vector2<int>

◆ Vector2u

using sf::Vector2u = Vector2<unsigned int>

◆ Vector3f

using sf::Vector3f = Vector3<float>

◆ Vector3i

using sf::Vector3i = Vector3<int>

◆ VulkanFunctionPointer

using sf::VulkanFunctionPointer = void (*)()

Enumeration Type Documentation

◆ CoordinateType

enum class sf::CoordinateType
strong

Types of texture coordinates that can be used for rendering.

See also
sf::Texture::bind
Enumerator
Normalized 

Texture coordinates in range [0 .. 1].

Pixels 

Texture coordinates in range [0 .. size].

◆ PrimitiveType

enum class sf::PrimitiveType
strong

Types of primitives that a sf::VertexArray can render.

Points and lines have no area, therefore their thickness will always be 1 pixel, regardless the current transform and view.

Enumerator
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.

◆ SoundChannel

enum class sf::SoundChannel
strong

Types of sound channels that can be read/written from sound buffers/files.

In multi-channel audio, each sound channel can be assigned a position. The position of the channel is used to determine where to place a sound when it is spatialised. Assigning an incorrect sound channel will result in multi-channel audio being positioned incorrectly when using spatialisation.

Enumerator
Unspecified 
Mono 
FrontLeft 
FrontRight 
FrontCenter 
FrontLeftOfCenter 
FrontRightOfCenter 
LowFrequencyEffects 
BackLeft 
BackRight 
BackCenter 
SideLeft 
SideRight 
TopCenter 
TopFrontLeft 
TopFrontRight 
TopFrontCenter 
TopBackLeft 
TopBackRight 
TopBackCenter 

◆ State

enum class sf::State
strong

Enumeration of the window states.

Enumerator
Windowed 

Floating window.

Fullscreen 

Fullscreen window.

◆ StencilComparison

enum class sf::StencilComparison
strong

Enumeration of the stencil test comparisons that can be performed.

The comparisons are mapped directly to their OpenGL equivalents, specified by glStencilFunc().

Enumerator
Never 

The stencil test never passes.

Less 

The stencil test passes if the new value is less than the value in the stencil buffer.

LessEqual 

The stencil test passes if the new value is less than or equal to the value in the stencil buffer.

Greater 

The stencil test passes if the new value is greater than the value in the stencil buffer.

GreaterEqual 

The stencil test passes if the new value is greater than or equal to the value in the stencil buffer.

Equal 

The stencil test passes if the new value is strictly equal to the value in the stencil buffer.

NotEqual 

The stencil test passes if the new value is strictly inequal to the value in the stencil buffer.

Always 

The stencil test always passes.

◆ StencilUpdateOperation

enum class sf::StencilUpdateOperation
strong

Enumeration of the stencil buffer update operations.

The update operations are mapped directly to their OpenGL equivalents, specified by glStencilOp().

Enumerator
Keep 

If the stencil test passes, the value in the stencil buffer is not modified.

Zero 

If the stencil test passes, the value in the stencil buffer is set to zero.

Replace 

If the stencil test passes, the value in the stencil buffer is set to the new value.

Increment 

If the stencil test passes, the value in the stencil buffer is incremented and if required clamped.

Decrement 

If the stencil test passes, the value in the stencil buffer is decremented and if required clamped.

Invert 

If the stencil test passes, the value in the stencil buffer is bitwise inverted.

Function Documentation

◆ degrees()

Angle sf::degrees ( float angle)
nodiscardconstexpr

Construct an angle value from a number of degrees.

Parameters
angleNumber of degrees
Returns
Angle value constructed from the number of degrees
See also
radians

◆ err()

SFML_SYSTEM_API std::ostream & sf::err ( )
nodiscard

Standard stream used by SFML to output warnings and errors.

By default, sf::err() outputs to the same location as std::cerr, (-> the stderr descriptor) which is the console if there's one available.

It is a standard std::ostream instance, so it supports all the insertion operations defined by the STL (operator <<, manipulators, etc.).

sf::err() can be redirected to write to another output, independently of std::cerr, by using the rdbuf() function provided by the std::ostream class.

Example:

// Redirect to a file
std::ofstream file("sfml-log.txt");
std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
// Redirect to nothing
sf::err().rdbuf(nullptr);
// Restore the original output
sf::err().rdbuf(previous);
SFML_SYSTEM_API std::ostream & err()
Standard stream used by SFML to output warnings and errors.
Returns
Reference to std::ostream representing the SFML error stream

◆ getNativeActivity()

SFML_SYSTEM_API ANativeActivity * sf::getNativeActivity ( )
nodiscard

Return a pointer to the Android native activity.

You shouldn't have to use this function, unless you want to implement very specific details, that SFML doesn't support, or to use a workaround for a known issue.

Returns
Pointer to Android native activity structure

\sfplatform{Android,SFML/System/NativeActivity.hpp}

◆ operator!=() [1/12]

SFML_NETWORK_API bool sf::operator!= ( IpAddress left,
IpAddress right )
nodiscard

Overload of != operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if both addresses are different

◆ operator<() [1/5]

SFML_NETWORK_API bool sf::operator< ( IpAddress left,
IpAddress right )
nodiscard

Overload of < operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if left is lesser than right

◆ operator<<()

SFML_NETWORK_API std::ostream & sf::operator<< ( std::ostream & stream,
IpAddress address )

Overload of << operator to print an IP address to an output stream.

Parameters
streamOutput stream
addressIP address to print
Returns
Reference to the output stream

◆ operator<=() [1/5]

SFML_NETWORK_API bool sf::operator<= ( IpAddress left,
IpAddress right )
nodiscard

Overload of <= operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if left is lesser or equal than right

◆ operator==() [1/12]

SFML_NETWORK_API bool sf::operator== ( IpAddress left,
IpAddress right )
nodiscard

Overload of == operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if both addresses are equal

◆ operator>() [1/5]

SFML_NETWORK_API bool sf::operator> ( IpAddress left,
IpAddress right )
nodiscard

Overload of > operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if left is greater than right

◆ operator>=() [1/5]

SFML_NETWORK_API bool sf::operator>= ( IpAddress left,
IpAddress right )
nodiscard

Overload of >= operator to compare two IP addresses.

Parameters
leftLeft operand (a IP address)
rightRight operand (a IP address)
Returns
True if left is greater or equal than right

◆ operator>>()

SFML_NETWORK_API std::istream & sf::operator>> ( std::istream & stream,
std::optional< IpAddress > & address )

Overload of >> operator to extract an IP address from an input stream.

Parameters
streamInput stream
addressIP address to extract
Returns
Reference to the input stream

◆ radians()

Angle sf::radians ( float angle)
nodiscardconstexpr

Construct an angle value from a number of radians.

Parameters
angleNumber of radians
Returns
Angle value constructed from the number of radians
See also
degrees

◆ sleep()

void SFML_SYSTEM_API sf::sleep ( Time duration)

Make the current thread sleep for a given duration.

sf::sleep is the best way to block a program or one of its threads, as it doesn't consume any CPU power. Compared to the standard std::this_thread::sleep_for function, this one provides more accurate sleeping time thanks to some platform-specific tweaks.

sf::sleep only guarantees millisecond precision. Sleeping for a duration less than 1 millisecond is prone to result in the actual sleep duration being less than what is requested.

Parameters
durationTime to sleep

◆ swap() [1/2]

SFML_GRAPHICS_API void sf::swap ( Texture & left,
Texture & right )
noexcept

Swap the contents of one texture with those of another.

Parameters
leftFirst instance to swap
rightSecond instance to swap

◆ swap() [2/2]

SFML_GRAPHICS_API void sf::swap ( VertexBuffer & left,
VertexBuffer & right )
noexcept

Swap the contents of one vertex buffer with those of another.

Parameters
leftFirst instance to swap
rightSecond instance to swap

Variable Documentation

◆ BlendAdd

SFML_GRAPHICS_API const BlendMode sf::BlendAdd
extern

Add source to dest.

◆ BlendAlpha

SFML_GRAPHICS_API const BlendMode sf::BlendAlpha
extern

Blend source and dest according to dest alpha.

◆ BlendMax

SFML_GRAPHICS_API const BlendMode sf::BlendMax
extern

Take maximum between source and dest.

◆ BlendMin

SFML_GRAPHICS_API const BlendMode sf::BlendMin
extern

Take minimum between source and dest.

◆ BlendMultiply

SFML_GRAPHICS_API const BlendMode sf::BlendMultiply
extern

Multiply source and dest.

◆ BlendNone

SFML_GRAPHICS_API const BlendMode sf::BlendNone
extern

Overwrite dest with source.