1 /* 2 * gfx.h 3 * AYM 1998-08-01 4 */ 5 6 7 #ifndef YH_GFX /* Prevent multiple inclusion */ 8 #define YH_GFX /* Prevent multiple inclusion */ 9 10 11 /* Width and height of font cell. Those figures are not meant to 12 represent the actual size of the character but rather the step 13 between two characters. For example, for the original 8x8 BGI 14 font, FONTW was 8 and FONTH was 10. DrawScreenText() is supposed 15 to draw characters properly _centered_ within that space, taking 16 into account the optional underscoring. */ 17 extern unsigned FONTW; 18 extern unsigned FONTH; 19 extern int font_xofs; 20 extern int font_yofs; 21 22 23 /* This number is the Y offset to use when underscoring a character. 24 For example, if you want to draw an underscored "A" at (x,y), 25 you should do : 26 DrawScreenString (x, y, "A"); 27 DrawScreenString (x, y + FONTU, "_"); */ 28 #define FONTU 1 29 30 /* Narrow spacing around text. That's the distance in pixels 31 between the characters and the inner edge of the box. */ 32 #define NARROW_HSPACING 4 33 #define NARROW_VSPACING 2 34 35 /* Wide spacing around text. That's the distance in pixels 36 between the characters and the inner edge of the box. */ 37 #define WIDE_HSPACING FONTW 38 #define WIDE_VSPACING (FONTH / 2) 39 40 /* Boxes */ 41 #define BOX_BORDER 2 // Offset between outer and inner edges of a 3D box 42 #define NARROW_BORDER 1 // Same thing for a shallow 3D box 43 #define HOLLOW_BORDER 1 // Same thing for a hollow box 44 #define BOX_VSPACING WIDE_VSPACING // Vertical space between two hollow boxes 45 46 /* Parameters set by command line args and configuration file */ 47 extern const char *BGIDriver; // BGI: default extended BGI driver 48 extern bool CirrusCursor; // use HW cursor on Cirrus Logic VGA cards 49 extern bool FakeCursor; // use a "fake" mouse cursor 50 extern const char *font_name; // X: the name of the font to load 51 // (if NULL, use the default) 52 extern Win_dim initial_window_width;// X: the name says it all 53 extern Win_dim initial_window_height;// X: the name says it all 54 extern int no_pixmap; // X: use no pixmap -- direct window output 55 extern int VideoMode; // BGI: default video mode for VESA cards 56 57 /* Global variables */ 58 extern int GfxMode; // current graphics mode, or 0 for text 59 extern int OrigX; // Map X-coord of centre of screen/window 60 extern int OrigY; // Map Y-coord of centre of screen/window 61 extern int ScrCenterX; // Display X-coord of center of screen/window 62 extern int ScrCenterY; // Display Y-coord of center of screen/window 63 #ifdef Y_X11 64 typedef unsigned long xpv_t; // The type of a pixel value in X's opinion 65 #ifdef X_PROTOCOL 66 extern Display *dpy; 67 extern int scn; 68 extern Colormap cmap; // The X colormap 69 extern Window win; 70 extern Drawable drw; 71 extern GC gc; 72 extern Visual *win_vis; // The visual for win 73 extern int win_depth; // The depth of win in bits 74 extern int win_bpp; // The depth of win in bytes 75 extern int x_server_big_endian; // Is the X server big-endian ? 76 extern int ximage_bpp; // Number of bytes per pixels in XImages 77 extern int ximage_quantum; // Pad XImage lines to a mult of that many B. 78 #endif // ifdef X_PROTOCOL 79 #endif // ifdef Y_X11 80 extern int text_dot; // DrawScreenText()/DrawScreenString() debug flag 81 82 /* gfx.cc */ 83 int InitGfx (void); 84 void SwitchToVGA256 (void); 85 void SwitchToVGA16 (void); 86 void TermGfx (void); 87 void SetWindowSize (int width, int height); 88 void ClearScreen (void); 89 void update_display (); 90 void force_window_not_pixmap (); 91 void SetLineThickness (int thick); 92 void SetDrawingMode (int _xor); 93 void DrawMapCircle (int, int, int); 94 void DrawMapLine (int mapx1, int mapy1, int mapx2, int mapy2); 95 void DrawMapVector (int, int, int, int); 96 void DrawMapArrow (int, int, unsigned); 97 void DrawScreenLine (int, int, int, int); 98 void DrawScreenRect (int x, int y, int width, int height); 99 void DrawScreenBox (int, int, int, int); 100 void DrawScreenBoxwh (int scrx0, int scry0, int width, int height); 101 void DrawScreenBox3D (int, int, int, int); 102 void DrawScreenBox3DShallow (int, int, int, int); 103 void DrawScreenBoxHollow (int x0, int y0, int x1, int y1, acolour_t colour); 104 void draw_box_border (int x, int y, int width, int height, 105 int thickness, int raised); 106 void DrawScreenText (int, int, const char *, ...); 107 void DrawScreenString (int, int, const char *); 108 void DrawScreenChar (int x, int y, char c); 109 void DrawPointer (bool); 110 void DrawScreenMeter (int, int, int, int, float); 111 void DrawScreenLineLen (int x, int y, int width, int height); 112 int TranslateToDoomColor (int); 113 #if defined Y_BGI && defined CIRRUS_PATCH 114 void SetHWCursorPos (unsigned, unsigned); 115 void SetHWCursorCol (long, long); 116 void SetHWCursorMap (char *); 117 #endif /* Y_BGI && CIRRUS_PATCH */ 118 #ifdef PCOLOUR_NONE 119 void set_pcolour (pcolour_t colour); 120 #endif 121 acolour_t get_colour (); 122 void set_colour (acolour_t); 123 void push_colour (acolour_t colour); 124 void pop_colour (void); 125 void draw_point (int x, int y); 126 void draw_map_point (int mapx, int mapy); 127 128 129 #endif /* DO NOT ADD ANYTHING AFTER THIS LINE */ 130