Virtualpad Analog sticks - in record mode show the previous frame's input in gray
This commit is contained in:
parent
e475edc3c6
commit
27fb2ce9a0
|
@ -44,7 +44,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
get
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished)
|
||||
if (Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished && Global.Emulator.Frame > 0)
|
||||
{
|
||||
return Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1);
|
||||
}
|
||||
|
@ -53,6 +53,19 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public IController PreviousFrame
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished && Global.Emulator.Frame > 1)
|
||||
{
|
||||
return Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 2);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Output(string message)
|
||||
{
|
||||
if (MessageCallback != null)
|
||||
|
|
|
@ -105,5 +105,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
PadControls.ForEach(c => c.Set(controller));
|
||||
}
|
||||
|
||||
public void SetPrevious(IController previous)
|
||||
{
|
||||
PadControls
|
||||
.OfType<VirtualPadAnalogStick>()
|
||||
.ToList()
|
||||
.ForEach(c => c.SetPrevious(previous));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,13 +138,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished && Global.Emulator.Frame > 0)
|
||||
Pads.ForEach(p => p.SetPrevious(null)); // Not the cleanest way to clear this every frame
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
Readonly = true;
|
||||
Pads.ForEach(p => p.Set(Global.MovieSession.CurrentInput));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Pads.ForEach(p => p.SetPrevious(Global.MovieSession.PreviousFrame));
|
||||
}
|
||||
|
||||
Readonly = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#endregion
|
||||
|
||||
public void SetPrevious(IController previous)
|
||||
{
|
||||
AnalogStick.SetPrevious(previous);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private void ManualX_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
SetAnalogControlFromNumerics();
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string XName = string.Empty;
|
||||
public string YName = string.Empty;
|
||||
|
||||
private IController _previous = null;
|
||||
|
||||
public int MaxX
|
||||
{
|
||||
get { return _maxX; }
|
||||
|
@ -49,6 +51,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private readonly Pen BlackPen = new Pen(Brushes.Black);
|
||||
private readonly Pen BluePen = new Pen(Brushes.Blue, 2);
|
||||
private readonly Pen GrayPen = new Pen(Brushes.Gray, 2);
|
||||
|
||||
private readonly Bitmap Dot = new Bitmap(7, 7);
|
||||
private readonly Bitmap GrayDot = new Bitmap(7, 7);
|
||||
|
@ -122,14 +125,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
unchecked
|
||||
{
|
||||
//Background
|
||||
// Background
|
||||
e.Graphics.FillRectangle(GrayBrush, 0, 0, 128, 128);
|
||||
e.Graphics.FillEllipse(ReadOnly ? OffWhiteBrush : WhiteBrush, 0, 0, 127, 127);
|
||||
e.Graphics.DrawEllipse(BlackPen, 0, 0, 127, 127);
|
||||
e.Graphics.DrawLine(BlackPen, 64, 0, 64, 127);
|
||||
e.Graphics.DrawLine(BlackPen, 0, 63, 127, 63);
|
||||
|
||||
//Line
|
||||
// Previous frame
|
||||
if (_previous != null)
|
||||
{
|
||||
var pX = (int)_previous.GetFloat(XName);
|
||||
var pY = (int)_previous.GetFloat(YName);
|
||||
e.Graphics.DrawLine(GrayPen, 64, 63, RealToGfx(pX), 127 - RealToGfx(pY));
|
||||
e.Graphics.DrawImage(GrayDot, RealToGfx(pX) - 3, 127 - RealToGfx(pY) - 3);
|
||||
}
|
||||
|
||||
// Line
|
||||
if (HasValue)
|
||||
{
|
||||
e.Graphics.DrawLine(BluePen, 64, 63, RealToGfx(X), 127 - RealToGfx(Y));
|
||||
|
@ -214,6 +226,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
public void SetPrevious(IController previous)
|
||||
{
|
||||
_previous = previous;
|
||||
}
|
||||
|
||||
public void SetPosition(int xval, int yval)
|
||||
{
|
||||
X = xval;
|
||||
|
|
Loading…
Reference in New Issue