Closing main window shuts down computer and exits app properly now.

This commit is contained in:
Brendan Robert 2015-02-03 23:50:23 -06:00
parent ebed2a7c52
commit d5b0e10add
2 changed files with 13 additions and 2 deletions

View File

@ -8,8 +8,8 @@ package jace;
import java.io.IOException;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
@ -46,8 +46,13 @@ public class JaceApplication extends Application {
}
controller.connectComputer(Emulator.computer);
});
primaryStage.setOnCloseRequest(value -> {
Emulator.computer.deactivate();
Platform.exit();
System.exit(0);
});
}
/**
* @param args the command line arguments
*/

View File

@ -104,6 +104,12 @@ public abstract class Computer implements Reconfigurable {
memory.loadRom(path);
}
public void deactivate() {
cpu.suspend();
motherboard.suspend();
video.suspend();
}
@InvokableAction(
name = "Cold boot",
description = "Process startup sequence from power-up",