Skip to content

Commit

Permalink
remove restart game
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoBilla committed Mar 29, 2021
1 parent 056354a commit c21f04b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/it/matlice/matlichess/EntryPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ public void actionPerformed(ActionEvent e) {
try {
PlayerInterface w = white.getSelectedInterface();
PlayerInterface b = black.getSelectedInterface();
runGame(w, b, () -> {
this.setVisible(true);
});
runGame(w, b);
this.setVisible(false);
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Errore nell'inizializzazione: " + ex.getMessage(), "Errore!", JOptionPane.ERROR_MESSAGE);
Expand All @@ -104,14 +102,12 @@ public void actionPerformed(ActionEvent e) {
*
* @param white white player
* @param black black player
* @param after Runnable to run after the game
*/
private void runGame(PlayerInterface white, PlayerInterface black, Runnable after) {
private void runGame(PlayerInterface white, PlayerInterface black) {
Thread t = new Thread(() -> {
View.getInstance().initialize();
Game.getInstance(white, black, new PhysicalPlayer()).setup();
while (Game.getInstance().mainloop()) ;
if (after != null) after.run();
while (Game.getInstance().mainloop());
});
t.start();
}
Expand Down

0 comments on commit c21f04b

Please sign in to comment.