diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..5a313ac0fdb1ae33622149385d94dd13deb43277 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "gcc.exe - Build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerPath": "C:\\Program Files (x86)\\CodeBlocks\\MinGW\\gdb32\\bin\\gdb32.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "C/C++: gcc.exe build active file" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000000000000000000000000000000000..38b7ee3cdb234e76d0452664240a0998671a4249 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,26 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "label": "C/C++: gcc.exe build active file", + "command": "C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\gcc.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/map1_e.txt b/map1_e.txt new file mode 100644 index 0000000000000000000000000000000000000000..7298837be5a3fbd045fae1e4e3d6b391720295fd --- /dev/null +++ b/map1_e.txt @@ -0,0 +1,23 @@ +-=======T=========================Ź +Ś Ś Ś +Ś Ś Ś +Ś Ś Hope it'll work Ś +Ś Ś Ś +Ś Ś Ś +Ś ?Ś Ś +Ś Ś +Ś Ś +Ś This is a box for snake Ś +Ś Ś +Ś Ś +Ś ============Ź Ś +Ś :D Ś Ś +Ś Ś Ś +Ś Ś Ś +Ś random Ś +Ś obstacles Ś +Ś Ś +Ś w-1250 char test Ś +Ś Ś +L=================================- + diff --git a/mapnouni.txt b/mapnouni.txt new file mode 100644 index 0000000000000000000000000000000000000000..8a14466a0c846c0971adac165986742e4c17d7df --- /dev/null +++ b/mapnouni.txt @@ -0,0 +1,3 @@ +Ś +Ś +asdbkjghkijgé \ No newline at end of file diff --git a/snake.c b/snake.c index 7ba69c1c892fc5e0d42987b8e57e91d981a0b05b..16ea9b4976a1690fc34ad4400f6f920f8181d2be 100644 --- a/snake.c +++ b/snake.c @@ -6,7 +6,7 @@ //typedef unsigned long long int pointer; //Not optimal -int isUnicodeEncoding = 1; +int isUnicodeEncoding = 0; typedef enum Direcion{ UP, @@ -218,7 +218,11 @@ void _print1char(Matrix *map){ while(scanf(" %d%d", &x, &y) == 2){ if(x >= 0 && y >= 0 && x < map->width && y < map->height){ for(int i = 0;i < 2; i++){ - printf("\nvalue: %d, %d, %d, %d\n", map->matrix[x][y].chars[i].bytes.c[0], map->matrix[x][y].chars[i].bytes.c[1], map->matrix[x][y].chars[i].bytes.c[2], map->matrix[x][y].chars[i].bytes.c[3]); + printf("\nvalue: %hhx, %hhx, %hhx, %hhx\n", + (unsigned)map->matrix[x][y].chars[i].bytes.c[0], + (unsigned)map->matrix[x][y].chars[i].bytes.c[1], + (unsigned)map->matrix[x][y].chars[i].bytes.c[2], + (unsigned)map->matrix[x][y].chars[i].bytes.c[3]); printf("as character: \""); printChar(map->matrix[x][y].chars[i]); printf("\"\n"); @@ -250,7 +254,7 @@ int core(int argc, char const *argv[]) //test code printf("map:\n"); _testprint(&map); - //_print1char(&map); + _print1char(&map); /* code */ //free stuff rmMatrix(&map); @@ -270,7 +274,7 @@ int main(int argc, char const *argv[]) { 2 + 3; int ret; - char const *array[] = {argv[0], "snake/map1.txt"}; + char const *array[] = {argv[0], "map1_e.txt"}; ret = core(2, array); printf("\npress any key to continue"); getchar(); diff --git a/snake.exe b/snake.exe index 2301e1bbbdd1ebd1686e5392a9c30bc90d90fbbd..54601e4e248e4774849ff6d7e9830b048fe8ce91 100644 Binary files a/snake.exe and b/snake.exe differ diff --git a/test.txt b/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d758c9c7bc06c1e307f05d92d896aaf0a8a6d2c --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +? \ No newline at end of file