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

C++ Menu_ItemAtCursor函数代码示例

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

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



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

示例1: Menu_SlideItem

void Menu_SlideItem (menuframework_s *s, int32_t dir)
{
	menucommon_s *item = (menucommon_s *) Menu_ItemAtCursor(s);

	if (item)
	{
		switch (item->type)
		{
		case MTYPE_SLIDER:
			Slider_DoSlide ((menuslider_s *) item, dir);
			break;
		case MTYPE_SPINCONTROL:
			SpinControl_DoSlide ((menulist_s *) item, dir);
			break;
		}
	}
}
开发者ID:calking25,项目名称:quake2vr,代码行数:17,代码来源:ui_backend.c


示例2: Menu_ItemAtCursor

static const char *Keys_MenuKey( int key )
{
	menuaction_s *item = ( menuaction_s * ) Menu_ItemAtCursor( &s_keys_menu );

	//pressing mouse1 to pick a new bind wont force bind/unbind itself - spaz
	if ( bind_grab && !(cursor.buttonused[MOUSEBUTTON1]&&key==K_MOUSE1))
	{	
		if ( key != K_ESCAPE && key != '`' )
		{
			char cmd[1024];

			Com_sprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]);
			Cbuf_InsertText (cmd);
		}
		
		// Knightmare- added Psychospaz's mouse support
		//dont let selecting with mouse buttons screw everything up
		UI_RefreshCursorButtons();
		if (key==K_MOUSE1)
			cursor.buttonclicks[MOUSEBUTTON1] = -1;

		//Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" );
		Menu_SetStatusBar( &s_keys_menu, "Press ENTER or LEFT CLICK to change the key. Press BACKSPACE to clear." );
		bind_grab = false;
		return menu_out_sound;
	}

	switch ( key )
	{
	case K_KP_ENTER:
	case K_ENTER:
		if (item == &s_keys_back_action) { // back action hack
			UI_BackMenu(item); return NULL; }
		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( &s_keys_menu, key );
	}
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:44,代码来源:ui_options_keys.c


示例3: Field_Draw

void
Field_Draw(menufield_s * f)
{
	int		i;
	char		tempbuffer[128] = "";
	int 		alpha = mouseOverAlpha(&f->generic);

	if (f->generic.name)
		Menu_DrawStringR2LDark(f->generic.x + f->generic.parent->x + LCOLUMN_OFFSET, f->generic.y + f->generic.parent->y, f->generic.name, 255);

	Q_strncpyz(tempbuffer, f->buffer + f->visible_offset, f->visible_length);

	Draw_Char(f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y - 4, 18, 255);
	Draw_Char(f->generic.x + f->generic.parent->x + 16, f->generic.y + f->generic.parent->y + 4, 24, 255);

	Draw_Char(f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y - 4, 20, 255);
	Draw_Char(f->generic.x + f->generic.parent->x + 24 + f->visible_length * 8, f->generic.y + f->generic.parent->y + 4, 26, 255);

	for (i = 0; i < f->visible_length; i++) {
		Draw_Char(f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y - 4, 19, 255);
		Draw_Char(f->generic.x + f->generic.parent->x + 24 + i * 8, f->generic.y + f->generic.parent->y + 4, 25, 255);
	}

	Menu_DrawString(f->generic.x + f->generic.parent->x + 24, f->generic.y + f->generic.parent->y, tempbuffer, alpha);

	if (Menu_ItemAtCursor(f->generic.parent) == f) {
		int		offset;

		if (f->visible_offset)
			offset = f->visible_length;
		else
			offset = f->cursor;

		if (((int)(Sys_Milliseconds() / 250)) & 1) {
			Draw_Char(f->generic.x + f->generic.parent->x + (offset + 2) * 8 + 8,
			    f->generic.y + f->generic.parent->y,
			    11, 255);
		} else {
			Draw_Char(f->generic.x + f->generic.parent->x + (offset + 2) * 8 + 8,
			    f->generic.y + f->generic.parent->y,
			    ' ', 255);
		}
	}
}
开发者ID:ZwS,项目名称:qudos,代码行数:44,代码来源:qmenu.c


示例4: Menu_ItemAtCursor

const char *Default_MenuCharEvent( menuframework_s *m, qwchar key )
{
	menucommon_t *item = NULL;

	if( m )
	{
		item = Menu_ItemAtCursor( m );
		if( item != NULL )
		{
			if( item->type == MTYPE_FIELD )
			{
				if( Field_CharEvent( item, key ) )
					return NULL;
			}
		}
	}

	return NULL;
}
开发者ID:Kaperstone,项目名称:warsow,代码行数:19,代码来源:ui_menu.c


示例5: ArenaServers_MenuKey

/*
=================
ArenaServers_MenuKey
=================
*/
static sfxHandle_t ArenaServers_MenuKey( int key ) {
	if( key == K_SPACE  && g_arenaservers.refreshservers ) {
		ArenaServers_StopRefresh();	
		return menu_move_sound;
	}

	if( ( key == K_DEL || key == K_KP_DEL ) && ( g_servertype == UIAS_FAVORITES ) &&
		( Menu_ItemAtCursor( &g_arenaservers.menu) == &g_arenaservers.list ) ) {
		ArenaServers_Remove();
		ArenaServers_UpdateMenu();
		return menu_move_sound;
	}

	if( key == K_MOUSE2 || key == K_ESCAPE ) {
		ArenaServers_StopRefresh();
		ArenaServers_SaveChanges();
	}


	return Menu_DefaultKey( &g_arenaservers.menu, key );
}
开发者ID:ensiform,项目名称:q3pp,代码行数:26,代码来源:ui_servers2.cpp


示例6: Menu_SelectItem

qboolean
Menu_SelectItem(menuframework_s * s)
{
	menucommon_s   *item = (menucommon_s *) Menu_ItemAtCursor(s);

	if (item) {
		switch (item->type) {
		case MTYPE_FIELD:
			return Field_DoEnter((menufield_s *) item);
		case MTYPE_ACTION:
			Action_DoEnter((menuaction_s *) item);
			return true;
		case MTYPE_LIST:
			/* Menulist_DoEnter( ( menulist_s * ) item ); */
			return false;
		case MTYPE_SPINCONTROL:
			/* SpinControl_DoEnter( ( menulist_s * ) item ); */
			return false;
		}
	}
	return false;
}
开发者ID:ZwS,项目名称:qudos,代码行数:22,代码来源:qmenu.c


示例7: Menu_SelectItem

int Menu_SelectItem( menuframework_t *s )
{
	menucommon_t *item = ( menucommon_t * ) Menu_ItemAtCursor( s );

	if ( item )
	{
		switch ( item->type )
		{
		case MTYPE_FIELD:
			return Field_DoEnter( ( menufield_t * ) item ) ;
		case MTYPE_ACTION:
			Action_DoEnter( ( menuaction_t * ) item );
			return 1;
		case MTYPE_LIST:
//			Menulist_DoEnter( ( menulist_t * ) item );
			return 0;
		case MTYPE_SPINCONTROL:
//			SpinControl_DoEnter( ( menulist_t * ) item );
			return 0;
		}
	}
	return 0;
}
开发者ID:Jaegermeiste,项目名称:quake2_322,代码行数:23,代码来源:qmenu.c


示例8: Menu_Draw

