annotate TaskManager/Test/test_render/ieshoot.cpp @ 206:dee3b5092a70

add Camera
author gongo@gendarme.cr.ie.u-ryukyu.ac.jp
date Thu, 29 Jan 2009 13:52:47 +0900
parents efb1df3176f4
children 953811245b63
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include "SceneGraphRoot.h"
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include "SGList.h"
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
4 static const float jiki_speed = 6.0f;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
5 static const float jiki_radius = 32.0f;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
6
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
7 static const float tama_speed = 10.0f;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
8 static const float tama_radius = 16.0f;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
9
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
10 static const float boss_radius_x = 64.0f;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
11 static const float boss_radius_y = 128.0f;
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12
205
gongo@localhost.localdomain
parents: 203
diff changeset
13 static const float iebosstama_speed = 15.0f;
gongo@localhost.localdomain
parents: 203
diff changeset
14
gongo@localhost.localdomain
parents: 203
diff changeset
15 static void
gongo@localhost.localdomain
parents: 203
diff changeset
16 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h,
gongo@localhost.localdomain
parents: 203
diff changeset
17 SceneGraphPtr tree);
gongo@localhost.localdomain
parents: 203
diff changeset
18 static void
gongo@localhost.localdomain
parents: 203
diff changeset
19 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h, SceneGraphPtr tree);
gongo@localhost.localdomain
parents: 203
diff changeset
20 static void ieboss_move(SceneGraphPtr node, int screen_w, int screen_h);
gongo@localhost.localdomain
parents: 203
diff changeset
21
gongo@localhost.localdomain
parents: 203
diff changeset
22 static void iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h);
gongo@localhost.localdomain
parents: 203
diff changeset
23
gongo@localhost.localdomain
parents: 203
diff changeset
24
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 static void
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 iejiki_collision(SceneGraphPtr node, int screen_w, int screen_h,
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 SceneGraphPtr tree)
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31 static void
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 ietama_collision(SceneGraphPtr node, int screen_w, int screen_h,
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
33 SceneGraphPtr tree)
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 static void
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
38 ieboss_collision(SceneGraphPtr node, int screen_w, int screen_h,
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
39 SceneGraphPtr tree)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
40 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
41 SceneGraphIteratorPtr it = sgroot->getIterator(tree);
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
42 static int damage = 0;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
43
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 201
diff changeset
44 for (; it->hasNext(IETAMA);) {
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 201
diff changeset
45 it->next(IETAMA);
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
46 SceneGraphPtr tama = it->get();
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
47
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
48 if (node->xyz[0] - boss_radius_x < tama->xyz[0] + tama_radius
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
49 && node->xyz[0] + boss_radius_x > tama->xyz[0] - tama_radius
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
50 && node->xyz[1] + boss_radius_y > tama->xyz[1] - tama_radius) {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
51 tama->remove();
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
52
205
gongo@localhost.localdomain
parents: 203
diff changeset
53 node->set_move_collision(ieboss_move, ieboss_collision_invincibil);
gongo@localhost.localdomain
parents: 203
diff changeset
54
gongo@localhost.localdomain
parents: 203
diff changeset
55 SceneGraphPtr iebosstama = sgroot->createSceneGraph(Earth);
gongo@localhost.localdomain
parents: 203
diff changeset
56 iebosstama->set_move_collision(iebosstama_move, ietama_collision);
gongo@localhost.localdomain
parents: 203
diff changeset
57 iebosstama->xyz[0] = node->xyz[0];
gongo@localhost.localdomain
parents: 203
diff changeset
58 iebosstama->xyz[1] = node->xyz[1] + boss_radius_y;
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
59 //iebosstama->xyz[2] = 50.0f;
205
gongo@localhost.localdomain
parents: 203
diff changeset
60 node->addBrother(iebosstama);
gongo@localhost.localdomain
parents: 203
diff changeset
61
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
62 damage++;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
63 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
64 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
65
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
66 if (damage > 10) {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
67 node->remove();
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
68 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
69 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
70
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
71 static void
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
72 ieboss_move(SceneGraphPtr node, int screen_w, int screen_h)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
73 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
74 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
75 * TODO
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
76 * Boss が複数居た場合、これじゃ駄目
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
77 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
78 static int x_speed = 5.0f;
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
79 static int z_speed = 5.0f;
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
80
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
81 node->xyz[0] += x_speed;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
82
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
83 if (node->xyz[0] - boss_radius_x < 0) {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
84 x_speed = -x_speed;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
85 node->xyz[0] = boss_radius_x;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
86 } else if (node->xyz[0] + boss_radius_x > screen_w) {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
87 x_speed = -x_speed;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
88 node->xyz[0] = screen_w - boss_radius_x;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
89 }
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
90
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
91 //node->xyz[2] += z_speed;
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
92 if (node->xyz[2] >= 100.0f) {
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
93 node->xyz[2] = 99.99f;
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
94 z_speed = -z_speed;
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
95 } else if (node->xyz[2] <= -100.0f) {
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
96 node->xyz[2] = -99.99f;
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
97 z_speed = -z_speed;
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
98 }
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
99 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
100
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
101 static void
205
gongo@localhost.localdomain
parents: 203
diff changeset
102 ieboss_collision_invincibil(SceneGraphPtr node, int screen_w, int screen_h,
gongo@localhost.localdomain
parents: 203
diff changeset
103 SceneGraphPtr tree)
gongo@localhost.localdomain
parents: 203
diff changeset
104 {
gongo@localhost.localdomain
parents: 203
diff changeset
105 static int frame = 0;
gongo@localhost.localdomain
parents: 203
diff changeset
106
gongo@localhost.localdomain
parents: 203
diff changeset
107 frame++;
gongo@localhost.localdomain
parents: 203
diff changeset
108
gongo@localhost.localdomain
parents: 203
diff changeset
109 node->flag_drawable ^= 1;
gongo@localhost.localdomain
parents: 203
diff changeset
110
gongo@localhost.localdomain
parents: 203
diff changeset
111 if (frame > 60) {
gongo@localhost.localdomain
parents: 203
diff changeset
112 frame = 0;
gongo@localhost.localdomain
parents: 203
diff changeset
113 node->flag_drawable = 1;
gongo@localhost.localdomain
parents: 203
diff changeset
114 node->set_move_collision(ieboss_move, ieboss_collision);
gongo@localhost.localdomain
parents: 203
diff changeset
115 }
gongo@localhost.localdomain
parents: 203
diff changeset
116 }
gongo@localhost.localdomain
parents: 203
diff changeset
117
gongo@localhost.localdomain
parents: 203
diff changeset
118 static void
gongo@localhost.localdomain
parents: 203
diff changeset
119 iebosstama_move(SceneGraphPtr node, int screen_w, int screen_h)
gongo@localhost.localdomain
parents: 203
diff changeset
120 {
gongo@localhost.localdomain
parents: 203
diff changeset
121 node->xyz[1] += iebosstama_speed;
gongo@localhost.localdomain
parents: 203
diff changeset
122
gongo@localhost.localdomain
parents: 203
diff changeset
123 // 描画領域から抜けたら削除
gongo@localhost.localdomain
parents: 203
diff changeset
124 if (node->xyz[1] > screen_h) {
gongo@localhost.localdomain
parents: 203
diff changeset
125 node->remove();
gongo@localhost.localdomain
parents: 203
diff changeset
126 }
gongo@localhost.localdomain
parents: 203
diff changeset
127 }
gongo@localhost.localdomain
parents: 203
diff changeset
128
gongo@localhost.localdomain
parents: 203
diff changeset
129 static void
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
130 ietama_move(SceneGraphPtr node, int screen_w, int screen_h)
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
131 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
132 node->xyz[1] -= tama_speed;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
133
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
134 // 描画領域から抜けたら削除
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
135 if (node->xyz[1] < 0) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
136 node->remove();
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
137 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
138 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
139
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
140 static void
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
141 iejiki_move(SceneGraphPtr node, int screen_w, int screen_h)
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
142 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
143 Pad *pad = sgroot->getController();
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
144
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
145 if (pad->left.isPush()
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
146 || pad->left.isHold()) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
147 node->xyz[0] -= jiki_speed;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
148
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
149 if (node->xyz[0] - jiki_radius< 0) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
150 node->xyz[0] = jiki_radius;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
151 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
152 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
153
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
154 if (pad->right.isPush()
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
155 || pad->right.isHold()) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
156 node->xyz[0] += jiki_speed;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
157
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
158 if (node->xyz[0] + jiki_radius > screen_w) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
159 node->xyz[0] = screen_w - jiki_radius;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
160 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
161 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
162
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
163 if (pad->up.isPush()
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
164 || pad->up.isHold()) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
165 node->xyz[1] -= jiki_speed;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
166
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
167 if (node->xyz[1] - jiki_radius < 0) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
168 node->xyz[1] = jiki_radius;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
169 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
170 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
171
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
172 if (pad->down.isPush()
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
173 || pad->down.isHold()) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
174 node->xyz[1] += jiki_speed;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
175
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
176 if (node->xyz[1] + jiki_radius > screen_h) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
177 node->xyz[1] = screen_h - jiki_radius;
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
178 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
179 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
180
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
181 if (pad->circle.isPush()) {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
182 SceneGraphPtr ietama = sgroot->createSceneGraph(IETAMA);
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
183 ietama->set_move_collision(ietama_move, ietama_collision);
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
184 ietama->xyz[0] = node->xyz[0];
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
185 ietama->xyz[1] = node->xyz[1];
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
186 node->addBrother(ietama);
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
187 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
188 }
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
189
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
190
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
191 void
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
192 ieshoot_init(void)
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
193 {
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
194 SceneGraphPtr iejiki;
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
195 SceneGraphPtr enemy;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
196 SceneGraphPtr back;
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
197
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
198 sgroot->createFromXMLfile("xml_file/ietama.xml");
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
199 sgroot->createFromXMLfile("xml_file/ieboss.xml");
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
200 sgroot->createFromXMLfile("xml_file/iejiki.xml");
205
gongo@localhost.localdomain
parents: 203
diff changeset
201 sgroot->createFromXMLfile("xml_file/universe.xml");
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
202
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
203 back = sgroot->createSceneGraph();
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
204
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
205 iejiki = sgroot->createSceneGraph(IEJIKI);
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
206 iejiki->set_move_collision(iejiki_move, iejiki_collision);
206
dee3b5092a70 add Camera
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 205
diff changeset
207 iejiki->xyz[2] = 20;
203
5c6c9667ac61 fix CreateSpan::run
gongo@localhost.localdomain
parents: 202
diff changeset
208 back->addChild(iejiki);
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
209
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
210 enemy = sgroot->createSceneGraph(IEBOSS);
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
211 enemy->set_move_collision(ieboss_move, ieboss_collision);
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
212 enemy->xyz[1] = boss_radius_y;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
213 back->addChild(enemy);
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
214
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 199
diff changeset
215 sgroot->setSceneData(back);
199
eb20274baa7c add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
216 }