本文整理汇总了C++中Menu_ItemAtCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ Menu_ItemAtCursor函数的具体用法?C++ Menu_ItemAtCursor怎么用?C++ Menu_ItemAtCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Menu_ItemAtCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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 );
}
}
示例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);
}
}
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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 );
}
}
示例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);
}
}
示例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:
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........
示例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 );
//.........这里部分代码省略.........
示例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 );
}
}
}
示例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 );
}