Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Optimizing huds for all resolutions

  1. #11
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    I use this in my mod to align my huds in almost exactly the same spot in each resolution

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

  2. The Following 2 Users Say Thank You to Mitch For This Useful Post:

    EvoloZz (13th January 2013),kung foo man (13th January 2013)

  3. #12
    Sergeant EvoloZz's Avatar
    Join Date
    Sep 2012
    Location
    Helsinki, Finland
    Posts
    360
    Thanks
    314
    Thanked 167 Times in 120 Posts
    What about if i want the value to be aligned with the element, kinda like this
    Code:
    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?

  4. #13
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by EvoloZz View Post
    What about if i want the value to be aligned with the element, kinda like this
    Code:
    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:

    Code:
    	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:

    Code:
    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.

  5. The Following 2 Users Say Thank You to Tally For This Useful Post:

    EvoloZz (14th January 2013),kung foo man (14th January 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •