diff options
Diffstat (limited to 'include/framebuffer.h')
-rw-r--r-- | include/framebuffer.h | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/include/framebuffer.h b/include/framebuffer.h index 7b04685..3055e51 100644 --- a/include/framebuffer.h +++ b/include/framebuffer.h @@ -22,17 +22,64 @@ #ifndef DS81_FRAMEBUFFER_H #define DS81_FRAMEBUFFER_H -#define FB_RGB(r,g,b) ((RGB15(r,g,b))|0x8000) - -void FB_Init(uint16 *vram); -void FB_Print(const char *text, int x, int y, int colour, int paper); -void FB_Centre(const char *text, int y, int colour, int paper); -void FB_printf(int x, int y, int colour, int paper, const char *format, ...); -void FB_HLine(int x1, int x2, int y, int colour); -void FB_VLine(int x, int y1, int y2, int colour); -void FB_Box(int x, int y, int w, int h, int colour); -void FB_FillBox(int x, int y, int w, int h, int colour); +/* 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); -void FB_Blit(sImage *img, int x, int y); + +/* 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 */ |