本文整理汇总了C++中KeyMapping::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyMapping::clear方法的具体用法?C++ KeyMapping::clear怎么用?C++ KeyMapping::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyMapping
的用法示例。
在下文中一共展示了KeyMapping::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RestoreDefault
// Note that it's easy to add other defaults if desired.
void RestoreDefault() {
g_controllerMap.clear();
#if defined(_WIN32)
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
SetDefaultKeyMap(DEFAULT_MAPPING_X360, false);
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#elif defined(ANDROID)
// Autodetect a few common devices
std::string name = System_GetProperty(SYSPROP_NAME);
if (IsNvidiaShield(name)) {
SetDefaultKeyMap(DEFAULT_MAPPING_SHIELD, true);
} else if (IsOuya(name)) { // TODO: check!
SetDefaultKeyMap(DEFAULT_MAPPING_OUYA, true);
} else if (IsXperiaPlay(name)) {
SetDefaultKeyMap(DEFAULT_MAPPING_XPERIA_PLAY, true);
} else {
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true);
}
#elif defined(BLACKBERRY)
std::string name = System_GetProperty(SYSPROP_NAME);
if (IsBlackberryQWERTY(name)) {
SetDefaultKeyMap(DEFAULT_MAPPING_BLACKBERRY_QWERTY, true);
} else {
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true);
}
#else
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#endif
}
示例2: RestoreDefault
// Note that it's easy to add other defaults if desired.
void RestoreDefault() {
g_controllerMap.clear();
#if defined(_WIN32)
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
SetDefaultKeyMap(DEFAULT_MAPPING_X360, false);
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#elif defined(ANDROID)
// Autodetect a few common devices
std::string name = System_GetName();
if (name == "NVIDIA:SHIELD") {
SetDefaultKeyMap(DEFAULT_MAPPING_SHIELD, true);
} else if (name == "OUYA:OUYA Console") { // TODO: check!
SetDefaultKeyMap(DEFAULT_MAPPING_OUYA, true);
} else if (name == "Sony Ericsson:R800i" || name == "Sony Ericsson:zeus") {
SetDefaultKeyMap(DEFAULT_MAPPING_XPERIA_PLAY, true);
} else {
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true);
}
#else
SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#endif
}