Ejemplo n.º 1
0
static void Action_Draw(menuaction_s *a)
{
	float	x, y;
	int		style;
	float*	color;

	style = 0;
	color = colorMenuText;
	if (a->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
	} else if ((a->generic.flags & QMF_PULSEIFFOCUS)
		&& (a->generic.parent->cursor == a->generic.menuPosition))
	{
		color = colorTextHighlight;
		style = FONT_PULSE;
	} else if ((a->generic.flags & QMF_HIGHLIGHT_IF_FOCUS)
		&& (a->generic.parent->cursor == a->generic.menuPosition))
	{
		color = colorTextHighlight;
	} else if (a->generic.flags & QMF_BLINK) {
		style = FONT_BLINK;
		color = colorTextHighlight;
	}

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

	SCR_DrawString(x, y, a->generic.name, SMALLCHAR_SIZE, style, color);

	if (a->generic.parent->cursor == a->generic.menuPosition) {
		// draw cursor
		SCR_DrawString(x - BIGCHAR_SIZE, y, "\15", SMALLCHAR_SIZE, FONT_BLINK, color);
	}
}
Ejemplo n.º 2
0
static void SpinControl_Draw(menulist_s *s)
{
	float	*color;
	float	x, y;
	int		style = 0;
	qboolean focus;

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

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

	if (s->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
	} else if (focus) {
		color = colorTextHighlight;
		style |= FONT_PULSE;
	} else if (s->generic.flags & QMF_BLINK) {
		color = colorTextHighlight;
		style |= FONT_BLINK;
	} else {
		color = colorTextNormal;
	}

	if (focus) {
		// draw cursor
		SCR_FillRect(s->generic.left, s->generic.top, s->generic.right-s->generic.left+1, s->generic.bottom-s->generic.top+1, colorListbar);
		SCR_DrawString(x, y, "\15", SMALLCHAR_SIZE, FONT_CENTER | FONT_BLINK, color);
	}

	SCR_DrawString(x - SMALLCHAR_SIZE, y, s->generic.name, SMALLCHAR_SIZE, style | FONT_RIGHT, color);
	SCR_DrawString(x + SMALLCHAR_SIZE, y, s->itemnames[s->curvalue], SMALLCHAR_SIZE, style, color);
}
Ejemplo n.º 3
0
static void Button_Draw(menubutton_s *b)
{
	float	x, y;
	int		style;
	float	*color;
	qhandle_t	shader;

	x = b->generic.left;
	y = b->generic.top;

	if (b->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
	} else {
		color = colorBlack;
	}

	style = b->style | FONT_SMALL;
	if (Menu_ItemAtCursor(b->generic.parent) == b) {
		style |= FONT_PULSE;
		trap_R_SetColor(colorOrange);
		shader = uis.button;
		// shader = uis.buttonHover;
	} else {
		trap_R_SetColor(colorYellow);
		shader = uis.button;
	}

	UI_DrawHandlePic(x, y, BUTTON_WIDTH, BUTTON_HEIGHT, shader);

	SCR_DrawString(x + BUTTON_WIDTH / 2, y + (BUTTON_HEIGHT - 14) / 2,
		b->string, 14, style | FONT_CENTER, color);
}
Ejemplo n.º 4
0
void Menu_DrawStringDark (int x, int y, const char *string, int alpha)
{
	char	newstring[1024];

	Com_sprintf (newstring, sizeof(newstring), S_COLOR_ALT"%s", string);
	SCR_DrawString (x, y, ALIGN_CENTER, newstring, alpha);
}
Ejemplo n.º 5
0
static void Text_Draw(menutext_s *t)
{
	float	x, y;
	char	buff[512];
	float	*color;

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

	buff[0] = '\0';

	// possible label
	if (t->generic.name) {
		strcpy(buff, t->generic.name);
	}

	// possible value
	if (t->string) {
		strcat(buff, t->string);
	}

	if (t->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
	} else {
		color = t->color;
	}

	SCR_DrawString(x, y, buff, SMALLCHAR_SIZE, t->style, color);
}
Ejemplo n.º 6
0
void MenuField_Draw(menufield_s *f)
{
	int		x;
	int		y;
	int		w;
	int		style;
	qboolean focus;
	float	*color;

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

	if (f->generic.flags & QMF_SMALLFONT) {
		w = SMALLCHAR_SIZE;
		style = FONT_SMALL;
	} else {
		w = BIGCHAR_SIZE;
		style = 0;
	}

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

	if (f->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
	} else if (focus) {
		color = colorTextHighlight;
	} else {
		color = colorTextNormal;
	}

	if (focus) {
		// draw cursor
		SCR_FillRect(f->generic.left, f->generic.top, f->generic.right-f->generic.left+1, f->generic.bottom-f->generic.top+1, colorListbar);
		SCR_DrawString(x, y, "\15", w, FONT_CENTER | FONT_BLINK, color);
	}

	if (f->generic.name) {
		SCR_DrawString(x - w, y, f->generic.name, w, FONT_RIGHT, color);
	}

	MField_Draw(&f->field, x + w, y, w, style, color);
}
Ejemplo n.º 7
0
void Menu_DrawStringR2LDark (int x, int y, const char *string, int alpha)
{
	char	newstring[1024];

	Com_sprintf (newstring, sizeof(newstring), S_COLOR_ALT"%s", string);
	x -= stringLen(string)*MENU_FONT_SIZE;
	SCR_DrawString (x, y, ALIGN_CENTER, newstring, alpha);
}
Ejemplo n.º 8
0
void SearchLocalGames( void )
{
	int32_t		i;

	m_num_servers = 0;
	for (i=0 ; i<MAX_LOCAL_SERVERS ; i++)
		strcpy (local_server_names[i], NO_SERVER_STRING);

	Menu_DrawTextBox (168, 192, 36, 3);
	SCR_DrawString (188, 192+MENU_FONT_SIZE, ALIGN_CENTER, S_COLOR_ALT"Searching for local servers, this", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*2, ALIGN_CENTER, S_COLOR_ALT"could take up to a minute, so", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*3, ALIGN_CENTER, S_COLOR_ALT"please be patient.", 255);

	// the text box won't show up unless we do a buffer swap
	R_EndFrame();

	// send out info packets
	CL_PingServers_f();
}
static void SoundResetDefaultsFunc ( void *unused )
{
	Cvar_SetToDefault ("s_volume");
	Cvar_SetToDefault ("cd_nocd");
	Cvar_SetToDefault ("cd_loopcount");
	Cvar_SetToDefault ("s_khz");
	Cvar_SetToDefault ("s_loadas8bit");
	Cvar_SetToDefault ("s_primary");

	Menu_DrawTextBox (168, 192, 36, 3);
	SCR_DrawString (188, 192+MENU_FONT_SIZE, ALIGN_CENTER, S_COLOR_ALT"Restarting the sound system. This", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*2, ALIGN_CENTER, S_COLOR_ALT"could take up to a minute, so", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*3, ALIGN_CENTER, S_COLOR_ALT"please be patient.", 255);

	// the text box won't show up unless we do a buffer swap
	GLimp_EndFrame();

	CL_Snd_Restart_f();

	SoundSetMenuItemValues();
}
Ejemplo n.º 10
0
void ScrollList_Draw(menulist_s *l)
{
	float		x;
	float		u;
	float		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_SIZE) / 2 + 1;
				}

				SCR_FillRect(u, y, l->width*SMALLCHAR_SIZE, SMALLCHAR_SIZE+2, colorListbar);
				color = colorTextHighlight;

				if (hasfocus) {
					style = FONT_PULSE;
				} else {
					style = 0;
				}
			} else {
				color = colorTextNormal;
				style = 0;
			}

			if (l->generic.flags & QMF_CENTER_JUSTIFY) {
				style |= FONT_CENTER;
			}

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

			y += SMALLCHAR_SIZE;
		}
		x += (l->width + l->seperation) * SMALLCHAR_SIZE;
	}
}
Ejemplo n.º 11
0
static void Slider_Draw(menuslider_s *s)
{
	int			x;
	int			y;
	int			style;
	float		*color;
	int			button;
	qboolean	focus;

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

	if (s->generic.flags & QMF_GRAYED) {
		color = colorTextDisabled;
		style = 0;
	} else if (focus) {
		color  = colorTextHighlight;
		style = FONT_PULSE;
	} else {
		color = colorTextNormal;
		style = 0;
	}

	// draw label
	SCR_DrawString(x - SMALLCHAR_SIZE, y, s->generic.name, SMALLCHAR_SIZE, style | FONT_RIGHT, color);

	// draw slider
	trap_R_SetColor(color);
	UI_DrawHandlePic(x + SMALLCHAR_SIZE, y, 96, 16, sliderBar);

	// 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 & FONT_PULSE) {
		button = sliderButton_1;
	} else {
		button = sliderButton_0;
	}

	UI_DrawHandlePic((int)(x + 2*SMALLCHAR_SIZE + (SLIDER_RANGE-1)*SMALLCHAR_SIZE* s->range) - 2, y - 2, 12, 20, button);
}
Ejemplo n.º 12
0
void Menu_DrawStatusBar (const char *string)
{
	if (string)
	{
		int l = strlen( string );

		SCR_DrawFill( 0, SCREEN_HEIGHT-(MENU_FONT_SIZE+2), SCREEN_WIDTH, MENU_FONT_SIZE+2, ALIGN_BOTTOM_STRETCH, 60,60,60,255 );
		SCR_DrawFill( 0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, 1, ALIGN_BOTTOM_STRETCH, 0,0,0,255 );
		SCR_DrawString( SCREEN_WIDTH/2-(l/2)*MENU_FONT_SIZE, SCREEN_HEIGHT-(MENU_FONT_SIZE+1), ALIGN_BOTTOM, string, 255 );
	}
	else
		SCR_DrawFill( 0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+3, ALIGN_BOTTOM_STRETCH, 0,0,0,255 );
}
static void UpdateSoundQualityFunc ( void *unused )
{
	//Knightmare- added DMP's 44/48 KHz sound support
	//** DMP check the newly added sound quality menu options
	switch (s_options_sound_quality_list.curvalue)
	{
	case 1:
		Cvar_SetValue( "s_khz", 22 );
		Cvar_SetValue( "s_loadas8bit", false );
		break;
	case 2:
		Cvar_SetValue( "s_khz", 44 );
		Cvar_SetValue( "s_loadas8bit", false );
		break;
	case 3:
		Cvar_SetValue( "s_khz", 48 );
		Cvar_SetValue( "s_loadas8bit", false );
		break;
	default:
		Cvar_SetValue( "s_khz", 11 );
		Cvar_SetValue( "s_loadas8bit", true );
		break;
	}
	//** DMP end sound menu changes

	Cvar_SetValue ("s_primary", s_options_sound_compatibility_list.curvalue);

	Menu_DrawTextBox (168, 192, 36, 3);
	SCR_DrawString (188, 192+MENU_FONT_SIZE, ALIGN_CENTER, S_COLOR_ALT"Restarting the sound system. This", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*2, ALIGN_CENTER, S_COLOR_ALT"could take up to a minute, so", 255);
	SCR_DrawString (188, 192+MENU_FONT_SIZE*3, ALIGN_CENTER, S_COLOR_ALT"please be patient.", 255);

	// the text box won't show up unless we do a buffer swap
	GLimp_EndFrame();

	CL_Snd_Restart_f();
}
Ejemplo n.º 14
0
/**
 * @brief This is called every frame, and can also be called explicitly to flush text to the screen
 * @sa UI_Draw
 * @sa CL_ViewRender
 * @sa SCR_DrawConsole
 * @sa SCR_DrawCursor
 */
void SCR_UpdateScreen (void)
{
	if (cls.waitingForStart)
		return;

	/* if the screen is disabled (loading plaque is up, or vid mode changing)
	 * do nothing at all */
	if (cls.disableScreen) {
		if (CL_Milliseconds() - cls.disableScreen > 120000 && refdef.ready) {
			cls.disableScreen = 0;
			Com_Printf("Loading plaque timed out.\n");
			return;
		}
	}

	/* not initialized yet */
	if (!screenInitialized)
		return;

	R_BeginFrame();

	/* draw scene, if it is need */
	CL_ViewRender();

	/* draw the ui on top of the render view */
	UI_Draw();

	SCR_DrawConsole();

	if (cl_fps->integer)
		SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 10, 0, va("fps: %3.1f", cls.framerate));
	if (scr_rspeed->integer) {
		if (CL_OnBattlescape())
			SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80, va("brushes: %6i alias: %6i\n", refdef.brushCount, refdef.aliasCount));
		else
			SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80, va("alias: %6i\n", refdef.aliasCount));

		SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80 + con_fontHeight, va("batches: %6i\n", refdef.batchCount));
		if (r_programs->integer) {
			SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80 + con_fontHeight * 2, va("FFP->shader switches:    %6i\n", refdef.FFPToShaderCount));
			SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80 + con_fontHeight * 3, va("shader->shader switches: %6i\n", refdef.shaderToShaderCount));
			SCR_DrawString(viddef.context.width - 20 - con_fontWidth * 30, 80 + con_fontHeight * 4, va("shader->FFP switches:    %6i\n", refdef.shaderToFFPCount));
		}
	}

	SCR_DrawCursor();

	R_EndFrame();
}
Ejemplo n.º 15
0
static void RadioButton_Draw(menuradiobutton_s *rb)
{
	float		x;
	float		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 = colorTextDisabled;
		style = 0;
	} else if (focus) {
		color = colorTextHighlight;
		style = FONT_PULSE;
	} else {
		color = colorTextNormal;
		style = 0;
	}

	if (rb->generic.name) {
		SCR_DrawString(x + 18, y, rb->generic.name, SMALLCHAR_SIZE, style, color);
	}

	y += (SMALLCHAR_SIZE - 16) / 2;

	if (!rb->curvalue) {
		UI_DrawHandlePic(x, y, 16, 16, uis.rb_off);
	} else {
		UI_DrawHandlePic(x, y, 16, 16, uis.rb_on);
	}
}
Ejemplo n.º 16
0
/*
* Con_DrawNotify
*
* Draws the last few lines of output transparently over the game top
*/
void Con_DrawNotify( void )
{
    int v;
    char *text;
    const char *say;
    const char *translated;
    int i;
    int time;
    char *s;

    v = 0;
    if( con_drawNotify->integer )
    {
        for( i = min( NUM_CON_TIMES, con.numlines ) - 1; i >= 0; i-- )
        {
            time = con.times[i];
            if( time == 0 )
                continue;
            time = cls.realtime - time;
            if( time > con_notifytime->value*1000 )
                continue;
            text = con.text[i] ? con.text[i] : "";

            SCR_DrawString( 8, v, ALIGN_LEFT_TOP, text, cls.fontSystemSmall, colorWhite );

            v += SCR_strHeight( cls.fontSystemSmall );
        }
    }

    if( cls.key_dest == key_message )
    {
        int x, y;
        int width, prewidth;
        int promptwidth, cursorwidth;
        struct qfontface_s *font = NULL;

        if( con_chatCGame->integer )
        {
            width = con_chatWidth->integer;

            if( *con_chatFontFamily->string && con_chatFontSize->integer ) {
                font = SCR_RegisterFont( con_chatFontFamily->string, con_chatFontStyle->integer, con_chatFontSize->integer );
            }
            if( !font )
                font = cls.fontSystemSmall;

            x = con_chatX->integer;
            y = con_chatY->integer;
        }
        else
        {
            width = viddef.width;
            x = 8;
            y = v;
            font = cls.fontSystemSmall;
        }

        // 48 is an arbitrary offset for not overlapping the FPS and clock prints
        width -= 48;
        cursorwidth = SCR_strWidth( "_", font, 0 );

        if( chat_team )
        {
            say = "say_team:";
        }
        else
        {
            say = "say:";
        }

        translated = L10n_TranslateString( "common", say );
        if( !translated ) {
            translated = say;
        }
        SCR_DrawString( x, y, ALIGN_LEFT_TOP, translated, font, colorWhite );
        promptwidth = SCR_strWidth( translated, font, 0 ) + SCR_strWidth( " ", font, 0 );

        s = chat_buffer;
        prewidth = chat_linepos ? SCR_strWidth( s, font, chat_linepos ) : 0;

        // don't let the cursor go beyond the left screen edge
        clamp_high( chat_prestep, prewidth );

        // don't let it go beyond the right screen edge
        clamp_low( chat_prestep, prewidth - ( width - promptwidth - cursorwidth ) );

        // FIXME: we double the font height to compensate for alignment issues
        SCR_DrawClampString( x + promptwidth - chat_prestep,
                             y, s, x + promptwidth, y,
                             x + width, y + SCR_strHeight( font ) * 2, font, colorWhite );

        if( (int)( cls.realtime>>8 )&1 )
            SCR_DrawRawChar( x + promptwidth + prewidth - chat_prestep, y, '_',
                             font, colorWhite );
    }
Ejemplo n.º 17
0
void Menu_DrawString (int x, int y, const char *string, int alpha)
{
	SCR_DrawString (x, y, ALIGN_CENTER, string, alpha);
}
Ejemplo n.º 18
0
void Menu_DrawStringR2L (int x, int y, const char *string, int alpha)
{
	x -= stringLen(string)*MENU_FONT_SIZE;
	SCR_DrawString (x, y, ALIGN_CENTER, string, alpha);
}