Intelligent input drawing

This commit is contained in:
adelikat 2013-12-08 19:42:07 +00:00
parent 22ff2bff04
commit d3f088a0bc
2 changed files with 18 additions and 7 deletions

View File

@ -37,6 +37,16 @@ namespace BizHawk.Client.Common
_records[frame].Buttons[buttonName] ^= true; _records[frame].Buttons[buttonName] ^= true;
} }
public void SetButton(int frame, string buttonName, bool value)
{
_records[frame].Buttons[buttonName] = value;
}
public bool IsPressed(int frame, string buttonName)
{
return _records[frame].Buttons[buttonName];
}
#region Implementation #region Implementation
public TasMovie(string filename, bool startsFromSavestate = false) public TasMovie(string filename, bool startsFromSavestate = false)

View File

@ -248,12 +248,18 @@ namespace BizHawk.Client.EmuHawk
#region TASView Events #region TASView Events
private string StartDrawColumn = String.Empty; //TODO: move me
private bool StartOn = false; //TODO: move me
private void TASView_MouseDown(object sender, MouseEventArgs e) private void TASView_MouseDown(object sender, MouseEventArgs e)
{ {
if (TASView.PointedCell.Row.HasValue && !String.IsNullOrEmpty(TASView.PointedCell.Column)) if (TASView.PointedCell.Row.HasValue && !String.IsNullOrEmpty(TASView.PointedCell.Column))
{ {
_tas.ToggleButton(TASView.PointedCell.Row.Value, TASView.PointedCell.Column); _tas.ToggleButton(TASView.PointedCell.Row.Value, TASView.PointedCell.Column);
TASView.Refresh(); TASView.Refresh();
StartDrawColumn = TASView.PointedCell.Column;
StartOn = _tas.IsPressed(TASView.PointedCell.Row.Value, TASView.PointedCell.Column);
} }
} }
@ -261,18 +267,13 @@ namespace BizHawk.Client.EmuHawk
private void TASView_PointedCellChanged(object sender, TasListView.CellEventArgs e) private void TASView_PointedCellChanged(object sender, TasListView.CellEventArgs e)
{ {
if (TASView.IsPaintDown) if (TASView.IsPaintDown && e.NewCell.Row.HasValue && !String.IsNullOrEmpty(StartDrawColumn))
{ {
_tas.ToggleButton(TASView.PointedCell.Row.Value, TASView.PointedCell.Column); _tas.SetButton(e.NewCell.Row.Value, StartDrawColumn, StartOn); //Notice it uses new row, old column, you can only paint across a single column
TASView.Refresh(); TASView.Refresh();
} }
} }
#endregion #endregion
#region Classes
// Everything in here will probably need to be moved at some point
#endregion
} }
} }