foxygit / doom Log in
commits tags

/src/i_video.h · 3.85 KB

raw
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//	System specific interface stuff.
//


#ifndef __I_VIDEO__
#define __I_VIDEO__

#include "doomtype.h"

// Screen width and height.
//
// Raised 2x from vanilla's 320x200 so splitscreen tiles (which each get
// only a fraction of this budget - see R_RenderSplitViews) have more
// actual pixels before being upscaled to fill their tile. The 3D
// renderer and i_video.c's window upscaling are already parameterized
// on these constants and adapt automatically; various absolute-pixel UI
// screens (menu, intermission, status bar) are NOT yet aspect/scale-
// aware and will look small/offset until updated - see doomstat.h's
// splitscreen for where this most matters (the classic status bar is
// already skipped there).

#define SCREENWIDTH  640
#define SCREENHEIGHT 400

// The resolution weapon-sprite (psprite) graphics were authored for, and
// which a handful of scale/reference calculations (pspritescale,
// BASEYCENTER, the light falloff table) still assume - independent of
// SCREENWIDTH/SCREENHEIGHT above. These used to always be the same
// number (320x200 was vanilla's only resolution), so nothing needed to
// distinguish "the internal framebuffer size" from "the size those
// formulas were calibrated for" until SCREENWIDTH/SCREENHEIGHT was
// raised for splitscreen. See R_SetupViewSizeTables and R_DrawPSprite.
#define ORIGWIDTH  320
#define ORIGHEIGHT 200

// Screen height used when aspect_ratio_correct=true.

#define SCREENHEIGHT_4_3 480

typedef boolean (*grabmouse_callback_t)(void);

// Called by D_DoomMain,
// determines the hardware configuration
// and sets up the video mode
void I_InitGraphics (void);

void I_GraphicsCheckCommandLine(void);

void I_ShutdownGraphics(void);

// Takes full 8 bit values.
void I_SetPalette (byte* palette);
int I_GetPaletteIndex(int r, int g, int b);

void I_UpdateNoBlit (void);
void I_FinishUpdate (void);

void I_ReadScreen (pixel_t* scr);

void I_BeginRead (void);

void I_SetWindowTitle(const char *title);

void I_CheckIsScreensaver(void);
void I_SetGrabMouseCallback(grabmouse_callback_t func);

void I_DisplayFPSDots(boolean dots_on);
void I_BindVideoVariables(void);

void I_InitWindowTitle(void);
void I_RegisterWindowIcon(const unsigned int *icon, int width, int height);
void I_InitWindowIcon(void);

// Called before processing any tics in a frame (just after displaying a frame).
// Time consuming syncronous operations are performed here (joystick reading).

void I_StartFrame (void);

// Called before processing each tic in a frame.
// Quick syncronous operations are performed here.

void I_StartTic (void);

// Enable the loading disk image displayed when reading from disk.

void I_EnableLoadingDisk(int xoffs, int yoffs);

extern char *video_driver;
extern boolean screenvisible;

extern int vanilla_keyboard_mapping;
extern boolean screensaver_mode;
extern int usegamma;
extern pixel_t *I_VideoBuffer;

extern int screen_width;
extern int screen_height;
extern int fullscreen;
extern int aspect_ratio_correct;
extern int integer_scaling;
extern int smooth_pixel_scaling;
extern int vga_porch_flash;
extern int force_software_renderer;

extern int png_screenshots;

extern char *window_position;
void I_GetWindowPosition(int *x, int *y, int w, int h);

// Joystic/gamepad hysteresis
extern unsigned int joywait;

extern int usemouse;


#endif