• Advertisement
Sign in to follow this  

Game Design in C++

This topic is 3304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys I've been poking around in these forums and decided it was time to join in order to get my questions answered. I have decent experience with using C++ (more in the direction of tedius homework assingments) and I am seeking help in using C++ for creating games. I googled a tutorial for the matter and found what appeared to be pretty decent. I coppied and pasted the code into MSVS2005 to see what it would look like and alas it returned some errors. The first error was obvious to see in the code #include <allegro.h>. I had no idea what that was so I looked it up, download the files, and tried to mess with the libraries in MSVS. I thought I got it but still got more errors. What I was actually hoping for in my first post was for someone to possibly give me ground-up help with making my MSVC able to work on games. I think it might be easier that way rather than a game of tag trying to show what steps I myself am on. If in fact more info is needed, please let me know. Thanks in advance for the help, Aaron-

Share this post


Link to post
Share on other sites
Advertisement
A forum member, LazyFoo, has a set of tutorials built around SDL. It goes from setting up your IDE, through introducing many of the functions you will be using to some more advanced topics. Is that what you had in mind?

Share this post


Link to post
Share on other sites
Oh man, that link was very much what I was looking for. It's exactly the help I need to get started :)

I have a question that you might be able to help with or maybe LazyFoo will see. In the second tutorial I get all the code entered in (typing it myself) and it produces an error: "The program '[2124] My Project.exe: Native' has exited with code 0 (0x0)." When I downloaded the media and source code from the tutorial page I was able to run it just fine so I picked through my code but it seems okay.

Share this post


Link to post
Share on other sites
Quote:
Original post by amhathaw
I have a question that you might be able to help with or maybe LazyFoo will see. In the second tutorial I get all the code entered in (typing it myself) and it produces an error: "The program '[2124] My Project.exe: Native' has exited with code 0 (0x0)." When I downloaded the media and source code from the tutorial page I was able to run it just fine so I picked through my code but it seems okay.


That's normal. Not an error. That's basically the output of this line of code:

int main() {
return 0; // <- exit with code 0
}

Share this post


Link to post
Share on other sites
Oh wow, duh haha. Can't believe I missed that. I thought it was an error though because the image itself didn't popup, MVS kind of flashes and then it gives me that output. It seems like it might be creating the image and then destroying it so fast that I just don't see it. Any ideas?

Share this post


Link to post
Share on other sites
Nice to know another Aaron on the forums :). It could be that its dissappearing. Was a while when I ran through some of those. Just throw a system("pause"); at the end, to see what happens. Note to normally avoid using that function, just a good test for now.

Share this post


Link to post
Share on other sites
Yea, make it sleep for a bit.

Use getch() to make it wait till a key is pressed. You will have to include <conio.h>

Or from look at the second lesson's code


//Wait 2 seconds
SDL_Delay( 2000 );


Increase 2000 to a higher value

Share this post


Link to post
Share on other sites
Alrighty, I think I found the problem! Thanks Aaron2 and Firenet for your help, you both gave ideas for possible problem solving tips in the future :)

Share this post


Link to post
Share on other sites
I am glad that you found SDL.

I just wanted to add a few things that may be useful to you:

1. OpenGL can be used with SDL in case you ever needed hardware acceleration. (Although I read that in the next version of SDL it will be much easier to use hardware surfaces).

2. Since you already have experience with C++, it will be easy for you to learn Python and use Pygame. "Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language." -- from Pygame website.

Once you learn SDL it is pretty painless to write SDL programs in C++ or Python. Python is generally an easier language than C++ so usually games or game prototypes can be developed quicker with Pygame. I use it for quick prototyping and script writing.

I think it's nice to be able to interface with SDL in either C++ or Python; it provides more flexibility.

3. And, yes Lazy Foo's tutorials are the best I've seen for SDL.

Share this post


Link to post
Share on other sites
I love Lazyfoos site. I found it helpful though to break down some of his functions (in the first few lessons) to work on one concept at a time. They are the best (and really only ones) I have seen.

Share this post


Link to post
Share on other sites
Man-o-man guys. I hope no one hates me for asking these trivial questions haha. I love the tutorials and I feel like I'm learning a lot, but I hit another speed bump. I'm trying to understand how to set up different extension libraries (i.e. being able to include SDL/SDL_image.h) and it doesn't seem to be working for me. If I try my code without the include and just use the default BMP association for my images it works just fine. But when I try to include the SDL_image.h for PNG files things hit the fan. I have the SDL_image-devel-1.2.7-VC9 download and I put the containing lib, header and dlls in the appropriate locations. I even set up the "Additional Dependencies" property up correctly (or so I think).
I really hate to be a thorn, but all help is appreciated :)

Aaron-

-edit-
oh and it might help to say that the error I'm receiving is "'SDL/SDL_image.h': No such file or directory"

I've also been digging around and I see a lot of posts about _DEBUG being defined or something. I'm not sure what that is or if it has any relevance either.

[Edited by - amhathaw on January 8, 2009 10:05:56 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement