2D Programming - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: 2D Programming (/thread-1395.html)
Pages: 1 2
2D Programming - Aaron - Apr 26, 2009 09:21 AM
Hello all. I come from the Dim3 forum community.
I'm a environment artist, not a programmer, but I would like to start learning graphics programming.
I am well versed in C++, just the language side of it, but know almost nothing about actual graphics programming-- I understand some math will be involved, which I am comfortable with. I know C++ well, but when it comes to actually using C++ to create a graphical game, I have no clue. Most I have done game-wise in C++ is create a little text adventure.
If anyone could point me to some good resources/tutorials/info about 2d graphics programming, perhaps with SDL, I would appreciate it. I understand that I am not going to develop Gears of War in a few weeks. I just want to start playing around with making a simple side scroller perhaps.
I am already a competent artist, so the art side of the game is easy for me. The programming is another story!
If anyone could give me some basic pointers, on what I need to learn, etc, that would be nice.
2D Programming - Blacktiger - Apr 26, 2009 01:45 PM
I think the standard recommendation around here is to learn OpenGL. Doing some basic 2D graphics in OpenGL isn't terribly hard, but it will probably take a little bit of getting used to. Check out the NeHe tutorials to get started. When starting out you could use the GLUT library to get a window set up. The nice thing about going this route is that once you are familiar with 2D graphics in OpenGL it isn't to hard to move up to 3D graphics.
2D Programming - Aaron - Apr 26, 2009 04:42 PM
Thank you for the tutorial link, I am going through them now.
My aim is not actually 3d graphics, as I know that there is no way I will ever become mathematically savvy enough to even start writing my own graphics engine. My aim is really just to start working on some simple, fun, 2d games.
2D Programming - Ingemar - Apr 29, 2009 11:31 PM
I think that's very sensible. 2D games are fun, easier to make and easier to play.
I have a package for 2D game programming that I am working on, that I judge is ready for at least the simpler games. It has never been used from C++ though, so a bit of hacking is needed to make interface files. OpenGL based.
But I am sure there are plenty of other 2D libraries around, so I am sure some suggestions will follow.
One that isn't graphics but physics is the Chipmunk physics engine, which I find impressive and very interesting. I havn't done any programming with it myself, so I can't judge how good its API is, but it looked promising.
2D Programming - Aaron - May 1, 2009 03:16 PM
Thank you for the suggestions.
I'm guessing it was written in C?
My problem right now is that all tutorials I can find for SDL are in C... therefore, telling me nothing about what I would need to change for C++. Even the SDL template for Xcode is in C, not C++. I suppose I just need to start tinkering around more, look through some reference pages.
2D Programming - Nosredna - May 2, 2009 07:36 AM
Jeff LaMarche is doing an OpenGL series right now. Poke around his blog--the installments are mixed in with his other posts.
2D Programming - Nosredna - May 2, 2009 07:54 AM
Aaron Wrote:Thank you for the suggestions.
Since the libraries are written in C, they can be called from C, Objective-C (which is a pure superset of C), or C++ (which is not a pure superset of C, but close). What you do in Objective-C or C++ all depends on how you want to set up your classes.
I find little reason to be very object-oriented when writing a game on my own. Typically I'll just have a struct full of arrays of structs. I know I'll have a maximum of, say, 32 enemies. So I'll have an array of 32 structs for enemies. Each enemy element will have an active flag and all the information about that enemy. When I want to add an enemy to the game, I spin through the array looking for an open enemy slot. When I want to draw the enemies, I spin through the array and draw the ones that have their active flag set. No linked lists. No memory allocations or deallocations in the game logic.
2D Programming - Aaron - May 2, 2009 09:50 AM
Ah, that makes sense.
I will look through the tutorials now, they seem good.
I made the mistake of learning C++ before C, so my programming side is more object oriented.
2D Programming - Nosredna - May 2, 2009 10:25 AM
Aaron Wrote:Ah, that makes sense.
That's not a problem. A struct is like a class. You can grab a C book and after a few hours you won't be scared anymore.
2D Programming - Aaron - May 2, 2009 10:34 AM
Well, I'm beginning to be less scared.
Quote:Code Deleted Due To Me Realizing What A Idiot I Am
2D Programming - AnotherJake - May 2, 2009 10:46 AM
Go hit up OneSadCookie's GLUT tutorial before you get yourself into too much more trouble.
2D Programming - Aaron - May 2, 2009 10:47 AM
I'm sure I look like a idiot right now.
EDIT: That was exactly what I needed to get started. Exactly. Thanks AnotherJake.
2D Programming - AnotherJake - May 2, 2009 10:54 AM
Nah. If you know how to work with XNA you'll get this figured out easy.
2D Programming - Nosredna - May 2, 2009 12:45 PM
AnotherJake Wrote:Go hit up OneSadCookie's GLUT tutorial before you get yourself into too much more trouble.
If you use that GLUT tutorial and avoid Objective-C completely, how do you get to all the APIs you need for things like multitouch and audio?
2D Programming - AnotherJake - May 2, 2009 12:59 PM
No, you don't get iPhone APIs or Objective-C with GLUT. I'm not trying to counter your Jeff LaMarche suggestion if that's what you're implying -- Aaron put up code (which he has since removed) which used GLUT and needed some help with that.