Widget:Interrupt: Difference between revisions

From COMP15212 Wiki
m 1 revision imported
pc>Yuron
No edit summary
Line 67: Line 67:
}
}


var isRunning = true;
function interrupt() {
function interrupt() {
     if ((mouse.x >= STOP_X) && (mouse.x < (STOP_X + STOP_DX)) &&
     if ((mouse.x >= STOP_X) && (mouse.x < (STOP_X + STOP_DX)) &&
         (mouse.y >= STOP_Y) && (mouse.y < (STOP_Y + STOP_DY))) {
         (mouse.y >= STOP_Y) && (mouse.y < (STOP_Y + STOP_DY))) {
         clearInterval(clockId);
         if (isRunning) {
            clearInterval(clockId);
            isRunning = false;
        } else {
            clockId = setInterval(animate, STEP_TIME);
            isRunning = true;
        }
     } else {
     } else {
         pending = true;
         pending = true;

Revision as of 10:48, 13 August 2019

This widget demonstrates the operation of an interrupt handler, and what happens when interrupts are disabled.