Created
July 12, 2018 19:54
-
-
Save omgmog/8e4d78090dc967c00cc49686cf424825 to your computer and use it in GitHub Desktop.
Hello World example for Pocket Sprite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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