PDA

View Full Version : Show FPS in Hud



DjTranceFire
21st October 2013, 20:25
Hey guys..
I'm trying to show the current value of "com_maxfps" in my custom hud.
I've done that with menu files but of course its only working with pre-defined values.
I want to change the hud to "FPS: Unknown" if the FPS is not defined.
Sadly its not possible to use "openMenuOnDvar" more then 17 times in a menu so i cant define all 1000 FPS steps... :D
Is there any way to get it working? :(

serthy
21st October 2013, 20:57
hud.menu

itemDef
{
rect 320 240 0 0
style WINDOW_STYLE_DVAR
dvar com_maxfps
dvarTest ui_showFPS
hideDvar
{
"0";
}
}

player.gsc

init()
{
level.hud_showFPS = getCvarInt( "scr_hud_showFPS" );
}

onPlayerSpawned()
{
player setClientCvar( "ui_showFPS" , level.hud_showFPS );
}

DjTranceFire
22nd October 2013, 12:30
No, I think you got me wrong.. :D
I want to show the current Client-FPS in the hud.
If the client has 125 FPS the hud shows "FPS: 125"
If the client has 250 FPS the hud shows "FPS: 250"
If the client has 333 FPS the hud shows "FPS: 333"
But if the client hast any other FPS then 125, 250 or 333 the hud shows "FPS: Unknown"

serthy
22nd October 2013, 12:45
Should exactly do this.
dvar com_maxfps will print the clients current value in com_maxfps

you can do things like this:

draw fps if it is 125,250 or 333, otherwise hide this itemdef

dvar com_maxfps
dvarTest com_maxfps
showDvar
{
"125";
"250";
"333";
}

and another one with this, hide this when its 125,250 or 333, in all other cases show this one

text "Unknown"
dvarTest com_maxfps
hideDvar
{
"125";
"250";
"333";
}

If you want the CURRENT client FPS a-la 327, there is no way, except for the cg_drawfps-one

DjTranceFire
22nd October 2013, 13:41
Yes, i know "showDvar" and "hideDvar" but how could i use this to show the FPS on the Hud?
Like this:
http://s1.directupload.net/images/131022/o534rgy5.jpg

serthy
22nd October 2013, 13:50
you have to force the dvar and set it to a client variable and draw the variable on the hud

player.fps = 333; player.hud_fps setValue( player.fps ); player setClientCvar( "com_maxfps" , player.fps );

IzNoGoD
22nd October 2013, 18:45
I PM-ed you with my xfire.

The way i did it is simple: i only detect those 5 fpsses, if its none of those, its MIX.