diff options
Diffstat (limited to '')
-rw-r--r-- | src/GameWindow.java (renamed from src/Sub.java) | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/Sub.java b/src/GameWindow.java index e365032..540d75b 100644 --- a/src/Sub.java +++ b/src/GameWindow.java @@ -10,15 +10,15 @@ import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class Sub implements ActionListener { +public class GameWindow implements ActionListener { public static final Dimension WINDOW_SIZE = new Dimension(600, 400); private JFrame frame; private JPanel menu; // TODO: remove map editor, start directly on Battle mode - public Sub() { - this.frame = new JFrame("Sub"); + public GameWindow() { + this.frame = new JFrame("Subconscious"); this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.frame.setSize(WINDOW_SIZE); @@ -53,19 +53,27 @@ public class Sub implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if ("editor".equals(e.getActionCommand())) { - MapEditor test = new MapEditor(frame, this); + MapEditor mapEditor = new MapEditor(frame); + this.frame.getContentPane().removeAll(); this.frame.getContentPane().invalidate(); - this.frame.getContentPane().add(test); + this.frame.getContentPane().add(mapEditor); this.frame.getContentPane().revalidate(); - test.start(); + + Thread mapEditorThread = new Thread(mapEditor); + mapEditorThread.start(); + } else if ("battle".equals(e.getActionCommand())) { - Battle test = new Battle(frame, this); + BattleScene battleScene = new BattleScene(frame); + this.frame.getContentPane().removeAll(); this.frame.getContentPane().invalidate(); - this.frame.getContentPane().add(test); + this.frame.getContentPane().add(battleScene); this.frame.getContentPane().revalidate(); - test.start(); + + Thread battleThread = new Thread(battleScene); + battleThread.start(); + } else if ("exit".equals(e.getActionCommand())) { this.frame.setVisible(false); this.frame.dispose(); @@ -78,8 +86,4 @@ public class Sub implements ActionListener { this.frame.getContentPane().add(this.menu); this.frame.getContentPane().revalidate(); } - - public static void main(String[] args) { - Sub sub = new Sub(); - } } |