Core.Object | +--Engine.Actor | +--Engine.HUD | +--CortTest.CortHUD
string
ET_Mask
void
PostRender(Canvas C)
00001 // the "config(CortTest)" at the end of the class definition means "variables 00002 // from this class which are declared using the 'config' keyword should be 00003 // loaded from/stored to the UT/System/CortTest.ini file. 00004 class CortHUD expands HUD config(CortTest); 00005 00006 // these lines tell the compiler to load the five mask textures and store them, 00007 // along with the compiled UnrealScript code, in the final Foo.u file. I'm not 00008 // entirely sure what the syntax of the #exec command is :-), but it definitely 00009 // works. The important fields are NAME, FILE and GROUP -- once the texture is loaded, 00010 // you refer to it in the code as Texture'MyModule.GROUP.NAME' (see below). 00011 #exec TEXTURE IMPORT NAME=ProjMaskA FILE=Textures\Masks\ProjA.pcx GROUP="Masks" MIPS=OFF FLAGS=2 00012 #exec TEXTURE IMPORT NAME=ProjMaskB FILE=Textures\Masks\ProjB.pcx GROUP="Masks" MIPS=OFF FLAGS=2 00013 #exec TEXTURE IMPORT NAME=ProjMaskC FILE=Textures\Masks\ProjC.pcx GROUP="Masks" MIPS=OFF FLAGS=2 00014 #exec TEXTURE IMPORT NAME=ProjMaskD FILE=Textures\Masks\ProjD.pcx GROUP="Masks" MIPS=OFF FLAGS=2 00015 #exec TEXTURE IMPORT NAME=ProjMaskE FILE=Textures\Masks\ProjE.pcx GROUP="Masks" MIPS=OFF FLAGS=2 00016 00017 // declaring a variable as "config" means that that variable CAN be loaded from/ 00018 // stored to the configuration file specified above, in the class declaration line. 00019 // See UT/System/CortTest.ini for an example of specifying the default value of a 00020 // variable in a config file. 00021 // 00022 // In this case, we keep a configuration file filled with any information which 00023 // needs to vary from Spectator to Spectator. This includes the name of the 00024 // texture to use as the Mask for this spectator. 00025 var config string ET_Mask; 00026 00027 function PostRender(Canvas C) { 00028 //Super.PostRender(C); 00029 //C.SetPos(0, C.ClipY/2 ); 00030 //C.Font = MyFonts.GetBigFont( C.ClipX ); 00031 //C.DrawText( PlayerOwner.PlayerReplicationInfo.PlayerName, False ); 00032 00033 // Switch the rendering style to Modulated, which means that when a texture is drawn, 00034 // a pixel value of 0-126 DARKENS whatever is behind the pixel, 127 has no effect, and 00035 // 128-255 BRIGHTENS what's behind the pixel. This is why all the pixels in our mask 00036 // are 127 or lower. 00037 C.Style = ERenderStyle.STY_Modulated; 00038 00039 C.SetPos(0.0, 0.0); 00040 00041 00042 //C.DrawRect(Texture'CortTest.Masks.ProjMaskB', 800.0, 600.0); 00043 00044 // this is an idiom to translate the string we read from the config file, 00045 // ET_Mask, into a Texture object which we then pass to DrawRect. 00046 C.DrawRect( Texture(DynamicLoadObject(ET_Mask, class'Texture')), C.ClipX, C.ClipY ); 00047 } 00048 00049 defaultproperties 00050 { 00051 ET_Mask="CortTest.Masks.ProjMaskA" 00052 }