Mercurial > hg > Members > kono > Cerium
annotate Renderer/Test/direction.cc @ 638:671fca057ad3
hmmmm
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 19 Nov 2009 18:18:20 +0900 |
parents | a5fda4e51498 |
children | d0b8860c17f8 |
rev | line source |
---|---|
507 | 1 #include "SceneGraphRoot.h" |
559 | 2 #include "direction.h" |
507 | 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 | |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
64 MainLoopPtr |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
65 direction::init(Viewer *sgroot, int screen_w, int screen_h) |
507 | 66 { |
67 SceneGraphPtr dx; | |
68 SceneGraphPtr dy; | |
69 SceneGraphPtr dz; | |
70 SceneGraphPtr back; | |
71 | |
559 | 72 sgroot->createFromXMLfile("xml_file/direction.xml"); |
507 | 73 |
562 | 74 dx = sgroot->createSceneGraph("Dirx"); |
75 dy = sgroot->createSceneGraph("Diry"); | |
76 dz = sgroot->createSceneGraph("Dirz"); | |
507 | 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); | |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
93 return sgroot; |
507 | 94 } |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
95 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
96 extern Application * |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
97 application() { |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
98 return new direction(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
99 } |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
100 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
101 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n"; |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
102 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
103 extern int init(TaskManager *manager, int argc, char *argv[]); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
104 extern void task_initialize(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
105 static void TMend(TaskManager *manager); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
106 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
107 int |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
108 TMmain(TaskManager *manager, int argc, char *argv[]) |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
109 { |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
110 task_initialize(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
111 manager->set_TMend(TMend); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
112 return init(manager, argc, argv); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
113 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
114 } |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
115 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
116 void |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
117 TMend(TaskManager *manager) |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
118 { |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
119 printf("test_nogl end\n"); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
120 } |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
121 |