UMenu
Class UMenuScreenshotCW

source: e:\games\UnrealTournament\UMenu\Classes\UMenuScreenshotCW.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UMenu.UMenuScreenshotCW
Direct Known Subclasses:None

class UMenuScreenshotCW
extends UWindow.UWindowDialogClientWindow


Variables
 string IdealPlayerCount
 string MapAuthor
 string MapTitle
 string PlayersText
 Texture Screenshot


Function Summary
 void Close(optional bool)
 void Paint(Canvas C, float MouseX, float MouseY)
 void SetMap(string MapName)



Source Code


00001	class UMenuScreenshotCW expands UWindowDialogClientWindow;
00002	
00003	var Texture Screenshot;
00004	var string MapTitle;
00005	var string MapAuthor;
00006	var string IdealPlayerCount;
00007	
00008	var localized string PlayersText;
00009	
00010	function SetMap(string MapName)
00011	{
00012		local int i;
00013		local LevelSummary L;
00014	
00015		i = InStr(Caps(MapName), ".UNR");
00016		if(i != -1)
00017			MapName = Left(MapName, i);
00018	
00019		Screenshot = Texture(DynamicLoadObject(MapName$".Screenshot", class'Texture'));
00020		L = LevelSummary(DynamicLoadObject(MapName$".LevelSummary", class'LevelSummary'));
00021		if(L != None)
00022		{
00023			MapTitle = L.Title;
00024			MapAuthor = L.Author;
00025			IdealPlayerCount = L.IdealPlayerCount;
00026		}
00027		else
00028		{
00029			MapTitle = "";
00030			MapAuthor = "";
00031			IdealPlayerCount = "";
00032		}
00033	}
00034	
00035	function Close(optional bool bByParent)
00036	{
00037		Super.Close(bByParent);
00038		Screenshot = None;
00039	}
00040	
00041	function Paint(Canvas C, float MouseX, float MouseY)
00042	{
00043		local float X, Y, W, H;
00044	
00045		DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BlackTexture');
00046		if(Screenshot != None)
00047		{
00048			W = Min(WinWidth, Screenshot.USize);
00049			H = Min(WinHeight, Screenshot.VSize);
00050			
00051			if(W > H)
00052				W = H;
00053			if(H > W)
00054				H = W;
00055	
00056			X = (WinWidth - W) / 2;
00057			Y = (WinHeight - H) / 2;
00058			
00059			C.DrawColor.R = 255;
00060			C.DrawColor.G = 255;
00061			C.DrawColor.B = 255;
00062	
00063			DrawStretchedTexture(C, X, Y, W, H, Screenshot);
00064	
00065			C.Font = Root.Fonts[F_Normal];
00066	
00067			if(IdealPlayerCount != "")
00068			{
00069				TextSize(C, IdealPlayerCount@PlayersText, W, H);
00070				X = (WinWidth - W) / 2;
00071				Y = WinHeight - H*2;
00072				ClipText(C, X, Y, IdealPlayerCount@PlayersText);
00073			}
00074	
00075			if(MapAuthor != "")
00076			{
00077				TextSize(C, MapAuthor, W, H);
00078				X = (WinWidth - W) / 2;
00079				Y = WinHeight - H*3;
00080				ClipText(C, X, Y, MapAuthor);
00081			}
00082			
00083			if(MapTitle != "")
00084			{		
00085				TextSize(C, MapTitle, W, H);
00086				X = (WinWidth - W) / 2;
00087				Y = WinHeight - H*4;
00088				ClipText(C, X, Y, MapTitle);
00089			}
00090		}
00091	}
00092	
00093	defaultproperties
00094	{
00095	     PlayersText="Players"
00096	}

End Source Code