SFML community forums
General => General discussions => Topic started by: ChayHawk on February 12, 2021, 05:27:25 pm
-
So it's been years and years and years since I last got into SFML. I think it was like SFML version 1.3 when i last tried it. I just got it working on VS 2019 and would like to buy some books but I see the books in the learn section were written in 2013-2017, are they still relevant to SFML's current release? like will i have a lot of trouble following them with the current version of SFML? if so, what books would you recommend?
-
SFML 2.x hasn't changed as much. There are a bunch of (advanced?) features that you won't see mentioned in the books, but the basics of how to structure your application for a game and how to use the basic SFML classes, such as texture, sprite, vertex array, render window, etc. are all the same.
Beyond SFML, you may also run into some C++ code, that you could be doing a lot simpler with C++17.
Personally, I do recommend SFML Game Development, especially since I know the authors have been using SFML for a longer time when writing the book, but then again I haven't dug a lot into the other books to objectively judge.
(Side note: Ignore all the bits that explain how to use C++11 features without a C++11 compiler, you can directly use C++11 and even C++17 features these days :D )
-
So I got the SFML Game Development by example book, and I got the source code for it and there's like 72 errors in it, stuff like sf::color is declared deprecated and a lot of them about not being able to convert char[256] to Utils::LPWSTR so I have no idea, probably gonna take me forever to figure out how to fix it, not sure if its the code in the book or if i did something wrong, but eh, whatever i guess.
-
My personal recommendation is, as eXpl0it3r said, SFML Game Development (https://www.packtpub.com/product/sfml-game-development/9781849696845) (not 'by example'). It concisely runs through a game project from beginning to end, and is written by authors who are on the SFML development team or closely associated with it, so, in my opinion, have a better understanding of SFML's design goals and how it is intented to be used.
sf::Text::setColor() has indeed been deprecated in favour of setFillColor() and setOutlineColor() (https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Text.php#afd1742fca1adb6b0ea98357250ffb634). The deprecation notice should only be a warning (setColor() still exists for compatibility), however Visual Studio treats deprecation warnings as errors. To change the behaviour you can disable the warning (https://developercommunity.visualstudio.com/content/problem/786502/cant-treat-deprecated-warning-as-warning-with-wx.html).
-
For the book SFML Game Development, in case you look for the source code, it's available on GitHub:
https://github.com/SFML/SFML-Game-Development-Book
It's a bit unfortunate that Packt still doesn't provide an easily visible link to that repo.
Since SFML 2 has been written with backwards compatibility in mind, anything that you could do in SFML 2.0 (at the time of the book's release) is still possible with SFML 2.5. There may be some minor improvements like setFillColor(), but code shouldn't break.
(Disclaimer: I'm one of the authors of that book, so I won't recommend this one over the others)
-
(Disclaimer: I'm one of the authors of that book, so I won't recommend this one over the others)
Don't have false modesty, it's a good book. :-)
-
Thank you :)