summaryrefslogtreecommitdiff
path: root/ROMs/typewriter.c
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 22:30:02 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 22:30:02 +1000
commit5d012f16b2a0200087afe9dffc906046d258b3b8 (patch)
treead7a8cee368d1b83e08df13243678a34d34c6aae /ROMs/typewriter.c
parent76cea79a46d42f8f59503d3bb421f0d298da66cb (diff)
seperated modules out
Diffstat (limited to 'ROMs/typewriter.c')
-rw-r--r--ROMs/typewriter.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/ROMs/typewriter.c b/ROMs/typewriter.c
index a63a77d..278e048 100644
--- a/ROMs/typewriter.c
+++ b/ROMs/typewriter.c
@@ -1,5 +1,7 @@
#load "font.bin"
-#include "lib.c"
+#include "std.c"
+#include "screen.c"
+#include "hid.c"
int drawChar(int ch, int x, int y, int color)
{
@@ -14,8 +16,8 @@ int drawChar(int ch, int x, int y, int color)
for (int xOff = 0; xOff < 8; xOff++)
{
int bit = (row >> (7 - xOff)) & 1;
- int pix = bit ? 8 : color;
- setPixel(x + xOff, y + yOff, pix);
+ int pix = bit ? COLOR_BLACK : color;
+ screen_setPixel(x + xOff, y + yOff, pix);
}
}
}
@@ -45,20 +47,20 @@ int main()
{
x = 0;
y = 0;
- clear(8);
+ screen_clear(COLOR_BLACK);
}
- int sk = readKey();
- while (getKeyState(sk)) { }
+ int sk = hid_waitForPressedKey();
+ while (hid_getKeyState(sk)) { }
- if (sk == SK_NL)
+ if (sk == SK_NEWLINE)
{
y += 8;
x = 0;
continue;
}
- if (sk == SK_BS)
+ if (sk == SK_BACKSPACE)
{
x -= 8;
if (x < 0)
@@ -66,8 +68,11 @@ int main()
drawChar(' ', x, y, 1);
continue;
}
+
+ if (hid_getKeyState(SK_SHIFT))
+ sk += ('a' - 'A');
- drawChar(sk, x, y, 1);
+ drawChar(sk, x, y, COLOR_RED);
x += 8;
}
} \ No newline at end of file