XenevaOS
Loading...
Searching...
No Matches
i_video.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// System specific interface stuff.
17//
18
19
20#ifndef __I_VIDEO__
21#define __I_VIDEO__
22
23#include "doomtype.h"
24
25// Screen width and height.
26
27#define SCREENWIDTH 320
28#define SCREENHEIGHT 200
29
30// Screen width used for "squash" scale functions
31
32#define SCREENWIDTH_4_3 256
33
34// Screen height used for "stretch" scale functions.
35
36#define SCREENHEIGHT_4_3 240
37
38#define MAX_MOUSE_BUTTONS 8
39
40typedef struct
41{
42 // Screen width and height
43
44 int width;
45 int height;
46
47 // Initialisation function to call when using this mode.
48 // Called with a pointer to the Doom palette.
49 //
50 // If NULL, no init function is called.
51
52 void (*InitMode)(byte *palette);
53
54 // Function to call to draw the screen from the source buffer.
55 // Return true if draw was successful.
56
57 boolean (*DrawScreen)(int x1, int y1, int x2, int y2);
58
59 // If true, this is a "poor quality" mode. The autoadjust
60 // code should always attempt to use a different mode to this
61 // mode in fullscreen.
62 //
63 // Some notes about what "poor quality" means in this context:
64 //
65 // The aspect ratio correction works by scaling up to the larger
66 // screen size and then drawing pixels on the edges between the
67 // "virtual" pixels so that an authentic blocky look-and-feel is
68 // achieved.
69 //
70 // For a mode like 640x480, you can imagine the grid of the
71 // "original" pixels spaced out, with extra "blurry" pixels added
72 // in the space between them to fill it out. However, when you're
73 // running at a resolution like 320x240, this is not the case. In
74 // the small screen case, every single pixel has to be a blurry
75 // interpolation of two pixels from the original image.
76 //
77 // If you run in 320x240 and put your face up close to the screen
78 // you can see this: it's particularly visible in the small yellow
79 // status bar numbers for example. Overall it still looks "okay"
80 // but there's an obvious - albeit small - deterioration in
81 // quality.
82 //
83 // Once you get to 640x480, all the original pixels are there at
84 // least once and it's okay (the higher the resolution, the more
85 // accurate it is). When I first wrote the code I was expecting
86 // that even higher resolutions would be needed before it would
87 // look acceptable, but it turned out to be okay even at 640x480.
88
89 boolean poor_quality;
91
93
94// Called by D_DoomMain,
95// determines the hardware configuration
96// and sets up the video mode
97void I_InitGraphics (void);
98
100
101void I_ShutdownGraphics(void);
102
103// Takes full 8 bit values.
104void I_SetPalette (byte* palette);
105int I_GetPaletteIndex(int r, int g, int b);
106
107void I_UpdateNoBlit (void);
108void I_FinishUpdate (void);
109
110void I_ReadScreen (byte* scr);
111
112void I_BeginRead (void);
113
114void I_SetWindowTitle(char *title);
115
116void I_CheckIsScreensaver(void);
118
119void I_DisplayFPSDots(boolean dots_on);
120void I_BindVideoVariables(void);
121
124
125// Called before processing any tics in a frame (just after displaying a frame).
126// Time consuming syncronous operations are performed here (joystick reading).
127
128void I_StartFrame (void);
129
130// Called before processing each tic in a frame.
131// Quick syncronous operations are performed here.
132
133void I_StartTic (void);
134
135// Enable the loading disk image displayed when reading from disk.
136
137void I_EnableLoadingDisk(void);
138
139void I_EndRead (void);
140
147
148
149extern char *video_driver;
150extern boolean screenvisible;
151
152extern float mouse_acceleration;
153extern int mouse_threshold;
154extern int vanilla_keyboard_mapping;
155extern boolean screensaver_mode;
156extern int usegamma;
157extern byte *I_VideoBuffer;
158
159extern int screen_width;
160extern int screen_height;
161extern int screen_bpp;
162extern int fullscreen;
163extern int aspect_ratio_correct;
164
165extern int show_diskicon;
166extern int diskicon_readbytes;
167
168#ifdef CMAP256
169
170extern boolean palette_changed;
171extern struct color colors[256];
172
173#endif // CMAP256
174
175#endif
size_t b
Definition main.cpp:156
unsigned int uint32_t
Definition acefiex.h:163
char title[128]
Definition d_main.c:877
boolean
Definition doomtype.h:74
boolean screensaver_mode
Definition i_video.c:101
char * video_driver
void I_BindVideoVariables(void)
Definition i_video.c:492
void I_BeginRead(void)
Definition i_video.c:467
void I_SetWindowTitle(char *title)
Definition i_video.c:475
int usegamma
Definition i_video.c:122
void I_StartTic(void)
Definition i_video.c:313
int screen_height
void I_FinishUpdate(void)
Definition i_video.c:326
void I_UpdateNoBlit(void)
Definition i_video.c:318
void I_EndRead(void)
Definition i_video.c:471
int show_diskicon
int aspect_ratio_correct
int vanilla_keyboard_mapping
Definition i_input.c:44
int screen_bpp
void I_EnableLoadingDisk(void)
Definition i_video.c:488
void I_InitWindowIcon(void)
void I_CheckIsScreensaver(void)
Definition i_video.c:500
int I_GetPaletteIndex(int r, int g, int b)
Definition i_video.c:431
byte * I_VideoBuffer
Definition i_video.c:97
int diskicon_readbytes
int mouse_threshold
Definition i_video.c:118
void I_InitGraphics(void)
Definition i_video.c:209
void I_GraphicsCheckCommandLine(void)
Definition i_video.c:480
boolean screenvisible
Definition i_video.c:106
int screen_width
void I_SetPalette(byte *palette)
Definition i_video.c:395
void I_ReadScreen(byte *scr)
Definition i_video.c:382
int fullscreen
boolean(* grabmouse_callback_t)(void)
Definition i_video.h:92
void I_InitWindowTitle(void)
float mouse_acceleration
Definition i_video.c:117
void I_SetGrabMouseCallback(grabmouse_callback_t func)
Definition i_video.c:484
void I_StartFrame(void)
Definition i_video.c:308
void I_ShutdownGraphics(void)
Definition i_video.c:303
void I_DisplayFPSDots(boolean dots_on)
Definition i_video.c:496
Definition i_video.h:141
uint32_t g
Definition i_video.h:143
uint32_t b
Definition i_video.h:142
uint32_t r
Definition i_video.h:144
uint32_t a
Definition i_video.h:145
Definition i_video.h:41
int height
Definition i_video.h:45
boolean poor_quality
Definition i_video.h:89
int width
Definition i_video.h:44