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
|
|
22 //charactor[0].frame;
|
3
|
23
|
4
|
24 //printf("charactor.x = %d\n", charactor1[0].frame);
|
|
25
|
|
26 }
|
|
27
|
3
|
28 void
|
4
|
29 create_title(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
|
2
|
30 {
|
|
31 Viewer *sgroot = (Viewer *)sgroot_;
|
5
|
32 SceneGraphPtr back1, title;
|
3
|
33
|
5
|
34 back1 = sgroot->createSceneGraph();
|
3
|
35 sgroot->setSceneData(back1);
|
5
|
36
|
3
|
37 /* createPropertyFromSceneGraph */
|
5
|
38 title = sgroot->createSceneGraph("title001");
|
|
39
|
4
|
40 charactor[0].x = w/2;
|
|
41 charactor[0].y = h/2;
|
3
|
42 charactor[0].vx = back1->stack_xyz[0];
|
|
43 charactor[0].vy = back1->stack_xyz[1];
|
5
|
44 //charactor[0].frame = back1->frame;
|
|
45 charactor[0].parent = (void*)back1;
|
|
46 charactor[0].root = (void*)title;
|
4
|
47
|
|
48 /* set_game_task(int id, ObjProperty property, int size, PostFunction post_func) */
|
3
|
49 HTask *back;
|
4
|
50
|
|
51 back = sgroot->manager->create_task(TITLE_MOVE);
|
3
|
52 back->set_cpu(SPE_ANY);
|
4
|
53 back->add_inData(charactor, sizeof(ObjPropertyPtr)*16);
|
|
54 back->add_outData(charactor, sizeof(ObjPropertyPtr)*16);
|
3
|
55 back->add_param((memaddr)1);
|
|
56 back->set_post(createSceneGraphFromProperty, (void*)charactor, 0);
|
|
57 back->spawn();
|
|
58 }
|
2
|
59
|
3
|
60 //title->xyz[0] = w/2;
|
|
61 //title->xyz[1] = h/2;
|
|
62
|
|
63
|
|
64 //title->set_move_collision(title_move, title_coll);
|
|
65
|
|
66
|
|
67
|
2
|
68
|
|
69 void
|
4
|
70 create_stage(void *sgroot_, int w, int h, ObjPropertyPtr charactor)
|
2
|
71 {
|
|
72 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
|
|
73
|
|
74 SceneGraphPtr stage = sgroot->createSceneGraph();
|
|
75 SceneGraphPtr mydandy = sgroot->createSceneGraph("mydandy");
|
|
76
|
|
77 mydandy->set_move_collision(dandy_move, dandy_coll);
|
|
78 stage->set_move_collision(stage_move, stage_coll);
|
|
79
|
|
80 mydandy->xyz[0] = w/2;
|
|
81 mydandy->xyz[1] = h*0.9;
|
|
82 mydandy->xyz[2] = 0.0f;
|
|
83
|
|
84 stage->addChild(mydandy);
|
|
85 sgroot->setSceneData(stage);
|
|
86 }
|
|
87
|
|
88 void
|
|
89 stage_move(SceneGraphPtr node, void *sgroot_, int w, int h)
|
|
90 {
|
|
91
|
|
92 //stage_plan(node, sgroot_, w, h);
|
|
93 node->frame += 1;
|
|
94
|
|
95 }
|
|
96
|
|
97 void
|
|
98 stage_coll(SceneGraphPtr node, void *sgroot_, int w, int h,SceneGraphPtr tree)
|
|
99 {
|
|
100 }
|
|
101
|
|
102
|