Sign in to follow this  
broady

[OpenGL] I need a tip

Recommended Posts

i' ll try to be as simple as i can. Suppose i have to write an application. This application works on a plane (sat glortho2D) ans has 2 steps. In the 1st step i let the user define (create) points on the plane. If the user clicks on a point on the plane a point is created "under" the cursor and it is rendered. This is pretty easy to do. In the 2nd step the user is able to drag the points he created in the 1st step. The question is: how can i jump from the first to the second step? The user should be able to say: "Hey i dont need more points, now i wanna start to move 'em around". How can i switch between these 2 working modes? Thanks good fellows

Share this post


Link to post
Share on other sites
You could just overlap the two modes.
Any mouse down selects the point under the cursor.
If the user mouses up before X time has elapsed, ignore the selection, and drop a new point.
If the user takes longer than X time AND moves the mouse, move the selected point instead of adding a new one.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
You could implement two classes, one for each of the two stages, and swap them upon some user input (could be as simple as the space bar, all the way to an onscreen button).


Thanks guys for the replyies.

I am more interested in the quoted solution since i have never used a button (never had to fight with even an easy GUI) and it seems i can learn more this way.

Can u give me a link or some resource to create buttons and stuff? Might be the red book can help me ill throw a look on it (oh it's near me :D). I am actually working on Glut and OpenGL.

Thanks again

Share this post


Link to post
Share on other sites
Quote:
Original post by broady
Can u give me a link or some resource to create buttons and stuff? Might be the red book can help me ill throw a look on it (oh it's near me :D). I am actually working on Glut and OpenGL.
A button is - in its most basic form - an image displayed onscreen (probably a textured quad), and a mouse-down handler that checks if the button was clicked (i.e. a glutMouseFunc() callback that checks if the mouse location is inside the button).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this