Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

XInterface.Tab_VideoSettings


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
// ====================================================================
//  Class:  XInterface.Tab_VideoSettings
//  Parent: XInterface.GUITabPanel
//
//  <Enter a description here>
// ====================================================================

class Tab_VideoSettings extends UT2K3TabPanel;

#exec OBJ LOAD FILE=InterfaceContent.utx

var		bool ShowSShot;

struct DisplayMode
{
	var int	Width,
			Height;
};

var DisplayMode DisplayModes[23];

var localized string	BitDepthText[2];

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	local int i;
	Super.Initcomponent(MyController, MyOwner);

	for (i=0;i<Controls.Length;i++)
		Controls[i].OnChange=InternalOnChange;

	moComboBox(Controls[1]).AddItem(BitDepthText[0]);
	moComboBox(Controls[1]).AddItem(BitDepthText[1]);
	moComboBox(Controls[1]).ReadOnly(true);
	
	CheckSupportedResolutions();
	
	Controls[6].FriendlyLabel  = GUILabel(Controls[5]);
	Controls[8].FriendlyLabel  = GUILabel(Controls[7]);
	Controls[10].FriendlyLabel = GUILabel(Controls[9]);
	
}

function CheckSupportedResolutions()
{
	local int		HighestRes;
	local int		Index;
	local int		BitDepth;
	local string	CurrentSelection;

	CurrentSelection = moComboBox(Controls[0]).MyComboBox.Edit.GetText();
	if(moComboBox(Controls[0]).ItemCount() > 0)
	moComboBox(Controls[0]).RemoveItem(0,moComboBox(Controls[0]).ItemCount());

	if(moComboBox(Controls[1]).GetText()==BitDepthText[0])
		BitDepth = 16;
	else
		BitDepth = 32;

	// Don't let user create non-fullscreen window bigger than highest
	//  supported resolution, or MacOS X client crashes. --ryan.
	if(!moCheckBox(Controls[2]).IsChecked()) // Controls[2] == fs toggle.
	{
		HighestRes = 0;
		for(Index = 0;Index < ArrayCount(DisplayModes);Index++)
		{
			if (PlayerOwner().ConsoleCommand(
					"SupportedResolution"$
					" WIDTH="$DisplayModes[Index].Width$
					" HEIGHT="$DisplayModes[Index].Height$
					" BITDEPTH="$BitDepth) == "1")
			{
				HighestRes = Index;   // biggest resolution hardware supports.
			}
		}

		for(Index = 0;Index <= HighestRes;Index++)
		{
			moComboBox(Controls[0]).AddItem(DisplayModes[Index].Width$"x"$DisplayModes[Index].Height);
		}
	}

	else  // Set dropdown for fullscreen modes...
	{
		for(Index = 0;Index < ArrayCount(DisplayModes);Index++)
		{
			if (PlayerOwner().ConsoleCommand(
				"SupportedResolution"$
				" WIDTH="$DisplayModes[Index].Width$
				" HEIGHT="$DisplayModes[Index].Height$
				" BITDEPTH="$BitDepth) == "1")
			{
				moComboBox(Controls[0]).AddItem(DisplayModes[Index].Width$"x"$DisplayModes[Index].Height);
			}
		}
    }

	moComboBox(Controls[0]).SetText(CurrentSelection);
}

function Refresh()
{
	InternalOnLoadINI(Controls[0],"");
	InternalOnLoadINI(Controls[1],"");
	InternalOnLoadINI(Controls[2],"");
}
	
