📄 function.h
字号:
/***************/
/* Header File */
/***************/
#include "CONST_DEFINE.h"
#include <SDL\SDL.h>
#ifndef __INC_H
#define __INC_H
/************************************************************************************/
/* USED STRUCTURES */
/************************************************************************************/
/*******
This structure carry the variable use
trough all the program. This is way is
use to avoid global variable
*******/
typedef struct infos {
SDL_Surface *screen; //Pointer to the screen
Uint32 yellow; //Declaration of color used
Uint32 green;
Uint32 red;
Uint32 white;
Uint32 black;
Uint32 blue;
Uint32 dark_blue;
Uint32 orange;
Uint32 marron;
int speed_level,current_speed; // Normal speed of the game and current speed
int fallCompleted;
int line,score;
int endGame;
Uint32 ground[GRID_WIDTH * GRID_HEIGHT]; // The game layer
} t_infos;
/*******
Structure of an object with the X and Y size, color,
position and significant or not square
*******/
typedef struct object{
Uint32 color; // color of object
int x,y; // Max dimension of the object
int *form; // array descripting the object
int position_X,position_Y; // position of the object
} object_t;
/*******
This is the vector movement modelise by a structure
vX,vY are in order X axis and Y axis movement and R the rotation movement
*******/
typedef struct movement{
int vX;
int vY;
int R;
} mov_t;
/************************************************************************************/
/* INIT.C */
/************************************************************************************/
/*********
Initialise the common and game variables
*********/
void init_Variables(t_infos * infos_globales, mov_t * mov);
/*******
Full the ground with bound lines and empty into
Can be used to load new level
*******/
void initGround(t_infos *infos);
/************************************************************************************/
/* GRAPH.C */
/************************************************************************************/
/*******
Is used to print the ground on the screen
The updating of screen or SDL_Flip is not implement into and must be
done to refresh the display
*******/
void drawGround(t_infos *infos);
/*******
Function used to draw the previous object
*******/
void drawPrev(t_infos *infos,object_t prev_current);
/*******
Function used to put the grid
*******/
void trace_Grille(t_infos *infos, Uint32 pixel);
/*******
Put a pixel on a given screen at the x,y coordinates with pixel color
*******/
void putpixel(t_infos *infos, int x, int y, Uint32 pixel);
/*******
Trace a horizontal or vertical line, depends on orient value.
Line starts at x,y coordinates and long of weidth
*******/
void line(t_infos *infos, int x, int y, int weidth, int orient, Uint32 pixel);
/************************************************************************************/
/* OBJECT.C */
/************************************************************************************/
/*******
Take in argument an object, try to apply a vector movement given, and apply
if the movement is possible
This function is the source of deplacement, detection of end of fall for pieces
and end of game
*******/
void moveCurrent(t_infos *infos,object_t *current,mov_t *mov);
/*******
Put the object on the ground
*******/
void placeObject(t_infos *infos,object_t current);
/*******
Remove the object of the ground, the significant boxes will colored in black
*******/
void removeObject(t_infos *infos,object_t current);
void swapObject(object_t * prev_current, object_t * current);
/*******
Create a form define in the array of object
Use the malloc function on object->form
*******/
void createObjet(t_infos *infos,object_t *object,int type);
/*******
Detect and remove the full line, update the score and the total number of line.
*******/
void detect_line(t_infos *infos);
/************************************************************************************/
/* EVENT.C */
/************************************************************************************/
/*******
Catch the key pressed, and perform the correspondant action
*******/
void keyboard_Gest(t_infos *infos, mov_t *mov);
/************************************************************************************/
/* GAME.C */
/************************************************************************************/
/*******
Detect if it is necessary to increase speed, and perform it
*******/
//void upDate_Speed(t_infos * infos);
/***********
Use to active endGame
***********/
void endGame(t_infos *infos,object_t object);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -