commit a9977378c572ac3dba921987849c0cfbc9f5f3ac Author: dylanbenzi Date: Wed Feb 26 16:53:00 2025 -0500 init commit + init testing maze diff --git a/a.out b/a.out new file mode 100755 index 0000000..6566a38 Binary files /dev/null and b/a.out differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..2bc4165 --- /dev/null +++ b/main.cpp @@ -0,0 +1,63 @@ +#include +#include + +using namespace std; + +int main() { + terminal_open(); + terminal_set("window: size=40x20, title='Terminal Trainers'"); + + int x = 10; + int y = 10; + + int mapHeight = 20; + int mapLength = 40; + int mapSize = mapHeight * mapLength; + + char map[mapSize + mapHeight]; + + strcat(map, "#######################################\n"); + strcat(map, "# #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * ##\n"); + strcat(map, "## * * * #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * * ##\n"); + strcat(map, "## * * #\n"); + strcat(map, "# * * * * #\n"); + strcat(map, "# * * * #\n"); + strcat(map, "# #\n"); + strcat(map, "#######################################\n"); + + + bool running = true; + + while (running) { + terminal_clear(); + + terminal_print_ext(0, 0, 40, 20, TK_ALIGN_LEFT, map); + terminal_put(x, y, 0x20AC); + + terminal_put_array(int x, int y, int w, int h, const uint8_t *data, int row_stride, int column_stride, const void *layout, int char_size) + + terminal_refresh(); + + int key = terminal_read(); + if (key == TK_ESCAPE) running = false; + else if (key == TK_UP || key == TK_W) y--; + else if (key == TK_DOWN || key == TK_S) y++; + else if (key == TK_LEFT || key == TK_A) x--; + else if (key == TK_RIGHT || key == TK_D) x++; + } + + terminal_close(); + return 0; +}