Skip to content

First gint app

This tutorial shows the smallest useful gint app for ClassPad.

You will draw some text, update the screen, then keep a loop running until the user exits.

For ClassPad builds, define FXCP before including gint headers:

#define FXCP
#include <gint/display.h>
#include <gint/keycodes.h>
#include <gint/keyboard.h>

display.h gives drawing functions like dclear, dtext, and dupdate. keyboard.h gives keydown() and event helpers.

Every app starts from main():

int main() {
return 1;
}

Returning 1 is the usual gint convention.

Inside main(), clear the screen, draw some text, and update the LCD:

dclear(0x2104);
dtext(1, 1, C_BLACK, "Sample fxSDK add-in.");
dupdate();

dclear() fills the VRAM. dtext() draws text into VRAM. dupdate() sends VRAM to the real screen.

Most gint apps use a loop:

while (true) {
dtext(1, 20, C_WHITE, "LOOP!");
dupdate();
}

This keeps the app alive and lets you react to input.

Before checking keys, clear old events:

clearevents();

Then check for a key:

if (keydown(KEY_EXE)) {
dtext(1, 40, C_WHITE, "EXE!");
}
if (keydown(KEY_EXIT)) {
return 1;
}

On ClassPad, use KEY_EXE for an action and KEY_EXIT to leave.

#define FXCP
#include <gint/display.h>
#include <gint/keycodes.h>
#include <gint/keyboard.h>
int main() {
dclear(0x2104);
dtext(1, 1, C_BLACK, "Sample fxSDK add-in.");
dupdate();
while (true) {
dtext(1, 20, C_WHITE, "LOOP!");
clearevents();
if (keydown(KEY_EXE)) {
dtext(1, 40, C_WHITE, "EXE!");
}
if (keydown(KEY_EXIT)) {
return 1;
}
dupdate();
}
return 1;
}