void Menu_Draw( menuframework_s *menu )
{
	int i;
	menucommon_s *item;

	/*
	** draw contents
	*/
	for ( i = 0; i < menu->nitems; i++ )
	{
		switch ( ( ( menucommon_s * ) menu->items[i] )->type )
		{
		case MTYPE_FIELD:
			Field_Draw( ( menufield_s * ) menu->items[i] );
			break;
		case MTYPE_SLIDER:
			Slider_Draw( ( menuslider_s * ) menu->items[i] );
			break;
		case MTYPE_LIST:
			MenuList_Draw( ( menulist_s * ) menu->items[i] );
			break;
		case MTYPE_SPINCONTROL:
			SpinControl_Draw( ( menulist_s * ) menu->items[i] );
			break;
		case MTYPE_ACTION:
			Action_Draw( ( menuaction_s * ) menu->items[i] );
			break;
		case MTYPE_SEPARATOR:
			Separator_Draw( ( menuseparator_s * ) menu->items[i] );
			break;
		}
	}

	item = (menucommon_s *) Menu_ItemAtCursor( menu );

	if ( item && item->cursordraw )
	{
		item->cursordraw( item );
	}
	else if ( menu->cursordraw )
	{
		menu->cursordraw( menu );
	}
	else if ( item && item->type != MTYPE_FIELD )
	{
		if ( item->flags & QMF_LEFT_JUSTIFY )
		{
			Draw_Char( menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
		else
		{
			Draw_Char( menu->x + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
	}

	if ( item )
	{
		if ( item->statusbarfunc )
			item->statusbarfunc( ( void * ) item );
		else if ( item->statusbar )
			Menu_DrawStatusBar( item->statusbar );
		else
			Menu_DrawStatusBar( menu->statusbar );

	}
	else
	{
		Menu_DrawStatusBar( menu->statusbar );
	}
}
开发者ID:turol,项目名称:webquake2,代码行数:70,代码来源:qmenu.c


示例9: Menu_Draw


//.........这里部分代码省略.........
		//Menu_DrawBackground("q2bg.tga");
	}

	// Draw the menu version information
	if (cl_menustamp->value > 0)
	{
		/*
		1 - Regular string
		2 - Regular string plus drop shadow (green... not effective)
		3 - All green string
		*/
		if (cl_menustamp->value == 1)
		{
			// Draw the text
			Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP);
		}
		else if (cl_menustamp->value == 2)
		{
			// Draw the drop shadow (we need black characters)
			DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3) - 1, viddef.height - FONTSIZE, MENUSTAMP);

			// Draw the text
			Menu_DrawString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE - 1, MENUSTAMP);
		}
		else if (cl_menustamp->value == 3)
		{
			// Draw the text
			DrawAltString (viddef.width - (strlen(MENUSTAMP) * FONTSIZE) - (FONTSIZE * 3), viddef.height - FONTSIZE, MENUSTAMP);
		}
	}

	// Menu drawing prevention hack for main menu
	if ((menu->x == -1) && (menu->y == -1))
		return;

	/*
	** draw contents
	*/
	for ( i = 0; i < menu->nitems; i++ )
	{
		switch ( ( ( menucommon_t * ) menu->items[i] )->type )
		{
		case MTYPE_FIELD:
			Field_Draw( ( menufield_t * ) menu->items[i] );
			break;
		case MTYPE_SLIDER:
			Slider_Draw( ( menuslider_t * ) menu->items[i] );
			break;
		case MTYPE_LIST:
			MenuList_Draw( ( menulist_t * ) menu->items[i] );
			break;
		case MTYPE_SPINCONTROL:
			SpinControl_Draw( ( menulist_t * ) menu->items[i] );
			break;
		case MTYPE_ACTION:
			Action_Draw( ( menuaction_t * ) menu->items[i] );
			break;
		case MTYPE_SEPARATOR:
			Separator_Draw( ( menuseparator_t * ) menu->items[i] );
			break;
		}
	}

	item = Menu_ItemAtCursor( menu );

	if ( item && item->cursordraw )
	{
		item->cursordraw( item );
	}
	else if ( menu->cursordraw )
	{
		menu->cursordraw( menu );
	}
	else if ( item && item->type != MTYPE_FIELD )
	{
		if ( item->flags & QMF_LEFT_JUSTIFY )
		{
			Draw_Char( menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
		else
		{
			Draw_Char( menu->x + item->cursor_offset, menu->y + item->y, 12 + ( ( int ) ( Sys_Milliseconds()/250 ) & 1 ) );
		}
	}

	if ( item )
	{
		if ( item->statusbarfunc )
			item->statusbarfunc( ( void * ) item );
		else if ( item->statusbar )
			Menu_DrawStatusBar( item->statusbar );
		else
			Menu_DrawStatusBar( menu->statusbar );

	}
	else
	{
		Menu_DrawStatusBar( menu->statusbar );
	}
}
开发者ID:Jaegermeiste,项目名称:quake2_322,代码行数:101,代码来源:qmenu.c


示例10: Menu_Draw


//.........这里部分代码省略.........
				{
					len = strlen(item->name);

					if (item->flags & QMF_LEFT_JUSTIFY) {
						min[0] += LCOLUMN_OFFSET * 2;
						max[0] = min[0] + len * 8;
					} else {
						min[0] -= len * 8 + 24;
					}

					type = MENUITEM_ACTION;
				}
				break;
			case MTYPE_SLIDER:
				{
					min[0] -= 16;
					max[0] += (SLIDER_RANGE + 2) * 8 + 16;
					type = MENUITEM_SLIDER;
				}
				break;
			case MTYPE_LIST:
			case MTYPE_SPINCONTROL:
				{
					int		len;
					menulist_s     *spin = menu->items[i];


					if (item->name) {
						len = strlen(item->name);
						min[0] -= len * 8 - LCOLUMN_OFFSET * 2;
					}
					len = strlen(spin->itemnames[spin->curvalue]);
					max[0] += len * 8;

					type = MENUITEM_ROTATE;
				}
				break;
			case MTYPE_FIELD:
				{
					menufield_s    *text = menu->items[i];

					len = text->visible_length + 2;

					max[0] += len * 8;
					type = MENUITEM_TEXT;
				}
				break;
			default:
				continue;
			}

			if (cursor.x >= min[0] &&
			    cursor.x <= max[0] &&
			    cursor.y >= min[1] &&
			    cursor.y <= max[1]) {
				/* new item */
				if (lastitem != item) {
					int		j;

					for (j = 0; j < MENU_CURSOR_BUTTON_MAX; j++) {
						cursor.buttonclicks[j] = 0;
						cursor.buttontime[j] = 0;
					}
				}
				cursor.menuitem = item;
				cursor.menuitemtype = type;

				menu->cursor = i;

				break;
			}
		}
	}
	cursor.mouseaction = false;

	item = Menu_ItemAtCursor(menu);

	if (item && item->cursordraw) {
		item->cursordraw(item);
	} else if (menu->cursordraw) {
		menu->cursordraw(menu);
	} else if (item && item->type != MTYPE_FIELD) {
		if (item->flags & QMF_LEFT_JUSTIFY) {
			Draw_Char(menu->x + item->x - 24 + item->cursor_offset, menu->y + item->y, 12 + ((int)(Sys_Milliseconds() / 250) & 1), 255);
		} else {
			Draw_Char(menu->x + item->cursor_offset, menu->y + item->y, 12 + ((int)(Sys_Milliseconds() / 250) & 1), 255);
		}
	}
	if (item) {
		if (item->statusbarfunc)
			item->statusbarfunc((void *)item);
		else if (item->statusbar)
			Menu_DrawStatusBar(item->statusbar);
		else
			Menu_DrawStatusBar(menu->statusbar);

	} else {
		Menu_DrawStatusBar(menu->statusbar);
	}
}
开发者ID:ZwS,项目名称:qudos,代码行数:101,代码来源:qmenu.c


