| Titoine42 |
le voici dans son intégralité :
#ifndef __XTETRIS_H__
#define __XTETRIS_H__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include "my/my.h"
#define TIMER_INTERVAL 150000
#define DEFAULT_WIDTH 9
#define DEFAULT_HEIGHT 20
#define DEFAULT_BLOCK_WIDTH 20
#define DEFAULT_BLOCK_HEIGHT 20
#define DEFAULT_BLOCK_SIZE 4
typedef struct s_global
{
int width;
int height;
int block_width;
int block_height;
char **tab;
char **tab_tmp;
int block;
int block_x;
int block_y;
} t_global;
typedef struct s_block
{
int block_type;
int rotation_ref;
int max_rotation;
char **tab;
} t_block;
typedef struct s_key_func
{
char key;
void (*f)();
} t_key_func;
int random(void);
int main(int argc, char **argv);
int get_arguments(int argc, char **argv);
void set_default_arguments();
void init();
void init_tabs();
void init_block_list();
void timer();
void new_block();
int test_block_move(int block, int x, int y);
void write_block_to_tab(int block, int x, int y);
void update_tab();
void reset_tab_tmp();
void block_down();
void k_down();
void k_fall();
void k_left();
void k_right();
void k_rotate_left();
void k_rotate_right();
void k_pause();
void k_quit();
void aff_gbl();
void aff_tab(char **tab);
void aff_block_list();
void my_outc(int c);
#ifndef __PUBLIC__
#define __PUBLIC__
t_key_func tab_key_func[]=
{
{'a', k_down},
{'b', k_fall},
{'c', k_left},
{'d', k_right},
{'e', k_rotate_left},
{'f', k_rotate_right},
{'g', k_pause},
{'h', k_quit},
{0, 0}
};
t_global *gbl;
t_block *block_tab[19];
#else
extern t_key_func tab_key_func[];
extern t_global *gbl;
extern t_block *block_tab[];
#endif
#endif |