I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some of the basics of C++ and I would love to write a simple 2d game/game engine for myself using C++. What other libraries or SDKs do I need and where would I find some tutorials and informational resources to move forward?

I've already looked into XNA with C#. There are a lot of resources for that but I would rather use non Microsoft products. The point of this is to have a little fun while becoming a better rounded programmer.

Please note that I'm not asking for the best place to start. I'm just asking for a place to start.

Thanks for any help!


6 Answers 6


The standard starting place (in my experience) for C++ game dev is SDL. You've got to get your hands a little dirtier with this than you do XNA.

If you want to try something a little higher level then I would suggest SFML. It handles some of the more menial tasks for you but you've still got to keep your eye on your memory usage, etc.

  • 1
    \$\begingroup\$ I'll look into those. My biggest problem with XNA is that it was so straightforward that I didn't feel like I was really learning the lower level stuff that I'm interested in exploring. \$\endgroup\$
    – yeomandev
    Commented Oct 7, 2011 at 22:34
  • 6
    \$\begingroup\$ SFML has a nice design, but is still quite a bit buggy and is in the process of a major API redesign- I wouldn't use it for more complex games until the next release is well polished. \$\endgroup\$
    – Bitgarden
    Commented Oct 7, 2011 at 22:39
  • \$\begingroup\$ If you want something a bit more challenging than SDL, try ClanLib. Like XNA it supports hardware acceleration, but also works on Linux, and also 2D exclusive. \$\endgroup\$
    – ChrisC
    Commented Oct 7, 2011 at 23:09
  • 2
    \$\begingroup\$ You can also go straight for the throat - OpenGL is my personal favorite (you can wrap it with SDL or SFML) \$\endgroup\$ Commented Oct 8, 2011 at 6:43

Personally, I would pick Allegro 5, for the following reasons:

  1. It has a CMake-based build system. This makes it much easier than most build systems for working on multiple platforms. This seems like a minor thing, but it's pretty important overall. It makes building the library much simpler.

  2. SFML is still in significant flux. 2.0 is a pretty substantial change. Whereas Allegro has already been through a significant change with version 5, and it's now all about stability.

  3. It covers modularity in a different way from SFML. With SFML, you ask for specific components, but you get all of them. If you ask for the graphics component, you get all of the graphics component. With Allegro 5, you always get the graphics component. But if you don't want to use Allegro's bitmap loaders, you don't have to; you can use your own.

  4. It has very good documentation. SFML uses Doxygen-style documentation, but even that is pretty Spartan. Whereas Allegro 5 is more comprehensive, with functions grouped together based on specific systems that they cover. It's not perfect, but it is better overall.

  5. They're smart enough to not try to do threading. With C++11/Boost.Threads either widely available or just around the corner, using another thread wrapper can be more than just problematic: it can be dangerous to getting your code working properly.

  • \$\begingroup\$ Why would you prefer/suggest Allegro over SDL or SFML? \$\endgroup\$ Commented Oct 8, 2011 at 8:36
  • \$\begingroup\$ @iamcreasy: If you insist. \$\endgroup\$ Commented Oct 8, 2011 at 9:00
  • \$\begingroup\$ You still don't mention SDL... \$\endgroup\$
    – Engineer
    Commented Oct 8, 2011 at 9:52
  • \$\begingroup\$ @NickWiggill: SDL has threads and platform-specific build systems. I didn't feel the need to call it out for anything specific. \$\endgroup\$ Commented Oct 8, 2011 at 10:54
  • \$\begingroup\$ @nicol-bolas you didn't mention the cons of Allegro. Like very low amount of tutorial comparing. \$\endgroup\$ Commented Oct 8, 2011 at 21:42

I would suggest using SDL. It's been around a long time so the documentation and support are pretty good, and it's one of the easiest ways I know of to get a drawing surface on the screen. It will give you practice writing classes in C++ (since you'll probably want to wrap a lot the the SDL C function calls) and also give you some experience using pointers and references and doing some basic memory management. Managing your own memory is one of the major differences between C++ and C#.


I think a fantastic place to start is LazyFoo. This will get you up and running with SDL faster than any other place I've seen. I'd recommend quickly getting into OpenGL (as soon as you can stomach it) because you'll get a lot more bang for your programming dollar- with hardware acceleration. If you do go that route, I recommend This Guide.

  • SFML -- the baby in the group, but potentially easiest to use from what I've read.
  • SDL -- the middle road. Very mature library, sensible, generally concise if a little arcane from time to time, and a very common choice. Setting up display formats can be a bit of a bastard, I've used lazyfoo's tutorials to help on that front.
  • Allegro -- Geriatric, it's been around since Atari ST days. For that reason, a lot of the 2D rendering code (which I think is only in Allegro 4) is pretty darn quick since the logic was built for much lower spec systems. I personally don't find it very intuitive, even considering the documentation.

Considering OpenGL accelerates the 2D side of things these days, it's not that important to have access to the fast software renderers that Allegro and SDL have (or had in earlier versions). However when I pick a library I focus on project maturity, user base and docs more than speed (so long as speed is reasonable), and I would say SDL and Allegro win on those fronts. SDL has also been to release triple AAA titles like Civ: Call to Power.


I would recommend SFML if you are using c++. It will get you something on the screen quickly and using it with your c++ game code is straight forward.


Not the answer you're looking for? Browse other questions tagged .