1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: i_video.h 1543 2020-08-22 02:36:35Z wesleyjohnson $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Copyright (C) 1998-2016 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // $Log: i_video.h,v $
21 // Revision 1.6  2001/08/20 20:40:39  metzgermeister
22 // Revision 1.5  2001/06/10 21:16:01  bpereira
23 // Revision 1.4  2001/02/24 13:35:20  bpereira
24 // Revision 1.3  2000/11/02 19:49:35  bpereira
25 // Revision 1.2  2000/02/27 00:42:10  hurdler
26 // Revision 1.1.1.1  2000/02/22 20:32:33  hurdler
27 // Initial import into CVS (v1.29 pr3)
28 //
29 //
30 // DESCRIPTION:
31 //      System specific video interface stuff.
32 //
33 //-----------------------------------------------------------------------------
34 
35 #ifndef I_VIDEO_H
36 #define I_VIDEO_H
37 
38 
39 #include "doomtype.h"
40 #include "command.h"
41   // consvar_t
42 
43 #ifdef __GNUG__
44 #pragma interface
45 #endif
46 
47 // configure settings, all possibilities
48 // Index to several tables.
49 typedef enum {
50   DRM_none,
51   // software draw modes
52   DRM_8pal, DRM_15, DRM_16, DRM_24, DRM_32,
53   // internal signaling, command line support
54   DRM_explicit_bpp,
55   DRM_native,
56   // hardware draw modes, DRM_opengl is boundary test
57   DRM_opengl,
58   DRM_minigl,
59   DRM_glide,
60   DRM_d3d,
61   DRM_END
62 } vid_drawmode_e;
63 
64 typedef enum {
65     render_init   = 0,
66     render_soft   = 1,
67     render_opengl = 2, //Hurdler: the same for render_minigl
68     render_d3d    = 3,
69     render_glide  = 4,
70     render_none   = 5  // for dedicated server
71 } rendermode_e;
72 
73 extern rendermode_e    rendermode;
74 
75 // Structure for passing modenums with the necessary context
76 typedef enum {
77     MODE_NOP,
78     MODE_window,
79     MODE_fullscreen,
80     MODE_voodoo,
81     MODE_either,  // window or fullscreen
82     MODE_other
83 } modetype_e;
84 
85 extern const char * modetype_string[ MODE_other + 1 ];
86 
87 typedef struct {
88     byte  modetype;  // from modetype_e
89     byte  index;
90 } modenum_t;
91 
92 typedef struct {
93     int   width, height;
94     const char *  mark;  // const string, only NULL when invalid mode
95     byte  type;  // modetype_e, MODE_NOP when not found
96 } modestat_t;
97 
98 
99 extern byte  allow_fullscreen;  // controlled by i_video
100 // can window before going to cv_fullscreen
101 extern byte  mode_fullscreen;   // modetype_e
102 
103 // Request to video drivers.
104 extern byte req_drawmode;  // vid_drawmode_e
105 extern byte req_bitpp;
106 // Parameter to V_switch_drawmode
107 extern byte req_alt_bitpp;
108 extern byte req_command_video_settings;
109 extern uint16_t req_width, req_height;
110 // From video drivers.
111 extern byte native_drawmode;  // vid_drawmode_e
112 extern byte native_bitpp;
113 extern byte native_bytepp;
114 
115 // added for OpenGL gamma correction
116 extern consvar_t cv_grgammared;
117 extern consvar_t cv_grgammagreen;
118 extern consvar_t cv_grgammablue;
119 
120 // wait for page flipping to end or not
121 extern consvar_t cv_vidwait;
122 
123 extern consvar_t cv_fullscreen; // for fullscreen support
124 
125 // Return true if engine can draw using the bitpp
126 boolean V_CanDraw( byte bitpp );
127 
128 // ---------------------------------------------
129 
130 // Setup HWR calls according to rendermode.
131 int  I_Rendermode_setup( void );
132 
133 // Initial windowed graphics
134 void I_StartupGraphics (void);
135 // Full game playing graphics, with hardware drawing, and options
136 // Returns FAIL_select, FAIL_end, FAIL_create, of status_return_e, 1 on success;
137 int I_RequestFullGraphics( byte select_fullscreen );
138 // Restore original video mode.
139 void I_ShutdownGraphics(void);
140 
141 // Takes full 8 bit values.
142 void I_SetPalette (RGBA_t* palette);
143 
144 #ifdef MACOS_DI
145 // in macos directory
146 void macConfigureInput(void);
147 
148 void VID_Pause(int pause);
149 #endif
150 
151 typedef struct {
152    uint16_t  first;
153    uint16_t  last;
154 } range_t;
155 
156 // modetype is of modetype_e
157 range_t  VID_ModeRange( byte modetype );
158 char  *  VID_GetModeName(modenum_t modenum);
159 modestat_t  VID_GetMode_Stat(modenum_t modenum);
160 
161 // rmodetype is of modetype_e
162 // Returns MODE_NOP when none found
163 modenum_t  VID_GetModeForSize( int rw, int rh, byte rmodetype );
164 
165 // To check if can draw the video
166 //   request_drawmode : vid_drawmode_e
167 //   request_fullscreen : true if want fullscreen modes
168 //   request_bitpp : bits per pixel
169 // Return true if there are viable modes.
170 boolean  VID_Query_Modelist( byte request_drawmode, byte request_fullscreen, byte request_bitpp );
171 
172 //  By setting setmodeneeded to a value > 0,
173 //  the video mode change is delayed until the start of the next refresh
174 //
175 //  Set the video mode right now.
176 //  Returns FAIL_end, FAIL_create, of status_return_e, 1 on success;
177 int  VID_SetMode( modenum_t modenum );
178 
179 void I_UpdateNoBlit (void);
180 void I_FinishUpdate (void);
181 
182 void I_ReadScreen (byte* scr);
183 
184 #if defined(SMIF_WIN_NATIVE) || defined(SMIF_OS2_NATIVE)
185 // printf to loading screen
186 void I_LoadingScreen ( const char * msg );
187 #endif
188 
189 // debug in color
190 // unused
191 void IO_Color( unsigned char color, unsigned char r, unsigned char g, unsigned char b );
192 
193 #endif
194