示例11: Menu_DefaultKey

sfxHandle_t Menu_DefaultKey(menuframework_s *m, int key)
{
	sfxHandle_t		sound = 0;
	menucommon_s	*item;
	int				cursor_prev;

	// menu system keys
	switch (key) {
	case K_MOUSE2:
	case K_ESCAPE:
		UI_PopMenu();
		return menu_out_sound;
	}

	if (!m || !m->nitems) {
		return 0;
	}

	// route key stimulus to widget
	item = Menu_ItemAtCursor(m);
	if (item && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) {
		switch (item->type) {
		case MTYPE_SPINCONTROL:
			sound = SpinControl_Key((menulist_s*)item, key);
			break;

		case MTYPE_RADIOBUTTON:
			sound = RadioButton_Key((menuradiobutton_s*)item, key);
			break;

		case MTYPE_SLIDER:
			sound = Slider_Key((menuslider_s*)item, key);
			break;

		case MTYPE_SCROLLLIST:
			sound = ScrollList_Key((menulist_s*)item, key);
			break;

		case MTYPE_FIELD:
			sound = MenuField_Key((menufield_s*)item, &key);
			break;
		}

		if (sound) {
			// key was handled
			return sound;
		}
	}

	// default handling
	switch (key) {
#ifndef NDEBUG
	case K_F11:
		uis.debug ^= 1;
		break;

	case K_F12:
		trap_Cmd_ExecuteText(EXEC_APPEND, "screenshot\n");
		break;
#endif
	case K_KP_UPARROW:
	case K_UPARROW:
		cursor_prev    = m->cursor;
		m->cursor_prev = m->cursor;
		m->cursor--;
		Menu_AdjustCursor(m, -1);
		if (cursor_prev != m->cursor) {
			Menu_CursorMoved(m);
			sound = menu_move_sound;
		}
		break;

	case K_TAB:
	case K_KP_DOWNARROW:
	case K_DOWNARROW:
		cursor_prev    = m->cursor;
		m->cursor_prev = m->cursor;
		m->cursor++;
		Menu_AdjustCursor(m, 1);
		if (cursor_prev != m->cursor) {
			Menu_CursorMoved(m);
			sound = menu_move_sound;
		}
		break;

	case K_MOUSE1:
	case K_MOUSE3:
		if (item)
			if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE)))
				return (Menu_ActivateItem(m, item));
		break;

	case K_JOY1:
	case K_JOY2:
	case K_JOY3:
	case K_JOY4:
	case K_AUX1:
	case K_AUX2:
	case K_AUX3:
	case K_AUX4:
//.........这里部分代码省略.........
开发者ID:baseas,项目名称:aftershock,代码行数:101,代码来源:ui_qmenu.c


示例12: UI_SPLevelMenu_MenuDraw

