2 Header file for use by GLUI controls.
3 Everything you need is right here.
7 #ifndef __GLUI_INTERNAL_CONTROL_H
8 #define __GLUI_INTERNAL_CONTROL_H
10 /* This is the main GLUI external header */
13 /* Here's some utility routines */
14 #include "glui_internal.h"
18 A GLUI_Control-drawing sentinal object.
19 On creation, saves the current draw buffer and window.
20 On destruction, restores draw buffer and window.
21 This is way nicer than calling save/restore manually.
23 class GLUI_DrawingSentinal {
24 int orig_buf, orig_win;
27 /** The constructor sets up the drawing system */
28 GLUI_DrawingSentinal(GLUI_Control *c_);
29 /** The destructor cleans up drawing back how it was */
30 ~GLUI_DrawingSentinal();
32 // Do-nothing routine to avoid compiler warning about unused variable
33 inline void avoid_warning(void) {}
35 /** Just drop a GLUI_DRAWINGSENTINAL_IDIOM at the start of your draw methods,
36 and they'll return if we can't be drawn, and
37 automatically save and restore all needed state.
39 #define GLUI_DRAWINGSENTINAL_IDIOM if (NOT can_draw()) return; GLUI_DrawingSentinal drawSentinal(this); drawSentinal.avoid_warning();
42 /** Return the time, in seconds. */
43 inline double GLUI_Time(void) {return 0.001*glutGet(GLUT_ELAPSED_TIME);}