annotate stage_init.cc @ 6:661ec1e92042

set_game_task move to API(SceneGrapRoot).
author tkaito
date Sun, 27 Jun 2010 22:58:57 +0900
parents bcbcee3c6729
children c015109a6041
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
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
22 }
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
23
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
24 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
25 create_title(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
26 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
27 Viewer *sgroot = (Viewer *)sgroot_;
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
28 SceneGraphPtr back1, title;
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
29
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
30 back1 = sgroot->createSceneGraph();
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
31 sgroot->setSceneData(back1);
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
32
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
33 /* createPropertyFromSceneGraph */
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
34 title = sgroot->createSceneGraph("title001");
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
35
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
36 charactor[0].x = w/2;
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
37 charactor[0].y = h/2;
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
38 charactor[0].vx = back1->stack_xyz[0];
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
39 charactor[0].vy = back1->stack_xyz[1];
5
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
40 //charactor[0].frame = back1->frame;
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
41 charactor[0].parent = (void*)back1;
bcbcee3c6729 title done.
tkaito
parents: 4
diff changeset
42 charactor[0].root = (void*)title;
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
43
6
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 5
diff changeset
44 int size = sizeof(ObjPropertyPtr)*16;
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
45
6
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 5
diff changeset
46 /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 5
diff changeset
47 /* DataSegment の List を渡すようにする*/
661ec1e92042 set_game_task move to API(SceneGrapRoot).
tkaito
parents: 5
diff changeset
48 sgroot->set_game_task(TITLE_MOVE, charactor, size, createSceneGraphFromProperty);
3
7b4c2cfeba45 task not move 2%
tkaito
parents: 2
diff changeset
49 }
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
50
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
51 void
4
ccc811ee5f55 property add.
tkaito
parents: 3
diff changeset
52 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
2
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
53 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
54 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
55
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
56 SceneGraphPtr stage = sgroot->createSceneGraph();
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
57 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
58
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
59 mydandy->set_move_collision(dandy_move, dandy_coll);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
60 stage->set_move_collision(stage_move, stage_coll);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
61
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
62 mydandy->xyz[0] = w/2;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
63 mydandy->xyz[1] = h*0.9;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
64 mydandy->xyz[2] = 0.0f;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
65
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
66 stage->addChild(mydandy);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
67 sgroot->setSceneData(stage);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
68 }
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
69
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
70 void
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
71 stage_move(SceneGraphPtr node, void *sgroot_, int w, int h)
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
72 {
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
73
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
74 //stage_plan(node, sgroot_, w, h);
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
75 node->frame += 1;
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
76
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_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree)
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
6e1afe1016dc Task is not yet.
tkaito
parents:
diff changeset
84