Mercurial > hg > Members > tkaito > task_dandy
annotate stage_init.cc @ 23:3fb8a6a34e24
debug and keep up with task_array
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Oct 2010 17:28:56 +0900 |
parents | fd9deaa67de9 |
children | a131729d6e4d 6bea374ee604 |
rev | line source |
---|---|
2 | 1 #include "dandy.h" |
2 | |
7 | 3 void |
21 | 4 create_crab(SchedTask *s, void *charactor_, void *b) |
5 { | |
6 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; | |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
7 SceneGraphPtr crab = (SceneGraphPtr)charactor->root; |
21 | 8 |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
9 crab->xyz[0] = charactor->x; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
10 crab->xyz[1] = charactor->y; |
21 | 11 } |
12 | |
13 void | |
7 | 14 create_title(SchedTask *s, void *charactor_, void *b) |
3 | 15 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
16 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_; |
21 | 17 SceneGraphPtr title = (SceneGraphPtr)charactor->root; |
5 | 18 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
19 if (charactor->flag == 1) { |
21 | 20 title->remove(); |
21 charactor->flag = 0; | |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
22 } |
4 | 23 } |
24 | |
3 | 25 void |
11 | 26 create_title_back(Viewer *sgroot_, int w, int h) |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
27 { |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
28 Viewer *sgroot = sgroot_; |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
29 SceneGraphPtr root = sgroot->createSceneGraph(); |
3 | 30 |
21 | 31 SceneGraphPtr title = (SceneGraphPtr)charactor[0].root; |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
32 charactor[0].x = w/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
33 charactor[0].y = h/2; |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
34 charactor[0].vx = 0.0; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
35 charactor[0].vy = 0.0; |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
36 charactor[0].flag = 0; |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
37 charactor[0].parent = (void*)root; |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
38 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
39 title->xyz[0] = charactor[0].x; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
40 title->xyz[1] = charactor[0].y; |
21 | 41 |
42 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root; | |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
43 charactor[1].x = w/2; |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
44 charactor[1].y = h/2; |
21 | 45 charactor[1].vx = 1.0; |
46 charactor[1].vy = 1.0; | |
47 charactor[1].flag = 0; | |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
48 charactor[1].parent = (void*)root; |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
49 |
21 | 50 crab->xyz[0] = charactor[1].x; |
51 crab->xyz[1] = charactor[1].y; | |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
52 crab->flag_drawable = 0; |
21 | 53 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
54 int size = sizeof(ObjProperty); |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
55 sgroot->task_array_init(TITLE_MOVE, TASK_NUM, PARAMETER, INDATA_NUM, OUTDATA_NUM); |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
56 sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title); |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
57 sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
58 |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
59 root->addChild(title); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
60 root->addChild(crab); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
61 sgroot->setSceneData(root); |
3 | 62 } |
2 | 63 |
7 | 64 |
2 | 65 void |
4 | 66 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor) |
2 | 67 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
68 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
2 | 69 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
70 SceneGraphPtr stage = sgroot->createSceneGraph(); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
71 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy"); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
72 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
73 //mydandy->set_move_collision(dandy_move, dandy_coll); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
74 //stage->set_move_collision(stage_move, stage_coll); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
75 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
76 mydandy->xyz[0] = w/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
77 mydandy->xyz[1] = h*0.9; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
78 mydandy->xyz[2] = 0.0f; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
79 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
80 stage->addChild(mydandy); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
81 sgroot->setSceneData(stage); |
2 | 82 } |