it's working but should fix return issue

This commit is contained in:
Rorikstr | Rust Dev 2025-09-28 12:16:58 +03:00
parent 1911d23459
commit 9de308925c
7 changed files with 609 additions and 212 deletions

View file

@ -0,0 +1,77 @@
#ifndef GAME_LOGIC_H
#define GAME_LOGIC_H
#include <stdbool.h>
#include "tetris.h" // для использования GameInfo_t
// Типы фигур
typedef enum {
I = 0,
J,
L,
O,
S,
T,
Z,
FIGURE_COUNT
} FigureType;
// Структура фигуры
typedef struct {
int x, y; // Позиция фигуры на поле
FigureType type; // Тип фигуры
int rotation; // Поворот (03)
} Figure;
typedef struct {
int game_field[FIELD_HEIGHT][FIELD_WIDTH];
Figure current_figure;
Figure next_figure;
bool figure_active;
int score;
int high_score;
int level;
int speed;
long long drop_time;
bool game_over;
bool paused;
} GameStateData;
// Внутренние функции
bool check_collision(void);
void init_game(void);
void update_game_state(void);
int get_random_figure(void);
const int (*get_figure_shape(FigureType type, int rotation))[4];
GameStateData* get_game_state(void);
void place_figure(void);
// Фигуры
const int (*i_fig_up())[4];
const int (*i_fig_right())[4];
const int (*i_fig_down())[4];
const int (*i_fig_left())[4];
const int (*o_fig())[4];
const int (*t_fig_up())[4];
const int (*t_fig_right())[4];
const int (*t_fig_down())[4];
const int (*t_fig_left())[4];
const int (*l_fig_up())[4];
const int (*l_fig_right())[4];
const int (*l_fig_down())[4];
const int (*l_fig_left())[4];
const int (*j_fig_up())[4];
const int (*j_fig_right())[4];
const int (*j_fig_down())[4];
const int (*j_fig_left())[4];
const int (*s_fig_up())[4];
const int (*s_fig_right())[4];
const int (*s_fig_down())[4];
const int (*s_fig_left())[4];
const int (*z_fig_up())[4];
const int (*z_fig_right())[4];
const int (*z_fig_down())[4];
const int (*z_fig_left())[4];
const int (*empty_fig())[4];
#endif