GBDK 2020 Docs
API Documentation for GBDK 2020
|
#include <types.h>
Go to the source code of this file.
Macros | |
#define | GRAPHICS_WIDTH 160 |
#define | GRAPHICS_HEIGHT 144 |
#define | SOLID 0x00 /* Overwrites the existing pixels */ |
#define | OR 0x01 /* Performs a logical OR */ |
#define | XOR 0x02 /* Performs a logical XOR */ |
#define | AND 0x03 /* Performs a logical AND */ |
#define | WHITE 0 |
#define | LTGREY 1 |
#define | DKGREY 2 |
#define | BLACK 3 |
#define | M_NOFILL 0 |
#define | M_FILL 1 |
#define | SIGNED 1 |
#define | UNSIGNED 0 |
Functions | |
void | gprint (char *str) NONBANKED |
void | gprintln (INT16 number, INT8 radix, INT8 signed_value) |
void | gprintn (INT8 number, INT8 radix, INT8 signed_value) |
INT8 | gprintf (char *fmt,...) NONBANKED |
void | plot (UINT8 x, UINT8 y, UINT8 colour, UINT8 mode) |
void | plot_point (UINT8 x, UINT8 y) |
void | switch_data (UINT8 x, UINT8 y, unsigned char *src, unsigned char *dst) NONBANKED |
void | draw_image (unsigned char *data) NONBANKED |
void | line (UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2) |
void | box (UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2, UINT8 style) |
void | circle (UINT8 x, UINT8 y, UINT8 radius, UINT8 style) |
UINT8 | getpix (UINT8 x, UINT8 y) |
void | wrtchr (char chr) |
void | gotogxy (UINT8 x, UINT8 y) |
void | color (UINT8 forecolor, UINT8 backcolor, UINT8 mode) |
All Points Addressable (APA) mode drawing library.
Drawing routines originally by Pascal Felber Legendary overhall by Jon Fuge jonny Commenting by Michael Hope @q-c ontin uum. demon .co. uk
Note: The standard text printf() and putchar() cannot be used in APA mode - use gprintf() and wrtchr() instead.
Note: Using drawing.h will cause it's custom VBL and LCD ISRs (drawing_vbl
and drawing_lcd
) to be installed.
Important note for the drawing API :
The Game Boy graphics hardware is not well suited to frame-buffer
style graphics such as the kind provided in drawing.h
. Due to that, most drawing functions (rectangles, circles, etc) will be slow . When possible it's much faster and more efficient to work with the tiles and tile maps that the Game Boy hardware is built around.
#define GRAPHICS_WIDTH 160 |
Size of the screen in pixels
#define GRAPHICS_HEIGHT 144 |
#define SOLID 0x00 /* Overwrites the existing pixels */ |
Possible drawing modes
#define OR 0x01 /* Performs a logical OR */ |
#define XOR 0x02 /* Performs a logical XOR */ |
#define AND 0x03 /* Performs a logical AND */ |
#define WHITE 0 |
Possible drawing colours
#define LTGREY 1 |
#define DKGREY 2 |
#define BLACK 3 |
#define M_FILL 1 |
#define SIGNED 1 |
Possible values for signed_value in gprintln() and gprintn()
#define UNSIGNED 0 |
void gprint | ( | char * | str | ) |
Print the string 'str' with no interpretation
Print 16 bit number in radix (base) in the default font at the current text position.
number | number to print |
radix | radix (base) to print with |
signed_value | should be set to SIGNED or UNSIGNED depending on whether the number is signed or not |
The current position is advanced by the numer of characters printed.
Print 8 bit number in radix (base) in the default font at the current text position.
INT8 gprintf | ( | char * | fmt, |
... | |||
) |
Print the string and arguments given by fmt with arguments __...__
fmt | The format string as per printf |
... | params |
Currently supported:
Old style plot - try plot_point()
Exchanges the tile on screen at x,y with the tile pointed by src, original tile is saved in dst. Both src and dst may be NULL - saving or copying to screen is not performed in this case.
void draw_image | ( | unsigned char * | data | ) |
Draw a full screen image at data
Draw a line in the current drawing mode and colour from x1,y1 to x2,y2
Draw a box (rectangle) with corners x1,y1 and x2,y2 using fill mode style (one of NOFILL or FILL)
Draw a circle with centre at x,y and radius using fill mode style (one of NOFILL or FILL)
void wrtchr | ( | char | chr | ) |
Prints the character chr in the default font at the current text position.
The current position is advanced by 1 after the character is printed.
Sets the current text position to x,y.
Note: x and y have units of tiles (8 pixels per unit)