.stl is the new extension for levels
[supertux.git] / src / level.h
1 //
2 // C Interface: level
3 //
4 // Description:
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2003
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_LEVEL_H
14 #define SUPERTUX_LEVEL_H
15
16 #include <string>
17 #include "texture.h"
18 #include "lispreader.h"
19
20 /* This type holds meta-information about a level-subset. */
21 /* It could be extended to handle manipulation of subsets. */
22 class st_subset
23   {
24   public:
25     st_subset();
26     static void create(const std::string& subset_name);
27     void load(char *subset);
28     void save();
29     void free();
30
31     std::string name;
32     std::string title;
33     std::string description;
34     texture_type image;
35     int levels;
36  
37   private:
38     void parse(lisp_object_t* cursor);
39   };
40
41 #define LEVEL_NAME_MAX 20
42
43 typedef struct st_level /*It is easier to read the sources IMHO, if we don't write something like int a,b,c; */
44   {
45     std::string name;
46     std::string theme;
47     std::string song_title;
48     std::string bkgd_image;
49     unsigned int* tiles[15];
50     int time_left;
51     int bkgd_red;
52     int bkgd_green;
53     int bkgd_blue;
54     int width;
55     float gravity;
56   }
57 st_level;
58
59 extern texture_type img_bkgd, img_bkgd_tile[2][4], img_solid[4], img_brick[2];
60
61 void level_default(st_level* plevel);
62 int level_load(st_level* plevel, const char * subset, int level);
63 void level_parse(st_level* plevel, lisp_object_t* cursor);
64 int level_load(st_level* plevel, const char* filename);
65 void level_save(st_level* plevel, const char * subset, int level);
66 void level_free(st_level* plevel);
67 void level_load_gfx(st_level* plevel);
68 void level_free_gfx();
69 void level_load_image(texture_type* ptexture, std::string theme, const char * file, int use_alpha);
70 void level_change(st_level* plevel, float x, float y, unsigned char c);
71 void level_load_song(st_level* plevel);
72 void level_free_song(void);
73
74 #endif /*SUPERTUX_LEVEL_H*/