How to develop a basic game using opengl that accepts keyboard commands

Asked

Viewed 3,045 times

0

I tried to follow the source of a tutorial Metar Gearn Nanna, because I was interested in creating a game in opengl and c++, it could be something simple, with precarious validations, just to understand the concept, I learned to draw triangles and color using opengl (I confess that I could have deduced a little time and effort for this task)but it was very far from being able to make a game like Snake for example. The link with the source was broken. And my knowledge in this area is extremely limited, almost nil, I followed this booklet, but I also had a hard time.

I believe that creating a game is something of interest to many developers by hobby, but many like me end up finding many difficulties. The lack of sample code of something functional was something that limited me a lot. I didn’t post code because I don’t know very well or where to start.

So the real question is: How to make a game in opengl (any game) that accepts user interaction (keyboard keys, mouse or control)?

What I expect in response are things like links with example code, documentation and etc... anything that is useful not only for me, but for everyone who has an interest in building a game. It doesn’t matter that it’s simple. If you have a menu and a frame that walks with the mouse arrows, it’s working! The idea is to give a north for all who want to develop a game read this question and with the answer be able to take the first steps.

1 answer

3


Working with openGL and C++ to create a game you will need to program it very low level even, I say this by the way of dealing collisions and some other functionality for example, it is more laborious but it is very pleasant to make from scratch and see the final result. You learn a lot from it.

I did an experiment on C++ once creating a silly little game just to test bumps and moves, commented as much as I could. Take a look at my game repository on github.. I think taking an example and trying to understand what each thing does makes learning much easier.

Link to the repository

The archive main.cpp is where I made the game and the folder resources is where I put the libs I used in the project.

  • I will definitely see congratulations on the initiative, as soon as I read put you an answer I will try.

  • Cool!! Any questions put there for us to debate!!

  • I haven’t executed it yet, I just read the main code from github. Your code is clean, well organized and easy to understand.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.