Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: List of modifications from SFML 1.6 to 2.0  (Read 37477 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
List of modifications from SFML 1.6 to 2.0
« on: July 16, 2011, 01:05:57 pm »
Since many SFML users have already asked this question and it might be useful for people who port projects from SFML 1.6 to Git revisions of SFML 2, I have created a list of API and functionality modifications. Feel free to complete it, I will edit this post. Note that SFML 2 is not finished yet, so the current API is still subject to change.

I only want to mention the most important and not obvious API-breaking changes to keep a good overview. Red are changes which may still compile with old code, but which introduce silent bugs and hence require special attention. Blue are pure additions.

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<unsigned int>
  • 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
« Last Edit: April 21, 2013, 12:32:56 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jove

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • http://www.jestofevekites.com/
List of modifications from SFML 1.6 to 2.0
« Reply #1 on: July 16, 2011, 03:09:13 pm »
Thanks Nexus.
{much better code}

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #2 on: July 16, 2011, 09:18:07 pm »
Good work there! Thank you!  :)
SFML / OS X developer

Contadotempo

  • Full Member
  • ***
  • Posts: 167
  • Firelink Shrine
    • View Profile
List of modifications from SFML 1.6 to 2.0
« Reply #3 on: July 16, 2011, 10:06:38 pm »
On SFML 1.6 sf::Image::SetSmooth() was set to true by default, on SFML 2.0 is set to false, right?
Is it worth adding it to the list?

xazax

  • Guest
List of modifications from SFML 1.6 to 2.0
« Reply #4 on: July 17, 2011, 09:31:36 am »
And there is a new SFML\OpenGL.hpp that needs to be included if somebody do OpenGL stuff. It wasn't there in 1.6.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #5 on: July 17, 2011, 10:51:15 am »
Here is my private changelog. It should be almost complete :)

I should rather put it in an official tutorial for SFML 2.0 ("Porting from 1.6 to 2.0"). I'll try to find the time to do it soon.

SYSTEM
- OS-specific implementations (threads, mutexes) no longer appear in the public headers
- Added thread-local storage classes
- Changed the sf::Thread interface
- Improved string handling (added sf::String (high-level) and sf::Utf (low-level))
- Added string conversions between UTF and latin-1 (ISO-5589-1)
- Errors are now written to a SFML specific stream (sf::Err()) rather than std::cerr
- Removed the sf::Randomizer class
- sf::Mutex is now recursive on all platforms (was not on Linux and Mac OS X)

WINDOW
- Changed WindowSettings to ContextSettings, changed default values (24, 8, 0) -> (0, 0, 0)
- Added the context version to ContextSettings (to be able to create OpenGL 3.x context)
- OpenGL headers are no longer included by default in sfml-window, it is now in SFML/OpenGL.hpp
- Added Style::Default
- Improved synchronization between events and corresponding states in sf::Input
- Merged VideoMode::GetModesCount and VideoMode::GetMode into a single function

VideoMode::GetFullscreenModes
- Renamed Window::UseVerticalSync to EnableVerticalSync
- Added a blocking WaitEvent function in sf::Window
- Added Window::GetSystemHandle()
- Added sf::Window::SetTitle
- Added mouse position to the Event::MouseWheelMoved event
- Added support for OpenGL 3 (and above) contexts
- sf::Input -> sf::Joystick, sf::Keyboard, sf::Mouse (directly connected to the OS rather than to sf::Event)
- Removed sf::Window::SetCursorPosition (see sf::Mouse::SetPosition(Window))

GRAPHICS
- Added sf::RenderImage
- View --> slightly changed interface
- Added viewport to sf::View
- Added rotation to sf::View
- Improved rendering performances
- Removed RenderWindow::Capture (use Image::CopyScreen instead)
- Removed RenderTarget::PreserveOpenGLStates, replaced with SaveGLStates/RestoreGLStates
- Added Image::GetMaximumSize()
- Renamed Image::GetValidTextureSize to Image::GetValidSize
- Views are now handled by value (copied), not by reference
- Renamed Shape::GetNbPoints to Shape::GetPointsCount (consistent with other similar functions)
- Glyph : Rectangle --> Bounds, TexCoords --> SubRect
- Renamed Shape::Set/GetOutlineWidth to Set/GetOutlineThickness
- Renamed sf::PostFx to sf::Shader, and made it more flexible (can be applied to individual drawables)
- Inverted angles in drawable classes
- Images are not smooth anymore by default
- Renamed sf::String to sf::Text
- Added Image::UpdatePixels for fast pixel updates
- sf::Rect is now defined as [left, top, width, height]
- Added a parameter to Sprite::SetImage, to allow auto-adjustment of the subrect to the size of the new image
- Fixed tab character not properly rendered in sf::Text
- Renamed the Center property of drawables to Origin
- sf::Font now dynamically adapts to the rendered text, there's no more fixed size and character set

