Skip to content
Snippets Groups Projects
Commit 3c475789 authored by KosmX's avatar KosmX
Browse files

PLEASE WORK

parent a008538f
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ struct termios term_config;
/**
* Init platform dependent stuff, mostly the custom oi control
*/
int initMultiplatform(void){
int initMultiplatform(int unicode){
#ifdef __linux__
struct termios info;
tcgetattr(0, &info); //get attr
......@@ -52,6 +52,7 @@ int initMultiplatform(void){
tcsetattr(0, TCSANOW, &info); //set attr
setbuf(stdin, NULL); //???
#else
SetConsoleOutputCP(65001); //YES YES YES UTF in WINDOWS TERMINAL!!! :D
//Enable vt100 emulation. Without this, snake is not working
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
if(out == INVALID_HANDLE_VALUE){
......
......@@ -5,7 +5,7 @@
struct Vec2i getWindowSize(void);
int initMultiplatform(void);
int initMultiplatform(int unicode);
void endMultiplatformLib(void);
......
......@@ -814,6 +814,7 @@ int tick(Matrix *map, screenData *scrDat, snakeChain *snake, Direction *d, int f
printf(blue);
print(c, snake->pos, scrDat, map->width, map->height);
printf("\e[0m");
fflush(stdout);
return 0; // waiting for user input.
}
updateFood(map, &foodTick, feedAmount, snake, scrDat);
......@@ -983,15 +984,6 @@ int core(int argc, char const *argv[])
return 2;
}
//----init tasks----
if(isUnicodeEncoding(0)){
#ifndef __linux__
setlocale(LC_ALL, ".utf-8");
#endif
}
//----import map----
......@@ -1010,7 +1002,7 @@ int core(int argc, char const *argv[])
_testprint(&map);
#endif
if(!initMultiplatform()){ // init stuff.
if(!initMultiplatform(isUnicodeEncoding(0))){ // init stuff.
printf("\e[7\e[?25l");//save cursor state and turn invisible cursor
loop(&map, tickspeed, repeatMap, feedAmount, canBite, foodText, foodLen);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment