Mercurial > hg > Game > Cerium
annotate Renderer/Test/direction.cc @ 755:8aaa29d3e874 draft
add Test/create_task {spe, task}/Property
author | hiroki@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 29 Jan 2010 11:34:43 +0900 |
parents | 18d31d18a6b2 |
children |
rev | line source |
---|---|
539 | 1 #include "SceneGraphRoot.h" |
559 | 2 #include "direction.h" |
539 | 3 |
4 static void | |
653
7a311860a76e
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) |
539 | 6 { |
653
7a311860a76e
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_; |
539 | 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 | |
653
7a311860a76e
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) |
539 | 32 { |
653
7a311860a76e
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_; |
539 | 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 | |
653
7a311860a76e
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) |
539 | 56 { |
57 node->xyz[0] = w/2; | |
58 node->xyz[1] = h/2; | |
59 } | |
60 | |
61 static void | |
653
7a311860a76e
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) |
539 | 63 { |
64 } | |
65 | |
557
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
66 MainLoopPtr |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
67 direction::init(Viewer *sgroot, int screen_w, int screen_h) |
539 | 68 { |
69 SceneGraphPtr dx; | |
70 SceneGraphPtr dy; | |
71 SceneGraphPtr dz; | |
72 SceneGraphPtr back; | |
73 | |
559 | 74 sgroot->createFromXMLfile("xml_file/direction.xml"); |
539 | 75 |
562 | 76 dx = sgroot->createSceneGraph("Dirx"); |
77 dy = sgroot->createSceneGraph("Diry"); | |
78 dz = sgroot->createSceneGraph("Dirz"); | |
539 | 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
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
95 return sgroot; |
539 | 96 } |
557
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
97 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
98 extern Application * |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
99 application() { |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
100 return new direction(); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
101 } |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
102 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
103 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n"; |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
104 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
105 extern int init(TaskManager *manager, int argc, char *argv[]); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
106 extern void task_initialize(); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
107 static void TMend(TaskManager *manager); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
108 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
109 int |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
110 TMmain(TaskManager *manager, int argc, char *argv[]) |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
111 { |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
112 task_initialize(); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
113 manager->set_TMend(TMend); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
114 return init(manager, argc, argv); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
115 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
116 } |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
117 |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
118 void |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
119 TMend(TaskManager *manager) |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
120 { |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
121 printf("test_nogl end\n"); |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
122 } |
764772be1e3c
fix examlples (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
540
diff
changeset
|
123 |