Mercurial > hg > Members > tkaito > task_dandy
annotate stage_init.cc @ 21:fd9deaa67de9
debug done.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 18 Oct 2010 02:52:52 +0900 |
parents | 632ce41a842a |
children | 3fb8a6a34e24 |
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_; | |
7 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root; | |
8 | |
9 crab->xyz[0] = charactor[1].x; | |
10 crab->xyz[1] = charactor[1].y; | |
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_; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
29 SceneGraphPtr back; |
21 | 30 back = sgroot->createSceneGraph(); |
3 | 31 |
21 | 32 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
|
33 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
|
34 charactor[0].y = h/2; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
35 charactor[0].vx = 1.0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
36 charactor[0].vy = 1.0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
37 charactor[0].flag = 0; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
38 charactor[0].parent = (void*)back; |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
39 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
40 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
|
41 title->xyz[1] = charactor[0].y; |
21 | 42 |
43 SceneGraphPtr crab = (SceneGraphPtr)charactor[1].root; | |
44 charactor[1].x = 0.0; | |
45 charactor[1].y = 0.0; | |
46 charactor[1].vx = 1.0; | |
47 charactor[1].vy = 1.0; | |
48 charactor[1].flag = 0; | |
49 charactor[1].parent = (void*)back; | |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
50 |
21 | 51 crab->xyz[0] = charactor[1].x; |
52 crab->xyz[1] = charactor[1].y; | |
53 | |
54 back->addChild(title); | |
55 // back->addChild(crab); | |
56 sgroot->setSceneData(back); | |
57 | |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
58 int size = sizeof(ObjProperty); |
21 | 59 // sgroot->set_pad_task(crab, CRAB_MOVE, (void*)&charactor[1], size, create_crab); |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
60 sgroot->set_pad_task(title, TITLE_MOVE, (void*)&charactor[0], size, create_title); |
3 | 61 } |
2 | 62 |
7 | 63 |
2 | 64 void |
4 | 65 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor) |
2 | 66 { |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
67 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
2 | 68 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
69 SceneGraphPtr stage = sgroot->createSceneGraph(); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
70 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
|
71 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
72 //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
|
73 //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
|
74 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
79 stage->addChild(mydandy); |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
80 sgroot->setSceneData(stage); |
2 | 81 } |