TAStudio - input painting for boolean input
This commit is contained in:
parent
238e9b4f73
commit
f0425f3cc5
|
@ -41,7 +41,18 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public bool this[string button]
|
||||
{
|
||||
get { return MyBoolButtons[button]; }
|
||||
get
|
||||
{
|
||||
return MyBoolButtons[button];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (MyBoolButtons.ContainsKey(button))
|
||||
{
|
||||
MyBoolButtons[button] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPressed(string button)
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public partial class Bk2Movie
|
||||
{
|
||||
private readonly List<string> _log = new List<string>();
|
||||
protected readonly List<string> _log = new List<string>();
|
||||
private string _logKey = string.Empty;
|
||||
|
||||
public string GetInputLog()
|
||||
|
|
|
@ -84,5 +84,44 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return "!";
|
||||
}
|
||||
|
||||
public void ToggleBoolState(int frame, string buttonName)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
adapter[buttonName] = !adapter.IsPressed(buttonName);
|
||||
|
||||
var lg = LogGeneratorInstance();
|
||||
lg.SetSource(adapter);
|
||||
_log[frame] = lg.GenerateLogEntry();
|
||||
Changes = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBoolState(int frame, string buttonName, bool val)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
var old = adapter[buttonName];
|
||||
adapter[buttonName] = val;
|
||||
|
||||
var lg = LogGeneratorInstance();
|
||||
lg.SetSource(adapter);
|
||||
_log[frame] = lg.GenerateLogEntry();
|
||||
|
||||
if (old != val)
|
||||
{
|
||||
Changes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BoolIsPressed(int frame, string buttonName)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
return adapter.IsPressed(buttonName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
//_tas.ToggleButton(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
|
||||
TasView.Refresh();
|
||||
var frame = TasView.PointedCell.Row.Value;
|
||||
var buttonName = TasView.PointedCell.Column;
|
||||
|
||||
_startDrawColumn = TasView.PointedCell.Column;
|
||||
//_startOn = _tas.IsPressed(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
|
||||
// TODO: if float, store the original value and copy that on cell chaned
|
||||
if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
|
||||
{
|
||||
_tas.ToggleBoolState(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
|
||||
TasView.Refresh();
|
||||
|
||||
_startDrawColumn = TasView.PointedCell.Column;
|
||||
_startOn = _tas.BoolIsPressed(frame, buttonName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +138,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startDrawColumn))
|
||||
{
|
||||
//_tas.SetBoolButton(e.NewCell.Row.Value, _startDrawColumn, /*_startOn*/ false); // Notice it uses new row, old column, you can only paint across a single column
|
||||
_tas.SetBoolState(e.NewCell.Row.Value, _startDrawColumn, _startOn); // Notice it uses new row, old column, you can only paint across a single column
|
||||
TasView.Refresh();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
// Input Painting
|
||||
private string _startDrawColumn = string.Empty;
|
||||
//private bool _startOn;
|
||||
private bool _startOn;
|
||||
private bool _startMarkerDrag;
|
||||
private bool _startFrameDrag;
|
||||
|
||||
|
|
Loading…
Reference in New Issue