]> icculus.org git repositories - taylor/freespace2.git/blob - include/uidefs.h
Initial revision
[taylor/freespace2.git] / include / uidefs.h
1 /*
2  * $Logfile: /Freespace2/code/UI/UiDefs.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Include file for stuff used internally by the UI code.
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 2     10/07/98 10:54a Dave
15  * Initial checkin.
16  * 
17  * 1     10/07/98 10:51a Dave
18  * 
19  * 8     4/01/98 5:07p Hoffoss
20  * Changed mouse button handling for UI in order to track fast events
21  * (like button going down and released all between frames).
22  * 
23  * 7     2/03/98 4:21p Hoffoss
24  * Made UI controls draw white text when disabled.
25  * 
26  * 6     6/12/97 12:39p John
27  * made ui use freespace colors
28  * 
29  * 5     6/11/97 1:13p John
30  * Started fixing all the text colors in the game.
31  * 
32  * 4     12/08/96 1:58a Lawrance
33  * added some additional colors 
34  * 
35  * 3     12/02/96 2:17p John
36  * Made right button drag UI gadgets around and
37  * Ctrl+Shift+Alt+F12 dumps out where they are.
38  * 
39  * 2     11/15/96 11:43a John
40  * 
41  * 1     11/14/96 6:55p John
42  *
43  * $NoKeywords: $
44  */
45
46 #ifndef _UIDEFS_H
47 #define _UIDEFS_H
48
49 #include "pstypes.h"
50 #include "key.h"
51 #include "mouse.h"
52 #include "2d.h"
53 #include "freespace.h"
54
55 #define CBLACK Color_black
56 #define CGREEN Color_green
57 #define CBRIGHT_GREEN Color_bright_green
58 #define CGRAY Color_grey
59 #define CDARK_GRAY Color_bright_white  // since gray doesn't work with our current color system..
60 #define CWHITE Color_white
61 #define CBRIGHT Color_bright_white
62
63 #define BORDER_WIDTH 8
64
65 void ui_hline(int x1, int x2, int y );
66 void ui_vline(int y1, int y2, int x );
67 void ui_string_centered( int x, int y, char * s );
68 void ui_draw_shad( int x1, int y1, int x2, int y2, int r1, int g1, int b1, int r2, int g2, int b2 );
69 void ui_draw_frame( int x1, int y1, int x2, int y2 );
70 void ui_rect( int x1, int y1, int x2, int y2 );
71 void ui_draw_box_out( int x1, int y1, int x2, int y2 );
72 void ui_draw_box_in( int x1, int y1, int x2, int y2 );
73 void ui_draw_line_in( int x1, int y1, int x2, int y2 );
74 void ui_draw_sunken_border( int x1, int y1, int x2, int y2 );
75
76 #define BUTTON_PRESSED          1
77 #define BUTTON_RELEASED         2
78 #define BUTTON_JUST_PRESSED     4
79 #define BUTTON_JUST_RELEASED    8
80 #define BUTTON_DOUBLE_CLICKED   16
81
82 #define B1_PRESSED          (ui_mouse.b1_status & BUTTON_PRESSED)
83 #define B1_RELEASED         (ui_mouse.b1_status & BUTTON_RELEASED)
84 #define B1_JUST_PRESSED     (ui_mouse.b1_status & BUTTON_JUST_PRESSED)
85 #define B1_JUST_RELEASED    (ui_mouse.b1_status & BUTTON_JUST_RELEASED)
86 #define B1_DOUBLE_CLICKED   (ui_mouse.b1_status & BUTTON_DOUBLE_CLICKED)
87
88 #define B2_PRESSED          (ui_mouse.b2_status & BUTTON_PRESSED)
89 #define B2_RELEASED         (ui_mouse.b2_status & BUTTON_RELEASED)
90 #define B2_JUST_PRESSED     (ui_mouse.b2_status & BUTTON_JUST_PRESSED)
91 #define B2_JUST_RELEASED    (ui_mouse.b2_status & BUTTON_JUST_RELEASED)
92
93 typedef struct UI_MOUSE {
94         int     x, y;
95         int     dx, dy;
96         int     b1_status;
97         int     b1_last_status;
98         int     b1_time_lastpressed;
99         int     b2_status;
100         int     b2_last_status;
101         int     b2_time_lastpressed;
102         int     timestamp;
103 } UI_MOUSE;
104
105 extern UI_MOUSE ui_mouse;
106 extern void ui_mouse_process();
107
108
109 #define Middle(x) ((x)/2)
110
111 #endif
112