SFML 2.0 finally officially released

After literally years of waiting, SFML 2 is finally here along with a site redesign. If you’ve never heard of it, SFML is a C++ library for (mostly) 2D games, including graphics, audio, networking and io functionality. As you can see, there is also a new logo.

There aren’t that many changes, this release was mostly about refactoring to eventually support iOS and Android. The 2 release has been waiting on documentation updates.

 

If you have a 1.6 SFML project, here are the code changes ( compiled by SFML user Nexus ) that can affect your code:

 


General

  • CMake instead of specific compiler solutions and makefiles
  • Use SFML_STATIC to indicate static linkage instead of SFML_DYNAMIC for dynamic linkage
  • Changed naming convention for functions from PascalCase to camelCase

System package

  • Added sf::Vector2u typedef for sf::Vector2
  • Added explicit conversion constructors from different vector types
  • All times (sf::Clock, sf::sleep(), …) are now measured with the sf::Time class instead of float seconds
  • sf::Thread works now with function objects, no more inheritance
  • Split sf::Unicode::Text to high-level sf::String and low-level sf::Utf
  • Removed sf::Randomizer
  • Low-level memory functions operate on void* instead of char*

Window package

  • Added sf::InputStream for customized resource loading
  • Added events JoystickConnected and JoystickDisconnected to track plug/unplug of joysticks
  • Replaced sf::Input with 3 separate classes sf::Mouse, sf::Keyboard and sf::Joystick. They use global inputs, not window-specific ones.
  • Renamed sf::Window::GetEvent() to pollEvent()
  • Sizes are returned as vectors

Graphics package

  • Added low-level graphics API with sf::VertexArray, sf::Vertex, sf::Transform
  • Added sf::RenderTexture as another render target
  • Added viewport and rotation to sf::View
  • Split sf::Drawable functionality into sf::Drawable (stateless interface) and sf::Transformable (convenience base class for transformable entities)
  • Renamed sf::String to sf::Text
  • Renamed sf::PostFX to sf::Shader
  • Dynamic adaption of sf::Font, no more fixed size and character set
  • sf::Font requires the source (file, memory, …) to remain valid throughout its lifetime
  • sf::RenderWindow::setView() now copies the sf::View
  • sf::Rect stores (left, top, width, height) instead of (left, top, right, bottom)
  • Changed sign of angles (concerns sf::Transformable rotations)
  • Split sf::Image into sf::Texture (OpenGL texture) and sf::Image (pure pixel container).
  • Renamed sf::Drawable::GetCenter(), SetCenter() to sf::Transformable::getOrigin(), setOrigin()
  • Made transformable interface to get size/bounds more uniform, now there are getLocalBounds() and getGlobalBounds()

Network package

  • Added more overloads for sf::Packet‘s operator<< and operator>>
  • Renamed sf::SocketTCP, sf::SocketUDP to sf::TcpSocket, sf::UdpSocket and made them non-copyable

Audio package

  • Added ability to seek in sound streams and musics
  • Fixed sf::Listener‘s target that was a relative direction instead of an absolute position

You can read more details about breaking changes in this thread.

 

Programming


Scroll to Top