Code: Select all
DrawNumber 4, TINYFONT, Grey, PowerupTime("Radsuit"), WhenNotZero/*FillZeros*/, -10, 50;How do I do that ?
Code: Select all
DrawNumber 4, TINYFONT, Grey, PowerupTime("Radsuit"), WhenNotZero/*FillZeros*/, -10, 50;
Code: Select all
class MyHud : BaseStatusBar
{
    private HUDFont _tinyFont;
    
    override void Init()
    {
        Super.Init();
        
        ...
        
        // Get the Font instance representing the font.
        Font fnt = "TINYFONT";
        // Create a HUDFont instance for use with the HUD drawing API.
        _tinyFont = HUDFont.Create(fnt, fnt.GetCharWidth("0"), Mono_CellLeft);
    }
}Code: Select all
override void Draw(int state, double TicFrac)
{
    ...
    
    // Let's see if the player has a radiation suit.
    let radSuit = Powerup(CPlayer.mo.FindInventory('PowerIronFeet'));
    
    if (radSuit != null)
    {
        // Get the amount of seconds left (tics / ticrate).
        int secondsLeft = int(Ceil(double(radSuit.EffectTics) / GameTicRate));
        // Draw the resulting value.
        DrawString(_tinyFont, FormatNumber(secondsLeft, 4), (-10, -50), DI_TEXT_ALIGN_RIGHT|DI_NOSHADOW, Font.CR_GREY);
    }
}