Athan's Q3F Beta2 HUD Editting TUTORIAL - Borders

Introduction

This document aims to inform you of the methods for placing borders on HUD items, and for removing them if already there.

Removing Current Borders

We'll start with removing borders from the default HUD, as this is easy.

A lot of the default HUD borders are placed using macros of the type:

   Q3F_ITEM_BORDER_FILLED_NEW(...)
   Q3F_ITEM_BORDER(...)
   
These are macros defined in ui/menudef.h. To remove a border defined this way simply comment the line out by putting // in front of it:
   //Q3F_ITEM_BORDER_FILLED_NEW(...)
   //Q3F_ITEM_BORDER(...)
   

Other borders are defined with a type ITEM_TYPE_BORDER in an itemDef. To remove these you have several options:

  1. If you want to remove all the borders for an entire menuDef you can comment out the loadborderbitmap lines:
         loadborderbitmap 0 "ui/gfx/hud/top_left"
         loadborderbitmap 1 "ui/gfx/hud/fill_left"
         loadborderbitmap 2 "ui/gfx/hud/bot_left"
         loadborderbitmap 3 "ui/gfx/hud/fill_top"
         loadborderbitmap 4 "ui/gfx/hud/fill_center_grey"
         loadborderbitmap 5 "ui/gfx/hud/fill_bot"
         loadborderbitmap 6 "ui/gfx/hud/top_right"
         loadborderbitmap 7 "ui/gfx/hud/fill_right"
         loadborderbitmap 8 "ui/gfx/hud/bot_right"
       
  2. If you want to only remove one itemDef's border within a menuDef (or at least not ALL the itemDefs' borders) then you'll need to locate the correct itemDef and change:
       visible MENU_TRUE
       
    into:
       visible MENU_FALSE
       
    In many ways this is a better method to remove all borders as well, as it means the code does no work drawing these items past checking the visible flag. I'd still comment the loadborderbitmap lines as well though, for extra efficiency.

There's another way to make a very simple border on an object, which will be explaind in detail below. These are simple rectangles and can be removed by commenting out the itemDef's:

   border <x>
   
where <x> is a non-zero value.


Adding a border

As mentioned above there are a number of macros defined in ui/menudef.h for putting borders around objects. Each of these actually puts an entire itemDef into your hud.menu file, so don't use them within another itemDef, but do place them within a menuDef.

Note that these macros are defined by the q3f development team and may be subject to change between releases. They use them in the default HUD they define. If something here doesn't work it's likely I'm either not aware of a change in a new release or haven't had time to document it yet.

MacroArguments/Comments
Q3F_ITEM_BORDER_FILLED_NEW(Q3F_BRD_X, Q3F_BRD_Y, Q3F_BRD_WIDTH, Q3F_BRD_HEIGHT)
  • Q3F_BRD_X - Top left x co-ordinate
  • Q3F_BRD_Y - Top left y co-ordinate
  • Q3F_BRD_WIDTH - Width of the entire border (not the thickness of it)
  • Q3F_BRD_HEIGHT Height of the entire border
Q3F_ITEM_BORDER(Q3F_BRD_X, Q3F_BRD_Y, Q3F_BRD_WIDTH, Q3F_BRD_HEIGHT) Same arguments as for Q3F_ITEM_BORDER_FILLED_NEW.

I'm going to stop there for now, as the dev team could easily change any of this as I said. If you desperately need a border the two above are probably enough to get you what you want. Note that due to not being able to use custom graphics you are stuck with just the above for graphical borders.

Adding a Simple Border

I mentioned simple rectangular borders above. You use 3 keywords in an itemDef to define one.

KeywordComments
border <style>Specifies the style of border, for possible values see Border Styles.
bordersize <p>Border width in pixels (at 640x480, scaled to your actual resolution).
bordercolor <r> <g> <b> <a> The colour of the border in RGB format, and then the Alpha component, i.e. how transparent it is (0 is all see-thru, 1 is totally opaque).

I've used something like the following on my own HUD on the itemDef that shows which team you're on:

    // blue_onteam_border
    itemDef {
      visible MENU_TRUE
      rect -1 0 54 28
      decoration
      border 1
      bordersize 1
      bordercolor 1 1 0 1
      ownerdrawflag CG_SHOW_ON_BLUE_TEAM
    }
   
This puts a bright yellow rectangle around the scorebox of the blue team if you're on the blue team (ownerdrawflag CG_SHOW_ON_BLUE_TEAM).


Neil Charley, aka Athan - q3f@gurus.tf