Refactor maze.c
This commit is contained in:
13
maze.c
13
maze.c
@@ -7,11 +7,13 @@
|
|||||||
#include <threads.h>
|
#include <threads.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define UP 3
|
#define RIGHT 4
|
||||||
#define LEFT 1
|
#define LEFT 1
|
||||||
#define DOWN 2
|
#define DOWN 2
|
||||||
#define RIGHT 4
|
#define UP 3
|
||||||
|
|
||||||
|
typedef struct termios TERMSTATE;
|
||||||
|
typedef uint8_t DIRECTION;
|
||||||
typedef struct MAPSTRUCT {
|
typedef struct MAPSTRUCT {
|
||||||
size_t x_size;
|
size_t x_size;
|
||||||
size_t y_size;
|
size_t y_size;
|
||||||
@@ -24,10 +26,6 @@ typedef struct MAPSTRUCT {
|
|||||||
uint8_t **pntr;
|
uint8_t **pntr;
|
||||||
} MAPSTRUCT;
|
} MAPSTRUCT;
|
||||||
|
|
||||||
typedef struct termios TERMSTATE;
|
|
||||||
|
|
||||||
typedef uint8_t DIRECTION;
|
|
||||||
|
|
||||||
TERMSTATE TSTATE;
|
TERMSTATE TSTATE;
|
||||||
MAPSTRUCT *MAP;
|
MAPSTRUCT *MAP;
|
||||||
|
|
||||||
@@ -184,7 +182,7 @@ void check_win() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reads keyboard input
|
// Reads keyboard input
|
||||||
void *capture() {
|
void *capture() {
|
||||||
set_term_raw(); // local function: Enable Raw Mode
|
set_term_raw(); // local function: Enable Raw Mode
|
||||||
|
|
||||||
@@ -259,7 +257,6 @@ int main(int argc, char *argv[]) {
|
|||||||
alloc_map();
|
alloc_map();
|
||||||
load_map(argv[1]);
|
load_map(argv[1]);
|
||||||
|
|
||||||
// Start Multithreading
|
|
||||||
pthread_t id_print, id_read;
|
pthread_t id_print, id_read;
|
||||||
|
|
||||||
pthread_create(&id_print, NULL, print, NULL);
|
pthread_create(&id_print, NULL, print, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user