Classes | Functions
System module

Classes

class  sf::Clock
 Utility class for manipulating time. More...
class  sf::InputStream
 Abstract class for custom file input streams. More...
class  sf::Lock
 Automatic wrapper for locking and unlocking mutexes. More...
class  sf::Mutex
 Blocks concurrent access to shared resources from multiple threads. More...
class  sf::NonCopyable
 Utility class that makes any derived class non-copyable. More...
class  sf::Resource< T >
 Base class for resources that need to notify dependent classes about their destruction. More...
class  sf::ResourcePtr< T >
 Safe pointer to a sf::Resource<T> More...
class  sf::String
 Utility string class that automatically handles conversions between types and encodings. More...
class  sf::Thread
 Utility class to manipulate threads. More...
class  sf::ThreadLocal
 Defines variables with thread-local storage. More...
class  sf::ThreadLocalPtr< T >
 Pointer to a thread-local variable. More...
class  sf::Utf
 Utility class providing generic functions for UTF conversions. More...
class  sf::Vector2< T >
 Utility template class for manipulating 2-dimensional vectors. More...
class  sf::Vector3< T >
 Utility template class for manipulating 3-dimensional vectors. More...

Functions

void SFML_API sf::Sleep (Uint32 duration)
 Make the current thread sleep for a given duration.
SFML_API std::ostream & sf::Err ()
 Standard stream used by SFML to output warnings and errors.

Function Documentation

sf::Err ( )

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, independantly 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(NULL);

 // Restore the original output
 sf::Err().rdbuf(previous);
void SFML_API sf::Sleep ( Uint32  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.

Parameters:
durationTime to sleep, in milliseconds