MyNes_src/MyNes/MyNes/FormSDL2Settings.cs
2024-07-03 18:15:19 +08:00

163 lines
6.0 KiB
C#

using System;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;
using MyNes.Properties;
namespace MyNes;
public class FormSDL2Settings : Form
{
private SDL2Settings sdl_settings;
private IContainer components;
private Label label1;
private RadioButton radioButton_direct3d;
private RadioButton radioButton_opengl;
private CheckBox checkBox_EnableOpenglShaders;
private Label label2;
private Label label3;
private CheckBox checkBox_Accelerated;
private CheckBox checkBox_Software;
private Button button1;
private Button button2;
private Button button3;
private RichTextBox richTextBox1;
public FormSDL2Settings()
{
InitializeComponent();
sdl_settings = new SDL2Settings(Path.Combine(Program.WorkingFolder, "sdlsettings.ini"));
sdl_settings.LoadSettings();
radioButton_opengl.Checked = sdl_settings.Video_Driver == "opengl";
checkBox_Accelerated.Checked = sdl_settings.Video_Accelerated;
checkBox_EnableOpenglShaders.Checked = sdl_settings.Video_EnableOpenglShaders == 1;
checkBox_Software.Checked = sdl_settings.Video_Software;
richTextBox1.Text = Resources.SDL2SettingsWarning;
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e)
{
sdl_settings.Video_Driver = (radioButton_opengl.Checked ? "opengl" : "direct3d");
sdl_settings.Video_Accelerated = checkBox_Accelerated.Checked;
sdl_settings.Video_EnableOpenglShaders = (checkBox_EnableOpenglShaders.Checked ? 1 : 0);
sdl_settings.Video_Software = checkBox_Software.Checked;
sdl_settings.SaveSettings();
base.DialogResult = DialogResult.OK;
Close();
}
private void button3_Click(object sender, EventArgs e)
{
radioButton_direct3d.Checked = true;
checkBox_EnableOpenglShaders.Checked = true;
checkBox_Accelerated.Checked = true;
checkBox_Software.Checked = true;
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager componentResourceManager = new System.ComponentModel.ComponentResourceManager(typeof(MyNes.FormSDL2Settings));
this.label1 = new System.Windows.Forms.Label();
this.radioButton_direct3d = new System.Windows.Forms.RadioButton();
this.radioButton_opengl = new System.Windows.Forms.RadioButton();
this.checkBox_EnableOpenglShaders = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.checkBox_Accelerated = new System.Windows.Forms.CheckBox();
this.checkBox_Software = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
base.SuspendLayout();
componentResourceManager.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
componentResourceManager.ApplyResources(this.radioButton_direct3d, "radioButton_direct3d");
this.radioButton_direct3d.Checked = true;
this.radioButton_direct3d.Name = "radioButton_direct3d";
this.radioButton_direct3d.TabStop = true;
this.radioButton_direct3d.UseVisualStyleBackColor = true;
componentResourceManager.ApplyResources(this.radioButton_opengl, "radioButton_opengl");
this.radioButton_opengl.Name = "radioButton_opengl";
this.radioButton_opengl.TabStop = true;
this.radioButton_opengl.UseVisualStyleBackColor = true;
componentResourceManager.ApplyResources(this.checkBox_EnableOpenglShaders, "checkBox_EnableOpenglShaders");
this.checkBox_EnableOpenglShaders.Name = "checkBox_EnableOpenglShaders";
this.checkBox_EnableOpenglShaders.UseVisualStyleBackColor = true;
componentResourceManager.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
componentResourceManager.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
componentResourceManager.ApplyResources(this.checkBox_Accelerated, "checkBox_Accelerated");
this.checkBox_Accelerated.Name = "checkBox_Accelerated";
this.checkBox_Accelerated.UseVisualStyleBackColor = true;
componentResourceManager.ApplyResources(this.checkBox_Software, "checkBox_Software");
this.checkBox_Software.Name = "checkBox_Software";
this.checkBox_Software.UseVisualStyleBackColor = true;
componentResourceManager.ApplyResources(this.button1, "button1");
this.button1.Name = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(button1_Click);
componentResourceManager.ApplyResources(this.button2, "button2");
this.button2.Name = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(button2_Click);
componentResourceManager.ApplyResources(this.button3, "button3");
this.button3.Name = "button3";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(button3_Click);
componentResourceManager.ApplyResources(this.richTextBox1, "richTextBox1");
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
componentResourceManager.ApplyResources(this, "$this");
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.Controls.Add(this.richTextBox1);
base.Controls.Add(this.button3);
base.Controls.Add(this.button2);
base.Controls.Add(this.button1);
base.Controls.Add(this.checkBox_Software);
base.Controls.Add(this.checkBox_Accelerated);
base.Controls.Add(this.label3);
base.Controls.Add(this.label2);
base.Controls.Add(this.checkBox_EnableOpenglShaders);
base.Controls.Add(this.radioButton_opengl);
base.Controls.Add(this.radioButton_direct3d);
base.Controls.Add(this.label1);
base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "FormSDL2Settings";
base.ShowIcon = false;
base.ShowInTaskbar = false;
base.ResumeLayout(false);
base.PerformLayout();
}
}