212
|
1 #include "SceneGraphRoot.h"
|
|
2 #include "SGList.h"
|
|
3
|
|
4 static void
|
|
5 x_move(SceneGraphPtr node, int w, int h)
|
|
6 {
|
|
7 Pad *pad = sgroot->getController();
|
|
8
|
|
9 node->xyz[0] = w/2;
|
|
10 node->xyz[1] = h/2;
|
|
11
|
|
12 if (pad->circle.isPush() || pad->circle.isHold()) {
|
|
13 node->angle[1] += 10.0f;
|
|
14 if (node->angle[1] > 360.0f) node->angle[1] = 0.0f;
|
|
15 }
|
|
16
|
|
17 if (pad->triangle.isPush() || pad->triangle.isHold()) {
|
|
18 node->angle[0] += 10.0f;
|
|
19 if (node->angle[0] > 360.0f) node->angle[0] = 0.0f;
|
|
20 }
|
|
21
|
|
22 if (pad->start.isPush()) {
|
|
23 node->angle[0] = 0.0f;
|
|
24 node->angle[1] = 90.0f;
|
|
25 }
|
|
26
|
|
27 }
|
|
28
|
|
29 static void
|
|
30 y_move(SceneGraphPtr node, int w, int h)
|
|
31 {
|
|
32 Pad *pad = sgroot->getController();
|
|
33
|
|
34 node->xyz[0] = w/2;
|
|
35 node->xyz[1] = h/2;
|
|
36
|
|
37 if (pad->cross.isPush() || pad->cross.isHold()) {
|
|
38 node->angle[2] += 10.0f;
|
|
39 }
|
|
40
|
|
41 if (pad->square.isPush() || pad->square.isHold()) {
|
|
42 node->angle[0] += 10.0f;
|
|
43 }
|
|
44
|
|
45 if (pad->start.isPush()) {
|
|
46 node->angle[0] = 90.0f;
|
|
47 node->angle[1] = 0.0f;
|
|
48 }
|
|
49
|
|
50 }
|
|
51
|
|
52 static void
|
|
53 z_move(SceneGraphPtr node, int w, int h)
|
|
54 {
|
|
55 node->xyz[0] = w/2;
|
|
56 node->xyz[1] = h/2;
|
|
57 }
|
|
58
|
|
59 static void
|
|
60 dir_collision(SceneGraphPtr node, int w, int h, SceneGraphPtr tree)
|
|
61 {
|
|
62 }
|
|
63
|
|
64 void
|
|
65 direction_init(void)
|
|
66 {
|
|
67 SceneGraphPtr dx;
|
|
68 SceneGraphPtr dy;
|
|
69 SceneGraphPtr dz;
|
|
70 SceneGraphPtr back;
|
|
71
|
|
72 sgroot->createFromXMLfile("xml_file/direction.xml");
|
|
73
|
|
74 dx = sgroot->createSceneGraph(Dirx);
|
|
75 dy = sgroot->createSceneGraph(Diry);
|
|
76 dz = sgroot->createSceneGraph(Dirz);
|
|
77 back = sgroot->createSceneGraph();
|
|
78
|
|
79 back->addChild(dx);
|
|
80 back->addChild(dy);
|
|
81 back->addChild(dz);
|
|
82
|
|
83 dx->set_move_collision(x_move, dir_collision);
|
|
84 dx->angle[1] = 90.0f;
|
|
85 dy->set_move_collision(y_move, dir_collision);
|
|
86 dy->angle[0] = 90.0f;
|
|
87 dz->set_move_collision(z_move, dir_collision);
|
|
88
|
|
89 back->angle[0] = 30.0f;
|
|
90 back->angle[1] = -30.0f;
|
|
91
|
|
92 sgroot->setSceneData(back);
|
|
93 }
|