2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
vid.c
|
|
|
|
|
|
|
|
general video driver functions
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/cvar.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#include "vid.h"
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/va.h"
|
|
|
|
#include "QF/qargs.h"
|
|
|
|
#include "QF/sys.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
extern viddef_t vid; // global video state
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
int scr_width, scr_height;
|
|
|
|
cvar_t *vid_width;
|
|
|
|
cvar_t *vid_height;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
VID_GetWindowSize (int def_w, int def_h)
|
|
|
|
{
|
2001-02-26 06:48:02 +00:00
|
|
|
int pnum;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
vid_width =
|
2001-03-31 01:02:52 +00:00
|
|
|
Cvar_Get ("vid_width", va ("%d", def_w), CVAR_ROM, 0, "screen width");
|
2001-02-26 06:48:02 +00:00
|
|
|
vid_height =
|
2001-03-31 01:02:52 +00:00
|
|
|
Cvar_Get ("vid_height", va ("%d", def_h), CVAR_ROM, 0, "screen height");
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if ((pnum = COM_CheckParm ("-width"))) {
|
|
|
|
if (pnum >= com_argc - 1)
|
|
|
|
Sys_Error ("VID: -width <width>\n");
|
|
|
|
Cvar_SetROM (vid_width, com_argv[pnum + 1]);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!vid_width->int_val)
|
2001-02-26 06:48:02 +00:00
|
|
|
Sys_Error ("VID: Bad window width\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if ((pnum = COM_CheckParm ("-height"))) {
|
|
|
|
if (pnum >= com_argc - 1)
|
|
|
|
Sys_Error ("VID: -height <height>\n");
|
|
|
|
Cvar_SetROM (vid_height, com_argv[pnum + 1]);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!vid_height->int_val)
|
2001-02-26 06:48:02 +00:00
|
|
|
Sys_Error ("VID: Bad window height\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-02-26 06:48:02 +00:00
|
|
|
if ((pnum = COM_CheckParm ("-winsize"))) {
|
|
|
|
if (pnum >= com_argc - 2)
|
|
|
|
Sys_Error ("VID: -winsize <width> <height>\n");
|
|
|
|
Cvar_SetROM (vid_width, com_argv[pnum + 1]);
|
|
|
|
Cvar_SetROM (vid_height, com_argv[pnum + 2]);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!vid_width->int_val || !vid_height->int_val)
|
2001-02-26 06:48:02 +00:00
|
|
|
Sys_Error ("VID: Bad window width/height\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
scr_width = vid.width = vid_width->int_val;
|
|
|
|
scr_height = vid.height = vid_height->int_val;
|
|
|
|
}
|