static void UI_SPLevelMenu_MenuDraw( void ) {
	int				n, i;
	int				x, y;
	vec4_t			color;
	int				level;
//	int				fraglimit;
	int				pad;
	char			buf[MAX_INFO_VALUE];
	char			string[64];

	if(	levelMenuInfo.reinit ) {
		UI_PopMenu();
		UI_SPLevelMenu();
		return;
	}

	// draw player name
	trap_Cvar_VariableStringBuffer( "name", string, 32 );
	Q_CleanStr( string );
	UI_DrawProportionalString( 320, PLAYER_Y, string, UI_CENTER|UI_SMALLFONT, color_orange );

	// check for model changes
	trap_Cvar_VariableStringBuffer( "model", buf, sizeof(buf) );
	if( Q_stricmp( buf, levelMenuInfo.playerModel ) != 0 ) {
		Q_strncpyz( levelMenuInfo.playerModel, buf, sizeof(levelMenuInfo.playerModel) );
		PlayerIcon( levelMenuInfo.playerModel, levelMenuInfo.playerPicName, sizeof(levelMenuInfo.playerPicName) );
		levelMenuInfo.item_player.shader = 0;
	}

	// standard menu drawing
	Menu_Draw( &levelMenuInfo.menu );

	// draw player award levels
	y = AWARDS_Y;
	i = 0;
	for( n = 0; n < 6; n++ ) {
		level = levelMenuInfo.awardLevels[n];
		if( level > 0 ) {
			if( i & 1 ) {
				x = 224 - (i - 1 ) / 2 * (48 + 16);
			}
			else {
				x = 368 + i / 2 * (48 + 16);
			}
			i++;

			if( level == 1 ) {
				continue;
			}

			if( level >= 1000000 ) {
				Com_sprintf( string, sizeof(string), "%im", level / 1000000 );
			}
			else if( level >= 1000 ) {
				Com_sprintf( string, sizeof(string), "%ik", level / 1000 );
			}
			else {
				Com_sprintf( string, sizeof(string), "%i", level );
			}

			UI_DrawString( x + 24, y + 48, string, UI_CENTER, color_yellow );
		}
	}

	UI_DrawProportionalString( 18, 38, va( "Tier %i", selectedArenaSet + 1 ), UI_LEFT|UI_SMALLFONT, color_orange );

	for ( n = 0; n < levelMenuInfo.numMaps; n++ ) {
		x = levelMenuInfo.item_maps[n].generic.x;
		y = levelMenuInfo.item_maps[n].generic.y;
		UI_FillRect( x, y + 96, 128, 18, color_black );
	}

	if ( selectedArenaSet > currentSet ) {
		UI_DrawProportionalString( 320, 216, "ACCESS DENIED", UI_CENTER|UI_BIGFONT, color_red );
		return;
	}

	// show levelshots for levels of current tier
	Vector4Copy( color_white, color );
	color[3] = 0.5+0.5*sin(uis.realtime/PULSE_DIVISOR);
	for ( n = 0; n < levelMenuInfo.numMaps; n++ ) {
		x = levelMenuInfo.item_maps[n].generic.x;
		y = levelMenuInfo.item_maps[n].generic.y;

		UI_DrawString( x + 64, y + 96, levelMenuInfo.levelNames[n], UI_CENTER|UI_SMALLFONT, color_orange );

		if( levelMenuInfo.levelScores[n] == 1 ) {
			UI_DrawHandlePic( x, y, 128, 96, levelMenuInfo.levelCompletePic[levelMenuInfo.levelScoresSkill[n] - 1] ); 
		}

		if ( n == selectedArena ) {
			if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) {
				trap_R_SetColor( color );
			}
			UI_DrawHandlePic( x-1, y-1, 130, 130 - 14, levelMenuInfo.levelSelectedPic ); 
			trap_R_SetColor( NULL );
		}
		else if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) {
			trap_R_SetColor( color );
			UI_DrawHandlePic( x-31, y-30, 256, 256-27, levelMenuInfo.levelFocusPic); 
//.........这里部分代码省略.........
开发者ID:ElderPlayerX,项目名称:Rune,代码行数:101,代码来源:ui_splevel.c


示例13:

/**
 * \brief Handle menu navigation
 */
const char *Default_MenuKey( menuframework_s *m, int key )
{
	const char *sound = NULL;
	menucommon_s *item;

	if( m )
	{
		if( ( item = Menu_ItemAtCursor( m ) ) != 0 )
		{
			if ( item->type == MTYPE_FIELD )
			{
				if ( Field_Key( ( menufield_s * ) item, key ) )
				{
					return NULL;
				}
			}
		}
	}

	switch( key )
	{
		case K_ESCAPE:
			M_PopMenu();
			return menu_out_sound;

		case K_KP_UPARROW:
		case K_UPARROW:
			if ( m )
			{
				m->cursor--;
				Menu_AdjustCursor( m, -1 );
				sound = menu_move_sound;
			}
			break;
		case K_TAB:
			if ( m )
			{
				m->cursor++;
				Menu_AdjustCursor( m, 1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_DOWNARROW:
		case K_DOWNARROW:
			if ( m )
			{
				m->cursor++;
				Menu_AdjustCursor( m, 1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_LEFTARROW:
		case K_LEFTARROW:
			if ( m )
			{
				Menu_SlideItem( m, -1 );
				sound = menu_move_sound;
			}
			break;
		case K_KP_RIGHTARROW:
		case K_RIGHTARROW:
			if ( m )
			{
				Menu_SlideItem( m, 1 );
				sound = menu_move_sound;
			}
			break;

		case K_MOUSE1:
		case K_MOUSE2:
		case K_MOUSE3:
		case K_JOY1:
		case K_JOY2:
		case K_JOY3:
		case K_JOY4:
		case K_AUX1:
		case K_AUX2:
		case K_AUX3:
		case K_AUX4:
		case K_AUX5:
		case K_AUX6:
		case K_AUX7:
		case K_AUX8:
		case K_AUX9:
		case K_AUX10:
		case K_AUX11:
		case K_AUX12:
		case K_AUX13:
		case K_AUX14:
		case K_AUX15:
		case K_AUX16:
			
		case K_KP_ENTER:
		case K_ENTER:
			if( m )
			{
				Menu_SelectItem( m );
//.........这里部分代码省略.........
开发者ID:Oppen,项目名称:Wolf3DRedux,代码行数:101,代码来源:wolf_menu.c


示例14: Controls_DrawKeyBinding

/*
=================
Controls_DrawKeyBinding
=================
*/
static void Controls_DrawKeyBinding( void *self )
{
	menuaction_s*	a;
	int				x;
	int				y;
	int				b1;
	int				b2;
	qboolean		c;
	char			name[32];
	char			name2[32];

	a = (menuaction_s*) self;

	x =	a->generic.x;
	y = a->generic.y;

	c = (Menu_ItemAtCursor( a->generic.parent ) == a);

	b1 = g_bindings[a->generic.id].bind1;
	if (b1 == -1)
		strcpy(name,"???");
	else
	{
		trap_Key_KeynumToStringBuf( b1, name, 32 );
		Q_strupr(name);

		b2 = g_bindings[a->generic.id].bind2;
		if (b2 != -1)
		{
			trap_Key_KeynumToStringBuf( b2, name2, 32 );
			Q_strupr(name2);

			strcat( name, " or " );
			strcat( name, name2 );
		}
	}

	if (c)
	{
		UI_FillRect( a->generic.left, a->generic.top, a->generic.right-a->generic.left+1, a->generic.bottom-a->generic.top+1, listbar_color ); 

		UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, text_color_highlight );
		UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT|UI_PULSE, text_color_highlight );

		if (s_controls.waitingforkey)
		{
			UI_DrawChar( x, y, '=', UI_CENTER|UI_BLINK|UI_SMALLFONT, text_color_highlight);
			UI_DrawString(500, SCREEN_HEIGHT * 0.85, "Waiting for new key ... ESCAPE to cancel", UI_SMALLFONT|UI_CENTER|UI_PULSE, colorWhite );
		}
		else
		{
			UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, text_color_highlight);
			UI_DrawString(500, SCREEN_HEIGHT * 0.83, "Press ENTER or CLICK to change", UI_SMALLFONT|UI_CENTER, colorWhite );
			UI_DrawString(500, SCREEN_HEIGHT * 0.87, "Press BACKSPACE to clear", UI_SMALLFONT|UI_CENTER, colorWhite );
		}
	}
	else
	{
		if (a->generic.flags & QMF_GRAYED)
		{
			UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, text_color_disabled );
			UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT, text_color_disabled );
		}
		else
		{
			UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, controls_binding_color );
			UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT, controls_binding_color );
		}
	}
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:75,代码来源:ui_controls2.c


示例15: Menu_Draw


//.........这里部分代码省略.........
				case MTYPE_SPINCONTROL:
					{
						int len;
						menulist_s *spin = menu->items[i];


						if (item->name)
						{
							len = strlen(item->name);
							min[0] -= SCR_ScaledVideo(len*MENU_FONT_SIZE - LCOLUMN_OFFSET*2);
						}

						len = strlen(spin->itemnames[spin->curvalue]);
						max[0] += SCR_ScaledVideo(len*MENU_FONT_SIZE);

						type = MENUITEM_ROTATE;
					}
					break;
				case MTYPE_FIELD:
					{
						menufield_s *text = menu->items[i];

						len = text->visible_length + 2;

						max[0] += SCR_ScaledVideo(len*MENU_FONT_SIZE);
						type = MENUITEM_TEXT;
					}
					break;
				default:
					continue;
			}

			if (cursor.x>=min[0] && 
				cursor.x<=max[0] &&
				cursor.y>=min[1] && 
				cursor.y<=max[1])
			{
				// new item
				if (lastitem!=item)
				{
					int j;

					for (j=0; j<MENU_CURSOR_BUTTON_MAX; j++)
					{
						cursor.buttonclicks[j] = 0;
						cursor.buttontime[j] = 0;
					}
				}

				cursor.menuitem = item;
				cursor.menuitemtype = type;
				
				menu->cursor = i;

				break;
			}
		}
	}

	cursor.mouseaction = false;
	// end mouseover code

	item = Menu_ItemAtCursor(menu);

	if (item && item->cursordraw)
	{
		item->cursordraw(item);
	}
	else if (menu->cursordraw)
	{
		menu->cursordraw(menu);
	}
	else if (item && item->type != MTYPE_FIELD)
	{
		if (item->flags & QMF_LEFT_JUSTIFY)
		{
			SCR_DrawChar (menu->x+item->x+item->cursor_offset-24, menu->y+item->y,
						ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
						255,255,255,255, false, true);
		}
		else
		{
			SCR_DrawChar (menu->x+item->cursor_offset, menu->y+item->y,
						ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
						255,255,255,255, false, true);
		}
	}

	if (item)
	{
		if (item->statusbarfunc)
			item->statusbarfunc ( (void *)item );
		else if (item->statusbar)
			Menu_DrawStatusBar (item->statusbar);
		else
			Menu_DrawStatusBar (menu->statusbar);
	}
	else
		Menu_DrawStatusBar( menu->statusbar );
}
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:101,代码来源:ui_backend.c


