2
|
1 #include "dandy.h"
|
|
2
|
|
3 void stage_move(SceneGraphPtr node, void *sgroot_, int w, int h);
|
|
4 void stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree);
|
|
5
|
|
6 void
|
3
|
7 createSceneGraphFromProperty(SchedTask *s, void *charactor_, void *b)
|
|
8 {
|
5
|
9 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;
|
|
10 SceneGraphPtr back1, title;
|
|
11 back1 = (SceneGraphPtr)charactor[0].parent;
|
|
12 title = (SceneGraphPtr)charactor[0].root;
|
4
|
13
|
3
|
14
|
5
|
15 title->xyz[0] = charactor[0].x;
|
|
16 title->xyz[1] = charactor[0].y;
|
|
17 title->stack_xyz[0] = charactor[0].vx;
|
|
18 title->stack_xyz[1] = charactor[0].vy;
|
|
19
|
|
20 back1->addChild(title);
|
|
21
|
4
|
22 }
|
|
23
|
3
|
24 void
|
4
|
25 create_title(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
|
2
|
26 {
|
|
27 Viewer *sgroot = (Viewer *)sgroot_;
|
5
|
28 SceneGraphPtr back1, title;
|
3
|
29
|
5
|
30 back1 = sgroot->createSceneGraph();
|
3
|
31 sgroot->setSceneData(back1);
|
5
|
32
|
3
|
33 /* createPropertyFromSceneGraph */
|
5
|
34 title = sgroot->createSceneGraph("title001");
|
|
35
|
4
|
36 charactor[0].x = w/2;
|
|
37 charactor[0].y = h/2;
|
3
|
38 charactor[0].vx = back1->stack_xyz[0];
|
|
39 charactor[0].vy = back1->stack_xyz[1];
|
5
|
40 //charactor[0].frame = back1->frame;
|
|
41 charactor[0].parent = (void*)back1;
|
|
42 charactor[0].root = (void*)title;
|
4
|
43
|
6
|
44 int size = sizeof(ObjPropertyPtr)*16;
|
4
|
45
|
6
|
46 /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
|
|
47 /* DataSegment の List を渡すようにする*/
|
|
48 sgroot->set_game_task(TITLE_MOVE, charactor, size, createSceneGraphFromProperty);
|
3
|
49 }
|
2
|
50
|
|
51 void
|
4
|
52 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
|
2
|
53 {
|
|
54 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
|
|
55
|
|
56 SceneGraphPtr stage = sgroot->createSceneGraph();
|
|
57 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
|
|
58
|
|
59 mydandy->set_move_collision(dandy_move, dandy_coll);
|
|
60 stage->set_move_collision(stage_move, stage_coll);
|
|
61
|
|
62 mydandy->xyz[0] = w/2;
|
|
63 mydandy->xyz[1] = h*0.9;
|
|
64 mydandy->xyz[2] = 0.0f;
|
|
65
|
|
66 stage->addChild(mydandy);
|
|
67 sgroot->setSceneData(stage);
|
|
68 }
|
|
69
|
|
70 void
|
|
71 stage_move(SceneGraphPtr node, void *sgroot_, int w, int h)
|
|
72 {
|
|
73
|
|
74 //stage_plan(node, sgroot_, w, h);
|
|
75 node->frame += 1;
|
|
76
|
|
77 }
|
|
78
|
|
79 void
|
|
80 stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree)
|
|
81 {
|
|
82 }
|
|
83
|
|
84
|