From ae01c7fc02f17105f9e04af493f4dd8986fbcb8b Mon Sep 17 00:00:00 2001 From: Oxore Date: Thu, 30 Nov 2017 17:42:15 +0300 Subject: Move includes to root dir --- Makefile | 3 +- _vimrc_local.vim | 4 +++ include/common.h | 42 +++++++++++++++++++++++++ include/functions.h | 30 ++++++++++++++++++ include/tet_conf.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ src/functions.c | 4 +-- src/include/common.h | 42 ------------------------- src/include/functions.h | 30 ------------------ src/include/tet_conf.h | 83 ------------------------------------------------- src/main.c | 4 +-- src/shape_maps.c | 2 +- 11 files changed, 166 insertions(+), 161 deletions(-) create mode 100644 include/common.h create mode 100644 include/functions.h create mode 100644 include/tet_conf.h delete mode 100644 src/include/common.h delete mode 100644 src/include/functions.h delete mode 100644 src/include/tet_conf.h diff --git a/Makefile b/Makefile index 247a436..3d62d6e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ FILES:=$(FILES:.c=.o) CFLAGS += -Wall CFLAGS += -std=c99 -CFLAGS += -O2 +CFLAGS += -O0 +CFLAGS += -Iinclude LIBS += -lcsfml-graphics LIBS += -lcsfml-window LIBS += -lcsfml-system diff --git a/_vimrc_local.vim b/_vimrc_local.vim index c5055bf..78f02f7 100644 --- a/_vimrc_local.vim +++ b/_vimrc_local.vim @@ -3,3 +3,7 @@ if (&ft=='c' || &ft=='h' || &ft=='cpp') setlocal tabstop=4 setlocal expandtab endif + +" Neomake c include +let g:neomake_c_enabled_makers = ['gcc'] +let g:neomake_c_gcc_maker = {'args': ['-fsyntax-only', '-Wall', '-Wextra', '-I../include/', '-I./include/']} diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..5a3d63e --- /dev/null +++ b/include/common.h @@ -0,0 +1,42 @@ +#ifndef TCOMMON_H +#define TCOMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tet_conf.h" + +typedef struct tCell { + uint8_t a; // active/empty state of cell + sfColor fColor; // fill color +} tCell; +tCell fldCAtt[25][10];// fld cells attributes + + +/* + * shape coords + * y + * ^. . . . + * |. . . . + * |. . . . + * |. . . . + * 0------->x + * + */ + +typedef struct shapeSt { + int x; // x coord of shape's left side + int y; // y coord of shape's bottom + int t; // shape type + sfColor fColor; // shape color + uint8_t c[4][4]; // array of shape cells +} shapeSt; +shapeSt actiSh, nxtShape; + +#endif diff --git a/include/functions.h b/include/functions.h new file mode 100644 index 0000000..ef9d42f --- /dev/null +++ b/include/functions.h @@ -0,0 +1,30 @@ +#ifndef TFUNCTIONS_H +#define TFUNCTIONS_H + +/* Prototypes of functions*/ +void tKeyCtrl(); +void initFld(); +void tTick(); +void resetActiveShape(); +void putShape(); +int cellCollisionCheck(int dir); +int wallCollisionCheck(); +int cellRotCollisionCheck(); +int wallRotCollisionCheck(); +void rotateLeft(); +void rotateRight(); +void rotateShape(); +int linesRmScore(); +void scoreDisplay(); +void colorizeFld(); +void colorizeActiSh(); +void drawFld(sfRenderWindow *window); +void menuTick(); +void colorizeRandom(); +void gameover(); +void genNextShape(); +void copyShape(struct shapeSt *localSh); +void drawNextShape(); +void cleanupFld(); + +#endif diff --git a/include/tet_conf.h b/include/tet_conf.h new file mode 100644 index 0000000..4896a56 --- /dev/null +++ b/include/tet_conf.h @@ -0,0 +1,83 @@ +#define windowName_conf "SFML" // Window name +#define uiColor1 sfColor_fromRGB(0, 0, 0) // Field background +#define uiColor2 sfColor_fromRGB(80, 80, 80) // Field inactive cell outline +#define uiColor3 sfColor_fromRGB(0, 0, 0) // Field active cell outline +#define tOrange sfColor_fromRGB(255, 130, 0) // Orange color of L shape +#define tBlue sfColor_fromRGB(0, 0, 255) +#define tGreen sfColor_fromRGB(0, 255, 0) +#define tRed sfColor_fromRGB(255, 0, 0) +#define tYellow sfColor_fromRGB(255, 255, 0) +#define tCyan sfColor_fromRGB(0, 255, 255) +#define tMagneta sfColor_fromRGB(192, 0, 255) +#define moveRepeatLatency1 150000 // microseconds, only for left-right arrows, + // first repeat move when long push +#define moveRepeatLatency2 30000 // microseconds, for Left, Right and Down + // arrows, the rest repeat move when long push + + +/* + * 19.......... + * 18.......... + * 17.......... + * 16.......... + * 15.......... + * 14.......... + * 13.......... + * 12.......... + * 11.......... + * 10.......... + * 9.......... + * 8.......... + * 7.......... + * 6.......... + * 5.......#.. + * 4......##.. + * 3......#... + * 2.#.##..... + * 1.##.#..#.. + * 0..#.#.###. + * 0123456789 + * + * L + * ..#. .#.. .... ##.. + * ###. .#.. ###. .#.. + * .... .##. #... .#.. + * .... .... .... .... + * + * RL + * #... .##. .... .#.. + * ###. .#.. ###. .#.. + * .... .#.. ..#. ##.. + * .... .... .... .... + * + * Z + * ##.. ..#. .... .#.. + * .##. .##. ##.. ##.. + * .... .#.. .##. #... + * .... .... .... .... + * + * S + * .##. .#.. .... #... + * ##.. .##. .##. ##.. + * .... ..#. ##.. .#.. + * .... .... .... .... + * + * Brick + * ##.. ##.. ##.. ##.. + * ##.. ##.. ##.. ##.. + * .... .... .... .... + * .... .... .... .... + * + * I + * .#.. .... .#.. .... + * .#.. #### .#.. #### + * .#.. .... .#.. .... + * .#.. .... .#.. .... + * + * T + * .#.. .#.. .... .#.. + * ###. .##. ###. ##.. + * .... .#.. .#.. .#.. + * .... .... .... .... + */ + diff --git a/src/functions.c b/src/functions.c index 503d971..e376f6b 100644 --- a/src/functions.c +++ b/src/functions.c @@ -1,5 +1,5 @@ -#include "include/common.h" -#include "include/functions.h" +#include "common.h" +#include "functions.h" /* Externs from main.c */ diff --git a/src/include/common.h b/src/include/common.h deleted file mode 100644 index 5a3d63e..0000000 --- a/src/include/common.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef TCOMMON_H -#define TCOMMON_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tet_conf.h" - -typedef struct tCell { - uint8_t a; // active/empty state of cell - sfColor fColor; // fill color -} tCell; -tCell fldCAtt[25][10];// fld cells attributes - - -/* - * shape coords - * y - * ^. . . . - * |. . . . - * |. . . . - * |. . . . - * 0------->x - * - */ - -typedef struct shapeSt { - int x; // x coord of shape's left side - int y; // y coord of shape's bottom - int t; // shape type - sfColor fColor; // shape color - uint8_t c[4][4]; // array of shape cells -} shapeSt; -shapeSt actiSh, nxtShape; - -#endif diff --git a/src/include/functions.h b/src/include/functions.h deleted file mode 100644 index ef9d42f..0000000 --- a/src/include/functions.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef TFUNCTIONS_H -#define TFUNCTIONS_H - -/* Prototypes of functions*/ -void tKeyCtrl(); -void initFld(); -void tTick(); -void resetActiveShape(); -void putShape(); -int cellCollisionCheck(int dir); -int wallCollisionCheck(); -int cellRotCollisionCheck(); -int wallRotCollisionCheck(); -void rotateLeft(); -void rotateRight(); -void rotateShape(); -int linesRmScore(); -void scoreDisplay(); -void colorizeFld(); -void colorizeActiSh(); -void drawFld(sfRenderWindow *window); -void menuTick(); -void colorizeRandom(); -void gameover(); -void genNextShape(); -void copyShape(struct shapeSt *localSh); -void drawNextShape(); -void cleanupFld(); - -#endif diff --git a/src/include/tet_conf.h b/src/include/tet_conf.h deleted file mode 100644 index 4896a56..0000000 --- a/src/include/tet_conf.h +++ /dev/null @@ -1,83 +0,0 @@ -#define windowName_conf "SFML" // Window name -#define uiColor1 sfColor_fromRGB(0, 0, 0) // Field background -#define uiColor2 sfColor_fromRGB(80, 80, 80) // Field inactive cell outline -#define uiColor3 sfColor_fromRGB(0, 0, 0) // Field active cell outline -#define tOrange sfColor_fromRGB(255, 130, 0) // Orange color of L shape -#define tBlue sfColor_fromRGB(0, 0, 255) -#define tGreen sfColor_fromRGB(0, 255, 0) -#define tRed sfColor_fromRGB(255, 0, 0) -#define tYellow sfColor_fromRGB(255, 255, 0) -#define tCyan sfColor_fromRGB(0, 255, 255) -#define tMagneta sfColor_fromRGB(192, 0, 255) -#define moveRepeatLatency1 150000 // microseconds, only for left-right arrows, - // first repeat move when long push -#define moveRepeatLatency2 30000 // microseconds, for Left, Right and Down - // arrows, the rest repeat move when long push - - -/* - * 19.......... - * 18.......... - * 17.......... - * 16.......... - * 15.......... - * 14.......... - * 13.......... - * 12.......... - * 11.......... - * 10.......... - * 9.......... - * 8.......... - * 7.......... - * 6.......... - * 5.......#.. - * 4......##.. - * 3......#... - * 2.#.##..... - * 1.##.#..#.. - * 0..#.#.###. - * 0123456789 - * - * L - * ..#. .#.. .... ##.. - * ###. .#.. ###. .#.. - * .... .##. #... .#.. - * .... .... .... .... - * - * RL - * #... .##. .... .#.. - * ###. .#.. ###. .#.. - * .... .#.. ..#. ##.. - * .... .... .... .... - * - * Z - * ##.. ..#. .... .#.. - * .##. .##. ##.. ##.. - * .... .#.. .##. #... - * .... .... .... .... - * - * S - * .##. .#.. .... #... - * ##.. .##. .##. ##.. - * .... ..#. ##.. .#.. - * .... .... .... .... - * - * Brick - * ##.. ##.. ##.. ##.. - * ##.. ##.. ##.. ##.. - * .... .... .... .... - * .... .... .... .... - * - * I - * .#.. .... .#.. .... - * .#.. #### .#.. #### - * .#.. .... .#.. .... - * .#.. .... .#.. .... - * - * T - * .#.. .#.. .... .#.. - * ###. .##. ###. ##.. - * .... .#.. .#.. .#.. - * .... .... .... .... - */ - diff --git a/src/main.c b/src/main.c index 9e226cf..8251b46 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ -#include "include/common.h" -#include "include/functions.h" +#include "common.h" +#include "functions.h" /* --- Variables --- */ int gameIsStarted = 0; diff --git a/src/shape_maps.c b/src/shape_maps.c index 0ee8d49..9de04d2 100644 --- a/src/shape_maps.c +++ b/src/shape_maps.c @@ -1,4 +1,4 @@ -#include "include/common.h" +#include "common.h" /* * Shapes maps * -- cgit v1.2.3