comparison Renderer/Test/aquarium.cc @ 877:65f0c4c7f381

[Renderer/Test/aquarium] changed euc to utf8
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 06 Jul 2010 09:55:35 +0900
parents 157f2ffeb526
children 596009c66065
comparison
equal deleted inserted replaced
876:00c84b5856c4 877:65f0c4c7f381
49 static void 49 static void
50 update_position_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) 50 update_position_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
51 { 51 {
52 52
53 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; 53 SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_;
54 // LindaServerから座標データを取得してオブジェクトに反映させる。 54 // LindaServer綺ф若帥緇吾с
55 55
56 if (!node->resend_flag || node->seq_rd != node->seq) { 56 if (!node->resend_flag || node->seq_rd != node->seq) {
57 unsigned char *reply_rd = psx_reply(node->seq_rd); 57 unsigned char *reply_rd = psx_reply(node->seq_rd);
58 if (reply_rd != NULL) { 58 if (reply_rd != NULL) {
59 set_position(node, reply_rd); 59 set_position(node, reply_rd);
163 MainLoopPtr 163 MainLoopPtr
164 aquarium::init(Viewer *sgroot, int screen_w, int screen_h) 164 aquarium::init(Viewer *sgroot, int screen_w, int screen_h)
165 { 165 {
166 this->sgroot = sgroot; 166 this->sgroot = sgroot;
167 width = screen_w; 167 width = screen_w;
168 linda_connect(); // 接続に合わせて serial_id も取得 168 linda_connect(); // ・膓 serial_id 緇
169 update_screen_scope(); 169 update_screen_scope();
170 parent = sgroot->createSceneGraph(); 170 parent = sgroot->createSceneGraph();
171 parent->set_move_collision(check_new_player_move, null_collision); 171 parent->set_move_collision(check_new_player_move, null_collision);
172 172
173 create_my_sg(sgroot, screen_w, screen_h); 173 create_my_sg(sgroot, screen_w, screen_h);
179 return sgroot; 179 return sgroot;
180 } 180 }
181 181
182 void 182 void
183 aquarium::linda_connect() { 183 aquarium::linda_connect() {
184 init_linda(); // セレクタの初期化 184 init_linda(); // 祉帥
185 linda = open_linda_java(linda_addr.hostname, linda_addr.port); 185 linda = open_linda_java(linda_addr.hostname, linda_addr.port);
186 // serial_id の取得 186 // serial_id 緇
187 int seq = psx_in(linda, GET_SERIAL_ID); 187 int seq = psx_in(linda, GET_SERIAL_ID);
188 unsigned char *data = NULL; 188 unsigned char *data = NULL;
189 do { 189 do {
190 psx_sync_n(); 190 psx_sync_n();
191 data = psx_reply(seq); 191 data = psx_reply(seq);
203 psx_sync_n(); 203 psx_sync_n();
204 data = psx_reply(seq); 204 data = psx_reply(seq);
205 } while (data == NULL); 205 } while (data == NULL);
206 aqua::Width *w = new aqua::Width(); 206 aqua::Width *w = new aqua::Width();
207 w->ParseFromArray(data + LINDA_HEADER_SIZE, *(int *)(data + LINDA_DATA_LENGTH_OFFSET)); 207 w->ParseFromArray(data + LINDA_HEADER_SIZE, *(int *)(data + LINDA_DATA_LENGTH_OFFSET));
208 start_x = w->width(); // 現在の全長を取得 208 start_x = w->width(); // 憜激緇
209 w->set_width(start_x + width); // 自分の横幅を足す 209 w->set_width(start_x + width); // 罔綛莇潟
210 int size = w->ByteSize(); 210 int size = w->ByteSize();
211 unsigned char *msg = (unsigned char *) sgroot->manager->allocate(sizeof(char) * size); 211 unsigned char *msg = (unsigned char *) sgroot->manager->allocate(sizeof(char) * size);
212 w->SerializeToArray(msg, size); // 更新したデータを再度シリアライズ 212 w->SerializeToArray(msg, size); // 贋違若帥綺激≪ゃ
213 delete w; 213 delete w;
214 psx_out(linda, 1, msg, size); 214 psx_out(linda, 1, msg, size);
215 psx_sync_n(); 215 psx_sync_n();
216 printf("start_x = %d, width = %d\n", start_x, width); 216 printf("start_x = %d, width = %d\n", start_x, width);
217 } 217 }