From 528261395b31292400f55de73da502297fd5a692 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Sat, 4 Dec 2021 14:52:15 +0100 Subject: [PATCH] Working on console interaction... --- ascii.cpp | 14 ++++++++++++++ ascii.h | 2 ++ main.cpp | 9 +++++++++ 3 files changed, 25 insertions(+) diff --git a/ascii.cpp b/ascii.cpp index 54c8348..be3d70d 100644 --- a/ascii.cpp +++ b/ascii.cpp @@ -261,6 +261,10 @@ bool btnp(uint8_t i) { return key_just_pressed == i; } +uint8_t whichbtn() { + return key_just_pressed; +} + int mousex() { return mouse_x; } @@ -350,6 +354,16 @@ void debug_one_line_up() { debug_cursor = debug_total_size-debug_line_size; } +void debugchr(const uint8_t chr) { + if (chr == 8) { + debug_text[debug_cursor--] = 32; + debug_text[debug_cursor] = 32; + } else { + debug_text[debug_cursor++] = chr; + if (debug_cursor >= debug_total_size) debug_one_line_up(); + } +} + void debug(const char *str) { const int len = SDL_strlen(str); for (int i=0; i