Jump to content
Sign in to follow this  
rksl-rock

Quick explanation of the Class MFD setup for custom HUDs.

Recommended Posts

This is just a very quick overview/explanation of the "class MFD" system to help people get started with it. I'll write a more comprehensive tut in the future.

Its actually a simple system but it can get complex really fast if you start designing and drawing your own HUDs. (see the RKSL Typhoon)

In the BIS aircraft the reticules etc work on a XY point reference system. Imagine a 1m x 1m plane. The top left corner is 0,0. Bottom right is 1,1. So the middle will be 0.5,0.5. All the figures relate to this grid. Any values over 1 or less than 0 eg -1) will not be drawn.

class MFD 
{
   borderLeft = 0.0;
   borderRight = 0.0;
   borderTop = 0.0;
   borderBottom = 0.0;

These values set the border around the HUD panel and allow you to change the aspect of the box so you dont distort the display if you need to change the aspect of the HUD. So changing the Left and Right borders to 0.1 will result in a display area 0.8 wide by 1.0 tall.

color[] = {1, 1, 1, 0.5};

Defines the colour of the HUD display. You can now add this command into your groups later so different components will have different colours.

Components are drawn in the HUD using "anchors". These are points that are used to tie the drawing overlay to. For example this is the anchor used for the direction indicator on the A10.

 class Bones 

{
   class PlaneW 
   {
       type = "fixed";                   //   "Fixed" means it does not animate with any source
       pos[] = {0.51, 0.34+0.09};
   };
};

This defines the centre anchor of the HUD as X = 0.51 and Y = 0.43. Now we need to draw the W. THis is the bit you need to edit to change the position of the recticles.

class Draw 
{
   alpha = 0.4;                    //   Alpha control how transparent the HUD will appear in general.
   color[] = {0.0, 0.3, 0.05};                   //   Again changes the colour of the display.  You wil find that this 'global' colour is over written by any colour command within other groups
   condition = "on";                    //   This mean thats the HUD will only appear in if the engine is ON.
   class PlaneW                         // THis is what is called a group.
   {
       clipTL[] = {0.0, 1.0};                    //   Clips the draw area TL means top left.
       clipBR[] = {1.0, 0.0};                    //   Clips the draw area BR means bottom right
        type = "line";                    //   You can have several draw types, line and text are most common.
       points[] = 
       {
           {"PlaneW", {-0.08, 0}, 1}, 
           {"PlaneW", {-0.03, 0}, 1},
           {"PlaneW", {-0.015, 0.033}, 1}, 
           {"PlaneW", {0.0, 0}, 1},
           {"PlaneW", {0.015, 0.033}, 1},
           {"PlaneW", {0.03, 0}, 1},
           {"PlaneW", {0.08, 0}, 1}
       };

};

The points are where the actual shape is defined relative to the anchor point.

So the first line starts -0.08,0 from the anchor. And ends at -0.03,0. Each segment of line must has a start and end point. So you will always have an even number of entries.

To draw more complex stuff you can just leave a blank entry to signify the end of a line. eg:

class RangeStick
                   {
                       class Circle
                       {
                           type = "line";
                           width = 4.0;
                           points[] = 
                           {
                               {{0.861, 0.150}, 1},
                               {{0.861, 0.849}, 1},
                               {},
                               {{0.861, 0.849}, 1},
                               {{0.872, 0.849}, 1},
                               {},
                               {{0.861, 0.779}, 1},
                               {{0.872, 0.779}, 1},
                               {},
                               {{0.861, 0.709}, 1},
                               {{0.872, 0.709}, 1},
                               {},
                               {{0.861, 0.639}, 1},
                               {{0.872, 0.639}, 1},
                               {},
                               {{0.861, 0.569}, 1},
                               {{0.872, 0.569}, 1},
                               {},
                               {{0.861, 0.499}, 1},
                               {{0.872, 0.499}, 1},
                               {},
                               {{0.861, 0.429}, 1},
                               {{0.872, 0.429}, 1},                                
                               {},
                               {{0.861, 0.360}, 1},
                               {{0.872, 0.360}, 1},
                               {},
                               {{0.861, 0.290}, 1},
                               {{0.872, 0.290}, 1},
                               {},
                               {{0.861, 0.220}, 1},
                               {{0.872, 0.220}, 1},
                               {},
                               {{0.861, 0.150}, 1},
                               {{0.872, 0.150}, 1},
                           };
                       };
                   };

If you dont it will just keep drawing lines between all points.

It is pretty simple but as I said it can get a bit complicated so its best to plan it out first and take some time to think about what you actually want to do.

There is a bit more of info here: http://community.bistudio.com/wiki/HUD

Good luck

Edited by RKSL-Rock

Share this post


Link to post
Share on other sites

Thanks for this Rock! Its all the information i have been bugging you about!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×