示例16: Menu_Draw

void Menu_Draw(menuframework_s *menu)
{
	int				i;
	menucommon_s	*itemptr;

	// draw menu
	for (i=0; i<menu->nitems; i++) {
		itemptr = (menucommon_s*)menu->items[i];

		if (itemptr->flags & QMF_HIDDEN) {
			continue;
		}

		if (itemptr->ownerdraw) {
			// total subclassing, owner draws everything
			itemptr->ownerdraw(itemptr);
		} else {
			switch (itemptr->type) {
			case MTYPE_RADIOBUTTON:
				RadioButton_Draw((menuradiobutton_s*)itemptr);
				break;

			case MTYPE_FIELD:
				MenuField_Draw((menufield_s*)itemptr);
				break;

			case MTYPE_SLIDER:
				Slider_Draw((menuslider_s*)itemptr);
				break;

			case MTYPE_SPINCONTROL:
				SpinControl_Draw((menulist_s*)itemptr);
				break;

			case MTYPE_ACTION:
				Action_Draw((menuaction_s*)itemptr);
				break;

			case MTYPE_BITMAP:
				Bitmap_Draw((menubitmap_s*)itemptr);
				break;

			case MTYPE_TEXT:
				Text_Draw((menutext_s*)itemptr);
				break;

			case MTYPE_SCROLLLIST:
				ScrollList_Draw((menulist_s*)itemptr);
				break;

			case MTYPE_PTEXT:
				PText_Draw((menutext_s*)itemptr);
				break;

			case MTYPE_BTEXT:
				BText_Draw((menutext_s*)itemptr);
				break;

			case MTYPE_BUTTON:
				Button_Draw((menubutton_s*)itemptr);
				break;
			default:
				trap_Error(va("Menu_Draw: unknown type %d", itemptr->type));
			}
		}
#ifndef NDEBUG
		if (uis.debug) {
			int	x;
			int	y;
			int	w;
			int	h;

			if (!(itemptr->flags & QMF_INACTIVE)) {
				x = itemptr->left;
				y = itemptr->top;
				w = itemptr->right - itemptr->left + 1;
				h =	itemptr->bottom - itemptr->top + 1;

				if (itemptr->flags & QMF_HASMOUSEFOCUS) {
					SCR_DrawRect(x, y, w, h, 1.0f, colorYellow);
				} else {
					SCR_DrawRect(x, y, w, h, 1.0f, colorWhite);
				}
			}
		}
#endif
	}

	itemptr = Menu_ItemAtCursor(menu);
	if (itemptr && itemptr->statusbar) {
		itemptr->statusbar((void *) itemptr);
	}
}
开发者ID:baseas,项目名称:aftershock,代码行数:93,代码来源:ui_qmenu.c


