Mercurial > hg > Members > tkaito > task_dandy
annotate stage_init.cc @ 27:34fde39c0a31
commit test.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 10 Dec 2010 02:57:29 +0900 |
parents | 6bea374ee604 a131729d6e4d |
children |
rev | line source |
---|---|
2 | 1 #include "dandy.h" |
2 | |
26 | 3 HTaskPtr |
4 pad_alloc(Viewer *sgroot) | |
5 { | |
6 HTaskPtr task = sgroot->manager->create_task(PAD_ALLOCATE); | |
7 void *pad = (void*)sgroot->getController(); | |
8 int size = sizeof(Pad); | |
2 | 9 |
26 | 10 task->set_param(0, PAD_INPUT); |
11 task->set_param(1, size); | |
12 task->add_inData(pad, size); | |
13 task->set_cpu(SPE_ANY); | |
14 task->spawn(); | |
15 | |
16 return task; | |
17 } | |
18 | |
19 HTaskPtr | |
20 pad_update(SceneGraphRoot *sgroot) | |
21 | 21 { |
26 | 22 HTaskPtr task = sgroot->tmanager->create_task(PAD_UPDATE); |
23 void *pad = (void*)sgroot->getController(); | |
24 int size = sizeof(Pad); | |
25 | |
26 task->set_param(0, PAD_INPUT); | |
27 task->set_param(1, size); | |
28 task->add_inData(pad, size); | |
29 task->set_cpu(SPE_ANY); | |
30 task->spawn(); | |
21 | 31 |
26 | 32 return task; |
33 } | |
34 | |
35 HTaskPtr | |
27 | 36 pad_free(SceneGraphRoot *sgroot) |
26 | 37 { |
27 | 38 HTaskPtr task = sgroot->tmanager->create_task(PAD_FREE); |
26 | 39 |
40 task->set_param(0, PAD_INPUT); | |
41 task->set_cpu(SPE_ANY); | |
42 task->spawn(); | |
43 | |
44 return task; | |
21 | 45 } |
46 | |
47 void | |
26 | 48 title_move(SceneGraphPtr node, void *sgroot_, int w, int h) |
3 | 49 { |
26 | 50 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
5 | 51 |
26 | 52 HTaskPtr update = pad_update(sgroot); |
53 HTaskPtr title_task = sgroot->tmanager->create_task(TITLE_MOVE); | |
54 int size = sizeof(ObjProperty); | |
55 title_task->set_param(0, PAD_INPUT); | |
56 title_task->add_inData((void *)&charactor[0], size); | |
57 title_task->add_outData((void *)&charactor[0], size); | |
58 title_task->set_cpu(SPE_ANY); | |
59 title_task->wait_for(update); | |
60 title_task->spawn(); | |
4 | 61 } |
62 | |
3 | 63 void |
11 | 64 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
|
65 { |
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
66 Viewer *sgroot = sgroot_; |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
67 SceneGraphPtr root = sgroot->createSceneGraph(); |
3 | 68 |
21 | 69 SceneGraphPtr title = (SceneGraphPtr)charactor[0].root; |
27 | 70 title->set_move_collision(title_move); |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
71 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
|
72 charactor[0].y = h/2; |
24 | 73 charactor[0].vx = 1.0; |
74 charactor[0].vy = 1.0; | |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
75 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
|
76 charactor[0].parent = (void*)root; |
26 | 77 |
19
632ce41a842a
testing game task with pad's input
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
78 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
|
79 title->xyz[1] = charactor[0].y; |
26 | 80 title->set_move_collision(title_move); |
21 | 81 |
26 | 82 pad_alloc(sgroot); |
23
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
83 root->addChild(title); |
3fb8a6a34e24
debug and keep up with task_array
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
84 sgroot->setSceneData(root); |
3 | 85 } |