[C] First gme is nrly done. Cmmts on code would be appreciat

My first game, a snake clone, is mostly finished; gameplay-wise it leaves much to be desired but for me this was much more of a technical excersise than creating something enjoyable. I’m looking for some comments on my code, I have no idea if I’ve fallen into any bad habbits or if I’m going about things in a wierd way.

I’d also like some advise on solving memory leaks, it happens when you switch between the game, main menu or highscores. Is there a program I can use to help me solve it? (I’m running Ubuntu)

Source: (I’m using the SDL_TTF and SDL_Image extensions)
http://www.mediafire.com/?5aadq8z8x34ff1q

A, D to move the snake.

Valgrind will help.

A quick guess though is that you are not freeing mem before you are
reloading graphics fonts etc…

  • Swyped from my droid.On Apr 26, 2011 10:19 PM, “0x20” wrote:

My first game, a snake clone, is mostly finished; gameplay-wise it leaves
much to be desired but for me this was much more of a technical excersise
than creating something enjoyable. I’m looking for some comments on my code,
I have no idea if I’ve fallen into any bad habbits or if I’m going about
things in a wierd way.

I’d also like some advise on solving memory leaks, it happens when you
switch between the game, main menu or highscores. Is there a program I can
use to help me solve it? (I’m running Ubuntu)

Source: (I’m using the SDL_TTF and SDL_Image extensions)
http://www.mediafire.com/?5aadq8z8x34ff1q

A, D to move the snake.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

–> much more of a technical excersise than creating something enjoyable.

sounds like the ethos of alot of games companies :wink:

Yeah, I’d also recommend Valgrind or gdb, whichever. I think Valgrind will
be the easier of the two.On Wed, Apr 27, 2011 at 1:24 AM, Jonathan Greig wrote:

Valgrind will help.

A quick guess though is that you are not freeing mem before you are
reloading graphics fonts etc…

  • Swyped from my droid.

On Apr 26, 2011 10:19 PM, “0x20” wrote:

My first game, a snake clone, is mostly finished; gameplay-wise it leaves
much to be desired but for me this was much more of a technical excersise
than creating something enjoyable. I’m looking for some comments on my code,
I have no idea if I’ve fallen into any bad habbits or if I’m going about
things in a wierd way.

I’d also like some advise on solving memory leaks, it happens when you
switch between the game, main menu or highscores. Is there a program I can
use to help me solve it? (I’m running Ubuntu)

Source: (I’m using the SDL_TTF and SDL_Image extensions)
http://www.mediafire.com/?5aadq8z8x34ff1q

A, D to move the snake.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yup, valgrind is just the thing, thanks guys.