[OpenGL] I need a tip
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
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).
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.
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.
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
Quote:Original post by broadyA 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).
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement