コード例 #1
0
static void UI_Preview_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;
	UI_FillRect( item->x - 2, item->y - 2, item->width + 4, item->height + 4, 0xFFC0C0C0 );
	UI_FillRect( item->x, item->y, item->width, item->height, 0xFF808080 );
	PIC_Set( uiFileDialog.image, 255, 255, 255, 255 );
	PIC_DrawTrans( item->x, item->y, item->width, item->height );
}
コード例 #2
0
static void UI_Preview_Ownerdraw( void *self )
{
    menuCommon_s	*item = (menuCommon_s *)self;
    UI_FillRect( item->x - 2, item->y - 2, item->width + 4, item->height + 4, 0xFFC0C0C0 );
    UI_FillRect( item->x, item->y, item->width, item->height, 0xFF808080 );
    PIC_Set( uiTouchButtons.textureid, CURCOLOR1(red), CURCOLOR1(green), CURCOLOR1(blue), CURCOLOR1(alpha));
    if( uiTouchButtons.additive.enabled )
        PIC_DrawAdditive( item->x, item->y, item->width, item->height );
    else
        PIC_DrawTrans( item->x, item->y, item->width, item->height );
}
コード例 #3
0
/*
 ==================
 UI_Cinematics_Ownerdraw
 ==================
*/
static void UI_Cinematics_Ownerdraw (void *self){

	menuCommon_t	*item = (menuCommon_t *)self;
	int				x = 566, y = 210, w = 412, h = 348;

	if (item->id == ID_CINPREVIEW){
		UI_ScaleCoords(&x, &y, &w, &h);

		// Draw black background, cinematic frame and box
		UI_FillRect(x, y, w, h, colorBlack);

		if (uiStatic.playingCinematic){
//			CIN_UpdateCinematic();
//			CIN_DrawCinematic();
		}

		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
	}
	else {
		if (uiCinematics.menu.items[uiCinematics.menu.cursor] == self)
			UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOXFOCUS);
		else
			UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, UI_MOVEBOX);

		UI_DrawPic(item->x, item->y, item->width, item->height, colorWhite, ((menuBitmap_t *)self)->pic);
	}
}
コード例 #4
0
ファイル: ui_atoms.c プロジェクト: Zekom/reaction
void UI_DrawTextBox(int x, int y, int width, int lines)
{
    UI_FillRect(x + BIGCHAR_WIDTH / 2, y + BIGCHAR_HEIGHT / 2, (width + 1) * BIGCHAR_WIDTH,
                (lines + 1) * BIGCHAR_HEIGHT, colorBlack);
    UI_DrawRect(x + BIGCHAR_WIDTH / 2, y + BIGCHAR_HEIGHT / 2, (width + 1) * BIGCHAR_WIDTH,
                (lines + 1) * BIGCHAR_HEIGHT, colorWhite, uiInfo.uiDC.whiteShader);
}
コード例 #5
0
/*
=================
UI_PlayerSetup_Ownerdraw
=================
*/
static void UI_PlayerSetup_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;

	// draw the background
	UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );

	// draw the rectangle
	UI_DrawRectangle( item->x, item->y, item->width, item->height, uiInputFgColor );

	if( !ui_showmodels->value && playerImage != 0 )
	{
		PIC_Set( playerImage, 255, 255, 255, 255 );
		PIC_Draw( item->x, item->y, item->width, item->height );
	}
	else
	{
		R_ClearScene ();

		// update renderer timings
		uiPlayerSetup.refdef.time = gpGlobals->time;
		uiPlayerSetup.refdef.frametime = gpGlobals->frametime;
		uiPlayerSetup.ent->curstate.body = 0; // clearing body each frame

		// draw the player model
		R_AddEntity( ET_NORMAL, uiPlayerSetup.ent );
		R_RenderFrame( &uiPlayerSetup.refdef );
	}
}
コード例 #6
0
/*
=================
SpinControl_Draw
=================
*/
static void SpinControl_Draw(menulist_s* s) {
    float* color;
    int x, y;
    int style;
    qboolean focus;

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

    style = UI_SMALLFONT;
    focus = (s->generic.parent->cursor == s->generic.menuPosition);

    if (s->generic.flags & QMF_GRAYED)
        color = text_color_disabled;
    else if (focus) {
        color = text_color_highlight;
        style |= UI_PULSE;
    } else if (s->generic.flags & QMF_BLINK) {
        color = text_color_highlight;
        style |= UI_BLINK;
    } else
        color = text_color_normal;

    if (focus) {
        // draw cursor
        UI_FillRect(s->generic.left, s->generic.top, s->generic.right - s->generic.left + 1, s->generic.bottom - s->generic.top + 1, listbar_color);
        UI_DrawChar(x, y, 13, UI_CENTER | UI_BLINK | UI_SMALLFONT, color);
    }

    UI_DrawString(x - SMALLCHAR_WIDTH, y, s->generic.name, style | UI_RIGHT, color);
    UI_DrawString(x + SMALLCHAR_WIDTH, y, s->itemnames[s->curvalue], style | UI_LEFT, color);
}
コード例 #7
0
ファイル: saveconfig.c プロジェクト: icanhas/yantar
/*
 * UI_SaveConfigMenu_SavenameDraw
 */
