コード例 #1
0
ファイル: new_menu.c プロジェクト: jogi1/camquake
void MS_Draw_Content_Button(struct menu_ct *content){
	int py = 8;

	content->rx = content->lx + strlen(content->text) * 8;
	if ((content->color))
	{
		Draw_ColoredString(content->lx,content->ly,va("&c%s%s",content->color,content->text),0);
	}
	else
	{
		Draw_String(content->lx,content->ly,content->text);
	}
	content->rx = content->lx + strlen(content->text)*8;
	content->ry = content->ly + py;
}
コード例 #2
0
void SCR_DrawFPS (void)
{
	extern cvar_t show_fps;
	static double lastframetime;
	double t;
	extern int fps_count;
	static int lastfps;
	int x, y;
	char st[80],st1[80];

	if (!show_fps.value)
		return;

	t = Sys_FloatTime ();
	if ((t - lastframetime) >= 1.0)
	{
		lastfps = fps_count;
		fps_count = 0;
		lastframetime = t;
	}
    sprintf(st1,"%3d FPS", lastfps);
    //Draw_FrontText(st, 0,  0, 0xFF0000FF, 0);

	if(lastfps < 20)
	   sprintf(st,"&cF00%3d &cF00F&cF00P&cF00S", lastfps);
	else if(lastfps > 20 && lastfps < 40)
       sprintf(st,"&c0F0%3d &cF00F&cF00P&cF00S", lastfps);
	else 
       sprintf(st,"&c00F%3d &cF00F&cF00P&cF00S", lastfps);
       
	x = vid.width - strlen(st1) * 16 - 60;
	y = 0 ; //vid.height - (sb_lines * (vid.height/240) )- 16;
   
	Draw_ColoredString (x, y, st, 0);

	//"&cF20 C &cF50 r &cF80 o &c883 w &cA85 _ &cA85 b &c668 a &c55A r"
	//
}
コード例 #3
0
ファイル: new_menu.c プロジェクト: jogi1/camquake
int MS_Popup_Menu(void)
{
	int i = 0;
	int x = 0;
	int width = -1;
	int dx, dy;
	struct MS_Popup_Entry *entry;
	struct MS_Popup_Menu_Menu *menu = NULL;

	if (!popup_menu_active && menu_active)
	{
		if (menu_active->lx <= mscx &&  menu_active->rx >= mscx)
			if (menu_active->ly <= mscy && menu_active->ry >= mscy)
				return popup_active;
	}

	if (popup_menus && !popup_menu_active)
	{
		menu = popup_menus;
		while (menu)
		{
			dx = menu->x - mscx;
			dy = menu->y - mscy;
			if (dx < MSP_RADIUS && dx > -MSP_RADIUS && dy < MSP_RADIUS && dy > -MSP_RADIUS)
				break;
			menu = menu->next;
		}

		if (menu)
		{
			MS_Draw_Tooltip(menu->x, menu->y, "press and hold right mousebutton", 0, 0, 1, 1);
		}

	}


	if (!popup_active)
		return popup_active;
	
	if (MS_Popup_Valid(popup_menu_active))
		menu = popup_menu_active;
	else
		if (!menu)
			menu = &MS_Popup_Menu_Root;
	

	if (menu->type == 1)
	{
		popup_active_entry = menu->entry;
		Deactivate_Popup_Menu();
		return popup_active;
	}
	
	entry = menu->entry;

	if (!entry)
		return popup_active;

	while (entry)
	{
		i = strlen(entry->name) * 8;
		if (i > width)
			width = i;
		x++;
		entry = entry->next;
	}

	Draw_AlphaRectangleRealRGB(popup_x - 1, popup_y - 1, width+2, x*8+2, 1, 1, 0, 0, 0, 1);
	Draw_AlphaRectangleRealRGB(popup_x - 1, popup_y - 1, width+2, x*8+2, 1, 0, 0, 1, 0, 1);

	i = 0;
	popup_active_entry = NULL;
	entry = menu->entry;
	while (entry)
	{
		if (mscx >= popup_x && mscx <= popup_x + width && mscy > popup_y + i*8 && mscy < popup_y + 8 + i*8)
		{
			popup_active_entry = entry;
			Draw_ColoredString(popup_x, popup_y + i++ * 8, va("&c00f%s",entry->name), 0);
		}
		else
			Draw_String(popup_x, popup_y + i++ * 8, entry->name);
		entry = entry->next;
	}

	popup_menu_active = menu;

	return popup_active;
}
コード例 #4
0
void MVD_Status (void){
	int x, y,p ;
	char str[1024];
	int i;
	int id = 0;
	int z = 0;
	double av_f =0;
	double av_t =0;
	double av_tk=0;


	if (!mvd_status.value)
		return;

	if (!cls.mvdplayback)
		return;

	for (i=0;i<mvd_cg_info.pcount;i++)
		if (mvd_new_info[i].id == spec_track)
			id = i;

	x = ELEMENT_X_COORD(mvd_status);
	y = ELEMENT_Y_COORD(mvd_status);
	if (mvd_new_info[id].p_info)
		strlcpy(str,mvd_new_info[id].p_info->name,sizeof(str));
	else
		str[0] = '\0';
	Draw_ColoredString (x, y+((z++)*8), str,1);
	strlcpy(str,"&cf40Took",sizeof(str));

	Draw_ColoredString (x, y+((z++)*8), str,1);

	strlcpy(str,va("RL: %i LG: %i GL: %i RA: %i YA: %i GA:%i",\
				mvd_new_info[id].mvdinfo.itemstats[RL_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[LG_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[GL_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[RA_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[YA_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[RA_INFO].count),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);
	strlcpy(str,va("Ring: %i Quad: %i Pent: %i MH: %i",\
				mvd_new_info[id].mvdinfo.itemstats[RING_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[PENT_INFO].count,\
				mvd_new_info[id].mvdinfo.itemstats[MH_INFO].count),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	//	Com_Printf("%f %f %f \n",lasttime,mvd_new_info[id].mvdinfo.das.alivetimestart, mvd_new_info[id].mvdinfo.das.alivetime);
	if (cls.demotime >+ lasttime + .1){
		lasttime=cls.demotime;
		lasttime1=mvd_new_info[id].mvdinfo.das.alivetime;
	}

	strlcpy(str,va("Deaths: %i",mvd_new_info[id].mvdinfo.das.deathcount),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"Average Run:",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"Time      Frags TKS",sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	for (p=0;p<=mvd_new_info[id].mvdinfo.run;p++){
		av_t += mvd_new_info[id].mvdinfo.runs[p].time;
		av_f += mvd_new_info[id].mvdinfo.runs[p].frags;
		av_tk += mvd_new_info[id].mvdinfo.runs[p].teamfrags;
	}
	if (av_t>0){
		av_t = av_t / (mvd_new_info[id].mvdinfo.run +1);
		av_f = av_f / (mvd_new_info[id].mvdinfo.run +1);
		av_tk = av_tk / (mvd_new_info[id].mvdinfo.run +1);
	}

	strlcpy(str,va("%9.3f %3.3f %3.3f",av_t,av_f,av_tk),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);


	strlcpy(str,"Last 3 Runs:",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"No. Time      Frags TKS",sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	p=mvd_new_info[id].mvdinfo.run-3;
	if (p<0)
		p=0;
	//&& mvd_new_info[id].mvdinfo.runs[p].time
	for(;p<=mvd_new_info[id].mvdinfo.run ;p++){
		strlcpy(str,va("%3i %9.3f %5i %3i",p+1,mvd_new_info[id].mvdinfo.runs[p].time,mvd_new_info[id].mvdinfo.runs[p].frags,mvd_new_info[id].mvdinfo.runs[p].teamfrags),sizeof(str));
		Draw_ColoredString (x, y+((z++)*8),str,1);
	}
	strlcpy(str,va("Last Fired Weapon: %s",TP_ItemName(mvd_new_info[id].mvdinfo.lfw)),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"&cf40Lost",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8), str,1);

	strlcpy(str,va("RL: %i LG: %i GL: %i QUAD: %i",\
				mvd_new_info[id].mvdinfo.itemstats[RL_INFO].lost,\
				mvd_new_info[id].mvdinfo.itemstats[LG_INFO].lost,\
				mvd_new_info[id].mvdinfo.itemstats[GL_INFO].lost,\
				mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].lost),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"&cf40Kills",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8), str,1);

	strlcpy(str,va("RL: %i LG: %i GL: %i SNG: %i NG: %i SSG: %i SG: %i AXE: %i",\
				mvd_new_info[id].mvdinfo.killstats.normal[RL_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[LG_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[GL_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SNG_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[NG_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SSG_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SG_INFO].kills,\
				mvd_new_info[id].mvdinfo.killstats.normal[AXE_INFO].kills),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,va("SPAWN: %i",\
				mvd_new_info[id].mvdinfo.spawntelefrags),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"&cf40Teamkills",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8), str,1);

	strlcpy(str,va("RL: %i LG: %i GL: %i SNG: %i NG: %i SSG: %i SG: %i AXE: %i",\
				mvd_new_info[id].mvdinfo.killstats.normal[RL_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[LG_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[GL_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SNG_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[NG_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SSG_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[SG_INFO].teamkills,\
				mvd_new_info[id].mvdinfo.killstats.normal[AXE_INFO].teamkills),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);
	strlcpy(str,va("SPAWN: %i",\
				mvd_new_info[id].mvdinfo.teamspawntelefrags),sizeof(str));
	strlcpy(str,Make_Red(str,1),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"Last 3 Quad Runs:",sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	strlcpy(str,"No. Time      Frags TKS",sizeof(str));
	strlcpy(str,Make_Red(str,0),sizeof(str));
	Draw_ColoredString (x, y+((z++)*8),str,1);

	p=mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].run-3;
	if (p<0)
		p=0;
	for(;p<=mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].run && mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].runs[p].time ;p++){
		strlcpy(str,va("%3i %9.3f %5i %3i",p+1,mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].runs[p].time,mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].runs[p].frags,mvd_new_info[id].mvdinfo.itemstats[QUAD_INFO].runs[p].teamfrags),sizeof(str));
		Draw_ColoredString (x, y+((z++)*8),str,1);
	}
}