diff options
author | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:27:15 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-11-19 10:27:15 +0100 |
commit | 7a7007571699eb57bc96cef4cd053a5bd50468b3 (patch) | |
tree | 14b879b399417a59a340c6fda9daf4719a3dbebf /src/GameWindow.java | |
parent | Add Actor.SkillSet, remove useless members in various strucutres (diff) | |
download | Subconscious-java-7a7007571699eb57bc96cef4cd053a5bd50468b3.tar.gz Subconscious-java-7a7007571699eb57bc96cef4cd053a5bd50468b3.zip |
Update Scene class (and some derivates) to be abstract
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(); - } } |