Added renderer selection to Windows launcher.

This commit is contained in:
Matthew Bowra-Dean
2010-11-29 23:23:53 +13:00
committed by Paul Chote
parent 7e25b6e58e
commit 564a4598b9
3 changed files with 49 additions and 3 deletions

View File

@@ -58,6 +58,7 @@ namespace OpenRA.Launcher
Process p = new Process();
p.StartInfo.FileName = "OpenRA.Game.exe";
p.StartInfo.Arguments = "Game.Mods=" + string.Join(",", modList.ToArray());
p.StartInfo.Arguments += " Graphics.Renderer=" + Launcher.Renderer;
p.Start();
return true;
}

View File

@@ -35,6 +35,8 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.webBrowser = new System.Windows.Forms.WebBrowser();
this.panel1 = new System.Windows.Forms.Panel();
this.cgButton = new System.Windows.Forms.RadioButton();
this.glButton = new System.Windows.Forms.RadioButton();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -103,6 +105,8 @@
//
// panel1
//
this.panel1.Controls.Add(this.cgButton);
this.panel1.Controls.Add(this.glButton);
this.panel1.Controls.Add(this.installButton);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 465);
@@ -110,6 +114,30 @@
this.panel1.Size = new System.Drawing.Size(671, 47);
this.panel1.TabIndex = 5;
//
// cgButton
//
this.cgButton.AutoSize = true;
this.cgButton.Location = new System.Drawing.Point(481, 18);
this.cgButton.Name = "cgButton";
this.cgButton.Size = new System.Drawing.Size(87, 17);
this.cgButton.TabIndex = 4;
this.cgButton.TabStop = true;
this.cgButton.Text = "CG Renderer";
this.cgButton.UseVisualStyleBackColor = true;
this.cgButton.CheckedChanged += new System.EventHandler(this.rendererChanged);
//
// glButton
//
this.glButton.AutoSize = true;
this.glButton.Location = new System.Drawing.Point(574, 18);
this.glButton.Name = "glButton";
this.glButton.Size = new System.Drawing.Size(86, 17);
this.glButton.TabIndex = 3;
this.glButton.TabStop = true;
this.glButton.Text = "GL Renderer";
this.glButton.UseVisualStyleBackColor = true;
this.glButton.CheckedChanged += new System.EventHandler(this.rendererChanged);
//
// Launcher
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -127,6 +155,7 @@
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
@@ -139,5 +168,7 @@
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.WebBrowser webBrowser;
private System.Windows.Forms.RadioButton cgButton;
private System.Windows.Forms.RadioButton glButton;
}
}

View File

@@ -21,6 +21,9 @@ namespace OpenRA.Launcher
public partial class Launcher : Form
{
Dictionary<string, Mod> allMods;
public static string Renderer = "Gl";
static string SupportDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Path.DirectorySeparatorChar + "OpenRA";
public Launcher()
{
InitializeComponent();
@@ -34,6 +37,11 @@ namespace OpenRA.Launcher
(b.ObjectForScripting as JSBridge).Document = b.Document;
};
RefreshMods();
string response = UtilityProgram.CallSimpleResponse("--settings-value", SupportDir, "Graphics.Renderer");
if (Util.IsError(ref response) || response.Equals("gl", StringComparison.InvariantCultureIgnoreCase))
glButton.Checked = true;
else
cgButton.Checked = true;
}
Mod GetMetadata(string mod)
@@ -167,8 +175,7 @@ namespace OpenRA.Launcher
treeView.Nodes["ModsNode"].ExpandAll();
treeView.Invalidate();
string responseString = UtilityProgram.CallSimpleResponse("--settings-value",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Path.DirectorySeparatorChar + "OpenRA", "Game.Mods");
string responseString = UtilityProgram.CallSimpleResponse("--settings-value", SupportDir, "Game.Mods");
if (Util.IsError(ref responseString))
treeView.SelectedNode = treeView.Nodes["ModsNode"].Nodes["ra"];
@@ -183,7 +190,14 @@ namespace OpenRA.Launcher
string modHtmlPath = string.Format("mods{0}{1}{0}mod.html", Path.DirectorySeparatorChar, e.Node.Name);
if (!File.Exists(modHtmlPath)) return;
webBrowser.Navigate(Path.GetFullPath(modHtmlPath));
}
private void rendererChanged(object sender, EventArgs e)
{
if (sender == glButton)
Renderer = "Gl";
else
Renderer = "Cg";
}
}
}