From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../CEdev/examples/hello_world/src/main.c | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/hello_world/src/main.c (limited to 'frontends/calculator/CEdev/examples/hello_world/src') diff --git a/frontends/calculator/CEdev/examples/hello_world/src/main.c b/frontends/calculator/CEdev/examples/hello_world/src/main.c new file mode 100644 index 0000000..333dcdc --- /dev/null +++ b/frontends/calculator/CEdev/examples/hello_world/src/main.c @@ -0,0 +1,48 @@ +/* Keep these headers */ +#include +#include +#include +#include + +/* Standard headers */ +#include +#include +#include +#include + +/* Put function prototypes here */ +void printText(const char *text, uint8_t x, uint8_t y); +void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos); + +/* Put all your code here */ +void main(void) { + /* uint8_t is an unsigned integer that can range from 0-255. */ + /* It performs faster than just an int, so try to use it (or int8_t) when possible */ + uint8_t count; + + /* Initialize some strings */ + const char *HelloWorld = "Hello World!"; + const char *Welcome = "Welcome to C!"; + + /* Clear the homescreen */ + os_ClrHome(); + + /* Print a few strings */ + printText(HelloWorld, 0, 0); + printText(Welcome, 0, 1); + + /* Wait for a key press */ + while (!os_GetCSC()); +} + +/* Draw text on the homescreen at the given X/Y location */ +void printText(const char *text, uint8_t xpos, uint8_t ypos) { + os_SetCursorPos(ypos, xpos); + os_PutStrFull(text); +} + +/* Draw small text at the given X/Y location */ +void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos) { + os_FontSelect(0); // sets small font (1 == big, see docs) + os_FontDrawText(text, xpos, ypos); +} -- cgit v1.2.3-101-g0448