summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/minesweeper.h73
1 files changed, 73 insertions, 0 deletions
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 <sysexits.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_thread.h>
+#include <SDL/SDL_mutex.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sdl_digit.h>
+
+#if defined (_WIN32)
+# include <windows.h>
+#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 */