示例17: UI_TeamOrdersMenu_Key

/*
=================
UI_TeamOrdersMenu_Key
=================
*/
sfxHandle_t UI_TeamOrdersMenu_Key( int key ) {
	menulist_s	*l;
	int	x;
	int	y;
	int	index;

	l = (menulist_s	*)Menu_ItemAtCursor( &teamOrdersMenuInfo.menu );
	if( l != &teamOrdersMenuInfo.list ) {
		return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
	}

	switch( key ) {
		case K_MOUSE1:
			x = l->generic.left;
			y = l->generic.top;
			if( UI_CursorInRect( x, y, l->generic.right - x, l->generic.bottom - y ) ) {
				index = (uis.cursory - y) / PROP_HEIGHT;
				l->oldvalue = l->curvalue;
				l->curvalue = index;

				if( l->generic.callback ) {
					l->generic.callback( l, QM_ACTIVATED );
					return menu_move_sound;
				}
			}
			return menu_null_sound;

		case K_JOY_DPAD_UP:
		case K_JOY_LEFTSTICK_UP:
		case K_2JOY_DPAD_UP:
		case K_2JOY_LEFTSTICK_UP:
		case K_3JOY_DPAD_UP:
		case K_3JOY_LEFTSTICK_UP:
		case K_4JOY_DPAD_UP:
		case K_4JOY_LEFTSTICK_UP:
		case K_KP_UPARROW:
		case K_UPARROW:
			l->oldvalue = l->curvalue;

			if( l->curvalue == 0 ) {
				l->curvalue = l->numitems - 1;
			}
			else {
				l->curvalue--;
			}
			return menu_move_sound;

		case K_JOY_DPAD_DOWN:
		case K_JOY_LEFTSTICK_DOWN:
		case K_2JOY_DPAD_DOWN:
		case K_2JOY_LEFTSTICK_DOWN:
		case K_3JOY_DPAD_DOWN:
		case K_3JOY_LEFTSTICK_DOWN:
		case K_4JOY_DPAD_DOWN:
		case K_4JOY_LEFTSTICK_DOWN:
		case K_KP_DOWNARROW:
		case K_DOWNARROW:
			l->oldvalue = l->curvalue;

			if( l->curvalue == l->numitems - 1 ) {
				l->curvalue = 0;;
			}
			else {
				l->curvalue++;
			}
			return menu_move_sound;
	}

	return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
}
开发者ID:KuehnhammerTobias,项目名称:ioid3-game,代码行数:75,代码来源:ui_teamorders.c


示例18: Bitmap_Draw

