Skip to content

Instantly share code, notes, and snippets.

@omgmog
Created July 12, 2018 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omgmog/8e4d78090dc967c00cc49686cf424825 to your computer and use it in GitHub Desktop.
Save omgmog/8e4d78090dc967c00cc49686cf424825 to your computer and use it in GitHub Desktop.
Hello World example for Pocket Sprite
#include "ugui.h"
#include "8bkc-hal.h"
#include "8bkc-ugui.h"
// used later in example
float health = 100;
void app_main() {
kchal_init();
kcugui_init();
while(1) {
kcugui_cls();
// configure the font and color
UG_FontSelect(&FONT_6X8);
UG_SetForecolor(C_WHITE);
// write "Hello world" to top/left corner of screen
UG_PutString(0, 0, "Hello world");
// Write a variable to the screen
char str[32];
health -= 0.00025;
sprintf(str, "HP: %.2f%%", health);
UG_PutString(0, 20, str);
kcugui_flush();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment