2D game : witch API?

Started by
21 comments, last by Sync Views 15 years, 10 months ago
hi, I want to develop a 2D game engine in c++ , for the windows platform I only got stuck witch graphical API i'm gonna use.. I mean : - GDI( or GDI+) - DirectX - OpenGL my first idea was to use GDI+ c'se it's quite powerfull and c'se I know it quite good and it's not that hard to use... then I realized that GDI( and GDI+) aren't hardware accelerated, where DirectX and OpenGl are... But those 2 aren't very easy (and I should learn them)... What should you people suggest ussing ?
Advertisement
I'd personally go with the happy trio of SDL, SDL_image and OpenGL.

- SDL provides initialization of a window, as well as mouse/keyboard and even joystick input handling
- SDL_image provides image loading
- OpenGL provides hardware accelerated rendering
- Documentation, examples and forum help are plentiful

Good luck!

"The right, man, in the wrong, place, can make all the dif-fer-rence in the world..." - GMan, Half-Life 2

A blog of my SEGA Megadrive development adventures: http://www.bigevilcorporation.co.uk

Not only that, but it makes your game portable; you could deploy it on multiple operating systems instead of just sticking to Windows.
The engine must be windows only (not my call... )

I just looked at SDL , but In windows, I know how to code a lot of the functions that they offer meself... so that's not really an option, but thx anyway for suggesting :)

I only need the graphical API, but I don't know witch to use :

- GDI : easy but not advanced
- GDI+ : easy, advanced but slow as it's not hardware accelerated
- DirectX and OpenGl : difficult, advanced, hardware accelerated but not made for 2D ...
-... other API ?

thx
Quote:Original post by Yourself
The engine must be windows only (not my call... )
Is this homework? Part of your job? I ask because I'm wondering why one would require that an engine be Windows-only. (I can imagine a project having the parameter that the engine can be Windows-only, but why would you require it to be so? If using a cross-platform library such as SDL serves the project well, why not do so?)
Quote:- GDI : easy but not advanced
- GDI+ : easy, advanced but slow as it's not hardware accelerated
- DirectX and OpenGl : difficult, advanced, hardware accelerated but not made for 2D ...
-... other API ?
DirectX and OpenGL are both fine for 2D. As for which to use, if this 'Windows only' thing is really important, you might as well use DirectX. If on the other hand you choose to use OpenGL, it would be kind of silly not to make the rest of the engine cross-platform as well.

Personally, I'd recommend SDL + OpenGL. Or, better yet, if your goal is to make a game, use a game engine that already exists rather than creating a new one from scratch.
Well I would go with the combination of OpenGL, GLFW, and GLPng. And if you want sound, then I would choose OpenAL. You can't go wrong with that combination.

And OpenGL is totally built for 2D if you just use an ortho matrix. With an ortho matrix you have a great advantage of other 2D engines in the fact that the depth is real and hardware-acclerated, not faked with software depth sorting.
Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume
Quote:Original post by jyk
Is this homework? Part of your job? I ask because I'm wondering why one would require that an engine be Windows-only. (I can imagine a project having the parameter that the engine can be Windows-only, but why would you require it to be so? If using a cross-platform library such as SDL serves the project well, why not do so?)[


it 's an engine that I will give to students (I'm a prof) and they are using windows ;) they use the engine to learn the basics of c++...

it looks like DirectX is the best option for now ...

I know that DirectX can handle 2D graphics but can it also handle stuff like collision detection ?
I haven't actually played with GDI+, but I'm developing a 2D game entirely in OpenGL. The editor that's evolving alongside it is a mix of GDI and OpenGL. I think if you could do a serious 2D game in GDI (with Dibs, I'd presume), then you'd be proficient enough to do one in OpenGL.

and writing shaders in GLSL is going to be way better for heavy effects, provided you're aiming at a decent class of hardware

Quote:Original post by Yourself
I know that DirectX can handle 2D graphics but can it also handle stuff like collision detection ?


No. But you can get something like Box2D and tie it in
Quote:Original post by Yourself
Quote:Original post by jyk
Is this homework? Part of your job? I ask because I'm wondering why one would require that an engine be Windows-only. (I can imagine a project having the parameter that the engine can be Windows-only, but why would you require it to be so? If using a cross-platform library such as SDL serves the project well, why not do so?)[


it 's an engine that I will give to students (I'm a prof) and they are using windows ;) they use the engine to learn the basics of c++...

it looks like DirectX is the best option for now ...

I know that DirectX can handle 2D graphics but can it also handle stuff like collision detection ?


Just curious, but what kind of professor are you. If you are on a tight schedule, and looking for an easy 2D OpenGL rendering engine to modify, then I recommend that you check out: http://www.googlecode.com/p/phoenixgl. It is under the GPL license which means you are free to modify it, and release it as you like. If you need any help, then just contact me by email.
Denzel Morris (@drdizzy) :: Software Engineer :: SkyTech Enterprises, Inc.
"When men are most sure and arrogant they are commonly most mistaken, giving views to passion without that proper deliberation which alone can secure them from the grossest absurdities." - David Hume
at this moment I give math and vb.net but in 2 yr (2009-2010) I start teaching C++ (STD lib's) in an bachelor gamedev.

This topic is closed to new replies.

Advertisement