5

I need to brush up on my C++ for a course I am teaching in the fall, I want to have fun doing it and have an idea for a simple 2D game, however I don't want to have to worry about any of the rendering code.

What would be the simplest library to take care of rendering 2D PNGs in a window?

As I said, this is to brush up on my object-oriented programming skills so I am not at all worried about performance or viability in industry, whatever has the simplest setup with clear documentation.

If on top of it the framework/engine has some gameloop management that would be fantastic, but I'm mostly looking for sprite loading/rendering so I can focus on the gameplay.

An example of a 'perfect world' engine would look like this:

Window window = engine.createWindow(1260, 720);
Sprite s = Sprite("path/to/img.png");
window.clear();
window.render(s, 100, 150);

This way I only have to worry about building the proper headers and functions for my game play objects.

5

Take a look at SFML. It offers window creation, event handling, sprite drawing and is all pretty simple to use.

  • That's absolutely perfect, thank you!, I can't upvote yet but +1! – Frank O'Brien Jul 7 '17 at 21:14
1

The Cairo graphics library has C++ bindings; that might interest you.


Also...

Not something you can use right now, but the C++ standards committee (WG21) has a subgroup, SG14, focusing on game development and low-latency capabilities. One of their issues of interest is 2D graphics capabilities as part of the language standard.

  • A recorded presentation from CppCon 2016 describing SG14's activities and interests.
  • A report (from May 2016) on SG14's progress, including some discussion and reference to specific proposals regarding 2D graphics.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.