Skip to content

Commit ff9ad3f

Browse files
committed
TAS playback stop button
1 parent 1c1a053 commit ff9ad3f

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/game/tas/TAS.as

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ package game.tas
2222
// The current index into the playback buffer. Not necessarily related to framecount/time.
2323
private var _idx:uint;
2424

25-
public function get curCommand():uint { return _idx + 1 }
25+
// no idea why this isnt _idx + 1 but o well.
26+
public function get curCommand():uint { return _idx }
2627
public function get commandCount():uint { return PlaybackBuffer ? PlaybackBuffer.length : 0 }
2728

2829
public var _recording:Boolean = false;

src/net/flashpunk/debug/Console.as

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ package net.flashpunk.debug
827827
}
828828
else _butStep.alpha = .5;
829829

830-
if (!_tasConsole.SaveButton) return;
830+
if (!_tasConsole.SaveButton || !_tasConsole.StopButton) return;
831831

832832
if (_tasConsole.SaveButton.bitmapData.rect.contains(_tasConsole.SaveButton.mouseX, _tasConsole.SaveButton.mouseY))
833833
{
@@ -848,6 +848,17 @@ package net.flashpunk.debug
848848
}
849849
}
850850
else _tasConsole.SaveButton.alpha = .5;
851+
852+
if (_tasConsole.StopButton.bitmapData.rect.contains(_tasConsole.StopButton.mouseX, _tasConsole.StopButton.mouseY))
853+
{
854+
_tasConsole.StopButton.alpha = 1;
855+
if (Input.mousePressed)
856+
{
857+
FP.tas.FlushPlayback();
858+
_tasConsole.visible = false;
859+
}
860+
}
861+
else _tasConsole.StopButton.alpha = .5;
851862
}
852863

853864
/** @private Gets a TextFormat object with the formatting. */

src/net/flashpunk/debug/TASConsole.as

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ package net.flashpunk.debug
3030
public var TasFramesLeftField:TextField = new TextField;
3131

3232
public var SaveButton:Bitmap;
33+
public var StopButton:Bitmap;
3334

3435
public function TASConsole()
3536
{
@@ -91,7 +92,7 @@ package net.flashpunk.debug
9192

9293
addChild(CurInputLabel);
9394
CurInputLabel.defaultTextFormat = console.format(12, 0xFFFFFF, "left");
94-
CurInputLabel.text = "Current Frame: ";
95+
CurInputLabel.text = "Current Input: ";
9596
CurInputLabel.embedFonts = true;
9697
CurInputLabel.selectable = false;
9798
CurInputLabel.width = 100;
@@ -135,9 +136,15 @@ package net.flashpunk.debug
135136
SaveButton.x = 120;
136137
SaveButton.y = 80;
137138
SaveButton.alpha = .5;
139+
140+
addChild(StopButton = new CONSOLE_STOP);
141+
StopButton.x = 4;
142+
StopButton.y = 80;
143+
StopButton.alpha = .5;
138144
}
139145

140146
[Embed(source = 'console_save.png')] private const CONSOLE_SAVE:Class;
147+
[Embed(source = 'console_stop.png')] private const CONSOLE_STOP:Class;
141148
}
142149

143150
}
159 Bytes
Loading

0 commit comments

Comments
 (0)