# sf Namespace Reference

## Classes

class | AudioResource
| Abstract base class for every class that owns a device-dependant resource -- allow them to initialize / shutdown even when the audio context is not created. More...
class | Listener
| Listener is a global interface for defining the audio listener properties ; the audio listener is the point in the scene from where all the sounds are heard. More...
class | Music
| Music defines a big sound played using streaming, so usually what we call a music :). More...
class | Sound
| Sound defines the properties of a sound such as position, volume, pitch, etc. More...
class | SoundBuffer
| SoundBuffer is the low-level for loading and manipulating sound buffers. More...
class | SoundBufferRecorder
| Specialized SoundRecorder which saves the captured audio data into a sound buffer. More...
class | SoundRecorder
| SoundRecorder is an interface for capturing sound data, it is meant to be used as a base class. More...
class | SoundStream
| SoundStream is a streamed sound, ie samples are acquired while the sound is playing. More...
class | Color
| Color is an utility class for manipulating 32-bits RGBA colors. More...
class | Drawable
| Abstract base class for every object that can be drawn into a render window. More...
class | Font
| Font is the low-level class for loading and manipulating character fonts. More...
class | Glyph
| Structure describing a glyph (a visual character). More...
class | Image
| Image is the low-level class for loading and manipulating images. More...
class | Matrix3
| Utility class to manipulate 3x3 matrices representing 2D transformations. More...
class | PostFX
| PostFX is used to apply a post effect to a window. More...
class | Rect
| Rect is an utility class for manipulating rectangles. More...
class | RenderTarget
| Base class for all render targets (window, image, . More...
class | RenderWindow
| Simple wrapper for sf::Window that allows easy 2D rendering. More...
class | Shape
| Shape defines a drawable convex shape ; it also defines helper functions to draw simple shapes like lines, rectangles, circles, etc. More...
class | Sprite
| Sprite defines a sprite : texture, transformations, color, and draw on screen. More...
class | String
| String defines a graphical 2D text, that can be drawn on screen. More...
class | View
| This class defines a view (position, size, etc. More...
class | Ftp
| This class provides methods for manipulating the FTP protocol (described in RFC 959). More...
class | Http
| This class provides methods for manipulating the HTTP protocol (described in RFC 1945). More...
class | IPAddress
| IPAddress provides easy manipulation of IP v4 addresses. More...
class | Packet
| Packet wraps data to send / to receive through the network. More...
class | Selector
| Selector allow reading from multiple sockets without blocking. More...
class | SelectorBase
| Private base class for selectors. More...
class | SocketTCP
| SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower). More...
class | SocketUDP
| SocketUDP wraps a socket using UDP protocol to send data fastly (but with less safety). More...
class | SocketHelper
| This class defines helper functions to do all the non-portable socket stuff. More...
class | Clock
| Clock is an utility class for manipulating time. More...
class | Lock
| Lock is an exception-safe automatic wrapper for locking and unlocking mutexes. More...
struct | NonCopyable
| Utility base class to easily declare non-copyable classes. More...
class | Randomizer
| Randomizer is an utility class for generating pseudo-random numbers. More...
class | Resource
| Base class for every resource that needs to notify dependent classes about its destruction. More...
class | ResourcePtr
| Safe pointer to a T resource (inheriting from sf::Resource<T>), its pointer is automatically reseted when the resource is destroyed. More...
class | Unicode
| Provides utility functions to convert from and to any unicode and ASCII encoding. More...
class | Vector2
| Vector2 is an utility class for manipulating 2 dimensional vectors. More...
class | Vector3
| Vector3 is an utility class for manipulating 3 dimensional vectors. More...
class | Mutex
| Mutex defines a mutex (MUTual EXclusion) object, that allows a thread to lock critical instructions to avoid simultaneous access with other threads. More...
class | Thread
| Thread defines an easy way to manipulate a thread. More...
class | Context
| Class wrapping an OpenGL context. More...
class | Event
| Event defines a system event and its parameters. More...
class | Input
| Input handles real-time input from keyboard and mouse. More...
class | VideoMode
| VideoMode defines a video mode (width, height, bpp, frequency) and provides static functions for getting modes supported by the display device. More...
class | Window
| Window is a rendering window ; it can create a new window or connect to an existing one. More...
class | WindowListener
| Base class for classes that want to receive events from a window (for internal use only). More...
struct | WindowSettings
| Structure defining the creation settings of windows. More...

## Namespaces

namespace | Blend
| Enumerate the blending modes for drawable objects.

namespace | Joy
| Definition of joystick axis for joystick events.

namespace | Key
| Definition of key codes for keyboard events.

namespace | Mouse
| Definition of button codes for mouse events.

namespace | Socket
namespace | Style
| Enumeration of window creation styles.

## Typedefs

typedef Rect< int > | IntRect
typedef Rect< float > | FloatRect
typedef Selector< SocketUDP > | SelectorUDP
typedef Selector< SocketTCP > | SelectorTCP
typedef Vector2< int > | Vector2i
typedef Vector2< float > | Vector2f
typedef Vector3< int > | Vector3i
typedef Vector3< float > | Vector3f

## Functions

SFML_API Color | operator+ (const Color &Color1, const Color &Color2)
| Operator + overload to add two colors.
SFML_API Color | operator * (const Color &Color1, const Color &Color2)
| Operator * overload to modulate two colors.
SFML_API std::istream & | operator>> (std::istream &Stream, IPAddress &Address)
| Operator >> overload to extract an address from an input stream.
SFML_API std::ostream & | operator<< (std::ostream &Stream, const IPAddress &Address)
| Operator << overload to print an address to an output stream.
void SFML_API | Sleep (float Duration)
| Make the current thread sleep for a given time.
template<typename T>
Vector2< T > | operator- (const Vector2< T > &V)
| Operator - overload ; returns the opposite of a vector.
template<typename T>
Vector2< T > & | operator+= (Vector2< T > &V1, const Vector2< T > &V2)
| Operator += overload ; add two vectors and assign to the first op.
template<typename T>
Vector2< T > & | operator-= (Vector2< T > &V1, const Vector2< T > &V2)
| Operator -= overload ; subtract two vectors and assign to the first op.
template<typename T>
Vector2< T > | operator+ (const Vector2< T > &V1, const Vector2< T > &V2)
| Operator + overload ; adds two vectors.
template<typename T>
Vector2< T > | operator- (const Vector2< T > &V1, const Vector2< T > &V2)
| Operator - overload ; subtracts two vectors.
template<typename T>
Vector2< T > | operator * (const Vector2< T > &V, T X)
| Operator * overload ; multiply a vector by a scalar value.
template<typename T>
Vector2< T > | operator * (T X, const Vector2< T > &V)
| Operator * overload ; multiply a scalar value by a vector.
template<typename T>
Vector2< T > & | operator *= (Vector2< T > &V, T X)
| Operator *= overload ; multiply-assign a vector by a scalar value.
template<typename T>
Vector2< T > | operator/ (const Vector2< T > &V, T X)
| Operator / overload ; divide a vector by a scalar value.
template<typename T>
Vector2< T > & | operator/= (Vector2< T > &V, T X)
| Operator /= overload ; divide-assign a vector by a scalar value.
template<typename T>
bool | operator== (const Vector2< T > &V1, const Vector2< T > &V2)
| Operator == overload ; compares the equality of two vectors.
template<typename T>
bool | operator!= (const Vector2< T > &V1, const Vector2< T > &V2)
| Operator != overload ; compares the difference of two vectors.
template<typename T>
Vector3< T > | operator- (const Vector3< T > &V)
| Operator - overload ; returns the opposite of a vector.
template<typename T>
Vector3< T > & | operator+= (Vector3< T > &V1, const Vector3< T > &V2)
| Operator += overload ; add two vectors and assign to the first op.
template<typename T>
Vector3< T > & | operator-= (Vector3< T > &V1, const Vector3< T > &V2)
| Operator -= overload ; subtract two vectors and assign to the first op.
template<typename T>
Vector3< T > | operator+ (const Vector3< T > &V1, const Vector3< T > &V2)
| Operator + overload ; adds two vectors.
template<typename T>
Vector3< T > | operator- (const Vector3< T > &V1, const Vector3< T > &V2)
| Operator - overload ; subtracts two vectors.
template<typename T>
Vector3< T > | operator * (const Vector3< T > &V, T X)
| Operator * overload ; multiply a vector by a scalar value.
template<typename T>
Vector3< T > | operator * (T X, const Vector3< T > &V)
| Operator * overload ; multiply a scalar value by a vector.
template<typename T>
Vector3< T > & | operator *= (Vector3< T > &V, T X)
| Operator *= overload ; multiply-assign a vector by a scalar value.
template<typename T>
Vector3< T > | operator/ (const Vector3< T > &V, T X)
| Operator / overload ; divide a vector by a scalar value.
template<typename T>
Vector3< T > & | operator/= (Vector3< T > &V, T X)
| Operator /= overload ; divide-assign a vector by a scalar value.
template<typename T>
bool | operator== (const Vector3< T > &V1, const Vector3< T > &V2)
| Operator == overload ; compares the equality of two vectors.
template<typename T>
bool | operator!= (const Vector3< T > &V1, const Vector3< T > &V2)
| Operator != overload ; compares the difference of two vectors.

## Function Documentation

template<typename T>

Vector3<T> sf::operator * | ( | T | X,
|  | const Vector3< T > & | V |
| ) |  |  | `[inline]`

Operator * overload ; multiply a scalar value by a vector.

Parameters:

  | X | : Scalar value
  | V | : Vector

Returns:
  X * V

template<typename T>

Vector3<T> sf::operator * | ( | const Vector3< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator * overload ; multiply a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V * X

template<typename T>

Vector2<T> sf::operator * | ( | T | X,
|  | const Vector2< T > & | V |
| ) |  |  | `[inline]`

Operator * overload ; multiply a scalar value by a vector.

Parameters:

  | X | : Scalar value
  | V | : Vector

Returns:
  X * V

template<typename T>

Vector2<T> sf::operator * | ( | const Vector2< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator * overload ; multiply a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V * X

SFML_API Color sf::operator * | ( | const Color & | Color1,
|  | const Color & | Color2 |
| ) |  |  |

Operator * overload to modulate two colors.

Parameters:

  | Color1 | : First color
  | Color2 | : Second color

Returns:
  Component-wise multiplication of the two colors

template<typename T>

Vector3<T>& sf::operator *= | ( | Vector3< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator *= overload ; multiply-assign a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V * X

template<typename T>

Vector2<T>& sf::operator *= | ( | Vector2< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator *= overload ; multiply-assign a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V * X

template<typename T>

bool sf::operator!= | ( | const Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator != overload ; compares the difference of two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  True if V1 is different than V2

template<typename T>

bool sf::operator!= | ( | const Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator != overload ; compares the difference of two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  True if V1 is different than V2

template<typename T>

Vector3<T> sf::operator+ | ( | const Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator + overload ; adds two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 + V2

template<typename T>

Vector2<T> sf::operator+ | ( | const Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator + overload ; adds two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 + V2

SFML_API Color sf::operator+ | ( | const Color & | Color1,
|  | const Color & | Color2 |
| ) |  |  |

Operator + overload to add two colors.

Parameters:

  | Color1 | : First color
  | Color2 | : Second color

Returns:
  Component-wise saturated addition of the two colors

template<typename T>

Vector3<T>& sf::operator+= | ( | Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator += overload ; add two vectors and assign to the first op.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 + V2

template<typename T>

Vector2<T>& sf::operator+= | ( | Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator += overload ; add two vectors and assign to the first op.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 + V2

template<typename T>

Vector3<T> sf::operator- | ( | const Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator - overload ; subtracts two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 - V2

template<typename T>

Vector3<T> sf::operator- | ( | const Vector3< T > & | V | ) | `[inline]`

Operator - overload ; returns the opposite of a vector.

Parameters:

  | V | : Vector to negate

Returns:
  -V

template<typename T>

Vector2<T> sf::operator- | ( | const Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator - overload ; subtracts two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 - V2

template<typename T>

Vector2<T> sf::operator- | ( | const Vector2< T > & | V | ) | `[inline]`

Operator - overload ; returns the opposite of a vector.

Parameters:

  | V | : Vector to negate

Returns:
  -V

template<typename T>

Vector3<T>& sf::operator-= | ( | Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator -= overload ; subtract two vectors and assign to the first op.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 - V2

template<typename T>

Vector2<T>& sf::operator-= | ( | Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator -= overload ; subtract two vectors and assign to the first op.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  V1 - V2

template<typename T>

Vector3<T> sf::operator/ | ( | const Vector3< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator / overload ; divide a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V / X

template<typename T>

Vector2<T> sf::operator/ | ( | const Vector2< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator / overload ; divide a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V / X

template<typename T>

Vector3<T>& sf::operator/= | ( | Vector3< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator /= overload ; divide-assign a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V / X

template<typename T>

Vector2<T>& sf::operator/= | ( | Vector2< T > & | V,
|  | T | X |
| ) |  |  | `[inline]`

Operator /= overload ; divide-assign a vector by a scalar value.

Parameters:

  | V | : Vector
  | X | : Scalar value

Returns:
  V / X

SFML_API std::ostream& sf::operator<< | ( | std::ostream & | Stream,
|  | const IPAddress & | Address |
| ) |  |  |

Operator << overload to print an address to an output stream.

Parameters:

  | Stream | : Output stream
  | Address | : Address to print

Returns:
  Reference to the output stream

template<typename T>

bool sf::operator== | ( | const Vector3< T > & | V1,
|  | const Vector3< T > & | V2 |
| ) |  |  | `[inline]`

Operator == overload ; compares the equality of two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  True if V1 is equal to V2

template<typename T>

bool sf::operator== | ( | const Vector2< T > & | V1,
|  | const Vector2< T > & | V2 |
| ) |  |  | `[inline]`

Operator == overload ; compares the equality of two vectors.

Parameters:

  | V1 | : First vector
  | V2 | : Second vector

Returns:
  True if V1 is equal to V2

SFML_API std::istream& sf::operator>> | ( | std::istream & | Stream,
|  | IPAddress & | Address |
| ) |  |  |

Operator >> overload to extract an address from an input stream.

Parameters:

  | Stream | : Input stream
  | Address | : Address to extract

Returns:
  Reference to the input stream

void SFML_API sf::Sleep | ( | float | Duration | ) |

Make the current thread sleep for a given time.

Parameters:

  | Duration | : Time to sleep, in seconds