# SFML - Simple and Fast Multimedia Library

SFML 3.0.0

- Main Page
- Topics
- Namespaces
- Classes
- Files

Loading...
Searching...
No Matches
Classes | Functions
System module

## Classes

class | sf::Angle
| Represents an angle value. More...
class | sf::Clock
| Utility class that measures the elapsed time. More...
class | sf::FileInputStream
| Implementation of input stream based on a file. More...
class | sf::InputStream
| Abstract class for custom file input streams. More...
class | sf::MemoryInputStream
| Implementation of input stream based on a memory chunk. More...
class | sf::String
| Utility string class that automatically handles conversions between types and encodings. More...
class | sf::Time
| Represents a time value. More...
class | sf::Utf< N >
| Utility class providing generic functions for UTF conversions. More...
class | sf::Vector2< T >
| Class template for manipulating 2-dimensional vectors. More...
class | sf::Vector3< T >
| Utility template class for manipulating 3-dimensional vectors. More...

## Functions

ANativeActivity * | sf::getNativeActivity ()
| Return a pointer to the Android native activity.
void | sf::sleep (Time duration)
| Make the current thread sleep for a given duration.
std::ostream & | sf::err ()
| Standard stream used by SFML to output warnings and errors.

## Detailed Description

Base module of SFML, defining various utilities. It provides vector classes, Unicode strings and conversion functions, threads and mutexes, timing classes.

## Function Documentation

## ◆ err()

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);
sf::err
std::ostream & err()
Standard stream used by SFML to output warnings and errors.

Returns
  Reference to `std::ostream` representing the SFML error stream

## ◆ getNativeActivity()

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

Platform Limitation
  This is only available on Android and to use it, you'll have to specifically include SFML/System/NativeActivity.hpp in your code.

## ◆ sleep()

void 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

  duration | Time to sleep