added optional button to restart game (door, panel and touch variants)
[rocksndiamonds.git] / src / libgame / image.h
1 // ============================================================================
2 // Artsoft Retro-Game Library
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // image.h
10 // ============================================================================
11
12 #ifndef IMAGE_H
13 #define IMAGE_H
14
15 #include "system.h"
16
17
18 // bitmap array positions for various element sizes, if available
19 //
20 // for any loaded image, the "standard" size (which represents the 32x32 pixel
21 // size for game elements) is always defined; other bitmap sizes may be NULL
22 //
23 // formats from 32x32 down to 1x1 are standard bitmap sizes for game elements
24 // (used in the game, in the level editor, in the level preview etc.)
25 //
26 // "CUSTOM" sizes for game elements (like 64x64) may be additionally created;
27 // all "OTHER" image sizes are stored if different from all other bitmap sizes,
28 // which may be used "as is" by global animations (as the "standard" size used
29 // normally may be wrong due to being scaled up or down to a different size if
30 // the same image contains game elements in a non-standard size)
31
32 #define IMG_BITMAP_32x32        0
33 #define IMG_BITMAP_16x16        1
34 #define IMG_BITMAP_8x8          2
35 #define IMG_BITMAP_4x4          3
36 #define IMG_BITMAP_2x2          4
37 #define IMG_BITMAP_1x1          5
38 #define IMG_BITMAP_CUSTOM       6
39 #define IMG_BITMAP_OTHER        7
40
41 #define NUM_IMG_BITMAPS         8
42
43 // these bitmap pointers point to one of the above bitmaps (do not free them)
44 #define IMG_BITMAP_PTR_GAME     8
45 #define IMG_BITMAP_PTR_ORIGINAL 9
46
47 #define NUM_IMG_BITMAP_POINTERS 10
48
49 // this bitmap pointer points to the bitmap with default image size
50 #define IMG_BITMAP_STANDARD     IMG_BITMAP_32x32
51
52
53 #define GET_BITMAP_ID_FROM_TILESIZE(x)  ((x) ==  1 ? IMG_BITMAP_1x1   : \
54                                          (x) ==  2 ? IMG_BITMAP_2x2   : \
55                                          (x) ==  4 ? IMG_BITMAP_4x4   : \
56                                          (x) ==  8 ? IMG_BITMAP_8x8   : \
57                                          (x) == 16 ? IMG_BITMAP_16x16 : \
58                                          (x) == 32 ? IMG_BITMAP_32x32 : \
59                                          IMG_BITMAP_CUSTOM)
60
61 #define GET_TILESIZE_FROM_BITMAP_ID(x)  ((x) == IMG_BITMAP_1x1   ? 1  : \
62                                          (x) == IMG_BITMAP_2x2   ? 2  : \
63                                          (x) == IMG_BITMAP_4x4   ? 4  : \
64                                          (x) == IMG_BITMAP_8x8   ? 8  : \
65                                          (x) == IMG_BITMAP_16x16 ? 16 : \
66                                          (x) == IMG_BITMAP_32x32 ? 32 : \
67                                          0)
68
69
70 int getImageListSize(void);
71 struct FileInfo *getImageListEntryFromImageID(int);
72 Bitmap **getBitmapsFromImageID(int);
73 int getOriginalImageWidthFromImageID(int);
74 int getOriginalImageHeightFromImageID(int);
75 char *getTokenFromImageID(int);
76 char *getFilenameFromImageID(int);
77 int getImageIDFromToken(char *);
78 char *getImageConfigFilename(void);
79 int getImageListPropertyMappingSize(void);
80 struct PropertyMapping *getImageListPropertyMapping(void);
81 void InitImageList(struct ConfigInfo *, int, struct ConfigTypeInfo *,
82                    char **, char **, char **, char **, char **);
83
84 void ReloadCustomImages(void);
85 void CreateImageWithSmallImages(int, int, int);
86 void CreateImageTextures(int);
87 void FreeAllImageTextures(void);
88 void ScaleImage(int, int);
89
90 void FreeAllImages(void);
91
92 #endif  // IMAGE_H