本文整理汇总了C++中inputLib::pick_key_or_button方法的典型用法代码示例。如果您正苦于以下问题:C++ inputLib::pick_key_or_button方法的具体用法?C++ inputLib::pick_key_or_button怎么用?C++ inputLib::pick_key_or_button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inputLib
的用法示例。
在下文中一共展示了inputLib::pick_key_or_button方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: config_input
void key_map::config_input()
{
CURRENT_FILE_FORMAT::st_game_config game_config_copy = game_config;
int selected_option = 0;
while (selected_option != -1) {
selected_option = draw_config_keys();
std::cout << "key_map::config_input - selected_option: " << selected_option << std::endl;
if (selected_option == 0) {
game_config.set_default_keys();
std::cout << "key_map::config_input - LEAVE #1" << std::endl;
} else if (selected_option == -1) {
std::cout << "key_map::config_input - LEAVE #2" << std::endl;
// apply changes to game-config
apply_key_codes_changes(game_config_copy);
return;
// -- NEW -- //
} else if (selected_option == 8) {
if (game_config.input_mode == INPUT_MODE_DIGITAL) {
game_config.input_mode = INPUT_MODE_ANALOG;
} else {
game_config.input_mode = INPUT_MODE_DIGITAL;
}
// -- NEW -- //
} else {
std::cout << "key_map::config_input - PICK KEY #1" << std::endl;
INPUT_COMMANDS selected_key = BTN_JUMP;
if (selected_option == 1) {
selected_key = BTN_JUMP;
} else if (selected_option == 2) {
selected_key = BTN_ATTACK;
} else if (selected_option == 3) {
selected_key = BTN_SHIELD;
} else if (selected_option == 4) {
selected_key = BTN_DASH;
} else if (selected_option == 5) {
selected_key = BTN_L;
} else if (selected_option == 6) {
selected_key = BTN_R;
} else if (selected_option == 7) {
selected_key = BTN_START;
} else if (selected_option == 9) {
selected_key = BTN_UP;
} else if (selected_option == 10) {
selected_key = BTN_DOWN;
} else if (selected_option == 11) {
selected_key = BTN_LEFT;
} else if (selected_option == 12) {
selected_key = BTN_RIGHT;
}
st_position menu_pos(graphLib.get_config_menu_pos().x + 74, graphLib.get_config_menu_pos().y + 40);
graphLib.clear_area(menu_pos.x, menu_pos.y, 180, 180, 0, 0, 0);
graphLib.draw_text(menu_pos.x, menu_pos.y, "PRESS A KEY OR BUTTON");
input.clean();
input.waitTime(20);
bool is_joystick = input.pick_key_or_button(game_config_copy, selected_key);
check_key_duplicates(game_config_copy, selected_key, is_joystick);
}
}
// apply changes to game-config
apply_key_codes_changes(game_config_copy);
}