• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Key_SetBinding函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Key_Unbind_f

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

	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: unbind <key> : remove commands from a key\n" );
		return;
	}
	
	b = Key_StringToKeynum( Cmd_Argv( 1 ));
	if( b == -1 )
	{
		Msg( "\"%s\" isn't a valid key\n", Cmd_Argv( 1 ));
		return;
	}
	Key_SetBinding( b, "" );
}
开发者ID:Rhoin,项目名称:Xash3D-CrossPlatform-Port,代码行数:23,代码来源:keys.c


示例17: M_UnbindCommand

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

	l = strlen(command);

	for (j=0 ; j<256 ; j++)
	{
		b = keybindings[j];
		if (!b)
			continue;
		// Knightmare- fix bug with key bound to +attack2 being confused with +attack
		if (!strncmp (b, "+attack2", 8) && strncmp (command, "+attack2", 8))
			continue;
		if (!strncmp (b, command, l) )
			Key_SetBinding (j, "");
	}
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:20,代码来源:ui_options_keys.c


示例18: Key_Bind_f

/**
 * \brief Console callback method to bind key mapping
 */
PRIVATE void Key_Bind_f( void )
{
        int                     i, c, b;
        char            cmd[ 1024 ];

        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
        cmd[ 0 ] = '\0';                // start out with a null string
        for( i = 2; i < c; ++i )
        {
                com_strlcat( cmd, Cmd_Argv( i ), sizeof( cmd ) );
                if( i != (c-1) )
				{
					com_strlcat( cmd, " ", sizeof( cmd ) );
				}
        }

        Key_SetBinding( b, cmd );
}
开发者ID:Oppen,项目名称:Wolf3DRedux,代码行数:44,代码来源:keys.c


示例19: Key_Bind_f

/*
===================
Key_Bind_f
===================
*/
void Key_Bind_f( void )
{
	int			i, c, b;
	char		cmd[MAX_STRING_TOKENS];
	
	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 ( keys[b].binding && keys[b].binding[0] )
			Com_Printf( "\"%s\" = \"%s\"\n", Cmd_Argv( 1 ), keys[b].binding );
		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++ )
	{
		strcat( cmd, Cmd_Argv( i ) );
		if ( i != ( c-1 ) )
			strcat( cmd, " " );
	}

	Key_SetBinding( b, cmd );
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:45,代码来源:keys.c


示例20: Key_Bind_f

/*
===================
Key_Bind_f
===================
*/
void Key_Bind_f( void )
{
	int	i, c, b;
	char	cmd[1024];
	
	c = Cmd_Argc();

	if( c < 2 )
	{
		Msg( "Usage: bind <key> [command] : attach a command to a key\n" );
		return;
	}

	b = Key_StringToKeynum( Cmd_Argv( 1 ));

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

	if( c == 2 )
	{
		if( keys[b].binding )
			Msg( "\"%s\" = \"%s\"\n", Cmd_Argv( 1 ), keys[b].binding );
		else Msg( "\"%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 ));
		if( i != ( c - 1 )) Q_strcat( cmd, " " );
	}

	Key_SetBinding( b, cmd );
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:45,代码来源:keys.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Key_SetCatcher函数代码示例发布时间:2022-05-30
下一篇:
C++ Key_KeynumToString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap