I'm fairly experienced with C and C#, but I've only ever created console/windows applications. I'm also experienced with AS3 and I've made some flash games.

I want to make proper 2D games in C++, but I have no idea where to begin with graphics. There are entire books devoted to game development in C++ that only work with console applications and I'm finding the lack of resources and tutorials for proper 2D games frustrating... I'm also not particularly interested in using existing engines because I want total control of what I create.

I've heard of the Allegro library; is it something that I should look into? How will I use DirectX?

Any resources or links to tutorials or information is greatly appreciated.

  • 2
    \$\begingroup\$ Please see the FAQ about "where to get started" and "which technology to use" questions. \$\endgroup\$
    – House
    Dec 17, 2012 at 16:58

3 Answers 3


A very nice starting point for 2D development in C++ is SFML. Taken from the official website:

SFML is a portable and easy to use multimedia API written in C++. You can see it as a modern, object-oriented alternative to SDL. SFML is composed of several packages to perfectly suit your needs. You can use SFML as a minimal windowing system to interface with OpenGL, or as a fully-featured multimedia library for building games or interactive programs.

I've been using SFML for a while, it's an object-oriented API which has a lot of examples on the site for you to learn from, as well as tutorials. If you are confused whether to use 1.6 or 2.0 I'd suggest going with 2.0 because eventually you'll still have to upgrade.

Even better, SFML is not C++ exclusive, it works with the following languages:

  • C
  • C++
  • .net (C#, VB .net, C++/CLI)
  • Python
  • D
  • Ruby

And the nice thing is, you can use OpenGL with it and the Qt framework as well. I think it's a nice starting point for 2D development, but if you want alternatives you can try out Allegro or SDL

  • 1
    \$\begingroup\$ I've also seen SFML successfully integrated with with wxWidgets (not only Qt). The code is open-source, readable and very pleasant, if you have a problem you can easily look into SFML's code if you don't find an answer on the web. It's also possible to integrate your own shaders or post-process effects if you need to (since you can use low-level OpenGL calls without breaking anything). \$\endgroup\$
    – Liosan
    Dec 17, 2012 at 9:51
  • \$\begingroup\$ @Liosan it's indeed possible, SFML has a lot of possibilities in it. \$\endgroup\$
    – Bugster
    Dec 17, 2012 at 20:08

On some level, you're going to have to manage gamestates, your video hardware, audio hardware, etc. While it can be a good learning experience to dabble with DirectX, DirectSound, and the like, if you immediately want to make a game, it's best to use some layer of abstraction.

SDL is cross-platform, open-source, works with C++ natively, and has great documentation and tutorials to get you started.

SDL Website


I highly recommend OpenGL for starting your game programming exercises. 2D game is basically flatted display in terms of 3D. For links and tutorials, I think you should be able to actually learn to display some primitive shapes such as a triangle first. Such tutorials on basic display is all over the web and youtube.

  • 2
    \$\begingroup\$ The OP explicitely said he wants to make 2d games. There are excellent libraries for that which use OpenGL for hardware acceleration internally. What would he gain from learning OpenGL? \$\endgroup\$
    – Philipp
    Dec 17, 2012 at 9:47
  • 1
    \$\begingroup\$ I don't disagree with this question. It is very possible to make 2D games in OpenGL, and in fact I make my 2D games in plain Direct3D. Even though it may not be the easiest library to make 2D games for a beginner, I still believe this is a very legitimate answer. \$\endgroup\$ Dec 17, 2012 at 9:57
  • \$\begingroup\$ @Philipp ur reputation is above 1000. I want to argue from my perspective but I guess it's better off using other libraries than use OpenGL to build 2D games... \$\endgroup\$ Dec 21, 2012 at 10:15

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