RMenu
Class RuneMenuTopWindow

source: c:\runehov\RMenu\Classes\RuneMenuTopWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--RMenu.RuneWindow
                  |
                  +--RMenu.RuneMenuTopWindow
Direct Known Subclasses:RMenuModTop, RuneMenuAboutTop, RuneMenuLoadTop, RuneMenuMultiplayerTop, RuneMenuNewTop, RuneMenuOptionsTop, RuneMenuSaveTop

class RuneMenuTopWindow
extends RMenu.RuneWindow

//============================================================================= // RuneMenuTopWindow //=============================================================================
Variables
 float SlideRate
 float XAlpha
 bool bOpen
 bool bOpening
 test1, test2


Function Summary
 void Created()
     
//=============================================================================
// Class Functions
//=============================================================================
 float CubicBlend(float t, float N1, float N2, float NC, float ND)
     
//--------------------------------------------------------
// CubicBlend
//
// t:	Alpha value [0..1]
// N1:	Start value
// N2:	End value
// NC:	Control value 1
// ND:	Control value 2
//--------------------------------------------------------
 void DebugString(string str)
 void DoneOpening()
 float HermiteBlend(float t, float N1, float N2, float S1, float S2)
     
//--------------------------------------------------------
// HermiteBlend
//
// t:	Alpha value [0..1]
// N1:	Start value
// N2:	End value
// S1:	Start slope
// S2:	End slope
//--------------------------------------------------------
 void HideAllWindows()
 void HideWindow()
 void Paint(Canvas C, float X, float Y)
 void SlideOpen()
 void Tick(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// RuneMenuTopWindow
00003	//=============================================================================
00004	class RuneMenuTopWindow extends RuneWindow;
00005	
00006	var float SlideRate;
00007	var float XAlpha;
00008	var bool bOpening;
00009	var bool bOpen;
00010	
00011	var float test1, test2;
00012	
00013	//=============================================================================
00014	// Class Functions
00015	//=============================================================================
00016	
00017	function Created()
00018	{
00019		Super.Created();
00020	}
00021	
00022	function Paint(Canvas C, float X, float Y)
00023	{
00024	//	LookAndFeel.DrawClientArea(Self, C);			// For tiled background
00025	//	DrawClippedTexture(C, 0, 0, Texture'TopBack');	// for exact size texture
00026		DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'TopBack');
00027	}
00028	
00029	function HideAllWindows()
00030	{
00031	}
00032	
00033	function HideWindow()
00034	{
00035		bAlwaysOnTop=false;
00036		Super.HideWindow();
00037		bOpen = false;
00038		bOpening = false;
00039		WinLeft=0;
00040	}
00041	
00042	function SlideOpen()
00043	{
00044		bAlwaysOnTop=false;
00045		bOpening = true;
00046		bOpen = false;
00047		WinLeft=0;
00048		XAlpha=0;
00049	
00050		LookAndFeel.PlayMenuSound(Self, MS_TopSlide);
00051	}
00052	
00053	function DoneOpening()
00054	{
00055		bAlwaysOnTop=true;
00056		bOpening = false;
00057		bOpen = true;
00058		LookAndFeel.PlayMenuSound(Self, MS_TopSlam);
00059	}
00060	
00061	function Tick(float DeltaTime)
00062	{
00063		local float PositionAlpha;
00064	
00065		if (bOpening)
00066		{
00067			XAlpha += DeltaTime * SlideRate;
00068			if (XAlpha >= 1.0)
00069				DoneOpening();
00070			XAlpha = FClamp(XAlpha, 0.0, 1.0);
00071	//		PositionAlpha = HermiteBlend(XAlpha, 0, 1, 0, 0);
00072			PositionAlpha = CubicBlend(XAlpha, 0, 1, test1, test2);
00073			WinLeft = 200.0*PositionAlpha;
00074	//		WindowAlpha = XAlpha;
00075		}
00076	}
00077	
00078	
00079	//--------------------------------------------------------
00080	// CubicBlend
00081	//
00082	// t:	Alpha value [0..1]
00083	// N1:	Start value
00084	// N2:	End value
00085	// NC:	Control value 1
00086	// ND:	Control value 2
00087	//--------------------------------------------------------
00088	function float CubicBlend(float t, float N1, float N2, float NC, float ND)
00089	{
00090		local float term1, term2, term3, term4;
00091	
00092		term1 = (1-t)*(1-t)*(1-t)*N1;
00093		term2 = t*t*t*N2;
00094		term3 = 3*t*(1-t)*(1-t)*NC;
00095		term4 = 3*t*t*(1-t)*ND;
00096	
00097		return term1 + term2 + term3 + term4;
00098	}
00099	
00100	//--------------------------------------------------------
00101	// HermiteBlend
00102	//
00103	// t:	Alpha value [0..1]
00104	// N1:	Start value
00105	// N2:	End value
00106	// S1:	Start slope
00107	// S2:	End slope
00108	//--------------------------------------------------------
00109	function float HermiteBlend(float t, float N1, float N2, float S1, float S2)
00110	{
00111		local float term1, term2, term3, term4;
00112	
00113		term1 = (2*t*t*t - 3*t*t + 1)	* N1;
00114		term2 = (-2*t*t*t + 3*t*t)		* N2;
00115		term3 = (t*t*t - 2*t*t + t)		* S1;
00116		term4 = -(t*t*t - 2*t*t + t)	* S2;
00117	//	term4 = (t*t*t - t*t)			* S2;	// wrong: try -(t*t*t - 2*t*t + t)*S2
00118	
00119		return term1 + term2 + term3 + term4;
00120	}
00121	
00122	function DebugString(string str)
00123	{
00124		if (RuneRootWindow(Root)!=None)
00125			if (RuneRootWindow(Root).StatusBar!=None)
00126				RuneRootWindow(Root).StatusBar.SetHelp(Str);
00127	}
00128	
00129	defaultproperties
00130	{
00131	     SlideRate=2.000000
00132	     test1=1.000000
00133	     test2=1.500000
00134	}

End Source Code