From 54f40f6cb863f00fbcaa77ebdb930d8d7fc6988d Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 28 Dec 2017 21:30:20 +0100 Subject: Imported the code into Git Signed-off-by: Olivier Gayot --- include/minesweeper.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 include/minesweeper.h (limited to 'include') diff --git a/include/minesweeper.h b/include/minesweeper.h new file mode 100644 index 0000000..6bc7738 --- /dev/null +++ b/include/minesweeper.h @@ -0,0 +1,73 @@ +#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 + +SDL_Surface *scr; +SDL_Surface *surf_number[9]; +SDL_Surface *bmb_surf; +SDL_Surface *hidden_surf; +SDL_Surface *selection_surf; +SDL_Surface *flag_surf; +SDL_Surface *wrong_flag; + +SDL_mutex *mutex; + +unsigned int discovered; +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 */ -- cgit v1.2.3