Mercurial > hg > Members > kono > Cerium
annotate Renderer/Test/direction.cc @ 864:8323230d766b
edit Renderer/Test/Makefile for ProtocolBuffers (please install ProtocolBuffers)
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Jun 2010 12:08:14 +0900 |
parents | 4dc02d3e98bb |
children |
rev | line source |
---|---|
507 | 1 #include "SceneGraphRoot.h" |
559 | 2 #include "direction.h" |
507 | 3 |
4 static void | |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
5 x_move(SceneGraphPtr node, void *sgroot_, int w, int h) |
507 | 6 { |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
7 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
507 | 8 Pad *pad = sgroot->getController(); |
9 | |
10 node->xyz[0] = w/2; | |
11 node->xyz[1] = h/2; | |
12 | |
13 if (pad->circle.isPush() || pad->circle.isHold()) { | |
14 node->angle[1] += 10.0f; | |
15 if (node->angle[1] > 360.0f) node->angle[1] = 0.0f; | |
16 } | |
17 | |
18 if (pad->triangle.isPush() || pad->triangle.isHold()) { | |
19 node->angle[0] += 10.0f; | |
20 if (node->angle[0] > 360.0f) node->angle[0] = 0.0f; | |
21 } | |
22 | |
23 if (pad->start.isPush()) { | |
24 node->angle[0] = 0.0f; | |
25 node->angle[1] = 90.0f; | |
26 } | |
27 | |
28 } | |
29 | |
30 static void | |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
31 y_move(SceneGraphPtr node, void *sgroot_, int w, int h) |
507 | 32 { |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
33 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; |
507 | 34 Pad *pad = sgroot->getController(); |
35 | |
36 node->xyz[0] = w/2; | |
37 node->xyz[1] = h/2; | |
38 | |
39 if (pad->cross.isPush() || pad->cross.isHold()) { | |
40 node->angle[2] += 10.0f; | |
41 } | |
42 | |
43 if (pad->square.isPush() || pad->square.isHold()) { | |
44 node->angle[0] += 10.0f; | |
45 } | |
46 | |
47 if (pad->start.isPush()) { | |
48 node->angle[0] = 90.0f; | |
49 node->angle[1] = 0.0f; | |
50 } | |
51 | |
52 } | |
53 | |
54 static void | |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
55 z_move(SceneGraphPtr node, void *sgroot_, int w, int h) |
507 | 56 { |
57 node->xyz[0] = w/2; | |
58 node->xyz[1] = h/2; | |
59 } | |
60 | |
61 static void | |
656
d0b8860c17f8
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
562
diff
changeset
|
62 dir_collision(SceneGraphPtr node, void *sgroot_, int w, int h, SceneGraphPtr tree) |
507 | 63 { |
64 } | |
65 | |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
66 MainLoopPtr |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
67 direction::init(Viewer *sgroot, int screen_w, int screen_h) |
507 | 68 { |
69 SceneGraphPtr dx; | |
70 SceneGraphPtr dy; | |
71 SceneGraphPtr dz; | |
72 SceneGraphPtr back; | |
73 | |
559 | 74 sgroot->createFromXMLfile("xml_file/direction.xml"); |
507 | 75 |
562 | 76 dx = sgroot->createSceneGraph("Dirx"); |
77 dy = sgroot->createSceneGraph("Diry"); | |
78 dz = sgroot->createSceneGraph("Dirz"); | |
507 | 79 back = sgroot->createSceneGraph(); |
80 | |
81 back->addChild(dx); | |
82 back->addChild(dy); | |
83 back->addChild(dz); | |
84 | |
85 dx->set_move_collision(x_move, dir_collision); | |
86 dx->angle[1] = 90.0f; | |
87 dy->set_move_collision(y_move, dir_collision); | |
88 dy->angle[0] = 90.0f; | |
89 dz->set_move_collision(z_move, dir_collision); | |
90 | |
91 back->angle[0] = 30.0f; | |
92 back->angle[1] = -30.0f; | |
93 | |
94 sgroot->setSceneData(back); | |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
95 return sgroot; |
507 | 96 } |
557
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
97 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
98 extern Application * |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
99 application() { |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
100 return new direction(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
101 } |
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 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
|
104 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
105 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
|
106 extern void task_initialize(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
107 static void TMend(TaskManager *manager); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
108 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
109 int |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
110 TMmain(TaskManager *manager, int argc, char *argv[]) |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
111 { |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
112 task_initialize(); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
113 manager->set_TMend(TMend); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
114 return init(manager, argc, argv); |
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 } |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
117 |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
118 void |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
119 TMend(TaskManager *manager) |
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 printf("test_nogl end\n"); |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
122 } |
ec72b601b71f
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
508
diff
changeset
|
123 |