Jump to content
  • Advertisement
Sign in to follow this  
Neoecs

Pong

This topic is 4925 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

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!

Share this post


Link to post
Share on other sites
Advertisement
Allegro = all the things you just asked for
OpenGL = Open Graphics Library. It does graphics.

Look up SDL, which will do everything else :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
no. you can only handle graphics using OpenGL; hence the name, Open Graphics Language.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!