For the complete documentation index, see llms.txt. This page is also available as Markdown.

OLED drawing and text

The Zen OLED is 128 x 64 monochrome pixels. Use cls_oled, pixel_oled, line_oled, rect_oled, and circle_oled for shapes; putc_oled plus puts_oled for buffered characters; print for const strings; and image_oled for packed monochrome images.

oled-dirty-redraw.gpc
const string READY_TEXT = "READY";

int oled_dirty = TRUE;

main {
    if(event_press(PS5_TRIANGLE)) oled_dirty = TRUE;

    if(oled_dirty) {
        cls_oled(OLED_BLACK);
        rect_oled(4, 4, 120, 56, FALSE, OLED_WHITE);
        print(36, 23, OLED_FONT_MEDIUM, OLED_WHITE, addr(READY_TEXT));
        oled_dirty = FALSE;
    }
}

Coordinates are X 0..127 and Y 0..63. Redraw only when a dirty flag is set; a full redraw every VM cycle can make input handling unresponsive. The additional built-in reference documents every OLED call, and the data chapter explains strings and image records.

Last updated