void Bitmap_Draw(menubitmap_s *b)
{
	float	x;
	float	y;
	float	w;
	float	h;
	vec4_t	tempcolor;
	float*	color;

	x = b->generic.x;
	y = b->generic.y;
	w = b->width;
	h =	b->height;

	if (b->generic.flags & QMF_RIGHT_JUSTIFY) {
		x = x - w;
	} else if (b->generic.flags & QMF_CENTER_JUSTIFY) {
		x = x - w/2;
	}

	// used to refresh shader
	if (b->generic.name && !b->shader) {
		b->shader = trap_R_RegisterShaderNoMip(b->generic.name);
		if (!b->shader && b->errorpic) {
			b->shader = trap_R_RegisterShaderNoMip(b->errorpic);
		}
	}

	if (b->focuspic && !b->focusshader) {
		b->focusshader = trap_R_RegisterShaderNoMip(b->focuspic);
	}

	if (b->generic.flags & QMF_GRAYED) {
		if (b->shader) {
			trap_R_SetColor(colorMdGrey);
			UI_DrawHandlePic(x, y, w, h, b->shader);
			trap_R_SetColor(NULL);
		}
	} else {
		if (b->shader) {
			UI_DrawHandlePic(x, y, w, h, b->shader);
		}

		if ( ((b->generic.flags & QMF_PULSE)
			|| (b->generic.flags & QMF_PULSEIFFOCUS))
			&& (Menu_ItemAtCursor(b->generic.parent) == b))
		{
			if (b->focuscolor) {
				tempcolor[0] = b->focuscolor[0];
				tempcolor[1] = b->focuscolor[1];
				tempcolor[2] = b->focuscolor[2];
				color = tempcolor;
			} else {
				color = colorPulse;
			}
			color[3] = 0.5+0.5*sin(uis.realtime/PULSE_DIVISOR);

			trap_R_SetColor(color);
			UI_DrawHandlePic(x, y, w, h, b->focusshader);
			trap_R_SetColor(NULL);
		} else if ((b->generic.flags & QMF_HIGHLIGHT) || ((b->generic.flags & QMF_HIGHLIGHT_IF_FOCUS)
			&& (Menu_ItemAtCursor(b->generic.parent) == b)))
		{
			if (b->focuscolor) {
				trap_R_SetColor(b->focuscolor);
				UI_DrawHandlePic(x, y, w, h, b->focusshader);
				trap_R_SetColor(NULL);
			} else {
				UI_DrawHandlePic(x, y, w, h, b->focusshader);
			}
		}
	}
}
开发者ID:baseas,项目名称:aftershock,代码行数:73,代码来源:ui_qmenu.c


示例19: Menu_ClickHit

const char *Default_MenuKey( menuframework_s *m, int key )
{
	const char *sound = NULL;
	menucommon_s *item = NULL;
	int index;

	if ( m )
	{
		if (key == K_MOUSE1) {
			index = Menu_ClickHit(m, m_mouse[0], m_mouse[1]);
			if( index != -1 && m_active->cursor != index) {
				m_active->cursor = index;
			}
		}

		if ( ( item = Menu_ItemAtCursor( m ) ) != 0 )
		{
			if ( item->type == MTYPE_FIELD )
			{
				if ( Field_Key( ( menufield_s * ) item, key ) )
					return NULL;
			}
			else if ( item->type == MTYPE_LIST )
			{
				if ( List_Key( ( menulist_s * ) item, key ) )
					return NULL;
			}
		}
	}

	// Little hack
	if( item && (item->type == MTYPE_SLIDER || item->type == MTYPE_SPINCONTROL) ) {
		if( key == K_MOUSE1 ) {
			key = K_RIGHTARROW;
		} else if( key == K_MOUSE2 ) {
			key = K_LEFTARROW;
		}
	}

	switch ( key )
	{
	case K_MOUSE2:
	case K_ESCAPE:
		M_PopMenu();
		return menu_out_sound;
	case K_KP_UPARROW:
	case K_UPARROW:
		if ( m )
		{
			m->cursor--;
			Menu_AdjustCursor( m, -1 );
			sound = menu_move_sound;
		}
		break;
	case K_TAB:
		if ( m )
		{
			m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_DOWNARROW:
	case K_DOWNARROW:
		if ( m )
		{
			m->cursor++;
			Menu_AdjustCursor( m, 1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_LEFTARROW:
	case K_LEFTARROW:
		if ( m )
		{
			Menu_SlideItem( m, -1 );
			sound = menu_move_sound;
		}
		break;
	case K_KP_RIGHTARROW:
	case K_RIGHTARROW:
		if ( m )
		{
			Menu_SlideItem( m, 1 );
			sound = menu_move_sound;
		}
		break;

	case K_MOUSE1:
	//case K_MOUSE2:
	case K_MOUSE3:
#ifdef JOYSTICK
	case K_JOY1:
	case K_JOY2:
	case K_JOY3:
	case K_JOY4:
	case K_AUX1:
	case K_AUX2:
	case K_AUX3:
	case K_AUX4:
//.........这里部分代码省略.........
开发者ID:chrisnew,项目名称:quake2,代码行数:101,代码来源:ui_atoms.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MergeFrom函数代码示例发布时间:2022-05-30
下一篇:
C++ Menu_Draw函数代码示例发布时间: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