XIDInterf
Class XIIIPadButtonBase

source: C:\XIII\XIDInterf\Classes\XIIIPadButtonBase.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUILabel
            |
            +--XIDInterf.XIIIGUIBaseButton
               |
               +--XIDInterf.XIIIButton
                  |
                  +--XIDInterf.XIIIPadButtonBase
Direct Known Subclasses:XIIIPadButton

class XIIIPadButtonBase
extends XIDInterf.XIIIButton


Variables
 ARRAY Key
 int PadButtonIndex
 ARRAY tButton


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
     
//____________________________________________________________________
// MLK    Set the text font and position
 bool IsRightKeyPressed(byte aKey)
 void Paint(Canvas C, float X, float Y)
     
//____________________________________________________________________
// MLK    Print the text clipped to the dimensions of the button



Source Code


00001	class XIIIPadButtonBase extends XIIIButton;
00002	
00003	VAR ARRAY<Texture> tButton;
00004	VAR ARRAY<byte> Key;
00005	VAR int PadButtonIndex;
00006	//____________________________________________________________________
00007	// MLK    Set the text font and position
00008	function BeforePaint(Canvas C,float X, float Y)
00009	{
00010		local float W, H;
00011	
00012	    //if ((myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0))
00013	    //    C.Font = font'XIIIFonts.XIIIConsoleFont';
00014	    //else 
00015	
00016		C.Font = font'XIIIFonts.PoliceF16';
00017		C.TextSize( Text, W, H);
00018	
00019		if ( NbMultiSplit >= 2 )
00020		{
00021			if ( NbMultiSplit == 2 )
00022			{
00023				// split screen mode with two viewports
00024				if (TextAlign == TXTA_Center) 
00025					TextX = 24+(WinWidth*640-24 - W)/2;
00026				TextY = (WinHeight*480 - H)/8;
00027			}
00028			else
00029			{
00030				// split screen mode with four viewports
00031				if (TextAlign == TXTA_Center) 
00032					TextX = 24+(WinWidth*640/2-24 - W)/2;
00033				TextY = (WinHeight*480 - H)/8;
00034			}
00035		}
00036		else
00037		{
00038			if (TextAlign == TXTA_Center) 
00039				TextX = 24+Max(0,((WinWidth*640-24)*fRatioX - W)/2);
00040			TextY = (WinHeight*480*fRatioY - H)/2;
00041		}
00042	
00043		if (bfadein) 
00044		{
00045			fadevalue+=speed; 
00046			if (fadevalue > 255) 
00047			{
00048				bfadein = false; 
00049				fadevalue = 255;
00050			}
00051		}
00052		if (bflash) 
00053		{
00054			fadevalue+=speed; 
00055			if (fadevalue > 254) 
00056			{
00057				fadevalue = 255; 
00058				speed = -speed/2;
00059			}
00060			if (fadevalue < 0) 
00061			{
00062				bflash = false; 
00063				speed = 8; 
00064			}
00065		}
00066	}
00067	
00068	
00069	//____________________________________________________________________
00070	// MLK    Print the text clipped to the dimensions of the button
00071	function Paint(Canvas C, float X, float Y)
00072	{
00073		LOCAL int OldClipX;
00074	//    if (C.Viewport != myRoot.ViewportOwner) return;
00075	//    super.Paint(C,X,Y);
00076	
00077		C.SpaceX = -1;
00078	    //if ((myRoot.bIamInMulti) && (myRoot.GetLevel().NetMode == 0))
00079	    //    C.Font = font'XIIIFonts.XIIISmallFont';
00080	    //else 
00081	        C.Font = font'XIIIFonts.PoliceF16';
00082	
00083	    C.Style = 5;
00084	    if (!bNoBg) 
00085	    {
00086	        C.DrawColor = BackColor;
00087	        if (bGlassLook) 
00088	        {
00089	            if (bHasFocus) 
00090	                C.DrawColor.A = 255;
00091	            else 
00092	                C.DrawColor.A = 128;
00093	        }
00094	        C.bUseBorder = bUseBorder;
00095	        DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, myRoot.FondMenu);
00096	        C.bUseBorder = false;
00097	    }
00098	    else 
00099	    {
00100	        if (bHasFocus) 
00101	            TextColor.A = 255;
00102	        else 
00103	            TextColor.A = 128;
00104	    }
00105	    if(Text!= "")
00106	    {
00107			C.Style = 1;
00108			C.DrawColor = C.MakeColor( 255,255,255,255 );
00109	        DrawStretchedTexture(C, TextX-24, TextY+2, 20*fRatioY, 20*fRatioY, tButton[PadButtonIndex]);
00110	        if ( bNeverFocus )
00111				C.DrawColor = C.MakeColor(192,192,192,255);
00112			else
00113				C.DrawColor = TextColor;
00114	
00115	        if (bfadein || bflash) 
00116	        {
00117	            C.Style = 5; 
00118	            C.DrawColor.A = fadevalue;
00119	        }
00120	        else 
00121	            C.Style = 1;
00122	        C.SetPos(TextX-2, TextY);
00123			OldClipX = C.ClipX;
00124			C.ClipX = WinWidth*640*fRatioX-2;
00125	        C.DrawTextClipped(Text, false);
00126			C.ClipX = OldClipX;
00127	    }
00128		C.SpaceX = 0;
00129	    C.Style = 1;
00130	}
00131	
00132	FUNCTION bool IsRightKeyPressed( byte aKey )
00133	{
00134	//	LOG ( "COMPARE"@aKey@"ET"@Key[ PadButtonIndex ]);
00135		return aKey==Key[ PadButtonIndex ];
00136	}
00137	
00138	
00139	
00140	defaultproperties
00141	{
00142	}

End Source Code