当前位置: 首页>>代码示例>>C++>>正文


C++ Key_SetBinding函数代码示例

本文整理汇总了C++中Key_SetBinding函数的典型用法代码示例。如果您正苦于以下问题:C++ Key_SetBinding函数的具体用法?C++ Key_SetBinding怎么用?C++ Key_SetBinding使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Key_SetBinding函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Key_Unbindall_f

/**
 * @brief Unbind all key bindings
 * @sa Key_SetBinding
 */
static void Key_Unbindall_f (void)
{
	int i;

	for (i = K_FIRST_KEY; i < K_LAST_KEY; i++)
		if (keyBindings[i]) {
			if (Q_streq(Cmd_Argv(0), "unbindallmenu"))
				Key_SetBinding(i, "", KEYSPACE_UI);
			else
				Key_SetBinding(i, "", KEYSPACE_GAME);
		}
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:16,代码来源:cl_keys.c

示例2: Key_Reset_f

/*
===================
Key_Reset_f
===================
*/
void Key_Reset_f( void )
{
	int	i;
	keyname_t	*kn;

	// clear all keys first	
	for( i = 0; i < 256; i++ )
	{
		if( keys[i].binding )
			Key_SetBinding( i, "" );
	}

	// apply default values
	for( kn = keynames; kn->name; kn++ )
		Key_SetBinding( kn->keynum, kn->binding ); 
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:21,代码来源:keys.c

示例3: 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

示例4: Key_Unbindall_f

static void Key_Unbindall_f (void)
{
	int	i;

	for (i = 0; i < 256; i++)
		Key_SetBinding(i, NULL);
}
开发者ID:svn2github,项目名称:uhexen2,代码行数:7,代码来源:keys.c

示例5: Key_Bind_f

/*
===================
Key_Bind_f
===================
*/
static void Key_Bind_f(void)
{
    int c, b;

    c = Cmd_Argc();

    if (c < 2) {
        Com_Printf("bind <key> [command] : attach a command to a key\n");
        return;
    }
    b = Key_StringToKeynum(Cmd_Argv(1));
    if (b == -1) {
        Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
        return;
    }

    if (c == 2) {
        if (keybindings[b])
            Com_Printf("\"%s\" = \"%s\"\n", Cmd_Argv(1), keybindings[b]);
        else
            Com_Printf("\"%s\" is not bound\n", Cmd_Argv(1));
        return;
    }

// copy the rest of the command line
    Key_SetBinding(b, Cmd_ArgsFrom(2));
}
开发者ID:jayschwa,项目名称:q2pro,代码行数:32,代码来源:keys.c

示例6: Key_Unbindall_f

void Key_Unbindall_f (void)
{
	int		i;
	
	for (i=0 ; i<256 ; i++)
		if (keybindings[i])
			Key_SetBinding (i, "");
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:8,代码来源:keys.c

示例7: Key_Unbindall

static void Key_Unbindall( void )
{
	int i;

	for( i = 0; i < 256; i++ )
	{
		if( keybindings[i] )
			Key_SetBinding( i, NULL );
	}
}
开发者ID:ewirch,项目名称:qfusion,代码行数:10,代码来源:keys.c

示例8: Key_Unbindall_f

/*
===================
Key_Unbindall_f
===================
*/
void Key_Unbindall_f( void )
{
	int	i;
	
	for( i = 0; i < 256; i++ )
	{
		if( i != K_ESCAPE && keys[i].binding )
			Key_SetBinding( i, "" );
	}
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:15,代码来源:keys.c

示例9: Key_Bind_f

/**
 * @brief Binds a key to a given script command
 * @sa Key_SetBinding
 */
static void Key_Bind_f (void)
{
	int i, c, b;
	char cmd[1024];

	c = Cmd_Argc();

	if (c < 2) {
		Com_Printf("Usage: %s <key> [command] : attach a command to a key\n", Cmd_Argv(0));
		return;
	}
	b = Key_StringToKeynum(Cmd_Argv(1));
	if (b == -1) {
		Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
		return;
	}

	if (c == 2) {
		if (keyBindings[b])
			Com_Printf("\"%s\" = \"%s\"\n", Cmd_Argv(1), keyBindings[b]);
		else
			Com_Printf("\"%s\" is not bound\n", Cmd_Argv(1));
		return;
	}

	/* copy the rest of the command line */
	cmd[0] = '\0';					/* start out with a null string */
	for (i = 2; i < c; i++) {
		Q_strcat(cmd, Cmd_Argv(i), sizeof(cmd));
		if (i != (c - 1))
			Q_strcat(cmd, " ", sizeof(cmd));
	}

	if (Q_streq(Cmd_Argv(0), "bindui"))
		UI_SetKeyBinding(cmd, b);
	else if (Q_streq(Cmd_Argv(0), "bindmenu"))
		Key_SetBinding(b, cmd, KEYSPACE_UI);
	else if (Q_streq(Cmd_Argv(0), "bindbattle"))
		Key_SetBinding(b, cmd, KEYSPACE_BATTLE);
	else
		Key_SetBinding(b, cmd, KEYSPACE_GAME);
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:46,代码来源:cl_keys.c

示例10: Key_Unbindall_f

/*
===================
Key_Unbindall_f
===================
*/
void Key_Unbindall_f (void)
{
	int		i;
	
	for ( i = 0 ; i < MAX_KEYS; i++ ) 
	{
		if ( keys[i].binding )
		{
			Key_SetBinding( i, "" );
		}
	}
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:17,代码来源:keys.c

示例11: Key_Unbindall_f

/**
 * \brief Console callback method to unbind all key mapping
 */
PRIVATE void Key_Unbindall_f( void )
{
	int i;

	for( i = 0; i < 256; ++i )
	{
		if( keybindings[ i ] )
		{
			Key_SetBinding( i, "" );
		}
	}
}
开发者ID:Oppen,项目名称:Wolf3DRedux,代码行数:15,代码来源:keys.c

示例12: Key_Unbind_f

/**
 * @brief Unbind a given key binding
 * @sa Key_SetBinding
 */
static void Key_Unbind_f (void)
{
	int b;

	if (Cmd_Argc() != 2) {
		Com_Printf("Usage: %s <key> : remove commands from a key\n", Cmd_Argv(0));
		return;
	}

	b = Key_StringToKeynum(Cmd_Argv(1));
	if (b == -1) {
		Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
		return;
	}

	if (Q_streq(Cmd_Argv(0), "unbindmenu"))
		Key_SetBinding(b, "", KEYSPACE_UI);
	else if (Q_streq(Cmd_Argv(0), "unbindbattle"))
		Key_SetBinding(b, "", KEYSPACE_BATTLE);
	else
		Key_SetBinding(b, "", KEYSPACE_GAME);
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:26,代码来源:cl_keys.c

示例13: Key_Init

/*
===================
Key_Init
===================
*/
void Key_Init( void )
{
	keyname_t	*kn;

	// register our functions
	Cmd_AddCommand( "bind", Key_Bind_f, "binds a command to the specified key in bindmap" );
	Cmd_AddCommand( "unbind", Key_Unbind_f, "removes a command on the specified key in bindmap" );
	Cmd_AddCommand( "unbindall", Key_Unbindall_f, "removes all commands from all keys in bindmap" );
	Cmd_AddCommand( "resetkeys", Key_Reset_f, "reset all keys to their default values" );
	Cmd_AddCommand( "bindlist", Key_Bindlist_f, "display current key bindings" );
	Cmd_AddCommand( "makehelp", Key_EnumCmds_f, "write help.txt that contains all console cvars and cmds" ); 

	// setup default binding. "unbindall" from config.cfg will reset it
	for( kn = keynames; kn->name; kn++ ) Key_SetBinding( kn->keynum, kn->binding ); 
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:20,代码来源:keys.c

示例14: M_UnbindCommand

static void M_UnbindCommand (char *command)
{
	int		j;
	int		l;
	char	*b;

	l = strlen(command);

	for (j=0 ; j<MAX_KEYS ; j++)
	{
		b = keys[j].binding;
		if (!b)
			continue;
		if (!strncmp (b, command, l) )
			Key_SetBinding (j, "");
	}
}
开发者ID:chrisnew,项目名称:quake2,代码行数:17,代码来源:ui_keys.c

示例15: Key_Unbind_f

/*
===================
Key_Unbind_f
===================
*/
static void Key_Unbind_f(void)
{
    int     b;

    if (Cmd_Argc() != 2) {
        Com_Printf("unbind <key> : remove commands from a key\n");
        return;
    }

    b = Key_StringToKeynum(Cmd_Argv(1));
    if (b == -1) {
        Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
        return;
    }

    Key_SetBinding(b, NULL);
}
开发者ID:jayschwa,项目名称:q2pro,代码行数:22,代码来源:keys.c


注:本文中的Key_SetBinding函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。