comparison Renderer/Test/network.cc @ 975:c48e3866f85f draft

player is center in camera
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 01 Oct 2010 19:26:10 +0900
parents 6e6d5a2ffe52
children 3a648f8f5d77
comparison
equal deleted inserted replaced
974:6e6d5a2ffe52 975:c48e3866f85f
165 Pad *pad = sgroot->getController(); 165 Pad *pad = sgroot->getController();
166 int flag = 0; 166 int flag = 0;
167 if (pad->right.isHold() || pad->left.isHold()) { 167 if (pad->right.isHold() || pad->left.isHold()) {
168 if (pad->right.isHold()) { 168 if (pad->right.isHold()) {
169 node->xyz[0] += 5.0f; 169 node->xyz[0] += 5.0f;
170 sgroot->camera->xyz[0] = node->xyz[0];
170 // node->angle[1] = 0.0f; 171 // node->angle[1] = 0.0f;
171 flag = 1; 172 flag = 1;
172 } else if (pad->left.isHold()) { 173 } else if (pad->left.isHold()) {
173 node->xyz[0] -= 5.0f; 174 node->xyz[0] -= 5.0f;
175 sgroot->camera->xyz[0] = node->xyz[0];
174 // node->angle[1] = 180.0f; 176 // node->angle[1] = 180.0f;
175 flag = 1; 177 flag = 1;
176 } 178 }
177 } 179 }
178 180
179 if (pad->down.isHold() || pad->up.isHold() ) { 181 if (pad->down.isHold() || pad->up.isHold() ) {
180 if (pad->down.isHold()) { 182 if (pad->down.isHold()) {
181 node->xyz[1] += 5.0f; 183 node->xyz[1] += 5.0f;
184 sgroot->camera->xyz[1] = node->xyz[1];
182 flag = 1; 185 flag = 1;
183 } else if (pad->up.isHold()) { 186 } else if (pad->up.isHold()) {
184 node->xyz[1] -= 5.0f; 187 node->xyz[1] -= 5.0f;
188 sgroot->camera->xyz[1] = node->xyz[1];
185 flag = 1; 189 flag = 1;
186 } 190 }
187 } 191 }
188 192
189 /* ここで座標を送信 */ 193 /* ここで座標を送信 */
198 int size; 202 int size;
199 void *addr = file_map(xml_file_name, &size); 203 void *addr = file_map(xml_file_name, &size);
200 SceneGraphPtr sgp = viewer->createSceneGraph(); 204 SceneGraphPtr sgp = viewer->createSceneGraph();
201 viewer->createFromXMLmemory(sgp, (char *)addr, size); 205 viewer->createFromXMLmemory(sgp, (char *)addr, size);
202 sgp->set_move_collision(my_move, null_collision); 206 sgp->set_move_collision(my_move, null_collision);
203 207 Camera *camera = viewer->sgroot->camera;
208 camera->xyz[0] = 0.0;
209 camera->xyz[1] = 0.0;
210
204 par->addChild(sgp); 211 par->addChild(sgp);
205 sgp->c_xyz[0] = 0.0f; 212 sgp->c_xyz[0] = 0.0f;
206 sgp->c_xyz[1] = 0.0f; 213 sgp->c_xyz[1] = 0.0f;
207 sgp->c_xyz[2] = 0.0f; 214 sgp->c_xyz[2] = 0.0f;
208 215