UI: Allow player 1's controls to be used to navigate the recent game selection screen
This commit is contained in:
parent
fcd09ebdd9
commit
147fcbfcf7
4 changed files with 59 additions and 3 deletions
8
GUI.NET/Controls/ctrlRecentGames.Designer.cs
generated
8
GUI.NET/Controls/ctrlRecentGames.Designer.cs
generated
|
@ -27,6 +27,7 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.tlpPreviousState = new Mesen.GUI.Controls.DBTableLayoutPanel();
|
||||
this.pnlPreviousState = new System.Windows.Forms.Panel();
|
||||
this.picPreviousState = new Mesen.GUI.Controls.GamePreviewBox();
|
||||
|
@ -34,6 +35,7 @@
|
|||
this.lblSaveDate = new System.Windows.Forms.Label();
|
||||
this.picNextGame = new System.Windows.Forms.PictureBox();
|
||||
this.picPrevGame = new System.Windows.Forms.PictureBox();
|
||||
this.tmrInput = new System.Windows.Forms.Timer(this.components);
|
||||
this.tlpPreviousState.SuspendLayout();
|
||||
this.pnlPreviousState.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picPreviousState)).BeginInit();
|
||||
|
@ -144,6 +146,11 @@
|
|||
this.picPrevGame.TabStop = false;
|
||||
this.picPrevGame.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picPrevGame_MouseDown);
|
||||
//
|
||||
// tmrInput
|
||||
//
|
||||
this.tmrInput.Interval = 50;
|
||||
this.tmrInput.Tick += new System.EventHandler(this.tmrInput_Tick);
|
||||
//
|
||||
// ctrlRecentGames
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -171,5 +178,6 @@
|
|||
private System.Windows.Forms.Label lblSaveDate;
|
||||
private System.Windows.Forms.PictureBox picNextGame;
|
||||
private System.Windows.Forms.PictureBox picPrevGame;
|
||||
private System.Windows.Forms.Timer tmrInput;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace Mesen.GUI.Controls
|
|||
lblSaveDate.Font = new Font(_fonts.Families[0], 10);
|
||||
|
||||
picPrevGame.Image.RotateFlip(RotateFlipType.RotateNoneFlipX);
|
||||
tmrInput.Enabled = true;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
|
@ -159,16 +160,20 @@ namespace Mesen.GUI.Controls
|
|||
|
||||
private void picPreviousState_Click(object sender, EventArgs e)
|
||||
{
|
||||
InteropEmu.LoadRecentGame(_recentGames[_currentIndex].FileName);
|
||||
LoadSelectedGame();
|
||||
}
|
||||
|
||||
private void picNextGame_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
_currentIndex = (_currentIndex + 1) % _recentGames.Count;
|
||||
UpdateGameInfo();
|
||||
GoToNextGame();
|
||||
}
|
||||
|
||||
private void picPrevGame_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
GoToPreviousGame();
|
||||
}
|
||||
|
||||
private void GoToPreviousGame()
|
||||
{
|
||||
if(_currentIndex == 0) {
|
||||
_currentIndex = _recentGames.Count - 1;
|
||||
|
@ -177,6 +182,45 @@ namespace Mesen.GUI.Controls
|
|||
}
|
||||
UpdateGameInfo();
|
||||
}
|
||||
|
||||
private void GoToNextGame()
|
||||
{
|
||||
_currentIndex = (_currentIndex + 1) % _recentGames.Count;
|
||||
UpdateGameInfo();
|
||||
}
|
||||
|
||||
private void LoadSelectedGame()
|
||||
{
|
||||
InteropEmu.LoadRecentGame(_recentGames[_currentIndex].FileName);
|
||||
}
|
||||
|
||||
private bool _waitForRelease = false;
|
||||
private void tmrInput_Tick(object sender, EventArgs e)
|
||||
{
|
||||
//Use player 1's controls to navigate the recent game selection screen
|
||||
if(!InteropEmu.IsRunning()) {
|
||||
uint keyCode = InteropEmu.GetPressedKey();
|
||||
|
||||
if(keyCode > 0) {
|
||||
if(!_waitForRelease) {
|
||||
foreach(KeyMappings mapping in ConfigManager.Config.InputInfo.Controllers[0].Keys) {
|
||||
if(mapping.Left == keyCode) {
|
||||
_waitForRelease = true;
|
||||
GoToPreviousGame();
|
||||
} else if(mapping.Right == keyCode) {
|
||||
_waitForRelease = true;
|
||||
GoToNextGame();
|
||||
} else if(mapping.A == keyCode || mapping.B == keyCode) {
|
||||
_waitForRelease = true;
|
||||
LoadSelectedGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_waitForRelease = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DBTableLayoutPanel : TableLayoutPanel
|
||||
|
|
|
@ -117,4 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="tmrInput.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -830,6 +830,7 @@ namespace Mesen.GUI.Forms.Config
|
|||
// chkAdaptiveSpriteLimit
|
||||
//
|
||||
this.chkAdaptiveSpriteLimit.AutoSize = true;
|
||||
this.chkAdaptiveSpriteLimit.Enabled = false;
|
||||
this.chkAdaptiveSpriteLimit.Location = new System.Drawing.Point(18, 26);
|
||||
this.chkAdaptiveSpriteLimit.Margin = new System.Windows.Forms.Padding(18, 3, 3, 3);
|
||||
this.chkAdaptiveSpriteLimit.Name = "chkAdaptiveSpriteLimit";
|
||||
|
|
Loading…
Add table
Reference in a new issue