/* Fonction de gestion du clavier spetial */ void Special_key(int key, int x, int y) { switch (key) { case GLUT_KEY_RIGHT: left_right+= 0.03; rotate_camera(left_right); break; case GLUT_KEY_LEFT: left_right-= 0.03; rotate_camera(left_right); break; case GLUT_KEY_UP: move_camera(0.02); break; case GLUT_KEY_DOWN: move_camera(-0.02); break; default: break; } glutPostRedisplay(); glutSwapBuffers(); }
void keyPressed(unsigned char key, int x, int y) { switch(key) { case 'd': move_camera(cam, RIGHT); break; case 'a': move_camera(cam, LEFT); break; case 'w': move_camera(cam, FORWARD); break; case 's': move_camera(cam, BACKWARD); break; case 'f': turn_camera(cam, LEFT); break; case 'h': turn_camera(cam, RIGHT); break; case 't': turn_camera(cam, UP); break; case 'g': turn_camera(cam, DOWN); break; } glutPostRedisplay(); }
static void handle_keypress(int key, camera *camera) { switch(key) { case SDLK_LEFT: move_camera(camera, -arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_RIGHT: move_camera(camera, arrows_camera_delta * ZOOM_LEVEL, 0); break; case SDLK_UP: move_camera(camera, 0, -arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_DOWN: move_camera(camera, 0, arrows_camera_delta * ZOOM_LEVEL); break; case SDLK_PAGEUP: zoom_in(camera); update_background(); break; case SDLK_PAGEDOWN: zoom_out(camera); update_background(); break; case SDLK_p: toggle_pause(); } }
/* Fonction de gestion du clavier spetial */ void Special_key(int key, int x, int y) { switch (key) { case GLUT_KEY_RIGHT: left_right+= 0.03; rotate_camera(left_right); break; case GLUT_KEY_LEFT: left_right-= 0.03; rotate_camera(left_right); break; case GLUT_KEY_UP: move_camera(0.02); break; case GLUT_KEY_DOWN: move_camera(-0.02); break; case GLUT_KEY_PAGE_DOWN: QueueRot+=1.0; queue_p[0] = Ecart * sin(DEGTORAD(QueueRot)) + (sphere_p[0][0]); queue_p[1] = sphere_p[1][0]; queue_p[2] = Ecart * cos(DEGTORAD(QueueRot)) + (sphere_p[2][0]); queue_ip[0] = Ecart * sin(DEGTORAD(QueueRot)) + (sphere_p[0][0]); queue_ip[1] = sphere_ip[1][0]; queue_ip[2] = Ecart * cos(DEGTORAD(QueueRot)) + (sphere_p[2][0]); break; case GLUT_KEY_PAGE_UP: QueueRot-=1.0; queue_p[0] = Ecart * sin(DEGTORAD(QueueRot)) + (sphere_p[0][0]); queue_p[1] = sphere_p[1][0]; queue_p[2] = Ecart * cos(DEGTORAD(QueueRot)) + (sphere_p[2][0]); queue_ip[0] = Ecart * sin(DEGTORAD(QueueRot)) + (sphere_p[0][0]); queue_ip[1] = sphere_ip[1][0]; queue_ip[2] = Ecart * cos(DEGTORAD(QueueRot)) + (sphere_p[2][0]); break; default: break; } glutPostRedisplay(); glutSwapBuffers(); }
//=========================================================// //=========================================================// static void keyboard(unsigned char key, int x, int y) { int number = -1; move_camera(number, key); glutPostRedisplay(); }
//=========================================================// //=========================================================// static void special(int key, int x, int y) { char letter = ' '; move_camera(key, letter); glutPostRedisplay(); }
void mouseButton(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON) { if (state == GLUT_DOWN) { // viewer->pos[2]-=0.05; // isClicked_left=1; camera++; move_camera(); } else { isClicked_left = 0; } } else if (button == GLUT_RIGHT_BUTTON) { if(state == GLUT_DOWN) { // viewer->pos[2]+=0.05; // isClicked_right=1; camera--; move_camera(); } else { isClicked_right=0; } } if ((button == 3) ) { if (state == GLUT_UP) return; viewer->pos[0]-=0.05; } else if(button == 4) { viewer->pos[0]+=0.05; } printf("viewer == (%f,%f)\n", viewer->pos[0],viewer->pos[2] ); }
void frame_play() { manage_sprites(); move_player(); move_camera(); animate_tilemap(); all_sprite_move(); // sprite movement and collisions update_hud(); }
void Player::center() { if((get_x() - BORDER_X) < camera_x()) { move_camera((get_x() - BORDER_X) - camera_x(), 0); } if((get_y() - BORDER_Y) < camera_y()) { move_camera(0, (get_y() - BORDER_Y) - camera_y()); } if((get_x() + PLAYER_WIDTH + BORDER_X) > (camera_x() + SCREEN_WIDTH)) { move_camera((get_x() + PLAYER_WIDTH + BORDER_X) - (camera_x() + SCREEN_WIDTH), 0); } if((get_y() + PLAYER_HEIGTH + BORDER_Y) > (camera_y() + SCREEN_HEIGHT)) { move_camera(0, (get_y() + PLAYER_HEIGTH + BORDER_Y) - (camera_y() + SCREEN_HEIGHT)); } }
void reset_level_data() { // reload all data into RAM if (load_game_data(data)) { frame_handler = frame_error; return; } sprites_reset(); player_reset(); interpret_spritetypes(); // apply mapper just once uint8_t mapper = data[255*256]; switch (mapper) { case 0 : black_mapper(); break; case TRANSPARENT : // null mapper break; default: message("Unknown mapper ! "); frame_handler = frame_error; return; } // interpret level after mapper get_level_boundingbox(); get_level_start(); memcpy(hud,"B0 F0G0 C0 E000 D00 ",sizeof(hud)); hud[1]='0'+lives; hud[6]='0'+level+1; move_camera(); // avoid being negative play_song(); // start playing song vga_frame=0; coins=0; }
static void update_camera_position(camera *camera) { // code to move the camera if the mouse // is within mouse_camera_epsilon of the edges int x = 0, y = 0; if(mouse_x > WIDTH - mouse_camera_epsilon) x = mouse_camera_delta * ZOOM_LEVEL; else if(mouse_x < mouse_camera_epsilon) x = -mouse_camera_delta * ZOOM_LEVEL; if(mouse_y > HEIGHT - mouse_camera_epsilon) y = mouse_camera_delta * ZOOM_LEVEL; else if(mouse_y < mouse_camera_epsilon) y = -mouse_camera_delta * ZOOM_LEVEL; if(x != 0 || y != 0) move_camera(camera, x, y); }
void GlViewer::mouseMoveEvent(QMouseEvent *event) { if(!m_scene) return; m_mouse_move = event->pos(); if (event->buttons() == Qt::LeftButton) { if (m_mouse_move != m_mouse_click) sample_mouse_path(m_mouse_move); } else { move_camera(m_mouse_click, m_mouse_move); } m_mouse_click = m_mouse_move; update(); }
void GlViewer::mouseReleaseEvent(QMouseEvent *event) { if (!m_scene) return; m_mouse_move = event->pos(); if (event->button() == Qt::LeftButton) { if (m_mouse_move != m_mouse_click) sample_mouse_path(m_mouse_move); } else { move_camera(m_mouse_click, m_mouse_move); } m_mouse_click = m_mouse_move; setCursor(QCursor(Qt::ArrowCursor)); update(); }
bool logic(Map& level, Player& player1, Viewpoint& camera, Idevice& input) { int mapvalue; if (input.get_click() == ON) { mapvalue = find_tile(level, input, camera); if (mapvalue == WARP) click_warp(level, player1, input, camera); if (mapvalue == EXIT) click_door(level, player1, input, camera); if (mapvalue == UPSTAIRS || mapvalue == DOWNSTAIRS) click_stairs(level, player1, input, camera); if (mapvalue == CAVE) click_dungeon(level, player1, input, camera); if (mapvalue == CITY) click_town(level, player1, input, camera); } input.put_click(OFF); if(player1.check_map() | player1.check_floor()) return 0; move_player(level, player1, input); move_camera(level, player1, camera); return 1; }
bool vsx_widget_desktop::key_down(signed long key, bool n_alt, bool n_ctrl, bool n_shift) { this->alt = n_alt; this->ctrl = n_ctrl; this->shift = n_shift; if (k_focus) { if (k_focus->event_key_down(key,alt,ctrl,shift)) { if (ctrl) { #ifdef VSXU_DEBUG printf("desktop key: %d\n",key); printf("f: %d",'f'); printf("F: %d",'F'); printf("res: %d", tolower(abs(key))); #endif switch (key) { case -GLFW_KEY_SPACE: ((vsx_window_texture_viewer*)tv)->run = !((vsx_window_texture_viewer*)tv)->run; break; // fullwindow case -'F': case -'f': // F //printf("going fullwindow\n"); ((vsx_window_texture_viewer*)tv)->fullwindow = !((vsx_window_texture_viewer*)tv)->fullwindow; if (((vsx_window_texture_viewer*)tv)->fullwindow) mouse.hide_cursor(); else mouse.show_cursor(); if (!((vsx_window_texture_viewer*)tv)->fullwindow) this->performance_mode = false; //if (alt) this->performance_mode = !this->performance_mode; break; // close all controllers case -'C': case -'c': delete_all_by_type(VSX_WIDGET_TYPE_CONTROLLER); break; // close all open anchors case -'D': case -'d': for (std::map<int, vsx_widget*>::iterator it = ilist.begin(); it != ilist.end(); ++it) { if ((*it).second->widget_type == VSX_WIDGET_TYPE_ANCHOR) { if ((*it).second->parent) if ((*it).second->parent->widget_type == VSX_WIDGET_TYPE_COMPONENT) { ((vsx_widget_anchor*)(*it).second)->toggle(1); } } } break; } } if (alt) { switch (key) { case -'F': case -'f': // F if (((vsx_window_texture_viewer*)tv)->fullwindow) { mouse.show_cursor(); this->performance_mode = !this->performance_mode; } default: break; } } if (!ctrl && !alt) switch (key) { case -GLFW_KEY_SPACE: { { if (a_focus->widget_type != VSX_WIDGET_TYPE_SERVER) { vsx_vector a = a_focus->get_pos_p(); move_camera(vsx_vector(a.x,a.y,2.0f)); } else move_camera(vsx_vector(xp,yp,2.0f)); } } break; case -GLFW_KEY_UP: case -'E': case -'e':{ interpolating = false;ypd=1.0;} break; case -GLFW_KEY_DOWN: case -'D': case -'d':{ interpolating = false;ypd=-1.0;} break; case -GLFW_KEY_LEFT: case -'s': case -'S':{ interpolating = false;xpd=-1.0;} break; case -GLFW_KEY_RIGHT: case -'F': case -'f':{ interpolating = false;xpd=1.0;} break; case -GLFW_KEY_PAGEUP: case -'R': case -'r':{ interpolating = false;zpd=-1.0;} break; case -GLFW_KEY_PAGEDOWN: case -'W': case -'w':{ interpolating = false;zpd=1.0;} break; } // switch } else { return true; } } else return true; return false; }
bool vsx_widget_desktop::key_down(signed long key, bool n_alt, bool n_ctrl, bool n_shift) { this->alt = n_alt; this->ctrl = n_ctrl; this->shift = n_shift; char test[2]; test[0] = (char)key; test[1] = 0; //printf("key as char: %s\n", test); //printf("got key: %d\n", key); if (k_focus) { if (k_focus->event_key_down(key,alt,ctrl,shift)) { if (ctrl) { #ifdef _WIN32 switch (tolower(abs(key))) { #else switch (tolower(key)) { #endif case ' ': ((vsx_window_texture_viewer*)tv)->run = !((vsx_window_texture_viewer*)tv)->run; break; // fullwindow case 'F': case 'f': // F //printf("going fullwindow\n"); ((vsx_window_texture_viewer*)tv)->fullwindow = !((vsx_window_texture_viewer*)tv)->fullwindow; if (((vsx_window_texture_viewer*)tv)->fullwindow) mouse.hide_cursor(); else mouse.show_cursor(); if (!((vsx_window_texture_viewer*)tv)->fullwindow) this->performance_mode = false; //if (alt) this->performance_mode = !this->performance_mode; break; // close all controllers case 'c': delete_all_by_type(VSX_WIDGET_TYPE_CONTROLLER); break; // close all open anchors case 'd': for (std::map<int, vsx_widget*>::iterator it = ilist.begin(); it != ilist.end(); ++it) { if ((*it).second->widget_type == VSX_WIDGET_TYPE_ANCHOR) { if ((*it).second->parent) if ((*it).second->parent->widget_type == VSX_WIDGET_TYPE_COMPONENT) { ((vsx_widget_anchor*)(*it).second)->toggle(1); } } } break; } } if (alt) { #ifdef _WIN32 switch (tolower(abs(key))) { #else switch (tolower(key)) { #endif case 'F': case 'f': // F if (((vsx_window_texture_viewer*)tv)->fullwindow) { mouse.show_cursor(); this->performance_mode = !this->performance_mode; } default: break; } } if (!ctrl && !alt) #ifdef _WIN32 switch (tolower(abs(key))) { #else switch (abs(key)) { #endif case 0x08: case ' ': { //if (a_focus->type >= 100) { if (a_focus->widget_type != VSX_WIDGET_TYPE_SERVER) { vsx_vector a = a_focus->get_pos_p(); move_camera(vsx_vector(a.x,a.y,2.0f)); } else move_camera(vsx_vector(xp,yp,2.0f)); /*zp = 2; xp = a.x; yp = a.y; xps = 0; yps = 0; zps = 0;*/ } } break; case 'E': case 'e':{ interpolating = false;ypd=1.0;} break; case 'D': case 'd':{ interpolating = false;ypd=-1.0;} break; case 's': case 'S':{ interpolating = false;xpd=-1.0;} break; case 'F': case 'f':{ interpolating = false;xpd=1.0;} break; case 'R': case 'r':{ interpolating = false;zpd=-1.0;} break; case 'W': case 'w':{ interpolating = false;zpd=1.0;} break; } // switch } else { return true; } } else return true; return false; } bool vsx_widget_desktop::key_up(signed long key, bool alt, bool ctrl, bool shift) { this->ctrl = ctrl; if (k_focus) { if (k_focus->event_key_up(key,alt,ctrl,shift)) { //if (!ctrl) switch (key) { case 'E': case 'e': ypd=0.0; break; case 'D': case 'd': ypd=0.0; break; case 'S': case 's': xpd=0.0; break; case 'F': case 'f': xpd=0.0; break; case 'R': case 'r': zpd=0.0; break; case 'W': case 'w': zpd=0.0; break; #ifndef VSXU_PLAYER #ifndef _WIN32 case GLFW_KEY_TAB: #else case 0x09: #endif { ((vsxu_assistant*)assistant)->toggle_size(); } break; #endif //case 'c': tcp_main_client.connect(578); break; } } else { return false; } } else return true; return false; } void vsx_widget_desktop::event_mouse_wheel(float y) { //if (y > 0) zps += -y; if (zps > 2.0f) zps = 2.0f; if (zps < -2.0f) zps = -2.0f; //else //zps += ; } void vsx_widget_desktop::move_camera(vsx_vector world) { camera_target = world; interpolating = true; }
void hw2_init(void) { printf("\nInitializing homework 2 ...\n"); //Set defaults. mouse_button[LEFT_BUTTON] = 0; mouse_button[RIGHT_BUTTON] = 0; camera_position.x = 25; camera_position.y = 45; memset(voxel_map, 1, VOXEL_COUNT); glfwSetWindowTitle("GFX Homework: 2.1.a"); //Add callbacks. glfwSetMouseButtonCallback(mouse_click_handler); glfwSetMousePosCallback(mouse_pos_handler); glfwSetKeyCallback(key_handler); //Check for OpenGL 2.1+ if(!GLEW_VERSION_2_1) { error("OpenGL 2.1+ required to view this homework."); return; } //Setup OpenGL. //Change the window size and OpenGL viewport. glfwSetWindowSize(TEXTURE_WIDTH, TEXTURE_HEIGHT); glViewport(0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); //Reset projection matrix. glMatrixMode(GL_PROJECTION); glLoadIdentity(); //Setup perspective projection. gluPerspective(60.0f, (float)(TEXTURE_WIDTH) / TEXTURE_HEIGHT, 1.0f, 1000.0f); //Reset model view matrix. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Going to need depth test and we're going to cull faces to improve performance. glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glDepthFunc(GL_LEQUAL); glDepthRange(0.0f, 1.0f); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CCW); //Slightly adjusting clear colors to work around lazy coding. glClearColor(0.01f, 0.01f, 0.01f, 0); glClearStencil(0); glClearDepth(1.0f); //Move camera. move_camera(0, 0, (GLfloat)(VOXEL_COUNT_Z * voxel_spacing + (VOXEL_COUNT_X * 4.5)), 0, 0, 0); //Generate the cube VBO. glGenBuffers(1, &voxel_vbo); glBindBuffer(GL_ARRAY_BUFFER, voxel_vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices)+sizeof(normals)+sizeof(colors), 0, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertices), sizeof(normals), normals); glBufferSubData(GL_ARRAY_BUFFER, sizeof(vertices)+sizeof(normals), sizeof(colors), colors); //Load shaders. //phong = load_shaders("Shaders/phong.vert", "Shaders/phong.frag"); simple_color = load_shaders("Shaders/color.vert", "Shaders/color.frag"); if(simple_color == NULL) { error("Failed to load shaders."); return; } //Use color shader which simply colors objects in one color. glUseProgram(simple_color->program); //Get the obj_color variable location in color_picker shader. obj_color_location = glGetUniformLocation(simple_color->program, "obj_color"); init_done = GL_TRUE; printf("DONE!\n"); printf("Using %d voxels!\n", VOXEL_COUNT); print_help(); }
int get_move(void) { int retval = -1; int mousex, mousey; SDL_Event event; const Uint8 *keystate = SDL_GetKeyboardState(NULL); Uint8 mousestate = SDL_GetMouseState(&mousex, &mousey); if (mousestate & SDL_BUTTON_MIDDLE) { move_camera(-(mousey - last_mousey) * MOUSE_CAM_SPEED, -(mousex - last_mousex) * MOUSE_CAM_SPEED); last_mousex = mousex; last_mousey = mousey; } else { last_mousex = mousex; last_mousey = mousey; } if (keystate[SDL_SCANCODE_LCTRL]) { if (keystate[SDL_SCANCODE_DOWN]) move_camera(-KEYBOARD_CAM_SPEED, 0.0f); if (keystate[SDL_SCANCODE_LEFT]) move_camera(0.0f, -KEYBOARD_CAM_SPEED); if (keystate[SDL_SCANCODE_RIGHT]) move_camera(0.0f, KEYBOARD_CAM_SPEED); if (keystate[SDL_SCANCODE_UP]) move_camera(KEYBOARD_CAM_SPEED, 0.0f); while (SDL_PollEvent(&event)) if (event.type == SDL_QUIT) /* FIXME */ exit(0); } while (SDL_PollEvent(&event)) { gg_event_t gg_event; if (event.type == SDL_QUIT) /* FIXME */ exit(0); if (event.type == SDL_MOUSEMOTION) set_mouse_pos(event.motion.x, event.motion.y); if (!gg_dialog_get_active() && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT) { retval = get_mouse_square(); if (retval != -1) select_piece(retval); continue; } if (!gg_dialog_get_active() && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_RIGHT) { gg_dialog_open(dialog_system_create()); continue; } if ((event.type == SDL_KEYDOWN && event.key.keysym.mod & KMOD_ALT && event.key.keysym.sym == SDLK_RETURN) || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_F11)) { DBG_LOG("Toggled fullscreen"); toggle_fullscreen(); continue; } gg_event = convert_event(&event); if (gg_event.type == GG_EVENT_NONE) continue; if (gg_dialog_get_active()) gg_dialog_input_current(gg_event); /* In the promote dialog */ else if (gg_event.type == GG_EVENT_KEY) switch (gg_event.key) { case GG_KEY_LEFT: move_selector(SELECTOR_LEFT); break; case GG_KEY_RIGHT: move_selector(SELECTOR_RIGHT); break; case GG_KEY_UP: move_selector(SELECTOR_UP); break; case GG_KEY_DOWN: move_selector(SELECTOR_DOWN); break; case GG_KEY_ACTION: retval = get_selector(); select_piece(retval); break; case GG_KEY_ESCAPE: gg_dialog_open(dialog_system_create()); break; case 'g': case GG_KEY_EXTRA3: /* gg_dialog_open(dialog_ingame_create()); */ break; case 'p': game_view_prev(); break; case 'n': game_view_next(); break; case 'r': game_retract_move(); break; default: break; } } return retval; }
int get_move() { int retval = -1; int mousex, mousey; static Sint16 rotx, roty; SDL_Event event; Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 mousestate = SDL_GetMouseState(&mousex, &mousey); if( mousestate & SDL_BUTTON_MIDDLE ) { move_camera( -(mousey-last_mousey)*MOUSE_CAM_SPEED, -(mousex-last_mousex)*MOUSE_CAM_SPEED); last_mousex=mousex; last_mousey=mousey; } else { last_mousex=mousex; last_mousey=mousey; } if (keystate[SDLK_LCTRL]) { if (keystate[SDLK_DOWN]) move_camera(-KEYBOARD_CAM_SPEED, 0.0f); if (keystate[SDLK_LEFT]) move_camera(0.0f, -KEYBOARD_CAM_SPEED); if (keystate[SDLK_RIGHT]) move_camera(0.0f, KEYBOARD_CAM_SPEED); if (keystate[SDLK_UP]) move_camera(KEYBOARD_CAM_SPEED, 0.0f); while (SDL_PollEvent( &event )) if (event.type == SDL_QUIT) /* FIXME */ exit(0); } if ((roty < -3000) || (roty > 3000)) move_camera(-roty / (float) 32768 * KEYBOARD_CAM_SPEED, 0.0f); if ((rotx < -3000) || (rotx > 3000)) move_camera(0.0f, -rotx / (float) 32768 * KEYBOARD_CAM_SPEED); while ( SDL_PollEvent( &event ) ) { gg_event_t gg_event; if (event.type == SDL_QUIT) /* FIXME */ exit(0); if (event.type == SDL_MOUSEMOTION) set_mouse_pos( event.motion.x, event.motion.y ); if (!gg_dialog_get_active() && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT) { retval = get_mouse_square(); if (retval != -1) select_piece(retval); continue; } if (!gg_dialog_get_active() && event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_RIGHT) { gg_dialog_open(dialog_system_create()); continue; } if ((event.type == SDL_JOYAXISMOTION) && (event.jaxis.axis == AXIS_VIEW_X)) { rotx = event.jaxis.value; continue; } if ((event.type == SDL_JOYAXISMOTION) && (event.jaxis.axis == AXIS_VIEW_Y)) { roty = event.jaxis.value; continue; } if ( (event.type == SDL_KEYDOWN && event.key.keysym.mod & KMOD_ALT && event.key.keysym.sym == SDLK_RETURN) || (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_F11) ) { DBG_LOG( "toggled fullscreen" ); toggle_fullscreen(); continue; } gg_event = convert_event(&event); if (gg_event.type == GG_EVENT_NONE) continue; if (gg_dialog_get_active()) gg_dialog_input_current(gg_event); /* In the promote dialog */ else if (gg_event.type == GG_EVENT_KEY) switch (gg_event.key) { case GG_KEY_LEFT: move_selector(SELECTOR_LEFT); break; case GG_KEY_RIGHT: move_selector(SELECTOR_RIGHT); break; case GG_KEY_UP: move_selector(SELECTOR_UP); break; case GG_KEY_DOWN: move_selector(SELECTOR_DOWN); break; case GG_KEY_ACTION: retval = get_selector(); select_piece(retval); break; case GG_KEY_ESCAPE: gg_dialog_open(dialog_system_create()); break; case 'g': case GG_KEY_EXTRA3: /* gg_dialog_open(dialog_ingame_create()); */ break; case 'p': game_view_prev(); break; case 'n': game_view_next(); break; case 'u': game_undo(); break; case 's': fen_encode(get_board()); /* game_save(); */ break; case 'l': /* load_game(); */ break; default: break; } } return retval; }