本文整理汇总了C++中Key_KeynumToString函数的典型用法代码示例。如果您正苦于以下问题:C++ Key_KeynumToString函数的具体用法?C++ Key_KeynumToString怎么用?C++ Key_KeynumToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Key_KeynumToString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DumpBindings
void DumpBindings (FILE *f)
{
int i, leftright;
char *spaces, *string;
qbool printed = false;
for (i = 0; i < (sizeof(keybindings) / sizeof(*keybindings)); i++) {
leftright = Key_IsLeftRightSameBind(i) ? 1 : 0;
if (keybindings[i] || leftright) {
printed = true;
#ifdef WITH_KEYMAP
string = Key_KeynumToString(i, NULL);
#else
string = Key_KeynumToString(i);
#endif
spaces = CreateSpaces(BIND_ALIGN_COL - strlen(string) - 6);
if (i == ';')
fprintf (f, "bind \";\"%s\"%s\"\n", spaces, keybindings[i]);
else
fprintf (f, "bind %s%s\"%s\"\n", string, spaces, keybindings[leftright ? i + 1 : i]);
if (leftright)
i += 2;
}
}
if (!printed)
fprintf(f, "//no bindings\n");
}
开发者ID:jogi1,项目名称:camquake,代码行数:29,代码来源:config_manager.c
示例2: IN_XBox360AxisToButton
static int IN_XBox360AxisToButton(int controllerAxis, int key, float expectedStartValue, float threshold) {
unsigned int axes = 0;
Sint16 axis = SDL_JoystickGetAxis(stick, controllerAxis);
float f = ((float) axis) / 32767.0f;
/*
if(f < -in_joystickThreshold->value)
{
axes |= (1 << (controllerAxis * 2));
}
else if(f > in_joystickThreshold->value)
{
axes |= (1 << ((controllerAxis * 2) + 1));
}
*/
if (f > (expectedStartValue + threshold + in_joystickThreshold->value)) {
axes |= (1 << (controllerAxis));
}
if ((axes & (1 << controllerAxis)) &&
!(stick_state.oldaxes & (1 << controllerAxis))) {
Com_QueueEvent(0, SE_KEY, key, true, 0, nullptr);
if (in_xbox360ControllerDebug->integer) {
Com_Printf("xbox axis = %i to key = Q:0x%02x(%s), value = %f\n",
controllerAxis,
key,
Key_KeynumToString(key),
f);
}
}
if (!(axes & (1 << controllerAxis)) &&
(stick_state.oldaxes & (1 << controllerAxis))) {
Com_QueueEvent(0, SE_KEY, key, false, 0, nullptr);
if (in_xbox360ControllerDebug->integer) {
Com_Printf("xbox axis = %i to key = Q:0x%02x(%s), value = %f\n",
controllerAxis,
key,
Key_KeynumToString(key),
f);
}
}
return axes;
}
开发者ID:Kangz,项目名称:Unvanquished,代码行数:49,代码来源:sdl_input.cpp
示例3: DrawKeyBindingFunc
static void DrawKeyBindingFunc( void *self )
{
int keys[2];
menuaction_s *a = ( menuaction_s * ) self;
M_FindKeysForCommand( bindnames[a->generic.localdata[0]][0], keys);
if (keys[0] == -1)
{
Menu_DrawString (a->generic.x + a->generic.parent->x + 16,
a->generic.y + a->generic.parent->y, "^1<NONE>", 255);
}
else
{
int x;
const char *name;
int alpha;
if (cursor.menuitem == a)
alpha=255;
else
alpha=160;
name = Key_KeynumToString (keys[0]);
Menu_DrawString (a->generic.x + a->generic.parent->x + 16,
a->generic.y + a->generic.parent->y, name , alpha);
x = strlen(name) * MENU_FONT_SIZE;
if (keys[1] != -1)
{
Menu_DrawString (a->generic.x + a->generic.parent->x + MENU_FONT_SIZE*3 + x,
a->generic.y + a->generic.parent->y, "or", alpha);
Menu_DrawString (a->generic.x + a->generic.parent->x + MENU_FONT_SIZE*6 + x,
a->generic.y + a->generic.parent->y, Key_KeynumToString(keys[1]), alpha);
}
}
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:49,代码来源:ui_options_keys.c
示例4: UI_Tooltip
/**
* @brief Wrapper for UI tooltips
*/
void UI_Tooltip (const uiNode_t* node, int x, int y)
{
const char* string;
const char* key = nullptr;
const char* tooltip = nullptr;
static const int maxWidth = 200;
/* check values */
if (node->key)
key = Key_KeynumToString(node->key->key);
if (node->tooltip)
tooltip = UI_GetReferenceString(node, node->tooltip);
/* normalize */
if (tooltip && tooltip[0] == '\0')
tooltip = nullptr;
if (key && key[0] == '\0')
key = nullptr;
/* create tooltip */
if (key && tooltip) {
char buf[MAX_VAR];
Com_sprintf(buf, sizeof(buf), _("Key: %s"), key);
string = va("%s\n%s", tooltip, buf);
} else if (tooltip) {
string = tooltip;
} else if (key) {
string = va(_("Key: %s"), key);
} else {
return;
}
UI_DrawTooltip(string, x, y, maxWidth);
}
开发者ID:yason,项目名称:ufoai,代码行数:37,代码来源:ui_tooltip.cpp
示例5: Key_KeynumToStringBuf
static void Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
#else
void Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
#endif // RTCW_XX
Q_strncpyz( buf, Key_KeynumToString( keynum, qtrue ), buflen );
}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:7,代码来源:cl_ui.cpp
示例6: IN_PrintKey
/*
===============
IN_PrintKey
===============
*/
static void IN_PrintKey( const SDL_Keysym *keysym, keyNum_t key, bool down )
{
if ( keysym->mod & KMOD_LSHIFT ) { Log::Notice( " KMOD_LSHIFT" ); }
if ( keysym->mod & KMOD_RSHIFT ) { Log::Notice( " KMOD_RSHIFT" ); }
if ( keysym->mod & KMOD_LCTRL ) { Log::Notice( " KMOD_LCTRL" ); }
if ( keysym->mod & KMOD_RCTRL ) { Log::Notice( " KMOD_RCTRL" ); }
if ( keysym->mod & KMOD_LALT ) { Log::Notice( " KMOD_LALT" ); }
if ( keysym->mod & KMOD_RALT ) { Log::Notice( " KMOD_RALT" ); }
if ( keysym->mod & KMOD_LGUI ) { Log::Notice( " KMOD_LGUI" ); }
if ( keysym->mod & KMOD_RGUI ) { Log::Notice( " KMOD_RGUI" ); }
if ( keysym->mod & KMOD_NUM ) { Log::Notice( " KMOD_NUM" ); }
if ( keysym->mod & KMOD_CAPS ) { Log::Notice( " KMOD_CAPS" ); }
if ( keysym->mod & KMOD_MODE ) { Log::Notice( " KMOD_MODE" ); }
if ( keysym->mod & KMOD_RESERVED ) { Log::Notice( " KMOD_RESERVED" ); }
Log::Notice( "%c 0x%02x \"%s\" Q:0x%02x(%s)\n", down ? '+' : ' ', keysym->scancode,
SDL_GetKeyName( keysym->sym ), key, Key_KeynumToString( key ) );
}
开发者ID:ChunHungLiu,项目名称:Unvanquished,代码行数:34,代码来源:sdl_input.cpp
示例7: IN_PrintKey
/*
===============
IN_PrintKey
===============
*/
static void IN_PrintKey( const SDL_Keysym *keysym, keyNum_t key, qboolean down )
{
if( down )
Com_Printf( "+ " );
else
Com_Printf( " " );
Com_Printf( "Scancode: 0x%02x(%s) Sym: 0x%02x(%s)",
keysym->scancode, SDL_GetScancodeName( keysym->scancode ),
keysym->sym, SDL_GetKeyName( keysym->sym ) );
if( keysym->mod & KMOD_LSHIFT ) Com_Printf( " KMOD_LSHIFT" );
if( keysym->mod & KMOD_RSHIFT ) Com_Printf( " KMOD_RSHIFT" );
if( keysym->mod & KMOD_LCTRL ) Com_Printf( " KMOD_LCTRL" );
if( keysym->mod & KMOD_RCTRL ) Com_Printf( " KMOD_RCTRL" );
if( keysym->mod & KMOD_LALT ) Com_Printf( " KMOD_LALT" );
if( keysym->mod & KMOD_RALT ) Com_Printf( " KMOD_RALT" );
if( keysym->mod & KMOD_LGUI ) Com_Printf( " KMOD_LGUI" );
if( keysym->mod & KMOD_RGUI ) Com_Printf( " KMOD_RGUI" );
if( keysym->mod & KMOD_NUM ) Com_Printf( " KMOD_NUM" );
if( keysym->mod & KMOD_CAPS ) Com_Printf( " KMOD_CAPS" );
if( keysym->mod & KMOD_MODE ) Com_Printf( " KMOD_MODE" );
if( keysym->mod & KMOD_RESERVED ) Com_Printf( " KMOD_RESERVED" );
Com_Printf( " Q:0x%02x(%s)\n", key, Key_KeynumToString( key, qtrue ) );
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:31,代码来源:sdl_input.c
示例8: Menu_ItemAtCursor
static const char *Keys_MenuKey( menuframework_s *self, int key )
{
menuaction_s *item = ( menuaction_s * ) Menu_ItemAtCursor( &s_keys_menu );
if ( bind_grab )
{
if ( key != K_ESCAPE && key != '`' )
{
char cmd[1024];
Com_sprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"", Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]);
Cbuf_InsertText (cmd);
}
Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" );
bind_grab = false;
return menu_out_sound;
}
switch ( key )
{
case K_KP_ENTER:
case K_ENTER:
case K_MOUSE1:
KeyBindingFunc( item );
return menu_in_sound;
case K_BACKSPACE: // delete bindings
case K_DEL: // delete bindings
case K_KP_DEL:
M_UnbindCommand( bindnames[item->generic.localdata[0]][0] );
return menu_out_sound;
default:
return Default_MenuKey( self, key );
}
}
开发者ID:chrisnew,项目名称:quake2,代码行数:35,代码来源:ui_keys.c
示例9: CLMN_AddBindings
static inline void CLMN_AddBindings (linkedList_t **list, char **bindings)
{
int i;
for (i = K_FIRST_KEY; i < K_LAST_KEY; i++)
if (bindings[i] && bindings[i][0] != '\0')
LIST_AddString(list, va("%s\t%s", Key_KeynumToString(i), Cmd_GetCommandDesc(bindings[i])));
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:7,代码来源:cl_menu.c
示例10: UI_KeyBindingNodeKeyPressed
/**
* @brief Called when we press a key when the node got the focus
* @return True, if we use the event
*/
static qboolean UI_KeyBindingNodeKeyPressed (uiNode_t *node, unsigned int key, unsigned short unicode)
{
const char *command;
const char *binding;
UI_RemoveFocus();
/** @todo what about macro expansion? */
if (!Q_strstart(node->text, "*binding:"))
return qfalse;
command = node->text + 9;
/** @todo ensure that the binding for the key command is not executed */
binding = Key_GetBinding(command, EXTRADATA(node).keySpace);
if (binding[0] != '\0') {
/* if it's the same command, do not change anything, otherwise
* show the reason why nothing was changed */
if (!Q_streq(binding, command)) {
const char *keyStr = Key_KeynumToString(key);
UI_DisplayNotice(va(_("Key %s already bound"), keyStr), 2000, NULL);
}
return qfalse;
}
/* fire change event */
if (node->onChange)
UI_ExecuteEventActions(node, node->onChange);
Key_SetBinding(key, command, EXTRADATA(node).keySpace);
return qtrue;
}
开发者ID:kevlund,项目名称:ufoai,代码行数:38,代码来源:ui_node_keybinding.c
示例11: IN_PrintKey
/*
===============
IN_PrintKey
===============
*/
static void IN_PrintKey( const SDL_keysym *keysym, keyNum_t key, qboolean down )
{
if( down )
Com_Printf( "+ " );
else
Com_Printf( " " );
Com_Printf( "0x%02x \"%s\"", keysym->scancode,
SDL_GetKeyName( keysym->sym ) );
if( keysym->mod & KMOD_LSHIFT ) Com_Printf( " KMOD_LSHIFT" );
if( keysym->mod & KMOD_RSHIFT ) Com_Printf( " KMOD_RSHIFT" );
if( keysym->mod & KMOD_LCTRL ) Com_Printf( " KMOD_LCTRL" );
if( keysym->mod & KMOD_RCTRL ) Com_Printf( " KMOD_RCTRL" );
if( keysym->mod & KMOD_LALT ) Com_Printf( " KMOD_LALT" );
if( keysym->mod & KMOD_RALT ) Com_Printf( " KMOD_RALT" );
if( keysym->mod & KMOD_LMETA ) Com_Printf( " KMOD_LMETA" );
if( keysym->mod & KMOD_RMETA ) Com_Printf( " KMOD_RMETA" );
if( keysym->mod & KMOD_NUM ) Com_Printf( " KMOD_NUM" );
if( keysym->mod & KMOD_CAPS ) Com_Printf( " KMOD_CAPS" );
if( keysym->mod & KMOD_MODE ) Com_Printf( " KMOD_MODE" );
if( keysym->mod & KMOD_RESERVED ) Com_Printf( " KMOD_RESERVED" );
Com_Printf( " Q:0x%02x(%s)", key, Key_KeynumToString( key ) );
if( keysym->unicode )
{
Com_Printf( " U:0x%02x", keysym->unicode );
if( keysym->unicode > ' ' && keysym->unicode < '~' )
Com_Printf( "(%c)", (char)keysym->unicode );
}
Com_Printf( "\n" );
}
开发者ID:chitmo,项目名称:openarena-engine,代码行数:40,代码来源:sdl_input.c
示例12: DrawKeyBindingFunc
static void DrawKeyBindingFunc( void *self )
{
int mkeys[2];
menuaction_s *a = ( menuaction_s * ) self;
M_FindKeysForCommand( bindnames[a->generic.localdata[0]][0], mkeys);
if (mkeys[0] == -1)
{
Menu_DrawString( a->generic.x + a->generic.parent->x + 16, a->generic.y + a->generic.parent->y, "???" );
}
else
{
int x;
const char *name;
name = Key_KeynumToString (mkeys[0]);
Menu_DrawString( a->generic.x + a->generic.parent->x + 16, a->generic.y + a->generic.parent->y, name );
x = strlen(name) * 8;
if (mkeys[1] != -1)
{
Menu_DrawString( a->generic.x + a->generic.parent->x + 24 + x, a->generic.y + a->generic.parent->y, "or" );
Menu_DrawString( a->generic.x + a->generic.parent->x + 48 + x, a->generic.y + a->generic.parent->y, Key_KeynumToString (mkeys[1]) );
}
}
}
开发者ID:chrisnew,项目名称:quake2,代码行数:29,代码来源:ui_keys.c
示例13: Cmd_JoyRemapList_f
/*
============
Cmd_JoyRemapList_f
============
*/
void Cmd_JoyRemapList_f( void ) {
int i;
int localPlayerNum;
joyDevice_t *device;
localPlayerNum = Com_LocalPlayerForCvarName( Cmd_Argv(0) );
if ( playerJoyRemapIndex[ localPlayerNum ] == -1 ) {
Com_Printf( "Joystick for player %d not initialized\n", localPlayerNum+1 );
return;
}
device = &joyDevice[ playerJoyRemapIndex[ localPlayerNum ] ];
if ( strcmp( device->name, device->ident ) ) {
Com_Printf("Device: %s (%s)\n", device->name, device->ident );
} else {
Com_Printf("Device: %s\n", device->name );
}
for ( i = 0 ; i < MAX_JOY_REMAPS ; i++ ) {
if ( device->remap[i].event.type == JOYEVENT_NONE ) {
continue;
}
Com_Printf ("%s %s\n", CL_JoyEventToString( &device->remap[i].event ),
Key_KeynumToString( device->remap[i].keynum ) );
}
}
开发者ID:DaneTheory,项目名称:spearmint,代码行数:34,代码来源:cl_joystick.c
示例14: Key_GetBinding
/**
* @brief Return the key binding for a given script command
* @param[in] binding The script command to bind keynum to
* @param space Namespace of the key binding
* @sa Key_SetBinding
* @return the binded key or empty string if not found
*/
const char* Key_GetBinding (const char *binding, keyBindSpace_t space)
{
int i;
char **keySpace = NULL;
switch (space) {
case KEYSPACE_UI:
keySpace = menuKeyBindings;
break;
case KEYSPACE_GAME:
keySpace = keyBindings;
break;
case KEYSPACE_BATTLE:
keySpace = battleKeyBindings;
break;
default:
Sys_Error("Unknown key space (%i) given", space);
}
for (i = K_FIRST_KEY; i < K_LAST_KEY; i++)
if (keySpace[i] && *keySpace[i] && Q_streq(keySpace[i], binding)) {
return Key_KeynumToString(i);
}
/* not found */
return "";
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:34,代码来源:cl_keys.c
示例15: PF_cl_keynumtostring
//string keynumtostring(float keynum) = #609;
void QCBUILTIN PF_cl_keynumtostring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int code = G_FLOAT(OFS_PARM0);
code = MP_TranslateQCtoFTECodes (code);
RETURN_TSTRING(Key_KeynumToString(code, 0));
}
开发者ID:ProfessorKaos64,项目名称:ftequake,代码行数:9,代码来源:pr_clcmd.c
示例16: Key_Bindlist_f
/*
* Key_Bindlist_f
*/
static void Key_Bindlist_f( void )
{
int i;
for( i = 0; i < 256; i++ )
if( keybindings[i] && keybindings[i][0] )
Com_Printf( "%s \"%s\"\n", Key_KeynumToString( i ), keybindings[i] );
}
开发者ID:ewirch,项目名称:qfusion,代码行数:11,代码来源:keys.c
示例17: Key_WriteBindings
/*
============
Key_WriteBindings
Writes lines containing "bind key value"
============
*/
void Key_WriteBindings (FILE *f)
{
int i;
for (i=0 ; i<256 ; i++)
if (keybindings[i] && keybindings[i][0])
fprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:15,代码来源:keys.c
示例18: Key_Bindlist_f
/**
* @brief List all binded keys with its function
*/
static void Key_Bindlist_f (void)
{
int i;
Com_Printf("key space: game\n");
for (i = K_FIRST_KEY; i < K_LAST_KEY; i++)
if (keyBindings[i] && keyBindings[i][0])
Com_Printf("- %s \"%s\"\n", Key_KeynumToString(i), keyBindings[i]);
Com_Printf("key space: menu\n");
for (i = K_FIRST_KEY; i < K_LAST_KEY; i++)
if (menuKeyBindings[i] && menuKeyBindings[i][0])
Com_Printf("- %s \"%s\"\n", Key_KeynumToString(i), menuKeyBindings[i]);
Com_Printf("key space: battle\n");
for (i = 0; i < K_LAST_KEY; i++)
if (battleKeyBindings[i] && battleKeyBindings[i][0])
Com_Printf("- %s \"%s\"\n", Key_KeynumToString(i), battleKeyBindings[i]);
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:21,代码来源:cl_keys.c
示例19: IN_PrintKey
/*
* @brief Prints keyboard identifiers in the console
*/
static void IN_PrintKey(const SDL_Keysym *keysym, keyNum_t key, qboolean down)
{
if (down)
{
Com_Printf("+ ");
}
else
{
Com_Printf(" ");
}
Com_Printf("0x%02x \"%s\"", keysym->scancode,
SDL_GetKeyName(keysym->sym));
if (keysym->mod & KMOD_LSHIFT)
{
Com_Printf(" KMOD_LSHIFT");
}
if (keysym->mod & KMOD_RSHIFT)
{
Com_Printf(" KMOD_RSHIFT");
}
if (keysym->mod & KMOD_LCTRL)
{
Com_Printf(" KMOD_LCTRL");
}
if (keysym->mod & KMOD_RCTRL)
{
Com_Printf(" KMOD_RCTRL");
}
if (keysym->mod & KMOD_LALT)
{
Com_Printf(" KMOD_LALT");
}
if (keysym->mod & KMOD_RALT)
{
Com_Printf(" KMOD_RALT");
}
if (keysym->mod & KMOD_NUM)
{
Com_Printf(" KMOD_NUM");
}
if (keysym->mod & KMOD_CAPS)
{
Com_Printf(" KMOD_CAPS");
}
if (keysym->mod & KMOD_MODE)
{
Com_Printf(" KMOD_MODE");
}
if (keysym->mod & KMOD_RESERVED)
{
Com_Printf(" KMOD_RESERVED");
}
Com_Printf(" Q:0x%02x(%s)\n", key, Key_KeynumToString(key,qtrue));
}
开发者ID:NewsNoobDude,项目名称:RTCW-SP-linux,代码行数:60,代码来源:sdl2_input.c
示例20: Key_KeynumToStringBuf
// only ever called by binding-display code, therefore returns non-technical "friendly" names
// in any language that don't necessarily match those in the config file...
//
void Key_KeynumToStringBuf( int keynum, char *buf, int buflen )
{
const char *psKeyName = Key_KeynumToString( keynum/*, qtrue */);
// see if there's a more friendly (or localised) name...
//
const char *psKeyNameFriendly = SE_GetString( va("KEYNAMES_KEYNAME_%s",psKeyName) );
Q_strncpyz( buf, (psKeyNameFriendly && psKeyNameFriendly[0]) ? psKeyNameFriendly : psKeyName, buflen );
}
开发者ID:entdark,项目名称:jaMME,代码行数:13,代码来源:cl_ui.cpp
注:本文中的Key_KeynumToString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论