-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogic.h
More file actions
48 lines (41 loc) · 1.21 KB
/
logic.h
File metadata and controls
48 lines (41 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef LOGIC_H
#define LOGIC_H
#define MAX_RADIUS 20
#define MAX_VELOCITIES 5
typedef struct {
int x;
int y;
int vx;
int vy;
int radius;
} Ball;
typedef struct {
int x_min;
int x_max;
int y_min;
int y_max;
} Boarder;
typedef struct {
int x_min;
int x_max;
int y_min;
int y_max;
int enable;
} Obstacle;
typedef struct {
int vx[MAX_VELOCITIES];
int vy[MAX_VELOCITIES];
int current_index; // ��ǰʹ�õ�����
} VelocityArray;
void initBall(Ball *ball, int x, int y, int vx, int vy, int radius);
void set_boarder(Ball *ball, Boarder *Boarder);
void updateBall(Ball *ball, Boarder *Boarder);
void upbtn_setting_change(int* currentMode,Ball *ball, int* moving_step,int *bullet_velocity, int *y_bias);
void downbtn_setting_change(int* currentMode,Ball *ball, int* moving_step,int *bullet_velocity, int *y_bias);
int calculateReflect(int currentPositionY, int now_yleft, int y_bias, int Brck_Pos[][4], int BRICKS_COUNT, int currentMode, int score, int ball_radius);
void generateSpeed(int *vx, int *vy);
void init_vel(int initial_v);
void updateBallSpeed(Ball* ball);
void init_velocities(int initial_v);
extern Obstacle randomObstacles[5];
#endif // LOGIC_H