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:
parent
f71b4d648c
commit
e5a9b01dde
18 changed files with 2403 additions and 2387 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue