/* * Initialization of VGA */ void vga_init(vidmem_vga_mode_t vga_mode) { load_mode(vga_mode); /* load logo */ render_plane(&vga_logo); }
/*** * Key press callback * TODO: define key mappings so I can switch kb layouts but * not need if statements to determine which key is pressed ****/ void process_key(unsigned char key, int x, int y) { #ifdef DEBUG_KEY cout << "Pressed " << key << "(" << (int)key << ")" << endl; #endif if (kb_layout == KB_QWERTY && game_mode == GAME_MODE) { switch (key) { case 27: // esc load_mode(TITLE_MODE); break; case 'd': // move right translate_eye(speed,0.0,0.0); break; case 'a': // move left translate_eye(-speed,0.0,0.0); break; case 'w': // move forward translate_eye(0.0,0.0,-speed); break; case 's': // move back translate_eye(0.0,0.0,speed); break; case 'e': // rotate right rotate_eye(-angular_speed,0); break; case 'q': // rotate left rotate_eye(angular_speed,0); break; case 'W': // rotate up rotate_eye(0,angular_speed); break; case 'S': // rotate down rotate_eye(0,-angular_speed); break; case '+': // speed up speed += .25; angular_speed += PI/12.0; break; case '-': // slow down speed = max(speed - 0.1, (GLdouble)0.0); angular_speed = max(angular_speed - PI/24.0, (GLdouble)0.0); break; default: break; } } else if (kb_layout == KB_DVORAK && game_mode == GAME_MODE) { switch (key) { case 'q': case 27: // esc load_mode(TITLE_MODE); break; case 'e': // move right translate_eye(speed,0.0,0.0); break; case 'a': // move left translate_eye(-speed,0.0,0.0); break; case ',': // move forward translate_eye(0.0,0.0,-speed); break; case 'o': // move back translate_eye(0.0,0.0,speed); break; case '.': // rotate right rotate_eye(-angular_speed,0); break; case '\'': // rotate left rotate_eye(angular_speed,0); break; case '<': // rotate up rotate_eye(0,angular_speed); break; case 'O': // rotate down rotate_eye(0,-angular_speed); break; case '+': // speed up speed += .25; angular_speed += PI/12.0; break; case '-': // slow down speed = max(speed - 0.1, (GLdouble)0.0); angular_speed = max(angular_speed - PI/24.0, (GLdouble)0.0); break; default: break; } } else if (game_mode == DIAG_MODE) { switch (key) { case 27: // esc load_mode(TITLE_MODE); break; case '\r': // enter case '\n': // enter case 32: // space diag_message = ""; break; default: break; } } else if (game_mode == TITLE_MODE) { switch (key) { case 27: // esc exit_glut("Leaving game."); break; case '\r': // enter case '\n': // enter load_mode(GAME_MODE); break; default: break; } } glutPostRedisplay(); }
void load_setup (void) { static char *buffer; char *profile; char *inifile; int i; #ifdef USE_NETCODE extern char *ftpfs_proxy_host; #endif buffer = concat_dir_and_file (home_dir, PROFILE_NAME); inifile = concat_dir_and_file (mc_home, "mc.ini"); if (exist_file (buffer)){ profile = buffer; } else if (exist_file (inifile)){ profile = strdup (inifile); free (buffer); } else { profile = buffer; } free (inifile); profile_name = profile; /* Load integer boolean options */ for (i = 0; options [i].opt_name; i++) *options [i].opt_addr = get_int (profile, options [i].opt_name, *options [i].opt_addr); load_layout (profile); load_panelize (); startup_left_mode = load_mode ("New Left Panel"); startup_right_mode = load_mode ("New Right Panel"); /* At least one of the panels is a listing panel */ if (startup_left_mode != view_listing && startup_right_mode!=view_listing) startup_left_mode = view_listing; if (!other_dir){ buffer = (char*) malloc (MC_MAXPATHLEN); load_string ("Dirs", "other_dir", ".", buffer, MC_MAXPATHLEN); if (vfs_file_is_local (buffer)) other_dir = buffer; else free (buffer); } #ifdef USE_NETCODE ftpfs_proxy_host = do_load_string ("Misc", "ftp_proxy_host", "gate"); #endif boot_current_is_left = GetPrivateProfileInt ("Dirs", "current_is_left", 1, profile); load_string ("Misc", "find_ignore_dirs", "", setup_color_string, sizeof (setup_color_string)); if (setup_color_string [0]) find_ignore_dirs = copy_strings (":", setup_color_string, ":", 0); /* The default color and the terminal dependent color */ load_string ("Colors", "base_color", "", setup_color_string, sizeof (setup_color_string)); load_string ("Colors", getenv ("TERM"), "", term_color_string, sizeof (term_color_string)); load_string ("Colors", "color_terminals", "", color_terminal_string, sizeof (color_terminal_string)); /* Load the directory history */ /* directory_history_load (); */ /* Remove the temporal entries */ profile_clean_section ("Temporal:New Left Panel", profile_name); profile_clean_section ("Temporal:New Right Panel", profile_name); #ifdef USE_VFS #ifdef USE_NETCODE ftpfs_init_passwd (); #endif #endif }