added Renderer Dropdown in RA Settings
This commit is contained in:
committed by
Chris Forbes
parent
d64ecac74e
commit
c9edf7d0dc
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2012 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -91,6 +91,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
var display = bg.Get("DISPLAY_PANE");
|
||||
var gs = Game.Settings.Graphics;
|
||||
|
||||
var GraphicsRendererDropdown = display.Get<DropDownButtonWidget>("GRAPHICS_RENDERER");
|
||||
GraphicsRendererDropdown.OnMouseDown = _ => ShowRendererDropdown(GraphicsRendererDropdown, gs);
|
||||
GraphicsRendererDropdown.GetText = () => gs.Renderer == "Gl" ?
|
||||
"OpenGL" : gs.Renderer == "Cg" ? "Cg Toolkit" : "OpenGL";
|
||||
|
||||
var windowModeDropdown = display.Get<DropDownButtonWidget>("MODE_DROPDOWN");
|
||||
windowModeDropdown.OnMouseDown = _ => ShowWindowModeDropdown(windowModeDropdown, gs);
|
||||
windowModeDropdown.GetText = () => gs.Mode == WindowMode.Windowed ?
|
||||
@@ -189,5 +194,26 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ShowRendererDropdown(DropDownButtonWidget dropdown, GraphicSettings s)
|
||||
{
|
||||
var options = new Dictionary<string, string>()
|
||||
{
|
||||
{ "OpenGL", "Gl" },
|
||||
{ "Cg Toolkit", "Cg" },
|
||||
};
|
||||
|
||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||
() => s.Renderer == options[o],
|
||||
() => s.Renderer = options[o]);
|
||||
item.Get<LabelWidget>("LABEL").GetText = () => o;
|
||||
return item;
|
||||
};
|
||||
|
||||
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 500, options.Keys, setupItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,22 +154,35 @@ Background@SETTINGS_MENU:
|
||||
Height:PARENT_BOTTOM - 100
|
||||
Visible: false
|
||||
Children:
|
||||
Label@MODE_LABEL:
|
||||
Label@RENDERER_LABEL:
|
||||
X:0
|
||||
Y:0
|
||||
Width:75
|
||||
Height:25
|
||||
Text:Renderer:
|
||||
DropDownButton@GRAPHICS_RENDERER:
|
||||
X:80
|
||||
Y:1
|
||||
Width:120
|
||||
Height:25
|
||||
Font:Regular
|
||||
Text:OpenGL
|
||||
Label@MODE_LABEL:
|
||||
X:0
|
||||
Y:30
|
||||
Width:45
|
||||
Height:25
|
||||
Text:Mode:
|
||||
DropDownButton@MODE_DROPDOWN:
|
||||
X:50
|
||||
Y:1
|
||||
Y:30
|
||||
Width:170
|
||||
Height:25
|
||||
Font:Regular
|
||||
Text:Windowed
|
||||
Container@WINDOW_RESOLUTION:
|
||||
X:220
|
||||
Y:0
|
||||
X:225
|
||||
Y:30
|
||||
Children:
|
||||
Label@At:
|
||||
Text:@
|
||||
@@ -197,14 +210,14 @@ Background@SETTINGS_MENU:
|
||||
Height:25
|
||||
MaxLength:5
|
||||
Label@VIDEO_DESC:
|
||||
Y:25
|
||||
Y:60
|
||||
Width:PARENT_RIGHT
|
||||
Height:25
|
||||
Font:Tiny
|
||||
Align:Center
|
||||
Text:Mode/Resolution changes will be applied after the game is restarted
|
||||
Text:Renderer/Mode/Resolution changes will be applied after the game is restarted.
|
||||
Checkbox@PIXELDOUBLE_CHECKBOX:
|
||||
Y:50
|
||||
Y:90
|
||||
Width:200
|
||||
Height:20
|
||||
Font:Regular
|
||||
|
||||
Reference in New Issue
Block a user