root/movingobject.c
/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- newmovingobject
- deletemovingobject
- setinitposition
- putmovingobject
1 /* movingobject.c */
2 #include<stdlib.h>
3 #include<vector2.h>
4 #include<movingobject.h>
5 #include<movingobjectmanager.h>
6 #include<screen.h>
7
8 movingobject* newmovingobject(object** shape,
9 void(*onestep)(movingobject* obj),
10 void(*display)(movingobject* obj),
11 int(*bomb)(movingobject* obj),
12 char* name){
13 movingobject* ret = (movingobject*)malloc(sizeof(movingobject));
14 ret->obj = shape;
15 ret->currentobj = *shape;
16 ret->onestep = onestep;
17 ret->display = display;
18 ret->bomb = bomb;
19 ret->cnt = 0;
20 ret->flag = 0;
21 ret->name = name;
22 return ret;
23 }
24
25 void deletemovingobject(movingobject* mobj){
26 free(mobj);
27 }
28
29 void setinitposition(movingobject* mobj, vector2 pos){
30 mobj->pos = pos;
31 }
32
33 void putmovingobject(movingobject* mobj){
34 mobj->display(mobj);
35 }
36
37
38
39
40