annotate stage_init.cc @ 4:ccc811ee5f55

property add.
author tkaito
date Mon, 21 Jun 2010 03:23:55 +0900
parents 7b4c2cfeba45
children bcbcee3c6729
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
1 #include "dandy.h"
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
3 void stage_move(SceneGraphPtr node, void *sgroot_, int w, int h);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
4 void stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
5
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
6 void
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
7 createSceneGraphFromProperty(SchedTask *s, void *charactor_, void *b)
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
8 {
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
9 ObjPropertyPtr charactor1 = (ObjPropertyPtr)charactor_;
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
10
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
11
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
12
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
13 //printf("charactor.x = %d\n", charactor1[0].frame);
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
14
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
15 }
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
16
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
17 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
18 create_title(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
19 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
20 Viewer *sgroot = (Viewer *)sgroot_;
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
21 SceneGraphPtr back1; //title;
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
22
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
23 back1 = sgroot->createSceneGraph();
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
24 //back->set_move_collision(back_move, back_coll);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
25 sgroot->setSceneData(back1);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
26 /* createPropertyFromSceneGraph */
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
27 //charactor[0].x = back1->xyz[0];
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
28 charactor[0].x = w/2;
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
29 //charactor[0].y = back1->xyz[1];
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
30 charactor[0].y = h/2;
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
31 charactor[0].vx = back1->stack_xyz[0];
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
32 charactor[0].vy = back1->stack_xyz[1];
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
33 charactor[0].frame = back1->frame;
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
34 charactor[0].root = (void*)back1;
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
35 charactor[0].frame = 4;
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
36
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
37 /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
38 HTask *back;
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
39
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
40 back = sgroot->manager->create_task(TITLE_MOVE);
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
41 back->set_cpu(SPE_ANY);
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
42 back->add_inData(charactor, sizeof(ObjPropertyPtr)*16);
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
43 back->add_outData(charactor, sizeof(ObjPropertyPtr)*16);
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
44 back->add_param((memaddr)1);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
45 back->set_post(createSceneGraphFromProperty, (void*)charactor, 0);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
46 back->spawn();
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
47 }
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
48
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
49 //title = sgroot->createSceneGraph("title001");
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
50 //title->xyz[0] = w/2;
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
51 //title->xyz[1] = h/2;
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
52 //back->addChild(title);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
53
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
54
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
55 //title->set_move_collision(title_move, title_coll);
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
56
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
57
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
58
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
59
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
60 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
61 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
62 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
63 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
64
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
65 SceneGraphPtr stage = sgroot->createSceneGraph();
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
66 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
67
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
68 mydandy->set_move_collision(dandy_move, dandy_coll);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
69 stage->set_move_collision(stage_move, stage_coll);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
70
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
71 mydandy->xyz[0] = w/2;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
72 mydandy->xyz[1] = h*0.9;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
73 mydandy->xyz[2] = 0.0f;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
74
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
75 stage->addChild(mydandy);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
76 sgroot->setSceneData(stage);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
77 }
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
78
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
79 void
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
80 stage_move(SceneGraphPtr node, void *sgroot_, int w, int h)
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
81 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
82
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
83 //stage_plan(node, sgroot_, w, h);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
84 node->frame += 1;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
85
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
86 }
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
87
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
88 void
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
89 stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree)
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
90 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
91 }
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
92
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
93