本文整理汇总了C++中inputLib::readInput方法的典型用法代码示例。如果您正苦于以下问题:C++ inputLib::readInput方法的具体用法?C++ inputLib::readInput怎么用?C++ inputLib::readInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inputLib
的用法示例。
在下文中一共展示了inputLib::readInput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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;
}
示例2: draw_screen
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();
}
}