From cd2650182ce710ae7fdfae2c68b91c417d54bc60 Mon Sep 17 00:00:00 2001 From: Oxore Date: Tue, 20 Jun 2017 21:01:53 +0700 Subject: Major refactoring! --- src/include/common.h | 36 ++++++++++++++++++++++++++++-------- src/include/functions.h | 9 +++++---- src/include/tet_conf.h | 3 ++- 3 files changed, 35 insertions(+), 13 deletions(-) (limited to 'src/include') diff --git a/src/include/common.h b/src/include/common.h index e7624c7..c606560 100644 --- a/src/include/common.h +++ b/src/include/common.h @@ -6,20 +6,40 @@ #include #include #include -#include #include +#include +#include +#include #include "functions.h" #include "tet_conf.h" -//#define EXIT_FAILURE -1 -//#define EXIT_SUCCESS 0 - struct tCell { - short a; // active/empty state of cell - sfColor fColor, oColor; // fill and outline color of cell + uint8_t a; // active/empty state of cell + sfColor fColor; // fill color +}; +struct tCell fldCAtt[20][10];// fld cells attributes + + +/* + * shape coords + * y + * ^. . . . + * |. . . . + * |. . . . + * |. . . . + * 0------->x + * + */ + +struct activeShape { + int x; // x coord of shape's left side + int y; // y coord of shape's bottom + int r; // rotate state, one of four + int t; // shape type + sfColor fColor; // shape color + uint8_t c[4][4]; // array of shape cells }; -struct tCell activeShape[4][4]; // 4x4 block of active crawling shape -struct tCell fld_rAttr[20][10];// fld cells attributes +struct activeShape actiSh; #endif diff --git a/src/include/functions.h b/src/include/functions.h index 3c54dfd..cb5bf09 100644 --- a/src/include/functions.h +++ b/src/include/functions.h @@ -11,13 +11,14 @@ int cellCollisionCheck(int dir); int wallCollisionCheck(); int cellRotCollisionCheck(); int wallRotCollisionCheck(); +void rotateLeft(); +void rotateRight(); void rotateShape(); -void rotateS1(); -void rotateS2(); -void rotateS3(); -void rotateS4(); int linesRmScore(); void scoreDisplay(); +void colorizeFld(); +void colorizeActiSh(); void menuTick(); +void colorizeRandom(); #endif diff --git a/src/include/tet_conf.h b/src/include/tet_conf.h index f2f1871..9f632c4 100644 --- a/src/include/tet_conf.h +++ b/src/include/tet_conf.h @@ -1,6 +1,7 @@ #define windowName_conf "SFML" // Window name #define uiColor1 sfColor_fromRGB(0, 0, 0) // Field background -#define uiColor2 sfColor_fromRGB(80, 80, 80) // Field cell outline +#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) -- cgit v1.2.3