annotate TaskManager/Test/test_render/direction.cpp @ 243:c4918a1fb6c9 draft

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