added universal.h and moved linux.h into the arch folder

This commit is contained in:
zombie maniac 2022-03-20 08:17:41 -04:00
parent 8b85fffc3a
commit ea3157952b
Signed by: nbrooks211
GPG key ID: F43C85C0DF0C334E
3 changed files with 23 additions and 4 deletions

21
src/arch/universal.h Normal file
View file

@ -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 <curses.h>
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();
}

View file

@ -1,6 +1,6 @@
#include <stdio.h> //printf and shit
#include <time.h>
#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--;