GBDK libraries

From GbdevWiki
Revision as of 08:00, 3 June 2016 by Caseyweederman (Talk | contribs) (Initializing a library exploration page)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Game Boy Development Kit comes bundled with a set of libraries targeting the Game Boy Z80 microprocessor and the Game Boy's unique hardware, as well as some modified C libraries.

The libraries most immediately useful to the game developer are found in gbdk/include/gb.

How do I use these? At the top of your script, type #include <libraryname.h> to be able to call any of the included functions.


/include

Broader C header files exist in the root of include.

ctype.h contains functions to check characters and swap them between upper and lower case.

gbdk-lib.h includes different libraries based on the implementation of the Small Device C Compiler.

rand.h contains randomization functions.

stdarg.h

stdio.h contains basic input and output functions, like writing and receiving lines of text.

stdlib.h

string.h contains generic string functions.

time.h contains clock functions.

types.h defines basic types used by various other libraries.


/include/gb

Libraries specific to the Game Boy exist within the gb subdirectory.

cgb.h contains functions specifically targeting the Color Game Boy.

console.h contains functions handling a draw cursor's position and drawing specified letters.

drawing.h contains a set of functions used to draw lines and shapes.

font.h contains functions for changing fonts.

gb.h contains the base definitions and functions, from reading inputs to manipulating sprites.

hardware.h contains definitions for communicating directly with the hardware.

malloc.h contains a simple implementation of the memory allocation function.

sample.h contains a function for playing sound samples.

sgb.h contains a function to check if the rom is running on the Super Game Boy.

/include/asm

<code>/include/consolez80