PDA

View Full Version : 2D Mouse Clicking



Snickers
08-20-2009, 06:33 AM
Hi,

I'm trying to make a 2d game which will look 3d, Im a beginner 3d programmer.

The basis for the code will be a grid in which you can select a square on a grid to activate a 2d animation which would result in a score change.

Would this be straight forward to do with just C++ and opengl or would there be a game engine to allow me to do this.(So im looking on how I can register user input on specific squares, hopefully a mouseover on a square will change its colour, I can then left click to select then drop an animation in)

Also how easy is it to export blender models in an opengl and C++ progam.

Snickers
08-20-2009, 07:24 AM
Would I use glut to handle the input directly with the objects on the screen, in this case manipulating the squares?

todayman
08-20-2009, 09:24 AM
This doesn't sound too complicated, so it should be mostly straightforward. You need some way to interface with the windowing system, like GLUT or a similar library. Check out these libraries (http://www.opengl.org/wiki/Related_toolkits_and_APIs#Toolkits_to_bridge_OpenG L_and_the_Window_System).

There are definitely engines out there (OGRE and Irrlicht come to mind, I've looked at both briefly). These two are large, and they will definitely help with loading meshes/animations. When using libraries like this, you probably will not need something like GLUT, as these will handle it for you.

Blender does have a Python API so you can write your own export scripts and your own readers in C++ for your game. Of course, this means learning Python, which you may or may not want to do. I have found it relatively easy to start by modifying the obj exporter to suit my needs, and have built up to writing my own script from scratch.

I'd suggest simply playing around with a bunch of these, and see which methods you like. Definitely check out online OpenGL tutorials. I know the online redbooks are way out of date, but I have found they give a good description of the basics of what's going on.

Snickers
08-20-2009, 11:37 AM
Thanks Todayman, thats brilliant advice! :)