diff options
author | Oxore <oxore@protonmail.com> | 2018-06-30 19:26:03 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2018-06-30 19:26:03 +0300 |
commit | bb9d1873ad414b09efdd7c8bf6798b431adb3cb2 (patch) | |
tree | e5b1106bd7a55a10c8ee7f9908f7bdd75413af29 /include | |
parent | bf0e5690a31d4c3cecd2ba512729a0b73989bbda (diff) |
Move all field&shape related funcs to field class
Diffstat (limited to 'include')
-rw-r--r-- | include/engine.h | 6 | ||||
-rw-r--r-- | include/field.h | 33 |
2 files changed, 21 insertions, 18 deletions
diff --git a/include/engine.h b/include/engine.h index 655eb01..7a4ce32 100644 --- a/include/engine.h +++ b/include/engine.h @@ -9,11 +9,7 @@ void tKeyCtrl(); void tTick(); void checkLevelUp(struct game *game); int getMoveLatencyOfLevel(int level); -int rmLines(); void valueAfterTextDisplay(int value, List *texts, char *type); -void colorizeActive(); void drawFld(sfRenderWindow *window); void gameover(struct game *game); -void genNextShape(); -void drawNextShape(); -void freeFld(); +void drawNextShape(sfRenderWindow *window); diff --git a/include/field.h b/include/field.h index 410e609..6e1c928 100644 --- a/include/field.h +++ b/include/field.h @@ -2,10 +2,6 @@ #define FLD_SIZE_X 10 #define FLD_BOUND_Y FLD_SIZE_Y + 3 #define FLD_BOUND_X FLD_SIZE_X -/* - * Types - * - * */ struct cell { char a; // active/empty state of cell @@ -14,13 +10,19 @@ struct cell { /* - * shape coords + * field + shape coord system * y - * ^. . . . - * |. . . . - * |. . . . - * |. . . . - * 0------->x + * ^. . . . . . . + * |. . . . . . . + * |. . . . . . . + * |. . y . . . . + * |. . ^ . . . . + * |. . | . . . . + * |. . | . . . . + * |. . 0------>x + * |. . . . . . . + * |. . . . . . . + * 0------------->x * */ @@ -49,10 +51,15 @@ struct field { void init_field(struct field *fld); void colorize_field(struct field *fld); void colorize_field_random(struct field *fld); -void init_next_shape_field(struct shape *next); +void colorize_active_shape(struct field *fld, struct shape *shape); +void init_next_shape(struct shape *next); void putShape(struct field *fld, struct shape *active); -int out_of_field(struct field *fld, struct shape *active); +int out_of_field(struct field *fld, struct shape *active); void load_shape(struct shape *shape); void rotate_shape(struct field *fld, struct shape *shape); -int collide(struct field *fld, struct shape *active); +int collide(struct field *fld, struct shape *active); void resetActiveShape(struct field *fld, struct shape *active); +void gen_shape(struct shape *shape); +int rm_lines(struct field *fld); +void free_field(struct field *fld); +void free_shape(struct shape *shape); |