summaryrefslogtreecommitdiff
path: root/include/framebuffer.h
blob: 3055e516e5581b6e2269bb12d16efcbfddeb0946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
   ds81 - Nintendo DS ZX81 emulator.

   Copyright (C) 2006  Ian Cowburn <ianc@noddybox.co.uk>
   
   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 the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  
   $Id$
*/
#ifndef DS81_FRAMEBUFFER_H
#define DS81_FRAMEBUFFER_H

/* Predefined colours.
*/
typedef enum 
{
    COL_TRANSPARENT	= -1,
    COL_BLACK		= 0,
    COL_WHITE		= 240,
    COL_RED		= 241,
    COL_GREEN		= 242,
    COL_BLUE		= 243,
    COL_GUISELECT	= 244,
    COL_GREY		= 245,
    COL_LIGHTGREY	= 246,
    COL_DARKGREY	= 247,
    COL_YELLOW		= 248
} FB_Colour;


/* Initialise 'framebuffer' code.  vram is where the 8-bit framebuffer is.
   palette is the palette to use/set.
*/
void	FB_Init(uint16 *vram, uint16 *palette);

/* Load the internal framebuffer font as a set of ASCII tiles (starting with
   space) at tiles.  The tiles will use colour COL_WHITE.
*/
void	FB_LoadASCIITiles(uint16 *tiles);

/* Print the text into the framebuffer. 
*/
void	FB_Print(const char *text, int x, int y,
		 FB_Colour colour, FB_Colour paper);
void	FB_Centre(const char *text, int y, 
		  FB_Colour colour, FB_Colour paper);
void	FB_printf(int x, int y, FB_Colour colour, FB_Colour paper,
		  const char *format, ...);

/* Lines and boxes.
*/
void	FB_HLine(int x1, int x2, int y, FB_Colour colour);
void	FB_VLine(int x, int y1, int y2, FB_Colour colour);
void	FB_Box(int x, int y, int w, int h, FB_Colour colour);
void	FB_FillBox(int x, int y, int w, int h, FB_Colour colour);

/* Clear to background
*/
void	FB_Clear(void);

/* Draw the image.  The image must be an 8-bit image, but with only the first
   16 palette entries used.  Just to complicate matters!

   The image is assumed to be an even number of pixels wide.  Also the passed
   X co-ord will be forced even.

   offset is used to give an offset into the palette to place colours from the
   image.  Palette entries 1 - 128 will always be safe to use (these routines
   will never use them).
*/
void	FB_Blit(sImage *img, int x, int y, int offset);

#endif	/* DS81_FRAMEBUFFER_H */