Module:Gfx
Description: standard mode (text mode) graphics driver
Source: gfx.asm
Wrapper: gfx.c
Wrapper: gfx.h

Description:

The Gfx module (pronounced "graphics"... duh.) is the "standard-mode" driver for the 30x7 LED display. Although arbitrary bitmaps can be uploaded, its focus is more on scrolling text and shifting the display. For more complex graphics stuff, Egfx is the way to go.

Note that before the string commands can be used, a font resource must first be loaded and used. Here is the system font which gives a description on how to create standard-mode fonts.

Commands:

cokerr Gfx_QueryVersion (char* versionstring)
returns the version string.

cokerr Gfx_SetMode (byte setting)
enables standard mode if setting is 1, disables it if setting is 0.

cokerr Gfx_Clear ()
clears the display.

cokerr Gfx_Dump (byte* bitmap)
uploads a bitmap to the display. bitmap is 30 bytes long, with each byte representing a vertical line on the display. The low bit is at the top of the screen; the high bit is ignored.

cokerr Gfx_DumpResource (byte rezId)
copies a bitmap from a resource to the display.

cokerr Gfx_Shift (byte how)
shifts or scrolls the display one pixel. how is one of the following:
SHIFT_ShiftLeft shift left (no wrap-around)
SHIFT_ShiftRight shift right (no wrap-around)
SHIFT_ScrollLeft scroll left (wraps around)
SHIFT_ScrollRight scroll right (wraps around)

cokerr Gfx_ScrollStop ()
stops automatic scrolling.

cokerr Gfx_ScrollSpeed (byte speed)
sets the display to scroll at one pixel each (speed * 8) milliseconds. Takes effect when the next ScrollStart or ScrollString command is called.

cokerr Gfx_ScrollStart (byte how, word duration)
starts automatic scrolling. how is a SHIFT_ constant as described above. The display scrolls for duration pixels, or if duration is zero, scrolls until stopped.

cokerr Gfx_ScrollCstring (char* string)
starts a null-terminated string scrolling to the left across the display, using the current font. The string must be 255 characters or less.

cokerr Gfx_ScrollPstring (char* string)
starts a pascal string scrolling to the left across the display, using the current font. The first byte of the string indicates the length of the text that follows. The string must be 255 characters or less.

cokerr Gfx_ScrollResource (byte rezID)
starts a string stored as a resource scrolling to the left across the display, using the current font. The resource string needs neither a length byte nor a terminator, and can be of any length.

cokerr Gfx_UseFontResource (byte rezID)
sets the current font to the given font resource.
Errors: ERROR_Coke_BadResourceID

cokerr Gfx_SetScrollRange (byte firstcolumn, byte length)
sets the effective screen size for scrolling operations, in order to preserve parts of the screen while scrolling others.