1 /*
2 			     Control Panel
3  */
4 
5 #ifndef CP_H
6 #define CP_H
7 
8 #include <sys/types.h>
9 #include <GL/gl.h>
10 #include "gw.h"
11 #include "v3dtex.h"
12 #include "cpvalues.h"
13 #include "cpins.h"
14 
15 
16 /*
17  *	Control Panel structure:
18  */
19 typedef struct {
20 
21 	gw_display_struct	*display;
22 	GLfloat	x, y, z;		/* In centimeters from center of
23 					 * cockpit.
24 					 */
25 	GLfloat heading, pitch, bank;	/* In radians. */
26 	GLfloat	width, height;		/* In centimeters. */
27 	v3d_texture_ref_struct	*tex;	/* Texture. */
28 
29 	/* List of all instruments on this control panel. */
30 	CPIns	**ins;
31 	int	total_ins;
32 
33 	ControlPanelValues	values;
34 
35 } ControlPanel;
36 #define CONTROL_PANEL(p)	((ControlPanel *)(p))
37 #define CONTROL_PANEL_DISPLAY(p)	(((p) != NULL) ? \
38  (CONTROL_PANEL(p)->display) : NULL)
39 #define CONTROL_PANEL_VALUES(p)		(((p) != NULL) ? \
40  &(CONTROL_PANEL(p)->values) : NULL)
41 
42 
43 extern time_t CPCurrentTime(ControlPanel *cp);
44 
45 extern CPIns *CPGetInsByNumber(ControlPanel *cp, int i);
46 extern int CPAppendIns(ControlPanel *cp, CPIns *ins);
47 
48 extern ControlPanel *CPNew(gw_display_struct *display);
49 extern void CPDelete(ControlPanel *cp);
50 
51 extern void CPSetPosition(
52 	ControlPanel *cp,
53 	GLfloat x, GLfloat y, GLfloat z /* In centimeters. */
54 );
55 extern void CPSetDirection(
56 	ControlPanel *cp,
57 	GLfloat heading, GLfloat pitch, GLfloat bank    /* In radians. */
58 );
59 extern void CPSetSize(
60 	ControlPanel *cp,
61 	GLfloat width, GLfloat height   /* In centimeters. */
62 );
63 extern void CPSetTexture(ControlPanel *cp, const char *path);
64 
65 extern void CPResetTimmers(ControlPanel *cp, time_t t);
66 extern void CPChangeValues(ControlPanel *cp, ControlPanelValues *v);
67 extern void CPDraw(ControlPanel *cp);
68 extern void CPManage(ControlPanel *cp, ControlPanelValues *v);
69 
70 
71 
72 #endif	/* CP_H */
73