int main(int argc, char *argv[]) { quick_load = false; UNUSED(argc); gameControl.currentStage = TECHNOBOT; game_config.selected_player = 1; //strncpy (FILEPATH, argv[0], strlen(argv[0])-11); string argvString = string(argv[0]); FILEPATH = argvString.substr(0, argvString.size()-EXEC_NAME.size()); //std::cout << "main - FILEPATH: " << FILEPATH << std::endl; format_v_2_0_1::file_io fio; fio.read_game(game_data); // INIT GRAPHICS if (graphLib.initGraphics() != true) { exit(-1); } // INIT GAME if (quick_load == false) { if (gameControl.showIntro() == false) { return 0; } } else { gameControl.quick_load_game(); //ending game_ending; //game_ending.start(); } input.clean(); input.p1_input[BTN_START] = 0; input.waitTime(200); input.clean(); while (true) { input.readInput(); if (input.p1_input[BTN_QUIT] == 1) { exit(-1); } gameControl.showGame(); graphLib.updateScreen(); } /// @TODO: sdl quit sub-systems SDL_Quit(); return 1; }
void key_map::draw_screen() { bool finished = false; st_position config_text_pos; st_position cursor_pos; short _pick_pos = 0; config_text_pos.x = graphLib.get_config_menu_pos().x + 74; config_text_pos.y = graphLib.get_config_menu_pos().y + 40; cursor_pos = config_text_pos; graphLib.clear_area(config_text_pos.x-1, config_text_pos.y-1, 180, 180, 0, 0, 0); input.clean(); input.waitTime(300); for (unsigned int i=0; i<_keys_list.size(); i++) { graphLib.draw_text(config_text_pos.x, config_text_pos.y + i*CURSOR_SPACING, _keys_list[i].c_str()); redraw_line(i); } graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING, "RETURN"); draw_lib.update_screen(); //cout << "scenesLib::option_picker::START\n"; graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING))); while (finished == false) { input.readInput(); if (input.p1_input[BTN_START]) { if (_pick_pos == (short)_keys_list.size()) { std::cout << "key_map::draw_screen - FINISHED #1" << std::endl; finished = true; } else { graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2, "PRESS NEW KEY/BUTTON"); //input code (number) draw_lib.update_screen(); //format_v_2_1_1::st_key_config new_key = input.get_pressed_key(); graphLib.clear_area(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2-1, 180, CURSOR_SPACING+1, 0, 0, 0); ///@TODO - key_config[_pick_pos].key_type = new_key.key_type; ///@TODO - key_config[_pick_pos].key_number = new_key.key_number; redraw_line(_pick_pos); draw_lib.update_screen(); } } if (input.p1_input[BTN_DOWN]) { soundManager.play_sfx(SFX_CURSOR); graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING))); _pick_pos++; if (_pick_pos >= (short)_keys_list.size()+1) { _pick_pos = 0; } graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING))); } if (input.p1_input[BTN_UP]) { soundManager.play_sfx(SFX_CURSOR); graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING))); _pick_pos--; if (_pick_pos < 0) { _pick_pos = _keys_list.size(); } graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING))); } if (input.p1_input[BTN_QUIT]) { std::cout << "key_map::draw_screen - FINISHED #2" << std::endl; finished = true; } input.clean(); input.waitTime(10); draw_lib.update_screen(); } }