XIDInterf
Class XIIIMenuPressStart

source: C:\XIII\XIDInterf\Classes\XIIIMenuPressStart.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
                  |
                  +--XIDInterf.XIIIMenuPressStart
Direct Known Subclasses:None

class XIIIMenuPressStart
extends XIDInterf.XIIIWindow

//============================================================================ // Press start page. // //============================================================================
Variables
 string Copyright
           to play video
 string TitleXBoxText
           message "Please press START to begin"
 VideoPlayer VP
           to play video
 bool bDisplayTitle
           to play video
 float fBlinkTimer
           to play video
 float fTimer
           to play video
 int iPlaying
           to play video
 string sBackground[4]
           texture filename
 string sVideo
           video filename
 Texture tBackGroundArrow
           texture handle
 Texture tBackGroundBack
           texture handle
 Texture tBackGroundWhite
           texture handle
 Texture tBackGround[4]
           texture handle


Function Summary
 void Created()
 bool InternalOnKeyEvent(out byte, out byte, float delta)
 void Paint(Canvas C, float X, float Y)



Source Code


00001	//============================================================================
00002	// Press start page.
00003	//
00004	//============================================================================
00005	class XIIIMenuPressStart extends XIIIWindow;
00006	
00007	var localized string TitleXBoxText;		// message "Please press START to begin"
00008	var string sBackground[4];				// texture filename
00009	var texture tBackGround[4];			// texture handle
00010	var texture tBackGroundBack;		// texture handle
00011	var texture tBackGroundWhite;		// texture handle
00012	var texture tBackGroundArrow;		// texture handle
00013	var string sVideo;					// video filename
00014	var VideoPlayer VP;                 // to play video
00015	var string Copyright;
00016	
00017	var int iPlaying;
00018	var float fTimer;
00019	var float fBlinkTimer;
00020	var bool bDisplayTitle;
00021	
00022	function Created()
00023	{
00024	    local int i;
00025	
00026	    Super.Created();
00027	
00028		tBackGround[0] = texture(DynamicLoadObject(sBackGround[0], class'Texture'));
00029		tBackGround[1] = texture(DynamicLoadObject(sBackGround[1], class'Texture'));
00030		tBackGround[2] = texture(DynamicLoadObject(sBackGround[2], class'Texture'));
00031		tBackGround[3] = texture(DynamicLoadObject(sBackGround[3], class'Texture'));
00032	
00033	//    bShowBCK = true;
00034	//    bShowSEL = true;
00035		  bForceHelp = false;
00036		  
00037		  fTimer=0;
00038		  fBlinkTimer=0;
00039		  bDisplayTitle = false;
00040		  bDisplayBar = false;
00041	}
00042	
00043	function Paint(Canvas C, float X, float Y)
00044	{
00045		local float W, H;
00046		local int i;
00047		local int iBoxLeft, iBoxTop;
00048		local int iArrowLeft;
00049	
00050		Super.Paint(C,X,Y);
00051	
00052		// draw black background
00053		C.bUseBorder = false;
00054		C.DrawColor = C.Static.MakeColor(0,0,0);
00055		C.SetPos(0,0);
00056		C.DrawTile(tBackGroundBack, C.SizeX, C.SizeY, 0, 0, tBackgroundBack.USize, tBackgroundBack.VSize );
00057	
00058	
00059		// draw background texture
00060		C.bUseBorder = false;
00061		C.BorderColor = BlackColor;
00062		C.DrawColor = WhiteColor;
00063		C.SetPos(C.SizeX/2-tBackGround[0].USize, 39 );
00064		C.DrawTile(tBackGround[0], tBackGround[0].USize,tBackGround[0].VSize, 0, 0, tBackGround[0].USize, tBackGround[0].VSize );
00065		C.SetPos(C.SizeX/2, 39 );
00066		C.DrawTile(tBackGround[1], tBackGround[1].USize,tBackGround[1].VSize, 0, 0, tBackGround[1].USize, tBackGround[1].VSize );
00067		C.SetPos(C.SizeX/2-tBackGround[0].USize, 39+tBackGround[0].VSize );
00068		C.DrawTile(tBackGround[2], tBackGround[2].USize,tBackGround[2].VSize, 0, 0, tBackGround[2].USize, tBackGround[2].VSize );
00069		C.SetPos(C.SizeX/2, 39+tBackGround[0].VSize );
00070		C.DrawTile(tBackGround[3], tBackGround[3].USize,tBackGround[3].VSize, 0, 0, tBackGround[3].USize, tBackGround[3].VSize );
00071	
00072		if ( bDisplayTitle )
00073		{
00074			// draw page title
00075			C.bUseBorder = false;
00076			C.BorderColor = C.Static.MakeColor(0,0,0);
00077			C.DrawColor = C.Static.MakeColor(255,196,175);
00078	
00079			C.TextSize(TitleXBoxText, W, H);
00080			
00081			iBoxLeft = 70;
00082			iBoxTop  = 70;
00083	
00084		    C.DrawColor.A = 92;
00085			C.Style = 5; // ERenderStyle.STY_Alpha;
00086	
00087			C.SetPos(iBoxLeft, iBoxTop);
00088			C.DrawTile(tBackGroundWhite, W+40,H+10, 0, 0, tBackGroundWhite.USize, tBackGroundWhite.VSize );
00089			
00090			// draw arrow
00091			iArrowLeft = iBoxLeft+110;
00092			C.bUseBorder = false;
00093			C.SetPos(iBoxLeft+iArrowLeft, iBoxTop-3+H+10);
00094			C.DrawTile(tBackGroundArrow, tBackGroundArrow.USize, tBackGroundArrow.VSize, 0, 0, tBackGroundArrow.USize, tBackGroundArrow.VSize );
00095	
00096			C.Style = 1; // ERenderStyle.STY_Normal;
00097			
00098			C.DrawColor = C.Static.MakeColor(0,0,0); // (248,211,108);
00099			C.SetPos(iBoxLeft+20, iBoxTop+5);
00100			C.DrawText(TitleXBoxText, false);
00101	
00102			C.DrawLine(iBoxLeft+iArrowLeft+8, iBoxTop+H+10, iBoxLeft+iArrowLeft+22, iBoxTop+H+10+22, C.Static.MakeColor(0,0,0) );
00103			C.DrawLine(iBoxLeft+iArrowLeft+22, iBoxTop+H+10, iBoxLeft+iArrowLeft+22, iBoxTop+H+10+22, C.Static.MakeColor(0,0,0) );
00104			
00105			C.DrawLine(iBoxLeft, iBoxTop+H+10, iBoxLeft+iArrowLeft+8, iBoxTop+H+10, C.Static.MakeColor(0,0,0) );
00106			C.DrawLine(iBoxLeft+iArrowLeft+22, iBoxTop+H+10, iBoxLeft+W+40, iBoxTop+H+10, C.Static.MakeColor(0,0,0) );
00107			C.DrawLine(iBoxLeft, iBoxTop, iBoxLeft+W+40, iBoxTop, C.Static.MakeColor(0,0,0) );
00108			C.DrawLine(iBoxLeft, iBoxTop, iBoxLeft, iBoxTop+H+10, C.Static.MakeColor(0,0,0) );
00109			C.DrawLine(iBoxLeft+W+40, iBoxTop, iBoxLeft+W+40, iBoxTop+H+10, C.Static.MakeColor(0,0,0) );
00110		}
00111	
00112		// copyright
00113		C.DrawColor = C.Static.MakeColor(248,211,108);
00114		C.SetPos(90, 400);
00115		C.DrawText(Copyright, false);
00116		// restore old param
00117		C.DrawColor = WhiteColor;
00118		C.DrawColor.A = 255; C.Style = 1; C.bUseBorder = false;
00119	}
00120	
00121	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00122	{
00123		local int  iStatus;
00124		local bool bPlayingVideo;
00125		
00126	    if (State==1) // IST_Press // to avoid auto-repeat
00127	    {
00128			bPlayingVideo = false;
00129	
00130			if ( VP != none )
00131			{
00132				iStatus = VP.GetStatus();
00133				
00134				if ( iStatus == 1/*playing*/ )
00135				{
00136					bPlayingVideo = true;
00137					
00138					if ((Key==0x0F) || (Key==0xD4))/*IK_Enter or A button*/
00139					{
00140						VP.Stop();
00141						fTimer=0;
00142						fBlinkTimer=0;
00143						return true;
00144					}
00145				}
00146			}
00147			
00148			if ( !bPlayingVideo )
00149			{
00150				if (Key==0xD4) /*IK_Joy13 -> start*/
00151				{
00152					if (myroot.EndOfPressStartPage())
00153					{
00154						/* tell the engine we're not in the press start menu page anymore */
00155						myRoot.OpenMenu("XIDInterf.XIIIMenuSelectProfile");
00156					}
00157					else
00158					{
00159						myRoot.OpenMenu("XIDInterf.XIIIMenuFreeBlock");				
00160					}
00161					return true;
00162				}
00163			}
00164	    }
00165	
00166	    return super.InternalOnKeyEvent(Key, state, delta);
00167	}
00168	
00169	event Tick(float fDeltatime)
00170	{
00171		local int i;
00172		
00173		fTimer = fTimer + fDeltatime;
00174		fBlinkTimer = fBlinkTimer  + fDeltatime;
00175		
00176		// blink title: on: 1sec, off: 0.5sec
00177		
00178		if ( !bDisplayTitle && (fBlinkTimer>0.5) )
00179		{
00180			bDisplayTitle = true;
00181			fBlinkTimer = fBlinkTimer - 0.5;
00182		}
00183		else if ( bDisplayTitle && (fBlinkTimer>1.0) )
00184		{
00185			bDisplayTitle = false;
00186			fBlinkTimer = fBlinkTimer - 1.0;
00187		}
00188	
00189		if ( (iPlaying==1) && (VP!=none) && (VP.GetStatus()==0) )
00190		{
00191			// end of video
00192			fTimer=0;
00193			iPlaying=0;
00194		}
00195	
00196		if ( VP!=none) iPlaying=VP.GetStatus();
00197	
00198		// display video
00199		if ( fTimer > 70 )
00200		{
00201			fTimer=-300;
00202	
00203	        if ( VP == none )
00204	          VP = new class'VideoPlayer';
00205	        if ( (VP!=none) && (iPlaying==0) )
00206	        {
00207	          VP.Open(sVideo);
00208	          VP.Play();
00209	        }
00210		}
00211	}
00212	
00213	

End Source Code