Updated addTimer() interface to include an ID; cleaned up how the CPU tracks the base speed, current speed, and target speed

This commit is contained in:
Jeff Parsons 2017-08-07 13:58:41 -07:00 • committed by Jeff Parsons
commit e5a9b01dde
18 changed files with 2403 additions and 2387 deletions

View file

@ -342,18 +342,17 @@ class Panel extends Component {
/**
* startTimer()
*
* This timer replaces the CPU's old dedicated VIDEO_UPDATES_PER_SECOND logic, which periodically called
* the Computer's updateVideo() function, which in turn called us; periodic updateAnimation() calls are now
* our own responsibility.
*
* @this {Panel}
*/
startTimer()
{
/*
* This timer replaces the CPU's old dedicated VIDEO_UPDATES_PER_SECOND logic, which periodically called
* the Computer's updateVideo() function, which in turn called us; periodic updateAnimation() calls are now
* our own responsibility.
*/
if (this.timer < 0 && this.canvas && this.cpu) {
var panel = this;
this.timer = this.cpu.addTimer(function() {
this.timer = this.cpu.addTimer(this.id, function() {
panel.updateAnimation();
}, 1000 / Panel.UPDATES_PER_SECOND);
}