From ea3157952b15231d1dd739c78b395d56b2012f31 Mon Sep 17 00:00:00 2001 From: zombie Date: Sun, 20 Mar 2022 08:17:41 -0400 Subject: [PATCH] added universal.h and moved linux.h into the arch folder --- src/{ => arch}/linux.h | 0 src/arch/universal.h | 21 +++++++++++++++++++++ src/main.c | 6 ++---- 3 files changed, 23 insertions(+), 4 deletions(-) rename src/{ => arch}/linux.h (100%) create mode 100644 src/arch/universal.h diff --git a/src/linux.h b/src/arch/linux.h similarity index 100% rename from src/linux.h rename to src/arch/linux.h diff --git a/src/arch/universal.h b/src/arch/universal.h new file mode 100644 index 0000000..a4b6524 --- /dev/null +++ b/src/arch/universal.h @@ -0,0 +1,21 @@ +//TODO these header files should be split into 2 files file.c and file.h +//file.h will just contain the decleration and file.c will contain the code + +//TODO This file should have time aswell +#include + +int zom_scrinit(void) { + puts("\e[2J"); + return 0; +} +int zom_screxit(void) { + return 0; +} +int zom_putcharat(int x, int y, char chara) { + mvaddch(y, x, chara); //flipped to match screen coords + printf("\e[%d;%dH%c", y, x, chara); + return 0; +} +char zom_getch(void) { + return getch(); +} diff --git a/src/main.c b/src/main.c index 95d80f1..f33f6d7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ #include //printf and shit #include -#include "linux.h" //TODO make this detect and change depending on os +#include "arch/linux.h" //TODO make this detect and change depending on os #include "maptest.h" #include "map.h" //###################################################### @@ -77,9 +77,6 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number prevtime = clock(); int delay = 1000; int dosspin = 0; - - //TODO nuke bools they arnt part of the c99 standard - //here it js being stolen from curses int gamerun = 1; @@ -145,6 +142,7 @@ int main( int argc, char *argv[] ) { //yoinked from the internet argc is number if ((clock() % 100) == 1) { if (enemy.x > player.x) { enemy.x--; + attempt_move(&player, 1, 0); } else {enemy.x++;} if (enemy.y > player.y) { enemy.y--;