Beginning C++ Game Programming
上QQ阅读APP看书,第一时间看更新

SFML

Simple Fast Media Library (SFML) is not the only C++ library for games and multimedia. It is possible to make an argument for using other libraries, but SFML seems to be the best for me, every time. First it is written using object oriented C++. The benefits of this are numerous. Most of these benefits you will experience as you progress through the book.

SFML is so easy to get started and is therefore a good choice if you are a beginner. At the same time, it also has the potential to build the highest-quality 2D games if you are a professional. So a beginner can get started using SFML and not worry about having to start again with a new language/library as their experience grows.

Perhaps the biggest benefit is that most modern C++ programming uses OOP. Every C++ beginners guide I have ever read uses and teaches OOP. OOP is, in fact, the future (and the now) of coding in almost all languages. So why, if you're learning C++ from the beginning, would you want to do it any other way?

SFML has a module (code) for just about anything you would ever want to do in a 2D game. SFML works using OpenGL, which can also make 3D games. OpenGL is the de-facto free-to-use graphics library for games when you want them to run on more than one platform. When you use SFML, you are automatically using OpenGL.

SFML drastically simplifies:

  • 2D graphics and animation including scrolling game worlds.
  • Sound effects and music playback, including high-quality directional sound.
  • Online multiplayer features
  • The same code can be compiled and linked on all major desktop operating systems, and soon mobile, as well!

Extensive research has not uncovered any more suitable way to build 2D games for PC, even for expert developers, and especially if you are a beginner and want to learn C++ in a fun gaming environment.