AUDIO
- Removed dependency to stb_vorbis
- Renamed SoundRecorder::CanCapture to SoundRecorder::IsAvailable
- Fixed sf::Listener's target that was a relative direction instead of an absolute position
- Added support for saving audio files as ogg/vorbis
- Added the ability to seek in sound streams and musics

NETWORK
- Reorganized the socket classes, however the features remain the same
- Minor modifications to sf::IpAddress
- Removed dependencies to system specific libraries in the public headers
- Made packet handling with UDP sockets more robust
- Added support for Unicode strings in sf::Packet
- Got rid of whatismyip.org as the default server for public IP retrieval
- Changed sf::Packet::operator bool() to something similar that avoids inappropriate implicit conversions

GENERAL
- Huge improvements to the API documentation, it is now much more detailed
- Changed const char* to const void* in LoadFromMemory functions
- The external libraries used by sfml-graphics are now linked instead of being integrated into the source code
- Removed the Qt and wxWidgets samples
- Switched to CMake, dropped individual support for compilers/IDEs
- New naming conventions for binaries (major version number appears in Windows DLLs -- not import libraries)
- SFML_DYNAMIC -> SFML_STATIC
- Added the SFML_VERSION_MAJOR and SFML_VERSION_MINOR macros
- Added support for 64-bits builds
- Changed all times in SFML to be Uint32 milliseconds instead of float seconds
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
List of modifications from SFML 1.6 to 2.0
« Reply #6 on: July 17, 2011, 11:39:37 am »
Ah nice, yours is slightly more detailed :D

Maybe it is worthwhile to emphasize backwards-incompatible changes and those who still compile but have other semantics. That would make it easier for people who just want to port projects without caring about all the new features. What do you think? I can colorize the points if you want ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #7 on: July 17, 2011, 11:41:37 am »
Well The time is one on that. Because I could compile rbSFML after it was changed from float to sf::Uint32 which kind of scared me.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #8 on: July 17, 2011, 12:10:25 pm »
Quote
Maybe it is worthwhile to emphasize backwards-incompatible changes and those who still compile but have other semantics. That would make it easier for people who just want to port projects without caring about all the new features. What do you think? I can colorize the points if you want

Like I said, I'll rather try to write the corresponding porting tutorial ;)
Laurent Gomila - SFML developer

TheMiss

  • Newbie
  • *
  • Posts: 9
    • View Profile
List of modifications from SFML 1.6 to 2.0
« Reply #9 on: July 17, 2011, 01:40:41 pm »
Why inverted angles of the sf::Drawable  :?:

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
List of modifications from SFML 1.6 to 2.0
« Reply #10 on: July 17, 2011, 01:50:33 pm »
Quote from: "Laurent"
Like I said, I'll rather try to write the corresponding porting tutorial ;)
That's a good idea, then you can mainly focus on the API breakers. But a complete list of changes in addition is useful, too.

Quote from: "TheMiss"
Why inverted angles of the sf::Drawable :?:
Because they were mathematically incorrect, see here.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

malandrin

  • Newbie
  • *
  • Posts: 26
    • View Profile
List of modifications from SFML 1.6 to 2.0
« Reply #11 on: July 20, 2011, 10:15:37 am »
I can't find Socket::isValid anymore in 2.0.
Should I forget it ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #12 on: July 20, 2011, 10:34:42 am »
Quote
I can't find Socket::isValid anymore in 2.0
Should I forget it ?

Yes.
* this is useless for UDP sockets
* for TCP sockets, you want to check if the socket is connected with GetRemoteAddress()
Laurent Gomila - SFML developer

AngelHoof

  • Newbie
  • *
  • Posts: 27
    • View Profile
List of modifications from SFML 1.6 to 2.0
« Reply #13 on: July 22, 2011, 01:30:42 pm »
Quote
sf::Input -> sf::Joystick, sf::Keyboard, sf::Mouse (directly connected to the OS rather than to sf::Event)


I thought I was using SFML 2.0, or are these simply not implemented in the build I am using?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
List of modifications from SFML 1.6 to 2.0
« Reply #14 on: July 22, 2011, 01:47:59 pm »
Quote
I thought I was using SFML 2.0, or are these simply not implemented in the build I am using?

It was implemented two weeks ago.
Laurent Gomila - SFML developer