The Following 3 Users Say Thank You to Marcus For This Useful Post: | ||
![]() |
2010-04-12
, 19:14
|
Posts: 270 |
Thanked: 239 times |
Joined on Dec 2009
@ Czech Republic
|
#2
|
I found a source code/tutorial for a very basic snake game in C using SDL, so I decided to try to do a port to C++, and hopefully to the Maemo platform at the end.
Unfortunately, I do not believe I have the needed C++ knowledge etc. yet, so therefore I'm posting the current source code. Basically all I've done so far, is the porting to C++, and a little other changes.
It is not commented, and _definitely_ not perfect. So it can be optimized a lot!
You need to download a font from somewhere and use it. I'm not sure I'm allowed to use the borgnine font I found on dafont.
When you've got a font either edit TTF_OpenFont(); or make a folder called "data", put the font in there and then rename the font to "borgnine.ttf".
Screenshot:
Compile with (Linux):
g++ -o main main.cpp -lSDL -lSDL_image -lSDL_ttf
http://www.cprogrammingreference.com...ming/Snake.php