UMenu
Class UMenuInputOptionsClientWindow

source: e:\games\UnrealTournament\UMenu\Classes\UMenuInputOptionsClientWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowClientWindow
            |
            +--UWindow.UWindowDialogClientWindow
               |
               +--UWindow.UWindowPageWindow
                  |
                  +--UMenu.UMenuPageWindow
                     |
                     +--UMenu.UMenuInputOptionsClientWindow
Direct Known Subclasses:UTInputOptionsCW

class UMenuInputOptionsClientWindow
extends UMenu.UMenuPageWindow


Variables
 UWindowCheckbox AutoAimCheck
 string AutoAimHelp
 string AutoAimText
 UWindowCheckbox AutoSlopeCheck
 string AutoSlopeHelp
 string AutoSlopeText
 float ControlOffset
 UWindowCheckbox DirectInputCheck
 string DirectInputHelp
 string DirectInputText
 UWindowCheckbox InvertMouseCheck
 string InvertMouseHelp
 string InvertMouseText
 UWindowCheckbox JoystickCheck
 string JoystickHelp
 string JoystickText
 UWindowCheckbox LookSpringCheck
 string LookSpringHelp
 string LookSpringText
 UWindowCheckbox MouseSmoothCheck
 string MouseSmoothHelp
 string MouseSmoothText
 UWindowCheckbox MouselookCheck
 string MouselookHelp
 string MouselookText
 UWindowEditControl SensitivityEdit
 string SensitivityHelp
 string SensitivityText


Function Summary
 void AfterCreate()
 void AutoAimChecked()
     
/*
 * Message Crackers
 */
 void AutoSlopeChecked()
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void DirectInputChecked()
 void InvertMouseChecked()
 void JoystickChecked()
 void LookSpringChecked()
 void MouseSmoothChanged()
 void MouselookChecked()
 void Notify(UWindowDialogControl C, byte E)
 void SaveConfigs()
 void SensitivityChanged()



Source Code


