-
Notifications
You must be signed in to change notification settings - Fork 0
/
Map.h
44 lines (36 loc) · 1.13 KB
/
Map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef MAP_H
#define MAP_H
// Arguments
typedef struct MAP_ELEMENT {
SDL_Surface *pic0; // image de base
SDL_Surface *pic1; // image sélectionnée (optionnel)
int isSelected;
} MapElement;
typedef struct MAP_ARGS {
int dCols, nCols;
int dRows, nRows;
int minSpace;
int nElements;
MapElement *elements;
int mode; // 0 == pressable, 1 = sélectionnable
int w; // largeur d'une image
int h; // hauteur d'une image
int x, y, cx, cy; // position actuelle du curseur
int state;
} MapArgs;
// Création
Widget *wMap(int dCols, int nCols, int dRows, int nRows, int minSpace, int mode);
void DrawMap(Widget *w);
int ActivateMap(Widget *w);
void CloseMap(Widget *w);
void wMap_AddElement(Widget *w, SDL_Surface *pic0, SDL_Surface *pic1);
// Méthodes
void wMap_DrawElement(Widget *w, int elt);
BOOL wMap_IsElementSelected(Widget *w, int elt);
void wMap_SelectElement(Widget *w, int elt);
void wMap_UnselectElement(Widget *w, int elt);
void wMap_SelectAll(Widget *w);
void wMap_UnselectAll(Widget *w);
void wMap_SetElementImage(Widget *w, int elt, SDL_Surface *pic0, SDL_Surface *pic1);
MapElement *wMap_GetElementStruct(Widget *w, int elt);
#endif