Ejemplo n.º 1
0
static void DrawNodeDescription( string text,
                                 float x_,
                                 float y_,
                                 float size_x,
                                 float size_y,
                                 bool ignore_occupied_areas,
                                 const GFXColor &col,
                                 navscreenoccupied *screenoccupation )
{
    //take the head and stick it in the back
    if (text.size() == 0)
        return;
    TextPlane    displayname;   //will be used to display shits names
    displayname.col = col;
    static float background_alpha =
        XMLSupport::parse_float( vs_config->getVariable( "graphics", "hud", "text_background_alpha", "0.0625" ) );
    int   length = text.size();
    float offset = (float(length)*0.005);
    if (ignore_occupied_areas) {
        displayname.SetPos( (x_-offset), y_ );
        displayname.SetText( text );
        displayname.SetCharSize( size_x, size_y );

        GFXColor tpbg = displayname.bgcol;
        bool     automatte = (0 == tpbg.a);
        if (automatte) displayname.bgcol = GFXColor( 0, 0, 0, background_alpha );
        displayname.Draw( text, 0, true, false, automatte );
        displayname.bgcol = tpbg;
    } else {
        float new_y = screenoccupation->findfreesector( x_, y_ );
        displayname.SetPos( (x_-offset), new_y );
        displayname.SetText( text );
        displayname.SetCharSize( size_x, size_y );
        GFXColor tpbg = displayname.bgcol;
        bool     automatte = (0 == tpbg.a);
        if (automatte) displayname.bgcol = GFXColor( 0, 0, 0, background_alpha );
        displayname.Draw( text, 0, true, false, automatte );
        displayname.bgcol = tpbg;
    }
}