1 /*
2  * Schism Tracker - a cross-platform Impulse Tracker clone
3  * copyright (c) 2003-2005 Storlek <storlek@rigelseven.com>
4  * copyright (c) 2005-2008 Mrs. Brisby <mrs.brisby@nimh.org>
5  * copyright (c) 2009 Storlek & Mrs. Brisby
6  * copyright (c) 2010-2012 Storlek
7  * URL: http://schismtracker.org/
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 
24 #ifndef DRAW_CHAR_H
25 #define DRAW_CHAR_H
26 
27 #include <stdint.h>
28 
29 /* --------------------------------------------------------------------- */
30 
31 void draw_char(unsigned char c, int x, int y, uint32_t fg, uint32_t bg);
32 void draw_char_bios(unsigned char c, int x, int y, uint32_t fg, uint32_t bg);
33 
34 /* return value is the number of characters drawn */
35 int draw_text(const char * text, int x, int y, uint32_t fg, uint32_t bg);
36 int draw_text_bios(const char * text, int x, int y, uint32_t fg, uint32_t bg);
37 
38 /* return value is the length of text drawn
39  * (so len - return is the number of spaces) */
40 int draw_text_len(const char * text, int len, int x, int y, uint32_t fg, uint32_t bg);
41 int draw_text_bios_len(const char * text, int len, int x, int y, uint32_t fg, uint32_t bg);
42 
43 void draw_fill_chars(int xs, int ys, int xe, int ye, uint32_t color);
44 
45 void draw_half_width_chars(uint8_t c1, uint8_t c2, int x, int y,
46 			   uint32_t fg1, uint32_t bg1, uint32_t fg2, uint32_t bg2);
47 
48 /* --------------------------------------------------------------------- */
49 /* boxes */
50 
51 /* don't use these directly */
52 void draw_thin_inner_box(int xs, int ys, int xe, int ye, uint32_t tl, uint32_t br);
53 void draw_thick_inner_box(int xs, int ys, int xe, int ye, uint32_t tl, uint32_t br);
54 void draw_thin_outer_box(int xs, int ys, int xe, int ye, uint32_t c);
55 void draw_thick_outer_box(int xs, int ys, int xe, int ye, uint32_t c);
56 void draw_thin_outer_cornered_box(int xs, int ys, int xe, int ye, int shade_mask);
57 
58 /* the type is comprised of one value from each of these enums.
59  * the "default" box type is thin, inner, and with outset shading. */
60 
61 /* for outer boxes, outset/inset work like light/dark respectively
62  * (because using two different colors for an outer box results in some
63  * ugliness at the corners) */
64 enum {
65 	BOX_OUTSET = (0),
66 	BOX_INSET = (1),
67 	BOX_FLAT_LIGHT = (2),
68 	BOX_FLAT_DARK = (3),
69 };
70 #define BOX_SHADE_MASK 3
71 
72 enum {
73 	BOX_INNER = (0 << 2),   /* 00 00 */
74 	BOX_OUTER = (1 << 2),   /* 01 00 */
75 	BOX_CORNER = (2 << 2),  /* 10 00 */
76 };
77 #define BOX_TYPE_MASK 12
78 
79 /* the thickness is ignored for corner boxes, which are always thin */
80 enum {
81 	BOX_THIN = (0 << 4),    /* 0 00 00 */
82 	BOX_THICK = (1 << 4),   /* 1 00 00 */
83 };
84 #define BOX_THICKNESS_MASK 16
85 
86 void draw_box(int xs, int ys, int xe, int ye, int flags);
87 /* .... */
88 void toggle_display_fullscreen(void); /* FIXME why on earth is this in this header? */
89 
90 #endif /* ! DRAW_CHAR_H */
91 
92