static void
UI_SaveConfigMenu_SavenameDraw(void *self)
{
	menufield_s *f;
	int style;
	float *color;

	f = (menufield_s*)self;

	if(f == Menu_ItemAtCursor(&saveConfig.menu)){
		style	= UI_LEFT|UI_PULSE|UI_SMALLFONT;
		color	= text_color_highlight;
	}else{
		style	= UI_LEFT|UI_SMALLFONT;
		color	= colorRed;
	}

	UI_DrawProportionalString(320, 192, "Enter filename:", UI_CENTER|
		UI_SMALLFONT,
		color_orange);
	UI_FillRect(f->generic.x, f->generic.y, f->field.widthInChars*
		SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT,
		colorBlack);
	MField_Draw(&f->field, f->generic.x, f->generic.y, style, color);
}
コード例 #8
0
void JKG_Slice_DrawGridSummary(int slot, float x, float y, float w, float h) {
	static const vec4_t topcol = {.2, 1, .2, 0.2f};
	static const vec4_t botcol = {1, 0.2, 0.2, 0.2f};

	int orientation = (slot >> 3) & 1;		// 0 = Columns, 1 = Rows
	int index = slot & 7;

	vec4_t color;

	const char *text;

	float w2;

	if ((orientation == 0 && index >= sliceData.width) || (orientation == 1 && index >= sliceData.height) ) {
		UI_DrawRect(x, y, w, h, disabled);
		return;
	} else {
		UI_FillRect(x, y, w, h/2, topcol);
		UI_FillRect(x, y + (0.5f * h), w, h/2, botcol);
		if (sliceData.inputState == INPUTSTATE_AWAITINGLINE) {
			float phase = 0.7f + sin((float)trap->Milliseconds() / 150.0f) * 0.1f;
			MAKERGBA(color, phase, phase, phase, 1.0f);
			UI_DrawRect(x, y, w, h, color);
		} else {
			UI_DrawRect(x, y, w, h, black);
		}
	}


	if (sliceData.summariesKnown) {
		text = va("%i", sliceData.summaries[slot].value);
		w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
		DC->drawText(x + (w/2) - (w2/2), y-1, 0.4f, const_cast<float *>(white), text, 0, 0, 0, 0 );

		text = va("%i", sliceData.summaries[slot].alarms);
		w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
		DC->drawText(x + (w/2) - (w2/2), y+(h*0.5f)-1, 0.4f, const_cast<float *>(white), text, 0, 0, 0, 0 );
	} else {
		text = "?";
		w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
		DC->drawText(x + (w/2) - (w2/2), y-1, 0.4f, const_cast<float *>(white), text, 0, 0, 0, 0 );

		w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
		DC->drawText(x + (w/2) - (w2/2), y+(h*0.5f)-1, 0.4f, const_cast<float *>(white), text, 0, 0, 0, 0 );
	}

}
コード例 #9
0
/*
=================
ScrollList_Draw
=================
*/
void ScrollList_Draw( menulist_s *l )
{
	int			x;
	int			u;
	int			y;
	int			i;
	int			base;
	int			column;
	float*		color;
	qboolean	hasfocus;
	int			style;

	hasfocus = (l->generic.parent->cursor == l->generic.menuPosition);

	x =	l->generic.x;
	for( column = 0; column < l->columns; column++ ) {
		y =	l->generic.y;
		base = l->top + column * l->height;
		for( i = base; i < base + l->height; i++) {
			if (i >= l->numitems)
				break;

			if (i == l->curvalue)
			{
				u = x - 2;
				if( l->generic.flags & QMF_CENTER_JUSTIFY ) {
					u -= (l->width * SMALLCHAR_WIDTH) / 2 + 1;
				}

				UI_FillRect(u,y,l->width*SMALLCHAR_WIDTH,SMALLCHAR_HEIGHT+2,listbar_color);
				color = text_color_highlight;

				if (hasfocus)
					style = UI_PULSE|UI_LEFT|UI_SMALLFONT;
				else
					style = UI_LEFT|UI_SMALLFONT;
			}
			else
			{
				color = text_color_normal;
				style = UI_LEFT|UI_SMALLFONT;
			}
			if( l->generic.flags & QMF_CENTER_JUSTIFY ) {
				style |= UI_CENTER;
			}

			UI_DrawString(
				x,
				y,
				l->itemnames[i],
				style,
				color);

			y += SMALLCHAR_HEIGHT;
		}
		x += (l->width + l->seperation) * SMALLCHAR_WIDTH;
	}
}
コード例 #10
0
ファイル: ui_mfield.c プロジェクト: zturtleman/recoil
/*
==================
MenuField_Draw
==================
*/
void MenuField_Draw( menufield_s *f )
{
    int		x;
    int		y;
    int		w;
    int		h;
    int		style;
    qboolean focus;
    float	*color;

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

    if (f->generic.flags & QMF_SMALLFONT)
    {
        w = SMALLCHAR_WIDTH;
        h = SMALLCHAR_HEIGHT;
        style = UI_SMALLFONT;
    }
    else
    {
        w = BIGCHAR_WIDTH;
        h = BIGCHAR_HEIGHT;
        style = UI_BIGFONT;
    }

    if (Menu_ItemAtCursor( f->generic.parent ) == f)
    {
        focus = qtrue;
        style |= UI_PULSE;
    }
    else
    {
        focus = qfalse;
    }

    if (f->generic.flags & QMF_GRAYED)
        color = text_color_disabled;
    else if (focus)
        color = text_color_highlight;
    else
        color = text_color_normal;

    if ( focus )
    {
        // draw cursor
        UI_FillRect( f->generic.left, f->generic.top, f->generic.right-f->generic.left+1, f->generic.bottom-f->generic.top+1, listbar_color );
        UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|style, color);
    }

    if ( f->generic.name )
    {
        UI_DrawString( x - w, y, f->generic.name, style|UI_RIGHT, color );
    }

    MField_Draw( &f->field, x + w, y, style, color );
}
コード例 #11
0
/*
=================
Slider_Draw
=================
*/
static void Slider_Draw(menuslider_s* s) {
    float* color;
    int style;
    int i;
    int x;
    int y;
    qboolean focus;

    x = s->generic.x;
    y = s->generic.y;
    focus = (s->generic.parent->cursor == s->generic.menuPosition);

    style = UI_SMALLFONT;
    if (s->generic.flags & QMF_GRAYED) {
        color = text_color_disabled;
    } else if (focus) {
        color  = text_color_highlight;
        style |= UI_PULSE;
    } else {
        color = text_color_normal;
    }

    if (focus) {
        // draw cursor
        UI_FillRect(s->generic.left, s->generic.top, s->generic.right - s->generic.left + 1, s->generic.bottom - s->generic.top + 1, listbar_color);
        UI_DrawChar(x, y, 13, UI_CENTER | UI_BLINK | UI_SMALLFONT, color);
    }

    // draw label
    UI_DrawString(x - SMALLCHAR_WIDTH, y, s->generic.name, UI_RIGHT | style, color);

    // draw slider
    UI_DrawChar(x + SMALLCHAR_WIDTH, y, 128, UI_LEFT | style, color);
    for (i = 0; i < SLIDER_RANGE; i++)
        UI_DrawChar(x + (i + 2)*SMALLCHAR_WIDTH, y, 129, UI_LEFT | style, color);
    UI_DrawChar(x + (i + 2)*SMALLCHAR_WIDTH, y, 130, UI_LEFT | style, color);

    // clamp thumb
    if (s->maxvalue > s->minvalue) {
        s->range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue);
        if (s->range < 0)
            s->range = 0;
        else if (s->range > 1)
            s->range = 1;
    } else
        s->range = 0;

    // draw thumb
    if (style & UI_PULSE) {
        style &= ~UI_PULSE;
        style |= UI_BLINK;
    }
    UI_DrawChar((int)(x + 2 * SMALLCHAR_WIDTH + (SLIDER_RANGE - 1)*SMALLCHAR_WIDTH * s->range), y, 131, UI_LEFT | style, color);
}
コード例 #12
0
ファイル: ui_cdkey.c プロジェクト: Clever-Boy/entityplus
/*
=================
UI_CDKeyMenu_DrawKey
=================
*/
static void UI_CDKeyMenu_DrawKey( void *self ) {
	menufield_s		*f;
	qboolean		focus;
	int				style;
	char			c;
	float			*color;
	int				x, y;
	int				val;

	f = (menufield_s *)self;

	focus = (f->generic.parent->cursor == f->generic.menuPosition);

	style = UI_LEFT;
	if( focus ) {
		color = color_yellow;
	}
	else {
		color = color_orange;
	}

	x = 320 - 8 * BIGCHAR_WIDTH;
	y = 240 - BIGCHAR_HEIGHT / 2;
	UI_FillRect( x, y, 16 * BIGCHAR_WIDTH, BIGCHAR_HEIGHT, listbar_color );
	UI_DrawString( x, y, f->field.buffer, style, color );

	// draw cursor if we have focus
	if( focus ) {
		if ( trap_Key_GetOverstrikeMode() ) {
			c = 11;
		} else {
			c = 10;
		}

		style &= ~UI_PULSE;
		style |= UI_BLINK;

		UI_DrawChar( x + f->field.cursor * BIGCHAR_WIDTH, y, c, style, color_white );
	}

	val = UI_CDKeyMenu_PreValidateKey( f->field.buffer );
	if( val == 1 ) {
		UI_DrawProportionalString( 320, 376, "Please enter your CD Key", UI_CENTER|UI_SMALLFONT, color_yellow );
	}
	else if ( val == 0 ) {
		UI_DrawProportionalString( 320, 376, "The CD Key appears to be valid, thank you", UI_CENTER|UI_SMALLFONT, color_white );
	}
	else {
		UI_DrawProportionalString( 320, 376, "The CD Key is not valid", UI_CENTER|UI_SMALLFONT, color_red );
	}
}
コード例 #13
0
/*
=================
RadioButton_Draw
=================
*/
static void RadioButton_Draw( menuradiobutton_s *rb )
{
	int	x;
	int y;
	float *color;
	int	style;
	qboolean focus;

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

	focus = (rb->generic.parent->cursor == rb->generic.menuPosition);

	if ( rb->generic.flags & QMF_GRAYED )
	{
		color = text_color_disabled;
		style = UI_LEFT|UI_SMALLFONT;
	}
	else if ( focus )
	{
		color = text_color_highlight;
		style = UI_LEFT|UI_PULSE|UI_SMALLFONT;
	}
	else
	{
		color = text_color_normal;
		style = UI_LEFT|UI_SMALLFONT;
	}

	if ( focus )
	{
		// draw cursor
		UI_FillRect( rb->generic.left, rb->generic.top, rb->generic.right-rb->generic.left+1, rb->generic.bottom-rb->generic.top+1, listbar_color ); 
		UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color);
	}

	if ( rb->generic.name )
		UI_DrawString( x - SMALLCHAR_WIDTH, y, rb->generic.name, UI_RIGHT|UI_SMALLFONT, color );

	if ( !rb->curvalue )
	{
		UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 2, 16, 16, uis.rb_off);
		UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "off", style, color );
	}
	else
	{
		UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 2, 16, 16, uis.rb_on );
		UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "on", style, color );
	}
}
コード例 #14
0
/*
===============
UI_CreditMenu
===============
*/
void UI_CreditMenu( void ) {
	/* This UI_FillRect() hack will blank the borders if you're in widescreen,
	   so you get a completely black background instead of stripes from the
	   previous frame on each side of the credits.. */
	const float black[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
	UI_FillRect(0 - uis.xbias, 0, (640.0f / uis.xscale) * 2.0f, 480.0f / uis.yscale, black);

	memset( &s_credits, 0 ,sizeof(s_credits) );

	s_credits.menu.draw = UI_CreditMenu_Draw;
	s_credits.menu.key = UI_CreditMenu_Key;
	s_credits.menu.fullscreen = qtrue;
	UI_PushMenu ( &s_credits.menu );
}
コード例 #15
0
void JKG_Slice_DrawSecurityClearance(int slot, float x, float y, float w, float h) {

	const char *text;

	float w2;

	if (slot >= sliceData.securityLevels) {
		UI_DrawRect(x, y, w, h, disabled);
		return;
	} else {
		switch (sliceData.securityState[slot])
		{
			case 0:
				UI_FillRect(x, y, w, h, red);
				break;
			case 1:
				UI_FillRect(x, y, w, h, orange);
				break;
			case 2:
				UI_FillRect(x, y, w, h, yellow);
				break;
			case 3:
				UI_FillRect(x, y, w, h, green);
				break;
		}

		UI_DrawRect(x, y, w, h, black);
	}


	text = va("%i", slot + 1);
	
	w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.5f;
	DC->drawText(x + (w/2) - (w2/2), y+(h*0.2f), 0.5f, const_cast<float *>(white), text, 0, 0, 0, 0 );

}
コード例 #16
0
ファイル: basemenu.cpp プロジェクト: DavidKnight247/xash3d
/*
=================
UI_DrawRectangleExt
=================
*/
void UI_DrawRectangleExt( int in_x, int in_y, int in_w, int in_h, const int color, int outlineWidth )
{
	int	x, y, w, h;

	x = in_x - outlineWidth;
	y = in_y - outlineWidth;
	w = outlineWidth;
	h = in_h + outlineWidth + outlineWidth;

	// draw left
	UI_FillRect( x, y, w, h, color );

	x = in_x + in_w;
	y = in_y - outlineWidth;
	w = outlineWidth;
	h = in_h + outlineWidth + outlineWidth;

	// draw right
	UI_FillRect( x, y, w, h, color );

	x = in_x;
	y = in_y - outlineWidth;
	w = in_w;
	h = outlineWidth;

	// draw top
	UI_FillRect( x, y, w, h, color );

	// draw bottom
	x = in_x;
	y = in_y + in_h;
	w = in_w;
	h = outlineWidth;

	UI_FillRect( x, y, w, h, color );
}
コード例 #17
0
ファイル: menu_credits.cpp プロジェクト: lewa-j/cs16-client
/*
=================
UI_Credits_DrawFunc
=================
*/
static void UI_Credits_DrawFunc( void )
{
	int	i, y;
	float	speed = 32.0f * (768.0f / ScreenHeight);
	int	w = UI_SMALL_CHAR_WIDTH;
	int	h = UI_SMALL_CHAR_HEIGHT;
	int	color = 0x00FFA000;

	// draw the background first
	UI_FillRect( 0, 0, ScreenWidth, ScreenHeight, uiColorBlack );

	// now draw the credits
	UI_ScaleCoords( NULL, NULL, &w, &h );

	y = ScreenHeight - (((gpGlobals->time * 1000) - uiCredits.startTime ) / speed );

	// draw the credits
	for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += h )
	{
		// skip not visible lines, but always draw end line
		if( y <= -h && i != uiCredits.numLines - 1 ) continue;

		if(( y < ( ScreenHeight - h ) / 2 ) && i == uiCredits.numLines - 1 )
		{
			if( !uiCredits.fadeTime ) uiCredits.fadeTime = (gpGlobals->time * 1000);
			color = UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime );
			if( UnpackAlpha( color ))
				UI_DrawString( 0, ( ScreenHeight - h ) / 2, ScreenWidth, h, uiCredits.credits[i], color, true, w, h, 1, true );
		}
		else UI_DrawString( 0, y, ScreenWidth, h, uiCredits.credits[i], uiColorWhite, false, w, h, 1, true );
	}

	if( y < 0 && UnpackAlpha( color ) == 0 )
	{
		uiCredits.active = false; // end of credits
	}

	if( !uiCredits.active )
		UI_PopMenu();
}
コード例 #18
0
ファイル: ui_preferences.c プロジェクト: ioid3-games/ioid3-q3
/*
=======================================================================================================================================
Crosshair_Draw
=======================================================================================================================================
*/
static void Crosshair_Draw(void *self) {
	menulist_s *s;
	float *color;
	int x, y;
	int style;
	qboolean focus;

	s = (menulist_s *)self;
	x = s->generic.x;
	y = s->generic.y;
	style = UI_SMALLFONT;
	focus = (s->generic.parent->cursor == s->generic.menuPosition);

	if (s->generic.flags & QMF_GRAYED) {
		color = text_color_disabled;
	} else if (focus) {
		color = text_color_highlight;
		style |= UI_PULSE;
	} else if (s->generic.flags & QMF_BLINK) {
		color = text_color_highlight;
		style |= UI_BLINK;
	} else {
		color = text_color_normal;
	}

	if (focus) {
		// draw cursor
		UI_FillRect(s->generic.left, s->generic.top, s->generic.right - s->generic.left + 1, s->generic.bottom - s->generic.top + 1, listbar_color);
		UI_DrawChar(x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color);
	}

	UI_DrawString(x - SMALLCHAR_WIDTH, y, s->generic.name, style|UI_RIGHT, color);

	if (!s->curvalue) {
		return;
	}

	UI_DrawHandlePic(x + SMALLCHAR_WIDTH, y - 4, 24, 24, s_preferences.crosshairShader[s->curvalue]);
}
コード例 #19
0
/*
=================
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 );
		}
	}
}
コード例 #20
0
void JKG_Slice_DrawGridSlot(int slot, float x, float y, float w, float h)
{
	vec4_t color;
	vec4_t color2;

	int row = slot >> 3;
	int col = slot & 7;

	const char *text = NULL;
	float w2;

	if (row >= sliceData.height || col >= sliceData.width) {
		UI_DrawRect(x, y, w, h, disabled);
	} else {
		if (sliceData.grid[row][col].active) {
			// Determine the color to show
			switch (sliceData.grid[row][col].type) {
				case 0:	// Alarm node
					VectorCopy4M(red, color2);
					text = NULL;
					break;
				case 1:	// Relay node
					VectorCopy4M(orange, color2);
					text = NULL;
					break;
				case 2: // Reset node
					VectorCopy4M(yellow, color2);
					text = "R";
					break;
				case 3: // Access level 1
				case 4:	// Access level 2
				case 5:	// Access level 3
				case 6:	// Access level 4
				case 7: // Access level 5
					VectorCopy4M(green, color2);
					text = va("%i", sliceData.grid[row][col].type - 2);
					break;
			}

			if (sliceData.grid[row][col].revealTime) {
				float phase = (float)(trap->Milliseconds() - sliceData.grid[row][col].revealTime) / 250.0f;
				if (phase > 1.0f) phase = 1.0f;

				if (trap->Milliseconds() > sliceData.grid[row][col].revealTime + 250) {
					sliceData.grid[row][col].revealTime = 0;
				}

				LerpColor((float *)white, color2, color, phase);
				UI_FillRect(x, y, w, h, color);
				
				if (text) {
					color[0] = color[1] = color[2] = 1.0f;
					color[3] = phase;
					w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
					DC->drawText(x + (w/2) - (w2/2), y+(h*0.2f), 0.4f, color, text, 0, 0, 0, 0 );
				}
			} else {
				UI_FillRect(x, y, w, h, color2);
				if (text) {
					w2 = trap->R_Font_StrLenPixels(text, MenuFontToHandle(0), 1.0f) * 0.4f;
					DC->drawText(x + (w/2) - (w2/2), y+(h*0.2f), 0.4f, (float *)(white), text, 0, 0, 0, 0 );
				}
			}
		} else {
			if (sliceData.grid[row][col].blinkTime) {
				int delta = trap->Milliseconds() - sliceData.grid[row][col].blinkTime;
				float phase;
				if (delta > 2350) {	 // ~(7.5 * PI)*100, so the node blinks 4 times and stops when faded out
					sliceData.grid[row][col].blinkTime = 0;
				}

				phase = 0.5f + (sin((float)delta / 100.0f) * 0.5);

				if (sliceData.grid[row][col].blinkColor) {
					LerpColor((float *)offcolor, (float *)green, color, phase);
				} else {
					LerpColor((float *)offcolor, (float *)red, color, phase);
				}

				UI_FillRect(x, y, w, h, color);
			} else {
				if (sliceData.grid[row][col].marked) {
					if (sliceData.grid[row][col].marked == 1) {
						MAKERGBA(color, 0.3f, 0.3f, 1.0f, 0.7f + sin((float)trap->Milliseconds() / 150.0f) * 0.1f);
					} else {
						MAKERGBA(color, 1.0f, 0.3f, .3f, 0.7f + sin((float)trap->Milliseconds() / 150.0f) * 0.1f);
					}
					UI_FillRect(x, y, w, h, color);
				} else {
					UI_FillRect(x, y, w, h, offcolor);
				}
			}
		}

		if (sliceData.inputState == INPUTSTATE_AWAITINGNODE || (sliceData.inputState == INPUTSTATE_AWAITINGINACTIVENODE && !sliceData.grid[row][col].active)) {
			float phase = 0.7f + sin((float)trap->Milliseconds() / 150.0f) * 0.1f;
			MAKERGBA(color, phase, phase, phase, 1.0f);
			UI_DrawRect(x, y, w, h, color);
		} else {
			UI_DrawRect(x, y, w, h, black);
		}
	}
}
コード例 #21
0
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
	menuCommon_s	*item = (menuCommon_s *)self;

	UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
コード例 #22
0
static void UI_Color_Ownerdraw( void *self )
{
    menuCommon_s	*item = (menuCommon_s *)self;

    UI_FillRect( item->x, item->y, item->width, item->height, CURCOLOR );
}
コード例 #23
0
ファイル: ui_splevel.c プロジェクト: ElderPlayerX/Rune
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); 
			trap_R_SetColor( NULL );
		}
	}

	// show map name and long name of selected level
	y = 192;
	Q_strncpyz( buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "map" ), 20 );
	Q_strupr( buf );
	Com_sprintf( string, sizeof(string), "%s: %s", buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "longname" ) );
	UI_DrawProportionalString( 320, y, string, UI_CENTER|UI_SMALLFONT, color_orange );

//	fraglimit = atoi( Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "fraglimit" ) );
//	UI_DrawString( 18, 212, va("Frags %i", fraglimit) , UI_LEFT|UI_SMALLFONT, color_orange );

	// draw bot opponents
	y += 24;
	pad = (7 - levelMenuInfo.numBots) * (64 + 26) / 2;
	for( n = 0; n < levelMenuInfo.numBots; n++ ) {
		x = 18 + pad + (64 + 26) * n;
		if( levelMenuInfo.botPics[n] ) {
			UI_DrawHandlePic( x, y, 64, 64, levelMenuInfo.botPics[n]);
		}
		else {
			UI_FillRect( x, y, 64, 64, color_black );
			UI_DrawProportionalString( x+22, y+18, "?", UI_BIGFONT, color_orange );
		}
		UI_DrawString( x, y + 64, levelMenuInfo.botNames[n], UI_SMALLFONT|UI_LEFT, color_orange );
	}
}
コード例 #24
0
ファイル: ui_menu.c プロジェクト: zturtleman/q3rain
static void Main_MenuDraw(void) {
    refdef_t refdef;
    refEntity_t ent;
    vec3_t origin;
    vec3_t angles;
    float adjust;
    float x, y, w, h;
    vec4_t color;
    qboolean connected = qtrue;
    vec4_t oldColor = {0.8, 0.8, 0.8, 1};

    // FIXME dont call on every update...
    s_main.servers = (int) trap_Cvar_VariableValue("ma_servers");
    s_main.players = (int) trap_Cvar_VariableValue("ma_players");
    s_main.motd = UI_Cvar_VariableString("ma_motd");

    if (!s_main.motd || !Q_stricmp(s_main.motd, "")) {
        s_main.motd = "Failed to connect to master server";
        connected = qfalse;
    }

    // options the refdef

    memset(&refdef, 0, sizeof ( refdef));

    refdef.rdflags = RDF_NOWORLDMODEL;

    AxisClear(refdef.viewaxis);

    x = 0;
    y = 0;
    w = 640;
    h = 120;
    UI_AdjustFrom640(&x, &y, &w, &h);
    refdef.x = x;
    refdef.y = y;
    refdef.width = w;
    refdef.height = h;

    adjust = 0; // JDC: Kenneth asked me to stop this 1.0 * sin( (float)uis.realtime / 1000 );
    refdef.fov_x = 60 + adjust;
    refdef.fov_y = 19.6875 + adjust;

    refdef.time = uis.realtime;

    origin[0] = 300;
    origin[1] = 0;
    origin[2] = -32;

    trap_R_ClearScene();

    // add the model

    memset(&ent, 0, sizeof (ent));

    /*adjust = 5.0 * sin((float) uis.realtime / 5000);
    VectorSet(angles, 0, 180 + adjust, 0);
    AnglesToAxis(angles, ent.axis);
    ent.hModel = s_main.bannerModel;
    VectorCopy(origin, ent.origin);
    VectorCopy(origin, ent.lightingOrigin);
    ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
    VectorCopy(ent.origin, ent.oldorigin);*/

    x = 0;
    y = 0;
    w = 640;
    h = 64;
    UI_FillRect(x, y, w, h, color_black);

    x = 16;
    y = 16;
    UI_DrawString(x, y, "Hazewood", UI_LEFT, color_green);

    x = 196;
    y = 28;
    if (connected) {
      UI_DrawString(x, y, va("%s", s_main.motd), UI_LEFT | UI_SMALLERFONT, color_white);
    } else {
      UI_DrawString(x, y, va("%s", s_main.motd), UI_LEFT | UI_SMALLERFONT, color_red);
    }

    x = 640 - 196 + 48;
    y = 12;
    if (s_main.servers > 0) {
        UI_DrawString(x, y, va("%i Servers", s_main.servers), UI_LEFT | UI_SMALLFONT, color_blue);
    } else {
        UI_DrawString(x, y, va("%i Servers", s_main.servers), UI_LEFT | UI_SMALLFONT, color_red);
    }

    y = 36;
    if (s_main.players > 0) {
        UI_DrawString(x, y, va("%i Players", s_main.players), UI_LEFT | UI_SMALLFONT, color_blue);
    } else {
        UI_DrawString(x, y, va("%i Players", s_main.players), UI_LEFT | UI_SMALLFONT, color_red);
    }

    x = 0;
    y = 480 - 64;
    w = 640;
    h = 64;
    UI_FillRect(x, y, w, h, color_black);

    x = 0;
    y = 64;
    w = 640;
    h = 480 - 128;

    if (!s_main.up) {
        s_main.fade -= ((float) uis.frametime) / 10.0f;
    } else {
        s_main.fade += ((float) uis.frametime) / 10.0f;
    }
    if (s_main.fade >= 1200.0f) {
        s_main.up = qfalse;
        s_main.currentScene++;
        if (s_main.currentScene >= MAX_MENU_SCENES) {
            s_main.currentScene = 0;
        }
    }
    if (s_main.fade <= -100.0f) {
        s_main.up = qtrue;
    }

    Vector4Copy(oldColor, color);

    UI_DrawHandlePic(x, y, w, h, trap_R_RegisterShaderNoMip(va("gfx/scenes/%i", s_main.currentScene)));

    color[3] = s_main.fade / 1000.0f;
    if (color[3] > 1) {
        color[3] = 1;
    }
    if (color[3] < 0) {
        color[3] = 0;
    }
    trap_R_SetColor(color);
    UI_DrawNamedPic(x, y, w, h, "gfx/colors/blue.jpg");

    trap_R_SetColor(oldColor);

    trap_R_AddRefEntityToScene(&ent);

    trap_R_RenderScene(&refdef);

    if (strlen(s_errorMessage.errorMessage)) {
        UI_DrawProportionalString_AutoWrapped(320, 192, 600, 20, s_errorMessage.errorMessage, UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, menu_text_color);
    } else {
        Menu_Draw(&s_main.menu);
    }
}