Revision 1040 branches/simulator/projects/simulator/simulator/core/world.h

View differences:

world.h
13 13

  
14 14
#include <stdarg.h>
15 15

  
16
#define ID_OFFSET -1
16 17
#define ID_RECTANGLE 3
17
#define ID_CIRCLE 1
18

  
19
#define ID_POLY 0
18
#define ID_CIRCLE 2
19
#define ID_NULL 0
20
#define ID_POLY 1
20 21
#define POLY_DISCONNECTED 0
21 22
#define POLY_CONNECTED 1
22 23
#define POLY_RECT 2
......
24 25
#define NUM_SHAPES 3
25 26
#define RAY_MISS 1E30
26 27
#define CREATE(id, ...) (create_func[id](__VA_ARGS__))
28
#define PBBOX(b) {printf("(%g,%g) --> (%g, %g)\n",(b).p1.x,(b).p1.y,(b).p2.x,\
29
						  (b).p2.y);}
27 30
typedef struct {
28 31
    double x;
29 32
    double y;
......
52 55
} object_t;
53 56

  
54 57
typedef struct {
55
    int num_objs;
58
    int max_objs;
59
    int cur_objs;
56 60
    object_t *objs;
57
    bbox_t world;
61
    bbox_t win; 
58 62
} world_t;
59 63

  
60 64
/* Specific collision functions */
......
66 70
 *  Must be listed in the same order as IDs */
67 71
extern double (*collide_func[NUM_SHAPES])(ray_t *ray, object_t *obj);
68 72
extern int (*create_func[NUM_SHAPES])(object_t *obj, va_list ap);
73
extern int (*destroy_func[NUM_SHAPES])(object_t *obj);
74
extern world_t world;
69 75

  
70

  
76
int init_world(int num_objs, bbox_t b);
77
int destroy_world(void);
71 78
int create_poly(object_t *obj, va_list ap);
79
int destroy_poly(object_t *obj);
72 80
object_t *create(int id, ...);
73 81

  
74
void destroy_poly (object_t *obj);
82
void print_world(void);
83
void print_object(object_t *obj);
84

  
75 85
#endif
76 86

  

Also available in: Unified diff