Pong clone in C with SDL/GL (code example).

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
lelandbdean
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 18
Joined: Thu Mar 28, 2013 10:37 pm
Favorite Gaming Platforms: PC, Gameboy, PSP, SNES, NES
Programming Language of Choice: C/++ usually

Pong clone in C with SDL/GL (code example).

Post by lelandbdean »

Hey guys.

Made a simple Pong clone for a thing. Thought it might help someone just starting out to understand SDL/OpenGL, basic game logic and program flow control, etc.
Be forewarned: Shit has one .c file, and is a bit ugly. It is the way it is on purpose.

Anyway, here's the repo:
https://github.com/lelandbdean/SDL-OpenGL-Pong

And here's a screenshot:
Image
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Pong clone in C with SDL/GL (code example).

Post by dandymcgee »

Cool, thanks for sharing.

As you build on top of it and clean it up you should iteratively update the Git repo so that anyone using it to learn can go back and look at your history if they want. If you're trying to preserve the simplest possible project, you could fork it for the more complex version.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
lelandbdean
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 18
Joined: Thu Mar 28, 2013 10:37 pm
Favorite Gaming Platforms: PC, Gameboy, PSP, SNES, NES
Programming Language of Choice: C/++ usually

Re: Pong clone in C with SDL/GL (code example).

Post by lelandbdean »

dandymcgee wrote:As you build on top of it and clean it up you should iteratively update the Git repo so that anyone using it to learn can go back and look at your history if they want. If you're trying to preserve the simplest possible project, you could fork it for the more complex version.
That's the plan, actually. :) Keep every iteration of the project available, so if someone wants they can step through the evolution. I know the project is really simple, but I think it's a valuable illustration.

When I was first getting started (as a clueless teenager) the lack of "finished" examples/usage code for most libraries was a hurdle. "Here's how to load an image" vs. "Here's how to link all these subsystems and APIs together to make something cohesive."

As you gain experience, you reach a point where basic examples (and Reading The Fucking Manual) is enough to make you comfortable, but as a programming virgin it's daunting to slog through documentation and trying to make sense of it with no frame of reference. Hopefully this will help someone past that.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Pong clone in C with SDL/GL (code example).

Post by dandymcgee »

lelandbdean wrote: As you gain experience, you reach a point where basic examples (and Reading The Fucking Manual) is enough to make you comfortable, but as a programming virgin it's daunting to slog through documentation and trying to make sense of it with no frame of reference. Hopefully this will help someone past that.
I owe everything I know about SDL to LazyFoo. Good times.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

Re: Pong clone in C with SDL/GL (code example).

Post by superLED »

dandymcgee wrote:
lelandbdean wrote: As you gain experience, you reach a point where basic examples (and Reading The Fucking Manual) is enough to make you comfortable, but as a programming virgin it's daunting to slog through documentation and trying to make sense of it with no frame of reference. Hopefully this will help someone past that.
I owe everything I know about SDL to LazyFoo. Good times.
Haha, same here. I think I may have given up if it wasn't for his webpage with simple explanations of how tings work.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Pong clone in C with SDL/GL (code example).

Post by Falco Girgis »

Shit, I missed this thread. This is a really fucking badass take on pong, and I hope a lot of the newbies here realize how useful the source code is to them.
MarioWa
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 1
Joined: Wed Nov 15, 2017 5:10 am

Re: Pong clone in C with SDL/GL (code example).

Post by MarioWa »

dandyemcgee wrote:As you gain experience, you reach a point where basic examples (and Reading The Fucking Manual) is enough to make you comfortable, but as a programming virgin it's daunting to slog through documentation and trying to make sense of it with no frame of reference. Hopefully this will help someone past that.
This is really cool, thanks for the source code leland! Hope you don't mind if I play around with it!
Post Reply