UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Miscellaneous Recipes


236

else
{
ToggleDebug(); // Can't go any further, so back out
}
}
}

The following code should be added to draw the debug menu:
/*****************************************************************
* Draws the debug menu
*****************************************************************/
function DrawDebugMenu(HUD H)
{
local float XL, YL, YPos;
local DebugCommand command;
local SDebugCommandPage page;
local int index_array;
local Color cmnd_color;

/** Draws the menu */
if (bShowDebugMenu)
{
// Sets the font
H.Canvas.Font = class'Engine'.Static.GetLargeFont();
// Sets the length of the string (text)
H.Canvas.StrLen("X", XL, YL);
// Location on Y axis where text will begin (left)
YPos = 0;

// Top-left corner of the screen
H.Canvas.SetPos(0,0);

// Dark color
H.Canvas.SetDrawColor(10,10,10,128);
// Cover the size of the screen
H.Canvas.DrawRect(H.Canvas.SizeX,H.Canvas.SizeY);
if (CurrentPage == -1)
{
TutorialHUD(H).DrawDebugText("Debug
Screen",vect2d(0,YPos),
H.Canvas.Font,H.WhiteColor);
YPos += YL;

// Set the text color
Free download pdf