#ifndef MINESWEEPER_H #define MINESWEEPER_H #include #include #include #include #include #include #include #include #if defined (_WIN32) # include #endif #ifndef __cplusplus typedef unsigned char bool; enum { true = 1, false = 0 }; #endif extern SDL_Surface *scr; extern SDL_Surface *surf_number[9]; extern SDL_Surface *bmb_surf; extern SDL_Surface *hidden_surf; extern SDL_Surface *selection_surf; extern SDL_Surface *flag_surf; extern SDL_Surface *wrong_flag; extern SDL_mutex *mutex; extern unsigned int discovered; extern unsigned int g_flags; #define BLOCK_SIZE 30 #define BLOCK_W 30 #define BLOCK_H 16 #define BOMBS 100 typedef struct { bool flagged; bool type; bool hidden; bool selected; int touch; int x, y; } case_t; typedef struct { case_t tab[BLOCK_H][BLOCK_W]; unsigned int bombs; } map_t; void init_map(map_t *map); int get_nbr_touch(bool tab[BLOCK_H][BLOCK_W], int j, int i); void show_map(map_t *map); void load_surfaces(void); int move_left(map_t *map, int *selection); int move_right(map_t *map, int *selection); int move_up(map_t *map, int *selection); int move_down(map_t *map, int *selection); int flip(map_t *map, int *selection); int flag(map_t *map, int *selection); void dsp_ribbon_flags(void); SDL_Thread *start_clock(void); void dsp_clock(Uint32 base_ticks); int xSDL_BlitSurface(SDL_Surface *, SDL_Rect *, SDL_Surface *, SDL_Rect *); void xSDL_Flip(SDL_Surface *); #endif /* !MINESWEEPER_H */