]> icculus.org git repositories - divverent/darkplaces.git/blob - vid.h
fix nexuiz menu mouse input by resetting in_mouse_x/y variables in a
[divverent/darkplaces.git] / vid.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20 // vid.h -- video driver defs
21
22 #ifndef VID_H
23 #define VID_H
24
25 #define ENGINE_ICON ( (gamemode == GAME_NEXUIZ) ? nexuiz_xpm : darkplaces_xpm )
26
27 extern int cl_available;
28
29 typedef struct viddef_s
30 {
31         // these are set by VID_Mode
32         int width;
33         int height;
34         int bitsperpixel;
35         int fullscreen;
36         int refreshrate;
37         qboolean userefreshrate;
38         int stereobuffer;
39         int samples;
40
41         // these are used for state tracking
42         qboolean mouseaim;
43 } viddef_t;
44
45 // global video state
46 extern viddef_t vid;
47 extern void (*vid_menudrawfn)(void);
48 extern void (*vid_menukeyfn)(int key);
49
50 extern qboolean vid_hidden;
51 extern qboolean vid_activewindow;
52 extern cvar_t vid_hardwaregammasupported;
53 extern qboolean vid_usinghwgamma;
54 extern qboolean vid_supportrefreshrate;
55
56 extern cvar_t vid_fullscreen;
57 extern cvar_t vid_width;
58 extern cvar_t vid_height;
59 extern cvar_t vid_bitsperpixel;
60 extern cvar_t vid_samples;
61 extern cvar_t vid_refreshrate;
62 extern cvar_t vid_userefreshrate;
63 extern cvar_t vid_vsync;
64 extern cvar_t vid_mouse;
65 extern cvar_t vid_grabkeyboard;
66 extern cvar_t vid_stick_mouse;
67 extern cvar_t vid_resizable;
68 extern cvar_t vid_minwidth;
69 extern cvar_t vid_minheight;
70
71 extern cvar_t gl_combine;
72 extern cvar_t gl_finish;
73
74 extern cvar_t v_gamma;
75 extern cvar_t v_contrast;
76 extern cvar_t v_brightness;
77 extern cvar_t v_color_enable;
78 extern cvar_t v_color_black_r;
79 extern cvar_t v_color_black_g;
80 extern cvar_t v_color_black_b;
81 extern cvar_t v_color_grey_r;
82 extern cvar_t v_color_grey_g;
83 extern cvar_t v_color_grey_b;
84 extern cvar_t v_color_white_r;
85 extern cvar_t v_color_white_g;
86 extern cvar_t v_color_white_b;
87 extern cvar_t v_hwgamma;
88
89 extern int gl_stencil;
90
91 // brand of graphics chip
92 extern const char *gl_vendor;
93 // graphics chip model and other information
94 extern const char *gl_renderer;
95 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
96 extern const char *gl_version;
97 // extensions list, space separated
98 extern const char *gl_extensions;
99 // WGL, GLX, or AGL
100 extern const char *gl_platform;
101 // another extensions list, containing platform-specific extensions that are
102 // not in the main list
103 extern const char *gl_platformextensions;
104 // name of driver library (opengl32.dll, libGL.so.1, or whatever)
105 extern char gl_driver[256];
106
107 // compatibility hacks
108 extern qboolean isG200;
109 extern qboolean isRagePro;
110
111 // LordHavoc: GLX_SGI_swap_control and WGL_EXT_swap_control
112 extern int gl_videosyncavailable;
113
114 void *GL_GetProcAddress(const char *name);
115 int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *disableparm, int silent);
116
117 void VID_Shared_Init(void);
118
119 void GL_Init (void);
120
121 void VID_CheckExtensions(void);
122
123 void VID_Init (void);
124 // Called at startup
125
126 void VID_Shutdown (void);
127 // Called at shutdown
128
129 int VID_SetMode (int modenum);
130 // sets the mode; only used by the Quake engine for resetting to mode 0 (the
131 // base mode) on memory allocation failures
132
133 int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples);
134 // allocates and opens an appropriate OpenGL context (and its window)
135
136
137 // sets hardware gamma correction, returns false if the device does not
138 // support gamma control
139 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
140 int VID_SetGamma(unsigned short *ramps, int rampsize);
141 // gets hardware gamma correction, returns false if the device does not
142 // support gamma control
143 // (ONLY called by VID_UpdateGamma and VID_RestoreSystemGamma)
144 int VID_GetGamma(unsigned short *ramps, int rampsize);
145 // makes sure ramp arrays are big enough and calls VID_GetGamma/VID_SetGamma
146 // (ONLY to be called from VID_Finish!)
147 void VID_UpdateGamma(qboolean force, int rampsize);
148 // turns off hardware gamma ramps immediately
149 // (called from various shutdown/deactivation functions)
150 void VID_RestoreSystemGamma(void);
151
152 void VID_GrabMouse (qboolean grab);
153 void VID_Finish (void);
154
155 void VID_Restart_f(void);
156
157 void VID_Start(void);
158
159 extern unsigned int vid_gammatables_serial; // so other subsystems can poll if gamma parameters have changed; this starts with 0 and gets increased by 1 each time the gamma parameters get changed and VID_BuildGammaTables should be called again
160 extern qboolean vid_gammatables_trivial; // this is set to true if all color control values are at default setting, and it therefore would make no sense to use the gamma table
161 void VID_BuildGammaTables(unsigned short *ramps, int rampsize); // builds the current gamma tables into an array (needs 3*rampsize items)
162 #endif
163