Hardware Reference
In-Depth Information
To make the Gameduino library compatible, the include "Wprogram.h" in the beginning of GD.cpp needs to be
changed to include Arduino.h ; this can be done in any text editor.
The following list is a reference of the most common functions that will be used from the Gameduino's library.
All of the functions can be called with a preceding GD. before the function call.
begin() : Starts a connection to the Gameduino; returns true if successful.
rd(address) : Returns a byte read from the Gameduino's memory located at address .
wr(address, data) : Writes a byte of data to the Gameduino's memory at specified address .
rd16(address) : Same as rd() , but reads 16 bits from memory, instead of 8 bits, at address
and address +1.
wr16(address, data) : Writes 16 bits to memory.
fill(address, data, amount) : Copies 1 byte to consecutive memory addresses
up to amount .
copy(address, data pointer, amount) : Copies data from the Arduino's memory
to a Gameduino address.
setpal(palett e , RGB) : Sets the character color palette.
RGB(R, G, B) : Converts RGB byte values to 15-bit encoding for the Gameduino.
sprite(sprite #, position x, position y, image #, palette, rotation, collision) :
Tells the Gameduino to draw a sprite to the display. Table 11-1 describes the parameters for
drawing sprites to the display.
Table 11-1. Arguments for the sprite() Function
Parameter
Description
sprite #
Onscreen sprite number that addresses the individual
sprite value between 0 and 255
position x
Horizontal sprite position value between 0 and 511; 0 is
the left edge of screen
position y
Vertical sprite position on the screen value between 0
and 511; 0 is the top edge of screen
image #
Selects a background sprite to display from The
Gameduino's RAM value between 0 and 63
palette
Color palette to use when rendering the sprite value
between 0 and15
rotation
Sets the rotation and flip of the sprite
collision
Sets the collision detect flag
 
 
Search WWH ::




Custom Search