fixed scrolling and improved preview drawing
This commit is contained in:
parent
09243441bc
commit
9dcfad3038
2 changed files with 140 additions and 136 deletions
203
SoFii/MainWindow.Designer.cs
generated
203
SoFii/MainWindow.Designer.cs
generated
|
@ -31,6 +31,7 @@ namespace SoFii
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
|
||||||
this.serverBox = new System.Windows.Forms.GroupBox();
|
this.serverBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.serverUseCustom = new System.Windows.Forms.CheckBox();
|
||||||
this.serverAddressLabel = new System.Windows.Forms.Label();
|
this.serverAddressLabel = new System.Windows.Forms.Label();
|
||||||
this.serverAddressInput = new System.Windows.Forms.TextBox();
|
this.serverAddressInput = new System.Windows.Forms.TextBox();
|
||||||
this.serverResetButton = new System.Windows.Forms.Button();
|
this.serverResetButton = new System.Windows.Forms.Button();
|
||||||
|
@ -41,28 +42,27 @@ namespace SoFii
|
||||||
this.gameBrowseButton = new System.Windows.Forms.Button();
|
this.gameBrowseButton = new System.Windows.Forms.Button();
|
||||||
this.mainTabs = new System.Windows.Forms.TabControl();
|
this.mainTabs = new System.Windows.Forms.TabControl();
|
||||||
this.locationsTabPage = new System.Windows.Forms.TabPage();
|
this.locationsTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.versionLabel = new System.Windows.Forms.Label();
|
|
||||||
this.mainOpenFileDiag = new System.Windows.Forms.OpenFileDialog();
|
|
||||||
this.serverUseCustom = new System.Windows.Forms.CheckBox();
|
|
||||||
this.playerTabPage = new System.Windows.Forms.TabPage();
|
this.playerTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.playerNameBox = new System.Windows.Forms.GroupBox();
|
|
||||||
this.playerNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.playerNameInput = new System.Windows.Forms.TextBox();
|
|
||||||
this.playerNameColoursBox = new System.Windows.Forms.GroupBox();
|
|
||||||
this.playerNameColourButton = new System.Windows.Forms.Button();
|
|
||||||
this.playerNamePreview = new System.Windows.Forms.Panel();
|
|
||||||
this.gfxBox = new System.Windows.Forms.GroupBox();
|
this.gfxBox = new System.Windows.Forms.GroupBox();
|
||||||
this.gfxFullscreen = new System.Windows.Forms.CheckBox();
|
|
||||||
this.gfxResolutionLabel = new System.Windows.Forms.Label();
|
this.gfxResolutionLabel = new System.Windows.Forms.Label();
|
||||||
this.gfxResolutionSelect = new System.Windows.Forms.ComboBox();
|
this.gfxResolutionSelect = new System.Windows.Forms.ComboBox();
|
||||||
|
this.gfxFullscreen = new System.Windows.Forms.CheckBox();
|
||||||
|
this.playerNameBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.playerNamePreview = new System.Windows.Forms.Panel();
|
||||||
|
this.playerNameColoursBox = new System.Windows.Forms.GroupBox();
|
||||||
|
this.playerNameColourButton = new System.Windows.Forms.Button();
|
||||||
|
this.playerNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.playerNameInput = new System.Windows.Forms.TextBox();
|
||||||
|
this.versionLabel = new System.Windows.Forms.Label();
|
||||||
|
this.mainOpenFileDiag = new System.Windows.Forms.OpenFileDialog();
|
||||||
this.serverBox.SuspendLayout();
|
this.serverBox.SuspendLayout();
|
||||||
this.gameBox.SuspendLayout();
|
this.gameBox.SuspendLayout();
|
||||||
this.mainTabs.SuspendLayout();
|
this.mainTabs.SuspendLayout();
|
||||||
this.locationsTabPage.SuspendLayout();
|
this.locationsTabPage.SuspendLayout();
|
||||||
this.playerTabPage.SuspendLayout();
|
this.playerTabPage.SuspendLayout();
|
||||||
|
this.gfxBox.SuspendLayout();
|
||||||
this.playerNameBox.SuspendLayout();
|
this.playerNameBox.SuspendLayout();
|
||||||
this.playerNameColoursBox.SuspendLayout();
|
this.playerNameColoursBox.SuspendLayout();
|
||||||
this.gfxBox.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// serverBox
|
// serverBox
|
||||||
|
@ -80,6 +80,17 @@ namespace SoFii
|
||||||
this.serverBox.TabStop = false;
|
this.serverBox.TabStop = false;
|
||||||
this.serverBox.Text = "Server";
|
this.serverBox.Text = "Server";
|
||||||
//
|
//
|
||||||
|
// serverUseCustom
|
||||||
|
//
|
||||||
|
this.serverUseCustom.AutoSize = true;
|
||||||
|
this.serverUseCustom.Location = new System.Drawing.Point(87, 47);
|
||||||
|
this.serverUseCustom.Name = "serverUseCustom";
|
||||||
|
this.serverUseCustom.Size = new System.Drawing.Size(154, 17);
|
||||||
|
this.serverUseCustom.TabIndex = 304;
|
||||||
|
this.serverUseCustom.Text = "Use custom server address";
|
||||||
|
this.serverUseCustom.UseVisualStyleBackColor = true;
|
||||||
|
this.serverUseCustom.CheckedChanged += new System.EventHandler(this.serverUseCustom_CheckedChanged);
|
||||||
|
//
|
||||||
// serverAddressLabel
|
// serverAddressLabel
|
||||||
//
|
//
|
||||||
this.serverAddressLabel.AutoSize = true;
|
this.serverAddressLabel.AutoSize = true;
|
||||||
|
@ -181,6 +192,7 @@ namespace SoFii
|
||||||
//
|
//
|
||||||
// locationsTabPage
|
// locationsTabPage
|
||||||
//
|
//
|
||||||
|
this.locationsTabPage.AutoScroll = true;
|
||||||
this.locationsTabPage.Controls.Add(this.gameBox);
|
this.locationsTabPage.Controls.Add(this.gameBox);
|
||||||
this.locationsTabPage.Controls.Add(this.serverBox);
|
this.locationsTabPage.Controls.Add(this.serverBox);
|
||||||
this.locationsTabPage.Location = new System.Drawing.Point(4, 22);
|
this.locationsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||||
|
@ -191,36 +203,9 @@ namespace SoFii
|
||||||
this.locationsTabPage.Text = "Locations";
|
this.locationsTabPage.Text = "Locations";
|
||||||
this.locationsTabPage.UseVisualStyleBackColor = true;
|
this.locationsTabPage.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// versionLabel
|
|
||||||
//
|
|
||||||
this.versionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.versionLabel.AutoSize = true;
|
|
||||||
this.versionLabel.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
||||||
this.versionLabel.Location = new System.Drawing.Point(13, 533);
|
|
||||||
this.versionLabel.Name = "versionLabel";
|
|
||||||
this.versionLabel.Size = new System.Drawing.Size(117, 13);
|
|
||||||
this.versionLabel.TabIndex = 13;
|
|
||||||
this.versionLabel.Text = "SoFii version goes here";
|
|
||||||
//
|
|
||||||
// mainOpenFileDiag
|
|
||||||
//
|
|
||||||
this.mainOpenFileDiag.DefaultExt = "exe";
|
|
||||||
this.mainOpenFileDiag.Filter = "SoF2 Multiplayer Executable|SoF2MP.exe";
|
|
||||||
this.mainOpenFileDiag.RestoreDirectory = true;
|
|
||||||
//
|
|
||||||
// serverUseCustom
|
|
||||||
//
|
|
||||||
this.serverUseCustom.AutoSize = true;
|
|
||||||
this.serverUseCustom.Location = new System.Drawing.Point(87, 47);
|
|
||||||
this.serverUseCustom.Name = "serverUseCustom";
|
|
||||||
this.serverUseCustom.Size = new System.Drawing.Size(154, 17);
|
|
||||||
this.serverUseCustom.TabIndex = 304;
|
|
||||||
this.serverUseCustom.Text = "Use custom server address";
|
|
||||||
this.serverUseCustom.UseVisualStyleBackColor = true;
|
|
||||||
this.serverUseCustom.CheckedChanged += new System.EventHandler(this.serverUseCustom_CheckedChanged);
|
|
||||||
//
|
|
||||||
// playerTabPage
|
// playerTabPage
|
||||||
//
|
//
|
||||||
|
this.playerTabPage.AutoScroll = true;
|
||||||
this.playerTabPage.Controls.Add(this.gfxBox);
|
this.playerTabPage.Controls.Add(this.gfxBox);
|
||||||
this.playerTabPage.Controls.Add(this.playerNameBox);
|
this.playerTabPage.Controls.Add(this.playerNameBox);
|
||||||
this.playerTabPage.Location = new System.Drawing.Point(4, 22);
|
this.playerTabPage.Location = new System.Drawing.Point(4, 22);
|
||||||
|
@ -231,6 +216,50 @@ namespace SoFii
|
||||||
this.playerTabPage.Text = "Settings";
|
this.playerTabPage.Text = "Settings";
|
||||||
this.playerTabPage.UseVisualStyleBackColor = true;
|
this.playerTabPage.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// gfxBox
|
||||||
|
//
|
||||||
|
this.gfxBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.gfxBox.Controls.Add(this.gfxResolutionLabel);
|
||||||
|
this.gfxBox.Controls.Add(this.gfxResolutionSelect);
|
||||||
|
this.gfxBox.Controls.Add(this.gfxFullscreen);
|
||||||
|
this.gfxBox.Location = new System.Drawing.Point(6, 372);
|
||||||
|
this.gfxBox.Name = "gfxBox";
|
||||||
|
this.gfxBox.Size = new System.Drawing.Size(540, 72);
|
||||||
|
this.gfxBox.TabIndex = 500;
|
||||||
|
this.gfxBox.TabStop = false;
|
||||||
|
this.gfxBox.Text = "Graphics";
|
||||||
|
//
|
||||||
|
// gfxResolutionLabel
|
||||||
|
//
|
||||||
|
this.gfxResolutionLabel.AutoSize = true;
|
||||||
|
this.gfxResolutionLabel.Location = new System.Drawing.Point(24, 22);
|
||||||
|
this.gfxResolutionLabel.Name = "gfxResolutionLabel";
|
||||||
|
this.gfxResolutionLabel.Size = new System.Drawing.Size(57, 13);
|
||||||
|
this.gfxResolutionLabel.TabIndex = 502;
|
||||||
|
this.gfxResolutionLabel.Text = "Resolution";
|
||||||
|
//
|
||||||
|
// gfxResolutionSelect
|
||||||
|
//
|
||||||
|
this.gfxResolutionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.gfxResolutionSelect.FormattingEnabled = true;
|
||||||
|
this.gfxResolutionSelect.Location = new System.Drawing.Point(87, 19);
|
||||||
|
this.gfxResolutionSelect.Name = "gfxResolutionSelect";
|
||||||
|
this.gfxResolutionSelect.Size = new System.Drawing.Size(360, 21);
|
||||||
|
this.gfxResolutionSelect.TabIndex = 503;
|
||||||
|
this.gfxResolutionSelect.SelectedIndexChanged += new System.EventHandler(this.gfxResolutionSelect_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// gfxFullscreen
|
||||||
|
//
|
||||||
|
this.gfxFullscreen.AutoSize = true;
|
||||||
|
this.gfxFullscreen.Location = new System.Drawing.Point(87, 46);
|
||||||
|
this.gfxFullscreen.Name = "gfxFullscreen";
|
||||||
|
this.gfxFullscreen.Size = new System.Drawing.Size(74, 17);
|
||||||
|
this.gfxFullscreen.TabIndex = 501;
|
||||||
|
this.gfxFullscreen.Text = "Fullscreen";
|
||||||
|
this.gfxFullscreen.UseVisualStyleBackColor = true;
|
||||||
|
this.gfxFullscreen.CheckedChanged += new System.EventHandler(this.gfxFullscreen_CheckedChanged);
|
||||||
|
//
|
||||||
// playerNameBox
|
// playerNameBox
|
||||||
//
|
//
|
||||||
this.playerNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.playerNameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
@ -246,24 +275,13 @@ namespace SoFii
|
||||||
this.playerNameBox.TabStop = false;
|
this.playerNameBox.TabStop = false;
|
||||||
this.playerNameBox.Text = "Player Name";
|
this.playerNameBox.Text = "Player Name";
|
||||||
//
|
//
|
||||||
// playerNameLabel
|
// playerNamePreview
|
||||||
//
|
//
|
||||||
this.playerNameLabel.AutoSize = true;
|
this.playerNamePreview.Location = new System.Drawing.Point(87, 46);
|
||||||
this.playerNameLabel.Location = new System.Drawing.Point(46, 23);
|
this.playerNamePreview.Name = "playerNamePreview";
|
||||||
this.playerNameLabel.Name = "playerNameLabel";
|
this.playerNamePreview.Size = new System.Drawing.Size(360, 18);
|
||||||
this.playerNameLabel.Size = new System.Drawing.Size(35, 13);
|
this.playerNamePreview.TabIndex = 410;
|
||||||
this.playerNameLabel.TabIndex = 401;
|
this.playerNamePreview.Paint += new System.Windows.Forms.PaintEventHandler(this.playerNamePreview_Paint);
|
||||||
this.playerNameLabel.Text = "Name";
|
|
||||||
//
|
|
||||||
// playerNameInput
|
|
||||||
//
|
|
||||||
this.playerNameInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.playerNameInput.Location = new System.Drawing.Point(87, 20);
|
|
||||||
this.playerNameInput.Name = "playerNameInput";
|
|
||||||
this.playerNameInput.Size = new System.Drawing.Size(360, 20);
|
|
||||||
this.playerNameInput.TabIndex = 402;
|
|
||||||
this.playerNameInput.TextChanged += new System.EventHandler(this.playerNameInput_TextChanged);
|
|
||||||
//
|
//
|
||||||
// playerNameColoursBox
|
// playerNameColoursBox
|
||||||
//
|
//
|
||||||
|
@ -288,56 +306,41 @@ namespace SoFii
|
||||||
this.playerNameColourButton.TextAlign = System.Drawing.ContentAlignment.BottomRight;
|
this.playerNameColourButton.TextAlign = System.Drawing.ContentAlignment.BottomRight;
|
||||||
this.playerNameColourButton.UseVisualStyleBackColor = true;
|
this.playerNameColourButton.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// playerNamePreview
|
// playerNameLabel
|
||||||
//
|
//
|
||||||
this.playerNamePreview.Location = new System.Drawing.Point(87, 46);
|
this.playerNameLabel.AutoSize = true;
|
||||||
this.playerNamePreview.Name = "playerNamePreview";
|
this.playerNameLabel.Location = new System.Drawing.Point(46, 23);
|
||||||
this.playerNamePreview.Size = new System.Drawing.Size(360, 18);
|
this.playerNameLabel.Name = "playerNameLabel";
|
||||||
this.playerNamePreview.TabIndex = 410;
|
this.playerNameLabel.Size = new System.Drawing.Size(35, 13);
|
||||||
|
this.playerNameLabel.TabIndex = 401;
|
||||||
|
this.playerNameLabel.Text = "Name";
|
||||||
//
|
//
|
||||||
// gfxBox
|
// playerNameInput
|
||||||
//
|
//
|
||||||
this.gfxBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.playerNameInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.gfxBox.Controls.Add(this.gfxResolutionLabel);
|
this.playerNameInput.Location = new System.Drawing.Point(87, 20);
|
||||||
this.gfxBox.Controls.Add(this.gfxResolutionSelect);
|
this.playerNameInput.Name = "playerNameInput";
|
||||||
this.gfxBox.Controls.Add(this.gfxFullscreen);
|
this.playerNameInput.Size = new System.Drawing.Size(360, 20);
|
||||||
this.gfxBox.Location = new System.Drawing.Point(6, 372);
|
this.playerNameInput.TabIndex = 402;
|
||||||
this.gfxBox.Name = "gfxBox";
|
this.playerNameInput.TextChanged += new System.EventHandler(this.playerNameInput_TextChanged);
|
||||||
this.gfxBox.Size = new System.Drawing.Size(540, 72);
|
|
||||||
this.gfxBox.TabIndex = 500;
|
|
||||||
this.gfxBox.TabStop = false;
|
|
||||||
this.gfxBox.Text = "Graphics";
|
|
||||||
//
|
//
|
||||||
// gfxFullscreen
|
// versionLabel
|
||||||
//
|
//
|
||||||
this.gfxFullscreen.AutoSize = true;
|
this.versionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.gfxFullscreen.Location = new System.Drawing.Point(87, 46);
|
this.versionLabel.AutoSize = true;
|
||||||
this.gfxFullscreen.Name = "gfxFullscreen";
|
this.versionLabel.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||||
this.gfxFullscreen.Size = new System.Drawing.Size(74, 17);
|
this.versionLabel.Location = new System.Drawing.Point(13, 533);
|
||||||
this.gfxFullscreen.TabIndex = 501;
|
this.versionLabel.Name = "versionLabel";
|
||||||
this.gfxFullscreen.Text = "Fullscreen";
|
this.versionLabel.Size = new System.Drawing.Size(117, 13);
|
||||||
this.gfxFullscreen.UseVisualStyleBackColor = true;
|
this.versionLabel.TabIndex = 13;
|
||||||
this.gfxFullscreen.CheckedChanged += new System.EventHandler(this.gfxFullscreen_CheckedChanged);
|
this.versionLabel.Text = "SoFii version goes here";
|
||||||
//
|
//
|
||||||
// gfxResolutionLabel
|
// mainOpenFileDiag
|
||||||
//
|
//
|
||||||
this.gfxResolutionLabel.AutoSize = true;
|
this.mainOpenFileDiag.DefaultExt = "exe";
|
||||||
this.gfxResolutionLabel.Location = new System.Drawing.Point(24, 22);
|
this.mainOpenFileDiag.Filter = "SoF2 Multiplayer Executable|SoF2MP.exe";
|
||||||
this.gfxResolutionLabel.Name = "gfxResolutionLabel";
|
this.mainOpenFileDiag.RestoreDirectory = true;
|
||||||
this.gfxResolutionLabel.Size = new System.Drawing.Size(57, 13);
|
|
||||||
this.gfxResolutionLabel.TabIndex = 502;
|
|
||||||
this.gfxResolutionLabel.Text = "Resolution";
|
|
||||||
//
|
|
||||||
// gfxResolutionSelect
|
|
||||||
//
|
|
||||||
this.gfxResolutionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.gfxResolutionSelect.FormattingEnabled = true;
|
|
||||||
this.gfxResolutionSelect.Location = new System.Drawing.Point(87, 19);
|
|
||||||
this.gfxResolutionSelect.Name = "gfxResolutionSelect";
|
|
||||||
this.gfxResolutionSelect.Size = new System.Drawing.Size(360, 21);
|
|
||||||
this.gfxResolutionSelect.TabIndex = 503;
|
|
||||||
this.gfxResolutionSelect.SelectedIndexChanged += new System.EventHandler(this.gfxResolutionSelect_SelectedIndexChanged);
|
|
||||||
//
|
//
|
||||||
// MainWindow
|
// MainWindow
|
||||||
//
|
//
|
||||||
|
@ -360,11 +363,11 @@ namespace SoFii
|
||||||
this.mainTabs.ResumeLayout(false);
|
this.mainTabs.ResumeLayout(false);
|
||||||
this.locationsTabPage.ResumeLayout(false);
|
this.locationsTabPage.ResumeLayout(false);
|
||||||
this.playerTabPage.ResumeLayout(false);
|
this.playerTabPage.ResumeLayout(false);
|
||||||
|
this.gfxBox.ResumeLayout(false);
|
||||||
|
this.gfxBox.PerformLayout();
|
||||||
this.playerNameBox.ResumeLayout(false);
|
this.playerNameBox.ResumeLayout(false);
|
||||||
this.playerNameBox.PerformLayout();
|
this.playerNameBox.PerformLayout();
|
||||||
this.playerNameColoursBox.ResumeLayout(false);
|
this.playerNameColoursBox.ResumeLayout(false);
|
||||||
this.gfxBox.ResumeLayout(false);
|
|
||||||
this.gfxBox.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ namespace SoFii {
|
||||||
DrawPlayerNameColourButtons();
|
DrawPlayerNameColourButtons();
|
||||||
|
|
||||||
playerNameInput.Text = Settings.PlayerName;
|
playerNameInput.Text = Settings.PlayerName;
|
||||||
DrawPlayerNamePreview();
|
|
||||||
|
|
||||||
gfxResolutionSelect.Items.AddRange(new object[] {
|
gfxResolutionSelect.Items.AddRange(new object[] {
|
||||||
string.Empty,
|
string.Empty,
|
||||||
|
@ -392,7 +391,11 @@ namespace SoFii {
|
||||||
ResizeToFit();
|
ResizeToFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawPlayerNamePreview() {
|
private void playerNamePreview_Paint(object sender, PaintEventArgs e) {
|
||||||
|
DrawPlayerNamePreview(e.Graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawPlayerNamePreview(Graphics gfx) {
|
||||||
string userName = playerNameInput.Text;
|
string userName = playerNameInput.Text;
|
||||||
bool nextIsColourChar = false;
|
bool nextIsColourChar = false;
|
||||||
Color colour = SystemColors.ControlText;
|
Color colour = SystemColors.ControlText;
|
||||||
|
@ -402,56 +405,54 @@ namespace SoFii {
|
||||||
float offset = 0;
|
float offset = 0;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
using(Graphics gfx = playerNamePreview.CreateGraphics()) {
|
gfx.Clear(SystemColors.ControlLightLight);
|
||||||
gfx.Clear(SystemColors.ControlLightLight);
|
|
||||||
|
|
||||||
float spaceWidth = gfx.MeasureString(" ", font).Width + .1f;
|
float spaceWidth = gfx.MeasureString("_", font).Width;
|
||||||
|
|
||||||
void drawBuffer() {
|
void drawBuffer() {
|
||||||
if(sb.Length < 1)
|
if(sb.Length < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string str = sb.ToString();
|
string str = sb.ToString();
|
||||||
sb.Length = 0;
|
sb.Length = 0;
|
||||||
|
|
||||||
gfx.DrawString(str, font, brush, offset, 0);
|
gfx.DrawString(str, font, brush, offset, 0);
|
||||||
offset += gfx.MeasureString(str, font).Width - spaceWidth;
|
offset += gfx.MeasureString(str.Replace(' ', '_'), font).Width - spaceWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach(char chr in userName) {
|
foreach(char chr in userName) {
|
||||||
if(nextIsColourChar) {
|
if(nextIsColourChar) {
|
||||||
foreach(ColourCharInfo cci in Colours)
|
foreach(ColourCharInfo cci in Colours)
|
||||||
if(cci.Char == chr) {
|
if(cci.Char == chr) {
|
||||||
if(cci.Colour != colour) {
|
if(cci.Colour != colour) {
|
||||||
colour = cci.Colour;
|
colour = cci.Colour;
|
||||||
brush.Dispose();
|
brush.Dispose();
|
||||||
brush = new SolidBrush(colour);
|
brush = new SolidBrush(colour);
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
nextIsColourChar = false;
|
nextIsColourChar = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if(chr == '^') {
|
|
||||||
nextIsColourChar = true;
|
|
||||||
drawBuffer();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.Append(chr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drawBuffer();
|
if(chr == '^') {
|
||||||
|
nextIsColourChar = true;
|
||||||
|
drawBuffer();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.Append(chr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawBuffer();
|
||||||
|
|
||||||
brush.Dispose();
|
brush.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playerNameInput_TextChanged(object sender, EventArgs e) {
|
private void playerNameInput_TextChanged(object sender, EventArgs e) {
|
||||||
Settings.PlayerName = playerNameInput.Text;
|
Settings.PlayerName = playerNameInput.Text;
|
||||||
DrawPlayerNamePreview();
|
playerNamePreview.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gfxFullscreen_CheckedChanged(object sender, EventArgs e) {
|
private void gfxFullscreen_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
|
Loading…
Reference in a new issue