labyrinth

view src/level.h @ 1:d46f0947a96d

added helpful comment
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 06 Feb 2015 00:34:04 +0200
parents
children
line source
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
4 #define MAX_LEVEL_SIZE 64
6 struct level {
7 int cells[MAX_LEVEL_SIZE][MAX_LEVEL_SIZE];
8 int num_cells[2];
9 float cell_size; /* in meters */
10 float cell_height; /* in meters */
11 int start_pos[2];
13 float goal_pos[2];
15 unsigned int floor_tex, wall_tex, ceil_tex;
16 float floor_tex_scale, wall_tex_scale, ceil_tex_scale;
17 };
19 void level_init(struct level *lvl);
20 int level_load(struct level *lvl, const char *fname);
22 /* convert from cell coords to world space pos and back */
23 void level_pos_to_cell(struct level *lvl, float x, float y, int *res_cx, int *res_cy);
24 void level_cell_to_pos(struct level *lvl, int cx, int cy, float *resx, float *resy);
26 int level_cell(struct level *lvl, int cx, int cy);
27 int level_cell_at(struct level *lvl, float x, float y);
29 int level_obj_pos(struct level *lvl, int objname, float *resx, float *resy);
31 /* direction parameters are in-out */
32 int level_collide(struct level *lvl, float rad, float x, float y, float *dx, float *dy);
34 void level_draw(struct level *lvl);
36 #endif /* LEVEL_H_ */