Skip to content

Commit

Permalink
Merge pull request #50 from Mu0n/master
Browse files Browse the repository at this point in the history
Fixed a conflict with the form designer (scaling menus).

Thanks for your contribution.
  • Loading branch information
dtremblay authored Nov 7, 2023
2 parents 1dfb25c + bb0ac5f commit 4237084
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Tests/*.lst
bin/Debug
bin/Release
packages
UpgradeLog.htm
11 changes: 7 additions & 4 deletions Main/Display/Gpu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public unsafe partial class Gpu : UserControl
private static readonly int[] vs = new int[256 * 8];
private int[] lutCache = vs;


//NativeHeight and NativeWidth are no longer used in this fork proposition
public const int NativeHeight = 480;
public const int NativeWidth = 768;
public const int NativeWidth = 640;

private int MarginHeight;
private int MarginWidth;

Expand Down Expand Up @@ -85,10 +88,10 @@ public void SetViewSize(int viewWidth, int viewHeight)
ParentForm.Width = viewWidth + MarginWidth;
}

public void SetViewScaling(float scaling)
public void SetViewScaling(float scaling, int requiredWidth, int requiredHeight)
{
int viewHeight = (int)Math.Ceiling((float)NativeHeight * scaling);
int viewWidth = (int)Math.Ceiling((float)NativeWidth * scaling);
int viewHeight = (int)((float)requiredHeight * scaling);
int viewWidth = (int)((float)requiredWidth * scaling);

ParentForm.Height = viewHeight + MarginHeight;
ParentForm.Width = viewWidth + MarginWidth;
Expand Down
135 changes: 100 additions & 35 deletions Main/UI/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 24 additions & 6 deletions Main/UI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1898,22 +1898,40 @@ private void MIDIToVGMConvertToolStripMenuItem_Click(object sender, EventArgs e)
midiForm.Show();
}

private void scale1_0XToolStripMenuItem_Click(object sender, EventArgs e)
private void scale1_0X_H480ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(1.0f);
gpu.SetViewScaling(1.0f, 640, 480);
}

private void scale1_5XToolStripMenuItem_Click(object sender, EventArgs e)
private void scale1_5X_H480ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(1.5f);
gpu.SetViewScaling(1.5f, 640, 480);
}

private void scale2_0XToolStripMenuItem_Click(object sender, EventArgs e)
private void scale2_0X_H480ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(2.0f);
gpu.SetViewScaling(2.0f, 640, 480);
}

private void scale1_0X_H400ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(1.0f, 640, 400);
}

private void scale1_5X_H400ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(1.5f, 640, 400);
}

private void scale2_0X_H400ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
gpu.SetViewScaling(2.0f, 640, 400);
}
}
}
Expand Down

0 comments on commit 4237084

Please sign in to comment.