1 /* $Id: tenm_object.h,v 1.44 2003/02/11 11:19:37 oohara Exp $ */
2 
3 #ifndef __TENM_OBJECT_H__
4 #define __TENM_OBJECT_H__
5 
6 #include "tenm_primitive.h"
7 
8 struct _tenm_mass
9 {
10   /* number of primitives */
11   int n;
12   tenm_primitive **p;
13 };
14 typedef struct _tenm_mass tenm_mass;
15 
16 struct _tenm_object
17 {
18   int table_index;
19   char *name;
20   int attr;
21   int hit_mask;
22   int hit_point;
23   double x;
24   double y;
25   /* number of count */
26   int n;
27   int *count;
28   /* number of count_d */
29   int n_d;
30   double *count_d;
31   tenm_mass *mass;
32   /* pointer for these functions must be void because tenm_object is not
33    * yet defined
34    */
35   int (*move)(void *, double);
36   int (*hit)(void *, void *);
37   /* action other than move (such as shoot) */
38   int (*act)(void *, const void *);
39   int (*draw)(void *, int);
40   /* there is no need to put *tenm_image in this struct */
41 };
42 typedef struct _tenm_object tenm_object;
43 
44 tenm_mass *tenm_mass_new(int number_primitive, tenm_primitive **p);
45 void tenm_mass_delete(tenm_mass *p);
46 
47 
48 tenm_object *tenm_object_new(const char *name, int attr, int hit_mask,
49                              int hit_point, double x, double y,
50                              int number_count, int *count,
51                              int number_count_d, double *count_d,
52                              int number_primitive, tenm_primitive **p,
53                              int (*move)(tenm_object *, double),
54                              int (*hit)(tenm_object *, tenm_object *),
55                              int (*act)(tenm_object *, const tenm_object *),
56                              int (*draw)(tenm_object *, int));
57 void tenm_object_delete(tenm_object *p);
58 
59 int tenm_collided_mass(tenm_mass *p, tenm_mass *q);
60 int tenm_move_mass(tenm_mass *p, double dx, double dy);
61 
62 #endif /* not __TENM_OBJECT_H__ */
63