PDA

View Full Version : Optimizing huds for all resolutions



EvoloZz
13th January 2013, 12:09
I was just thinking if its possible to optimize huds for all players even for those who has really low resolutions, because normally they wont see any of them or only half of the text. Because i made all my huds on my badass gaming pc with highest resolution, but some players wont see 'em.
If anyone knows, help me :P

Jeplaa
13th January 2013, 13:16
Hey EvoloZz,

of course it is possible, add this to your hud element:



self.hud = newClientHudElem(self);
self.hud.vertAlign = "fullscreen";
self.hud.horzAlign = "fullscreen";

EvoloZz
13th January 2013, 13:28
Thanks a lot :P

randall
13th January 2013, 13:42
These are the valid values for...

vertAlign = "subtop" "top" "middle" "bottom" "fullscreen" "noscale" "alignto480" "center_safearea"
horzAlign = "subleft" left" "center" "right" "fullscreen" "noscale" "alignto640" "center_safearea"

EvoloZz
13th January 2013, 14:21
This is the result with highest res:
104
And this is result with lowest res:
105
I have no idea why "headshots" is alone from all others :P

kung foo man
13th January 2013, 14:23
Maybe forgot to align only that element? Cant check since no source is posted :)

EvoloZz
13th January 2013, 14:40
This is for headshots:

self.headshots = newClientHudElem(self);
self.headshots.vertAlign = "fullscreen";
self.headhosts.horzAlign = "fullscreen";
self.headshots.x = 615;
self.headshots.y = 300;
And this is for bashes:

self.bashes = newClientHudElem(self);
self.bashes.vertAlign = "fullscreen";
self.bashes.horzAlign = "fullscreen";
self.bashes.x = 615;
self.bashes.y = 320;
I don't see whats wrong

kung foo man
13th January 2013, 15:05
Could you name it self.headshots_2 for example?

Just to be sure its not changed somewhere later to a different position.

EvoloZz
13th January 2013, 15:16
Haha, the problem was so simple, i am just blind. If you look closely at the headshot hud i posted you can see that instead of "headshots" i have "headhosts" in one of them. omg i am stupid

kung foo man
13th January 2013, 15:18
shit happens :D

Mitch
13th January 2013, 19:51
I use this in my mod to align my huds in almost exactly the same spot in each resolution



hud.alignX = "right";
hud.alignY = "middle";
hud.horzAlign = "right";
hud.vertAlign = "bottom";
hud.x = -100;
hud.y = -200;
hud.label = &"^4Kills: ^7";
hud setValue(kills);

EvoloZz
14th January 2013, 17:15
What about if i want the value to be aligned with the element, kinda like this

Kills:
10
Of course it would be easy just to do with x and y, but if the value was 1 number long and then changes to 2 numbers, it automatically moves little bit to the right, but i want it always to be in the middle and under of the element :P
Is that possible too?

Tally
14th January 2013, 17:39
What about if i want the value to be aligned with the element, kinda like this

Kills:
10
Of course it would be easy just to do with x and y, but if the value was 1 number long and then changes to 2 numbers, it automatically moves little bit to the right, but i want it always to be in the middle and under of the element :P
Is that possible too?

In a case like that you use a label:


rankstring = self getRankstring( self.pers["rank"] );

if( !isDefined( self.rankhud ) )
{
self.rankhud = newClientHudElem( self );
self.rankhud.horzAlign = "fullscreen";
self.rankhud.vertAlign = "fullscreen";
self.rankhud.alignX = "left";
self.rankhud.alignY = "middle";
self.rankhud.x = 10;
self.rankhud.y = 474;
self.rankhud.alpha = 1;
self.rankhud.fontScale = 0.8;
self.rankhud.label = &"RANK_RANK";
}

if( isDefined( self.rankhud ) ) self.rankhud setText( rankstring );


And the localizedstring would be like this:


REFERENCE RANK
LANG_ENGLISH "RANK: "

The text, or alternatively, the value, sit inside the label, and is aligned by the settings for the self.rankhud hud element. A label is basically just a placeholder for some other element value.