2D Programming
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.
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.
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.
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.

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.
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.
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.
Thank you for the suggestions.
I'm guessing it was written in C?
Sounds interesting.
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.
I'm guessing it was written in C?
Sounds interesting.

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.
Jeff LaMarche is doing an OpenGL series right now. Poke around his blog--the installments are mixed in with his other posts.
http://iphonedevelopment.blogspot.com/
http://iphonedevelopment.blogspot.com/
Aaron Wrote:Thank you for the suggestions.
I'm guessing it was written in C?
Sounds interesting.
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.
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.
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.
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.
Aaron Wrote: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.
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.
Well, I'm beginning to be less scared. 

Quote:Code Deleted Due To Me Realizing What A Idiot I Am
Go hit up OneSadCookie's GLUT tutorial before you get yourself into too much more trouble.

I'm sure I look like a idiot right now.

EDIT: That was exactly what I needed to get started. Exactly. Thanks AnotherJake.
Nah. If you know how to work with XNA you'll get this figured out easy.
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?
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.