function InternalOnLoadINI(GUIComponent Sender, string s)
{
	local string temp;

	if (Sender==Controls[0])
	{
		// Resolution
		if(Controller.GameResolution != "")
			moComboBox(Controls[0]).SetText(Controller.GameResolution);
		else
			moComboBox(Controls[0]).SetText(Controller.GetCurrentRes());
	}
	if (Sender==Controls[1])
	{
		if (PlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice Use16bit") ~= "true")
			moComboBox(Sender).SetText(BitDepthText[0]);
		else
			moComboBox(Sender).SetText(BitDepthText[1]);

		CheckSupportedResolutions();
	}
	else if (Sender==Controls[2])
	{
		Temp = Sender.PlayerOwner().ConsoleCommand("ISFULLSCREEN");
		moCheckBox(Sender).Checked(bool(Temp));	
		CheckSupportedResolutions();
	}			
}		
		 
function string InternalOnSaveINI(GUIComponent Sender); 		// Do the actual work here

function InternalOnChange(GUIComponent Sender)
{
	if (!Controller.bCurMenuInitialized)
		return;

	if (Sender==Controls[0] || Sender==Controls[1] || Sender==Controls[2] )
	{
		Controls[3].bVisible=true;
		
		if(Sender != Controls[0])
			CheckSupportedResolutions();
	}

	else if (Sender==Controls[6])
		PlayerOwner().ConsoleCommand("GAMMA"@GUISlider(Controls[6]).Value);

	else if (Sender==Controls[8])
		PlayerOwner().ConsoleCommand("BRIGHTNESS"@GUISlider(Controls[8]).Value);
		
	else if (Sender==Controls[10])
		PlayerOwner().ConsoleCommand("CONTRAST"@GUISlider(Controls[10]).Value);
}			

function bool ApplyChanges(GUIComponent Sender)
{
	local string DesiredRes;

	DesiredRes = moComboBox(Controls[0]).MyComboBox.Edit.GetText();
	
	if (moComboBox(Controls[1]).GetText()==BitDepthText[0])
		DesiredRes=DesiredRes$"x16";
	else
		DesiredRes=DesiredRes$"x32";

	if (moCheckBox(Controls[2]).IsChecked())
		DesiredRes=DesiredRes$"f";
	else
		DesiredRes=DesiredRes$"w";

	Controls[3].bVisible=false;
		
	if ( Controller.OpenMenu("xinterface.UT2VideoChangeOK") )
		UT2VideoChangeOK(Controller.TopPage()).Execute(DesiredRes);

	return true;
}

function bool InternalOnClick(GUIComponent Sender)
{
	showsshot = !showsshot;
	
	Controls[12].bVisible = !ShowSShot;
	Controls[13].bVisible = !ShowSShot;
	
	if (showsshot)
		GUIImage(Controls[11]).Image = material'GammaSet1';
	else
		GUIImage(Controls[11]).Image = material'GammaSet0';
		
	return true;
}						

defaultproperties
{
	Begin Object class=moComboBox Name=VideoResolution
		WinWidth=0.390000
		WinHeight=0.050000
		WinLeft=0.124258
		WinTop=0.047396
		Caption="Resolution"
		INIOption="@INTERNAL"
		INIDefault="640x480"
		OnLoadINI=InternalOnLoadINI
		OnSaveINI=InternalOnSaveINI
		Hint="Select the video resolution at which you wish to play."
		bReadOnly=true
		CaptionWidth=0.375
	End Object
	Controls(0)=moComboBox'VideoResolution'		

	Begin Object class=moComboBox Name=VideoColorDepth
		WinWidth=0.390000
		WinHeight=0.050000
		WinLeft=0.121484
		WinTop=0.152345
		Caption="Color Depth"
		INIOption="@Internal"
		INIDefault="false"
		OnLoadINI=InternalOnLoadINI
		OnSaveINI=InternalOnSaveINI
		Hint="Select the maximum number of colors to display at one time."
		CaptionWidth=0.375		
	End Object
	Controls(1)=moComboBox'VideoColorDepth'		

	Begin Object class=moCheckBox Name=VideoFullScreen
		WinWidth=0.350000
		WinHeight=0.040000
		WinLeft=0.667226
		WinTop=0.047396
		Caption="Full Screen"
		INIOption="@Internal"
		INIDefault="True"
		OnLoadINI=InternalOnLoadINI
		OnSaveINI=InternalOnSaveINI
		Hint="Check this box to run the game full screen."
		bSquare=true
		ComponentJustification=TXTA_Left
		CaptionWidth=0.375		
	End Object
	Controls(2)=moCheckBox'VideoFullScreen'		

	Begin Object class=GUIButton Name=VideoApply
		WinWidth=0.25000
		WinHeight=0.050000
		WinLeft=0.667226
		WinTop=0.152345
		Caption="Apply Changes"
		Hint="Apply all changes to your video settings."
		bVisible=false;
		OnClick=ApplyChanges
	End Object
	Controls(3)=GUIButton'VideoApply'		

	
	Begin Object class=GUIImage Name=GammaBK
		WinWidth=0.957500
		WinHeight=0.697273
		WinLeft=0.021641
		WinTop=0.280365
		Image=Material'InterfaceContent.Menu.BorderBoxD'
		ImageColor=(R=255,G=255,B=255,A=160);
		ImageRenderStyle=MSTY_Alpha
		ImageStyle=ISTY_Stretched
	End Object
	Controls(4)=GUIImage'GammaBK'
	
	
	Begin Object class=GUILabel Name=GammaLabel
		Caption="Gamma"
		TextALign=TXTA_Center
		TextColor=(R=255,G=255,B=255,A=255)
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.060547
		WinTop=0.341146
		StyleName="TextLabel"
	End Object
	Controls(5)=GUILabel'GammaLabel'

	Begin Object class=GUISlider Name=GammaSlider
		WinWidth=0.250000
		WinLeft=0.062500
		WinTop=0.402345
		MinValue=0.5
		MaxValue=2.5
		INIOption="ini:Engine.Engine.ViewportManager Gamma"
		INIDefault="0.8"
		Hint="Use the slider to adjust the Gamma to suit your monitor."
	End Object
	Controls(6)=GUISlider'GammaSlider'

	
	Begin Object class=GUILabel Name=BrightnessLabel
		Caption="Brightness"
		TextALign=TXTA_Center
		TextColor=(R=255,G=255,B=255,A=255)
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.061524
		WinTop=0.555990
		StyleName="TextLabel"
	End Object
	Controls(7)=GUILabel'BrightnessLabel'
	
	Begin Object class=GUISlider Name=BrightnessSlider
		WinWidth=0.250000
		WinLeft=0.062500
		WinTop=0.623699
		MinValue=0
		MaxValue=1
		INIOption="ini:Engine.Engine.ViewportManager Brightness"
		INIDefault="0.8"
		Hint="Use the slider to adjust the Brightness to suit your monitor."
	End Object
	Controls(8)=GUISlider'BrightnessSlider'

	Begin Object class=GUILabel Name=ContrastLabel
		Caption="Contrast"
		TextALign=TXTA_Center
		TextColor=(R=255,G=255,B=255,A=255)
		WinWidth=0.250000
		WinHeight=32.000000
		WinLeft=0.059570
		WinTop=0.790365
		StyleName="TextLabel"
	End Object
	Controls(9)=GUILabel'ContrastLabel'
	
	Begin Object class=GUISlider Name=ContrastSlider
		WinWidth=0.250000
		WinLeft=0.062500
		WinTop=0.851565
		MinValue=0
		MaxValue=1
		INIOption="ini:Engine.Engine.ViewportManager Contrast"
		INIDEfault="0.8"
		Hint="Use the slider to adjust the Contrast to suit your monitor."
	End Object
	Controls(10)=GUISlider'ContrastSlider'

	Begin Object class=GUIImage Name=GammaBar
		WinWidth=0.400000
		WinHeight=0.500000
		WinLeft=0.454102
		WinTop=0.377604
		Image=material'GammaSet1'
		ImageColor=(R=255,G=255,B=255,A=255);
	End Object
	Controls(11)=GUIImage'GammaBar'

	Begin Object class=GUILabel Name=BrightDesc1
		Caption="Adjust the Gamma Setting so that the"
		TextALign=TXTA_Center
		TextColor=(R=230,G=200,B=0,A=255)
		TextFont="UT2MenuFont"
		WinWidth=1.000000
		WinHeight=32.000000
		WinLeft=0.151367
		WinTop=0.8
		bVisible=false
	End Object
	Controls(12)=GUILabel'BrightDesc1'

	Begin Object class=GUILabel Name=BrightDesc2
		Caption="Square is completely black."
		TextALign=TXTA_Center
		TextFont="UT2MenuFont"
		TextColor=(R=230,G=200,B=0,A=255)
		WinWidth=1.000000
		WinHeight=32.000000
		WinLeft=0.136719
		WinTop=0.870000
		bVisible=false
	End Object
	Controls(13)=GUILabel'BrightDesc2'
	
	Begin Object class=GUIButton Name=VideoLeft
		WinWidth=0.043555
		WinHeight=0.084414
		WinLeft=0.397656
		WinTop=0.573959
		bNeverFocus=true
		bRepeatClick=true
		OnClick=InternalOnClick
		bVisible=false
		StyleName="ArrowLeft"		
	End Object
	Controls(14)=GUIButton'VideoLeft'	

	Begin Object class=GUIButton Name=VideoRight
		WinWidth=0.043555
		WinHeight=0.084414
		WinLeft=0.864063
		WinTop=0.573959
		StyleName="ArrowRight"
		bNeverFocus=true
		bRepeatClick=true
		OnClick=InternalOnClick
		bVisible=false
	End Object
	Controls(15)=GUIButton'VideoRight'	
	
	
	WinTop=0.15
	WinLeft=0
	WinWidth=1
	WinHeight=0.74
	bAcceptsInput=false
	
	DisplayModes(0)=(Width=320,Height=240)
	DisplayModes(1)=(Width=512,Height=384)
	DisplayModes(2)=(Width=640,Height=480)
	DisplayModes(3)=(Width=720,Height=480)  // Some mac powerbooks
	DisplayModes(4)=(Width=800,Height=500)
	DisplayModes(5)=(Width=800,Height=600)
	DisplayModes(6)=(Width=840,Height=524)  // iMac g5 20"
	DisplayModes(7)=(Width=896,Height=600)  // Some mac powerbooks
	DisplayModes(8)=(Width=1024,Height=640)
	DisplayModes(9)=(Width=1024,Height=768)
	DisplayModes(10)=(Width=1152,Height=720)
	DisplayModes(11)=(Width=1152,Height=864)
	DisplayModes(12)=(Width=1280,Height=800)
	DisplayModes(13)=(Width=1280,Height=854) // Some mac powerbooks
	DisplayModes(14)=(Width=1280,Height=960)
	DisplayModes(15)=(Width=1280,Height=1024)
	DisplayModes(16)=(Width=1344,Height=840)  // imac G5 20"
	DisplayModes(17)=(Width=1440,Height=900)  // Some mac powerbooks
	DisplayModes(18)=(Width=1600,Height=1200)
	DisplayModes(19)=(Width=1680,Height=1050)
	DisplayModes(20)=(Width=1920,Height=1200)  // Apple 23" display
	DisplayModes(21)=(Width=2048,Height=1280)  // Apple 30" display
	DisplayModes(22)=(Width=2560,Height=1600)  // Apple 30" display

	BitDepthText(0)="16-bit Color"
	BitDepthText(1)="32-bit Color"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:36:28.000 - Creation time: Do 14.8.2014 09:58:51.741 - Created with UnCodeX