vid.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // vid.h -- video driver defs
  16. #define VID_CBITS 6
  17. #define VID_GRADES (1 << VID_CBITS)
  18. // a pixel can be one, two, or four bytes
  19. typedef byte pixel_t;
  20. typedef struct vrect_s
  21. {
  22. int x,y,width,height;
  23. struct vrect_s *pnext;
  24. } vrect_t;
  25. typedef struct
  26. {
  27. pixel_t *buffer; // invisible buffer
  28. pixel_t *colormap; // 256 * VID_GRADES size
  29. unsigned short *colormap16; // 256 * VID_GRADES size
  30. int fullbright; // index of first fullbright color
  31. unsigned rowbytes; // may be > width if displayed in a window
  32. unsigned width;
  33. unsigned height;
  34. float aspect; // width / height -- < 0 is taller than wide
  35. int numpages;
  36. int recalc_refdef; // if true, recalc vid-based stuff
  37. pixel_t *conbuffer;
  38. int conrowbytes;
  39. unsigned conwidth;
  40. unsigned conheight;
  41. int maxwarpwidth;
  42. int maxwarpheight;
  43. pixel_t *direct; // direct drawing to framebuffer, if not
  44. // NULL
  45. } viddef_t;
  46. extern viddef_t vid; // global video state
  47. extern unsigned short d_8to16table[256];
  48. extern unsigned d_8to24table[256];
  49. extern void (*vid_menudrawfn)(void);
  50. extern void (*vid_menukeyfn)(int key);
  51. void VID_SetPalette (unsigned char *palette);
  52. // called at startup and after any gamma correction
  53. void VID_ShiftPalette (unsigned char *palette);
  54. // called for bonus and pain flashes, and for underwater color changes
  55. void VID_Init (unsigned char *palette);
  56. // Called at startup to set up translation tables, takes 256 8 bit RGB values
  57. // the palette data will go away after the call, so it must be copied off if
  58. // the video driver will need it again
  59. void VID_Shutdown (void);
  60. // Called at shutdown
  61. void VID_Update (vrect_t *rects);
  62. // flushes the given rectangles from the view buffer to the screen
  63. int VID_SetMode (int modenum, unsigned char *palette);
  64. // sets the mode; only used by the Quake engine for resetting to mode 0 (the
  65. // base mode) on memory allocation failures
  66. void VID_HandlePause (qboolean pause);
  67. // called only on Win32, when pause happens, so the mouse can be released
  68. void VID_LockBuffer (void);
  69. void VID_UnlockBuffer (void);
  70. #ifdef GLQUAKE
  71. qboolean VID_Is8bit(void);
  72. #endif