Announcement

Collapse
No announcement yet.

Modifying the HUD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by [CD]Troy
    Can I have the scripts when you're done, I'm kinda stuck at huds. Would appreciate it!
    My HUD modification is pretty simple. The following function is in my GiftigBombcopter class. I may add a nuke icon, but haven't done so yet.

    Code:
    function drawHUD(Canvas c)
     { 
     local PlayerController p;
     local GiftigBombcopterWeapon w;
     
     super.drawHUD(c);
     
     p=PlayerController(owner);
     
     if(p==None)
      return;
     
     w=GiftigBombcopterWeapon(weapons[0]);
     
     if(w==None)
      return;
     
     if(w.warheads>0)
      c.setDrawColor(0,255,0,255);
     else
      c.setDrawColor(255,0,0,255);
     
     c.font=c.medFont;
     c.drawTextJustified(w.warheads@" / "@w.max_warheads@" warheads",0,10,80,90,100);
     
     c.setDrawColor(255,255,255,255);
     
     if(w.isInState('LoadingWarhead'))
      c.drawTextJustified("Obtaining the payload...",0,10,110,280,140);
     }

    Comment


      #17
      You should probably take a look at scaling your text positions based on the screen resolution (that's why you see so many canvas drawing functions with code snippets such as "SomeNumber * (c.clipx / 1024)" ). Try adjusting your screen resolution higher and lower to see if the text still draws correctly....

      Comment


        #18
        Originally posted by meowcat View Post
        You should probably take a look at scaling your text positions based on the screen resolution (that's why you see so many canvas drawing functions with code snippets such as "SomeNumber * (c.clipx / 1024)" ). Try adjusting your screen resolution higher and lower to see if the text still draws correctly....
        Thanks, I'll try that. Is c.clipx and c.clipy how to obtain the resolution then?

        Comment


          #19
          Yes. C (or whatever is the reference to the canvas object) has a bunch of accessible functions. I don't think UT2004 supports widescreens, so usually all you have to do is design your HUD elements to fit a specific resolution well, then apply a scaling factor like the one I included above to any "fixed" offsets when setting the drawing location on screen.

          Comment

          Working...
          X