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