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