00001	class UMenuInputOptionsClientWindow extends UMenuPageWindow;
00002	
00003	// Auto Aim
00004	var UWindowCheckbox AutoAimCheck;
00005	var localized string AutoAimText;
00006	var localized string AutoAimHelp;
00007	
00008	// Joystick
00009	var UWindowCheckbox JoystickCheck;
00010	var localized string JoystickText;
00011	var localized string JoystickHelp;
00012	
00013	// DirectInput
00014	var UWindowCheckbox DirectInputCheck;
00015	var localized string DirectInputText;
00016	var localized string DirectInputHelp;
00017	
00018	// Mouse Sensitivity
00019	var UWindowEditControl SensitivityEdit;
00020	var localized string SensitivityText;
00021	var localized string SensitivityHelp;
00022	
00023	// Invert Mouse
00024	var UWindowCheckbox InvertMouseCheck;
00025	var localized string InvertMouseText;
00026	var localized string InvertMouseHelp;
00027	
00028	// Look Spring
00029	var UWindowCheckbox LookSpringCheck;
00030	var localized string LookSpringText;
00031	var localized string LookSpringHelp;
00032	
00033	// Always Mouselook
00034	var UWindowCheckbox MouselookCheck;
00035	var localized string MouselookText;
00036	var localized string MouselookHelp;
00037	
00038	var UWindowCheckbox MouseSmoothCheck;
00039	var localized string MouseSmoothText;
00040	var localized string MouseSmoothHelp;
00041	
00042	// Auto Slope
00043	var UWindowCheckbox AutoSlopeCheck;
00044	var localized string AutoSlopeText;
00045	var localized string AutoSlopeHelp;
00046	
00047	var float ControlOffset;
00048	
00049	function Created()
00050	{
00051		local int ControlWidth, ControlLeft, ControlRight;
00052		local int CenterWidth, CenterPos, i;
00053		local string Sens;
00054	
00055		Super.Created();
00056	
00057		ControlWidth = WinWidth/2.5;
00058		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00059		ControlRight = WinWidth/2 + ControlLeft;
00060	
00061		CenterWidth = (WinWidth/4)*3;
00062		CenterPos = (WinWidth - CenterWidth)/2;
00063	
00064		// Joystick
00065		JoystickCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00066		JoystickCheck.bChecked = bool(GetPlayerOwner().ConsoleCommand("get windrv.windowsclient usejoystick"));
00067		JoystickCheck.SetText(JoystickText);
00068		JoystickCheck.SetHelpText(JoystickHelp);
00069		JoystickCheck.SetFont(F_Normal);
00070		JoystickCheck.Align = TA_Right;
00071	
00072		// Auto Aim
00073		AutoAimCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00074		if (GetPlayerOwner().MyAutoAim < 1.0)
00075			AutoAimCheck.bChecked = true;
00076		AutoAimCheck.SetText(AutoAimText);
00077		AutoAimCheck.SetHelpText(AutoAimHelp);
00078		AutoAimCheck.SetFont(F_Normal);
00079		AutoAimCheck.Align = TA_Right;
00080		ControlOffset += 25;
00081	
00082		// DirectInput
00083		DirectInputCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00084		DirectInputCheck.bChecked = bool(GetPlayerOwner().ConsoleCommand("get windrv.windowsclient UseDirectInput"));
00085		DirectInputCheck.SetText(DirectInputText);
00086		DirectInputCheck.SetHelpText(DirectInputHelp);
00087		DirectInputCheck.SetFont(F_Normal);
00088		DirectInputCheck.Align = TA_Right;
00089	
00090		// Look Spring
00091		LookSpringCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00092		if (GetPlayerOwner().bSnapToLevel)
00093			LookSpringCheck.bChecked = true;
00094		LookSpringCheck.SetText(LookSpringText);
00095		LookSpringCheck.SetHelpText(LookSpringHelp);
00096		LookSpringCheck.SetFont(F_Normal);
00097		LookSpringCheck.Align = TA_Right;
00098		ControlOffset += 25;
00099	
00100		// Always Mouselook
00101		MouselookCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00102		if (GetPlayerOwner().bAlwaysMouselook)
00103			MouselookCheck.bChecked = true;
00104		MouselookCheck.SetText(MouselookText);
00105		MouselookCheck.SetHelpText(MouselookHelp);
00106		MouselookCheck.SetFont(F_Normal);
00107		MouselookCheck.Align = TA_Right;
00108	
00109		// Auto Slope
00110		AutoSlopeCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlRight, ControlOffset, ControlWidth, 1));
00111		if (GetPlayerOwner().bLookUpStairs)
00112			AutoSlopeCheck.bChecked = true;
00113		AutoSlopeCheck.SetText(AutoSlopeText);
00114		AutoSlopeCheck.SetHelpText(AutoSlopeHelp);
00115		AutoSlopeCheck.SetFont(F_Normal);
00116		AutoSlopeCheck.Align = TA_Right;
00117		ControlOffset += 25;
00118	
00119		// Mouse Smoothing
00120		MouseSmoothCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00121		MouseSmoothCheck.bChecked = GetPlayerOwner().bMaxMouseSmoothing;
00122		MouseSmoothCheck.SetText(MouseSmoothText);
00123		MouseSmoothCheck.SetHelpText(MouseSmoothHelp);
00124		MouseSmoothCheck.SetFont(F_Normal);
00125		MouseSmoothCheck.Align = TA_Right;
00126	
00127		// Mouse Sensitivity
00128		SensitivityEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', ControlRight, ControlOffset, ControlWidth, 1));
00129		SensitivityEdit.SetText(SensitivityText);
00130		SensitivityEdit.SetHelpText(SensitivityHelp);
00131		SensitivityEdit.SetFont(F_Normal);
00132		SensitivityEdit.SetNumericOnly(True);
00133		SensitivityEdit.SetNumericFloat(True);
00134		SensitivityEdit.SetMaxLength(4);
00135		SensitivityEdit.Align = TA_Right;
00136		Sens = string(GetPlayerOwner().MouseSensitivity);
00137		i = InStr(Sens, ".");
00138		SensitivityEdit.SetValue(Left(Sens, i+3));
00139		ControlOffset += 25;
00140	
00141		// Invert Mouse
00142		InvertMouseCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', ControlLeft, ControlOffset, ControlWidth, 1));
00143		if (GetPlayerOwner().bInvertMouse)
00144			InvertMouseCheck.bChecked = true;
00145		InvertMouseCheck.SetText(InvertMouseText);
00146		InvertMouseCheck.SetHelpText(InvertMouseHelp);
00147		InvertMouseCheck.SetFont(F_Normal);
00148		InvertMouseCheck.Align = TA_Right;
00149	}
00150	
00151	function AfterCreate()
00152	{
00153		DesiredWidth = 220;
00154		DesiredHeight = ControlOffset;
00155	}
00156	
00157	function BeforePaint(Canvas C, float X, float Y)
00158	{
00159		local int ControlWidth, ControlLeft, ControlRight;
00160		local int CenterWidth, CenterPos;
00161	
00162		ControlWidth = WinWidth/2.5;
00163		ControlLeft = (WinWidth/2 - ControlWidth)/2;
00164		ControlRight = WinWidth/2 + ControlLeft;
00165	
00166		CenterWidth = (WinWidth/4)*3;
00167		CenterPos = (WinWidth - CenterWidth)/2;
00168	
00169		AutoAimCheck.SetSize(ControlWidth, 1);
00170		AutoAimCheck.WinLeft = ControlRight;
00171	
00172		JoystickCheck.SetSize(ControlWidth, 1);
00173		JoystickCheck.WinLeft = ControlLeft;
00174	
00175		InvertMouseCheck.SetSize(ControlWidth, 1);
00176		InvertMouseCheck.WinLeft = ControlLeft;
00177	
00178		DirectInputCheck.SetSize(ControlWidth, 1);
00179		DirectInputCheck.WinLeft = ControlLeft;
00180	
00181		LookSpringCheck.SetSize(ControlWidth, 1);
00182		LookSpringCheck.WinLeft = ControlRight;
00183	
00184		MouselookCheck.SetSize(ControlWidth, 1);
00185		MouselookCheck.WinLeft = ControlLeft;
00186	
00187		AutoSlopeCheck.SetSize(ControlWidth, 1);
00188		AutoSlopeCheck.WinLeft = ControlRight;
00189	
00190		MouseSmoothCheck.SetSize(ControlWidth, 1);
00191		MouseSmoothCheck.WinLeft = ControlLeft;
00192	
00193		SensitivityEdit.SetSize(ControlWidth, 1);
00194		SensitivityEdit.WinLeft = ControlRight;
00195		SensitivityEdit.EditBoxWidth = 30;
00196	}
00197	
00198	function Notify(UWindowDialogControl C, byte E)
00199	{
00200		Super.Notify(C, E);
00201		switch(E)
00202		{
00203		case DE_Change:
00204			switch(C)
00205			{
00206			case AutoAimCheck:
00207				AutoAimChecked();
00208				break;
00209			case JoystickCheck:
00210				JoystickChecked();
00211				break;
00212			case DirectInputCheck:
00213				DirectInputChecked();
00214				break;
00215			case InvertMouseCheck:
00216				InvertMouseChecked();
00217				break;
00218			case LookSpringCheck:
00219				LookSpringChecked();
00220				break;
00221			case MouselookCheck:
00222				MouselookChecked();
00223				break;
00224			case AutoSlopeCheck:
00225				AutoSlopeChecked();
00226				break;
00227			case SensitivityEdit:
00228				SensitivityChanged();
00229				break;
00230			case MouseSmoothCheck:
00231				MouseSmoothChanged();
00232				break;
00233			}
00234		}
00235	}
00236	
00237	/*
00238	 * Message Crackers
00239	 */
00240	
00241	function AutoAimChecked()
00242	{
00243		if(AutoAimCheck.bChecked)
00244		{
00245			GetPlayerOwner().ChangeAutoAim(0.93);
00246		} else {
00247			GetPlayerOwner().ChangeAutoAim(1.0);
00248		}
00249	}
00250	
00251	function JoystickChecked()
00252	{
00253		if(JoystickCheck.bChecked)
00254		{
00255			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient usejoystick 1");
00256		} else {
00257			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient usejoystick 0");
00258		}
00259	}
00260	
00261	function DirectInputChecked()
00262	{
00263		if(DirectInputCheck.bChecked)
00264		{
00265			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient UseDirectInput 1");
00266		} else {
00267			GetPlayerOwner().ConsoleCommand("set windrv.windowsclient UseDirectInput 0");
00268		}
00269	}
00270	
00271	function InvertMouseChecked()
00272	{
00273		GetPlayerOwner().bInvertMouse = InvertMouseCheck.bChecked;
00274	}
00275	
00276	function LookSpringChecked()
00277	{
00278		GetPlayerOwner().bSnapToLevel = LookSpringCheck.bChecked;
00279	}
00280	
00281	function MouselookChecked()
00282	{
00283		GetPlayerOwner().bAlwaysMouseLook = MouselookCheck.bChecked;
00284	}
00285	
00286	function AutoSlopeChecked()
00287	{
00288		GetPlayerOwner().bLookUpStairs = AutoSlopeCheck.bChecked;
00289	}
00290	
00291	function SensitivityChanged()
00292	{
00293		GetPlayerOwner().MouseSensitivity = float(SensitivityEdit.EditBox.Value);
00294	}
00295	
00296	function MouseSmoothChanged()
00297	{
00298		GetPlayerOwner().bMaxMouseSmoothing = MouseSmoothCheck.bChecked;
00299	}
00300	
00301	function SaveConfigs()
00302	{
00303		GetPlayerOwner().SaveConfig();
00304		Super.SaveConfigs();
00305	}
00306	
00307	defaultproperties
00308	{
00309	     AutoAimText="Auto Aim"
00310	     AutoAimHelp="Enable or disable vertical aiming help."
00311	     JoystickText="Joystick"
00312	     JoystickHelp="Enable or disable joystick."
00313	     DirectInputText="DirectInput"
00314	     DirectInputHelp="Enabling DirectInput on Windows 9x machines will improve mouse smoothness.  You must restart the game for this setting to take effect."
00315	     SensitivityText="Mouse Sensitivity"
00316	     SensitivityHelp="Adjust the mouse sensitivity, or how far you have to move the mouse to produce a given motion in the game."
00317	     InvertMouseText="Invert Mouse"
00318	     InvertMouseHelp="Invert the mouse X axis.  When true, pushing the mouse forward causes you to look down rather than up."
00319	     LookSpringText="Look Spring"
00320	     LookSpringHelp="If checked, releasing the mouselook key will automatically center the view. Only valid if Mouselook is disabled."
00321	     MouselookText="Mouselook"
00322	     MouselookHelp="If checked, the mouse is always used for controlling your view direction."
00323	     MouseSmoothText="Mouse Smoothing"
00324	     MouseSmoothHelp="If checked, mouse input will be smoothed to improve Mouselook smoothness."
00325	     AutoSlopeText="Auto Slope"
00326	     AutoSlopeHelp="If checked, your view will automatically adjust to look up and down slopes and stairs. Only valid if Mouselook is disabled."
00327	     ControlOffset=20.000000
00328	}

End Source Code