Pong

Started by
26 comments, last by Neoecs 18 years, 11 months ago
I have earlier programmed in Allegro and it was very easy, now I want to move up to something more professional, still crossplatform. I choosed OpenGL and it seemed hard. So, can i have the sourcecode for a Pong game, it would be helpful to se how input, processing, output and gamestates work, I think I can use a sourcecode to learn. Thanks!
Advertisement
Allegro = all the things you just asked for
OpenGL = Open Graphics Library. It does graphics.

Look up SDL, which will do everything else :)
:D So.. I cant handle input only using OpenGL?
no. you can only handle graphics using OpenGL; hence the name, Open Graphics Language.
Ok sorry.

But what about

if (keys[VK_RIGHT]){//Do stuff}

?

Found it in an NeHe guide...
Quote:Original post by Neoecs
Ok sorry.

But what about

if (keys[VK_RIGHT]){//Do stuff}

?

Found it in an NeHe guide...


That's some Win32 input handling, not something provided by OGL.

- Jason Astle-Adams

Ok, can I use that? I guess it wont work on other OS'es that Windows if i do? Is it fast? Is it good?
lol, VK_RIGHT VK_LEFT, are winapi virtual keys, constants defined in the windows headers. if you were wanting to make a cross platform game you would have to make a generic interface to the input.

If your a making a pong game I wouldn't be worrying about portability, unless it's a next gen version.
you are going to learn win32 programming in addition to opengl? as a beginner, might i suggest you try glut, freeglut or glfw ... all of which provide means for simple input handling (keyboard and mouse). that way you can learn opengl without worrying about the details of win32 programming... which in and off itself can be a daunting task for the 'young jedi in training'. others might suggest SDL, but as 'simple' as it is ... the others i mentioned are even easier to get up and running (assuming you know how to link in external libs and add a new header reference).
Quote:Original post by Neoecs
Ok, can I use that? I guess it wont work on other OS'es that Windows if i do?


Bingo, got it in one. Works perfectly fine, but only on Windows as you guessed. You might want to look at SDL; It's cross platform, and has input handling, sound, and rendering (and can be used for window handling along with OGL for 3d). Alternately, Screwtape's suggestions are an excellent way to get yourself some simple input handling along with OGL.

- Jason Astle-Adams

This topic is closed to new replies.

Advertisement