Draw
Jump to navigation
Jump to search
Note: This feature is for ZScript only. |
virtual void Draw(int state, double TicFrac)
Usage
Called at the same rate as the current frame rate. This is used to handle drawing HUD elements. Internally this function handles refreshing the border around the HUD, calling DrawMyPos, drawing the crosshair, and calling DrawAutomapHUD.
Parameters
- int state
- The current state of the HUD. This can be one of the following constants:
- HUD_StatusBar - The status bar is currently visible
- HUD_Fullscreen - The status bar is currently hidden but the HUD is still being drawn
- HUD_None - The HUD is completely disabled
- HUD_AltHud - GZDoom's alternate HUD is being used
- double TicFrac
- Since Draw is called between tics, this is the fraction of the way the game is to the next tic. For instance, if the game is running at 140 FPS this value would fluctuate between 0, 0.25, 0.5, and 0.75
Examples
This example is from DoomStatusBar, the HUD used in Doom:
class DoomStatusBar : BaseStatusBar
{
override void Draw (int state, double TicFrac)
{
Super.Draw (state, TicFrac);
if (state == HUD_StatusBar)
{
BeginStatusBar();
DrawMainBar (TicFrac);
}
else if (state == HUD_Fullscreen)
{
BeginHUD();
DrawFullScreenStuff ();
}
}
protected void DrawMainBar (double TicFrac)
{
... //omitted for brevity
}
protected void DrawFullScreenStuff ()
{
... //omitted for brevity
}
... //omitted for brevity
}