2
|
1 #include "dandy.h"
|
|
2
|
7
|
3 void
|
|
4 back_move(SceneGraphPtr node, void *sgroot_, int w, int h)
|
|
5 {
|
|
6 schedule(node, sgroot_, w, h);
|
|
7 node->frame += 1;
|
|
8 }
|
2
|
9
|
|
10 void
|
7
|
11 back_coll(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree)
|
|
12 {
|
|
13 }
|
|
14
|
|
15 void
|
|
16 create_title(SchedTask *s, void *charactor_, void *b)
|
3
|
17 {
|
5
|
18 ObjPropertyPtr charactor = (ObjPropertyPtr)charactor_;
|
|
19 SceneGraphPtr back1, title;
|
|
20 back1 = (SceneGraphPtr)charactor[0].parent;
|
|
21 title = (SceneGraphPtr)charactor[0].root;
|
4
|
22
|
5
|
23 title->xyz[0] = charactor[0].x;
|
|
24 title->xyz[1] = charactor[0].y;
|
|
25
|
|
26 back1->addChild(title);
|
|
27
|
4
|
28 }
|
|
29
|
3
|
30 void
|
7
|
31 create_back(void *sgroot_, int w, int h)
|
2
|
32 {
|
|
33 Viewer *sgroot = (Viewer *)sgroot_;
|
7
|
34 SceneGraphPtr back;
|
3
|
35
|
7
|
36 back = sgroot->createSceneGraph();
|
|
37 back->set_move_collision(back_move, back_coll);
|
|
38 sgroot->setSceneData(back);
|
5
|
39
|
4
|
40 charactor[0].x = w/2;
|
|
41 charactor[0].y = h/2;
|
7
|
42 charactor[0].parent = (void*)back;
|
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) */
|
7
|
47 sgroot->set_game_task(TITLE_MOVE, charactor, size, create_title);
|
|
48
|
3
|
49 }
|
2
|
50
|
7
|
51
|
2
|
52 void
|
4
|
53 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
|
2
|
54 {
|
|
55 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
|
|
56
|
|
57 SceneGraphPtr stage = sgroot->createSceneGraph();
|
|
58 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
|
|
59
|
7
|
60 //mydandy->set_move_collision(dandy_move, dandy_coll);
|
|
61 //stage->set_move_collision(stage_move, stage_coll);
|
2
|
62
|
|
63 mydandy->xyz[0] = w/2;
|
|
64 mydandy->xyz[1] = h*0.9;
|
|
65 mydandy->xyz[2] = 0.0f;
|
|
66
|
|
67 stage->addChild(mydandy);
|
|
68 sgroot->setSceneData(stage);
|
|
69 }
|
|
70
|