本文整理汇总了C++中input_manager::get_action_name方法的典型用法代码示例。如果您正苦于以下问题:C++ input_manager::get_action_name方法的具体用法?C++ input_manager::get_action_name怎么用?C++ input_manager::get_action_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类input_manager
的用法示例。
在下文中一共展示了input_manager::get_action_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display_help
void input_context::display_help()
{
// Shamelessly stolen from help.cpp
WINDOW *w_help = newwin(FULL_SCREEN_HEIGHT - 2, FULL_SCREEN_WIDTH - 2,
1 + (int)((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY - FULL_SCREEN_HEIGHT) / 2 : 0),
1 + (int)((TERMX > FULL_SCREEN_WIDTH) ? (TERMX - FULL_SCREEN_WIDTH) / 2 : 0));
werase(w_help);
// Draw win header and borders
draw_border(w_help, c_white);
mvwprintz(w_help, 0, (FULL_SCREEN_WIDTH - utf8_width(_("Keybindings"))) / 2 - 1,
c_ltred, " %s ", _("Keybindings"));
mvwprintz(w_help, 1, 51, c_ltred, _("Unbound keys"));
mvwprintz(w_help, 2, 51, c_ltgreen, _("Keybinding active only"));
mvwprintz(w_help, 3, 51, c_ltgreen, _("on this screen"));
mvwprintz(w_help, 4, 51, c_ltgray, _("Keybinding active globally"));
// Clear the lines. Don't touch borders
for (int i = 1; i < FULL_SCREEN_HEIGHT - 3; i++) {
mvwprintz(w_help, i, 1, c_black, " ");
}
for (int i = 0; i < registered_actions.size(); i++) {
const std::string &action_id = registered_actions[i];
if(action_id == "ANY_INPUT") {
continue;
}
bool overwrite_default;
const std::vector<input_event> &input_events = inp_mngr.get_input_for_action(action_id, category,
&overwrite_default);
nc_color col = input_events.size() ? c_white : c_ltred;
mvwprintz(w_help, i, 3, col, "%s: ", inp_mngr.get_action_name(action_id).c_str());
if (!input_events.size()) {
mvwprintz(w_help, i, 30, c_ltred, _("Unbound!"));
} else {
// The color depends on whether this input draws from context-local or from
// default settings. Default will be ltgray, overwrite will be ltgreen.
col = overwrite_default ? c_ltgreen : c_ltgray;
mvwprintz(w_help, i, 30, col, "%s", get_desc(action_id).c_str());
}
}
wrefresh(w_help);
refresh();
long ch = getch();
while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE) {
ch = getch();
};
werase(w_help);
wrefresh(w_help);
delwin(w_help);
}