annotate stage_init.cc @ 5:bcbcee3c6729

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