PDA

View Full Version : UI question, and more...



nycjay
06-21-2001, 04:52 PM
I am trying to make an opnegl/c++ app for a class. (I am using GLUT). For this assignment I have to show how a hard disk works, and a few algorightms (spinning disk, getting read by a head, etc.) What would be some ways to have the different examples (like scenes in a movie). I mean, could I (and if so how) make a "menu", and when one of the, say four choices is selected, it "plays" that part of the animation, then goes back to the main menu. How can I set up the different "animations" and get from one to the other. I hope this question is clear enough. Thanks for any input.
Regards,
Jason

Eber Kain
06-21-2001, 08:31 PM
I would start by makeing a Global variable, say GAME_STATE, use this to toggle between different modes, then set switch statements in your display and idle loops that check the int GAME_STATE and draw/animate for the proper mode.

use keyboard the same way,

switch (key) {
case '1':
GAME_STATE = 1;
break;
case '2':
GAME_STATE = 2;
break;
ect......

then its just a matter of scripting the animations like you want, if you do use an idle loop and intend on takeing the program to a different computer, i would add another global variable say float ANIMATION_SPEED = 0.01; and set up a few keys fo increase/decrease this, and use it ever place that you would normally put an increment.