From 554cd6754b9c5bf3ab84b3d30c5363aa5f93a535 Mon Sep 17 00:00:00 2001 From: Mathieu Huot Date: Sat, 9 Jan 2016 17:33:11 +0100 Subject: [PATCH] set in full screen, permanent input re-fixed, improved readme, proper game quit --- README.md | 20 ++++++++++---- .../{Warrior WIP.png => WarriorWIP.png} | Bin src/graphics/guiSkeleton/GraphicsMaster.java | 26 ++++++------------ src/graphics/guiSkeleton/MainFrame.java | 6 ++-- src/graphics/guiSkeleton/RepaintTimer.java | 9 ------ 5 files changed, 25 insertions(+), 36 deletions(-) rename src/assets/{Warrior WIP.png => WarriorWIP.png} (100%) diff --git a/README.md b/README.md index 786e49e..893b61e 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,26 @@ ################### INSTALLATION AND REQUIRED FEATURES ################### -This project require java 1.8. To install it on debian stable or ubuntu 14.04 see in the wiki (TODO) +This project require java 1.8. +To install it on debian stable or ubuntu 14.04 see in the wiki. +Make sure to have java 1.8 : java -version. + To compile: cd project folder make -To run +To run: + + Graphical version: + make play + Terminal version: + make play-term + +To compile and run: - Make sure to have java 1.8 : java -version - To play on graphical version : + Graphical version : make buildplay - To play on terminal version : + Terminal version : make buildplay-term ################### HOW TO PLAY ################### @@ -79,7 +88,6 @@ This game was created between september 2015 and january 2016. It was designed in a software engineering course of M1 at ENS Cachan, France. The following people were the developers : -Arrighi Emmanuel --Aubian Guillaume -Babonnaud William -Beauseigneur Clément -Begel Myriam diff --git a/src/assets/Warrior WIP.png b/src/assets/WarriorWIP.png similarity index 100% rename from src/assets/Warrior WIP.png rename to src/assets/WarriorWIP.png diff --git a/src/graphics/guiSkeleton/GraphicsMaster.java b/src/graphics/guiSkeleton/GraphicsMaster.java index 5af9537..6bd5eb5 100644 --- a/src/graphics/guiSkeleton/GraphicsMaster.java +++ b/src/graphics/guiSkeleton/GraphicsMaster.java @@ -2,7 +2,8 @@ package graphics.guiSkeleton; import graphics.graphical_abstraction.GraphicsMasterAbstraction; import graphics.graphical_abstraction.panel.PanelAbstraction; -import graphics.guiSkeleton.guiPanel.*; +import graphics.guiSkeleton.guiPanel.GamePanel; +import graphics.guiSkeleton.guiPanel.UnitialisedGUIPanel; import graphics.guiSkeleton.guiPanel.menuPanel.*; import graphics.guiSkeleton.guiPanel.menuPanel.characterChoice.MultiPlayer_CharacterChoicePanel; import graphics.guiSkeleton.guiPanel.menuPanel.characterChoice.SinglePlayer_CharacterChoicePanel; @@ -13,9 +14,11 @@ import graphics.guiSkeleton.guiPanel.menuPanel.gameLoad.SinglePlayer_LoadGamePan import graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel.MultiPlayer_MenuPanel; import graphics.guiSkeleton.guiPanel.menuPanel.multiPlayer_MenuPanel.SeverCreatedPanel; import graphics.guiSkeleton.inputManagement.MainFrameKeyListener; +import graphics.ingame_input_listener.InputConfiguration; import ingame_programming.IGPpanel; import javax.swing.*; +import java.awt.event.WindowEvent; /** * Created by dupriez on 10/11/15. @@ -33,13 +36,10 @@ public class GraphicsMaster extends GraphicsMasterAbstraction { // instantiated a second time by mistake) /** Singleton pattern implementation **/ - //private static GraphicsMaster thisGraphicsMaster - //protected MainFrame mainFrame; - - //protected static GraphicsMasterAbstraction thisGraphicsMaster = new GraphicsMaster(); + private MainFrame mainFrame; private GraphicsMaster() { - //this.thisGraphicsMaster = new GraphicsMaster(); + super.mainFrame=mainFrame; mapGUIStatesToGUIPanel.put(GUIStates.UNINITIALISED, new UnitialisedGUIPanel(this)); mapGUIStatesToGUIPanel.put(GUIStates.MAIN_MENU, new MainMenuPanel(this)); mapGUIStatesToGUIPanel.put(GUIStates.GAME_PANEL, new GamePanel(this)); @@ -85,12 +85,6 @@ public class GraphicsMaster extends GraphicsMasterAbstraction { public void run() { mainFrame = new MainFrame(); mainFrame.init(mainFrameKeyListener); - //MainFrame mf = (MainFrame)mainFrame; - //mf.setFocusable(true); //For the keyListener to work - //mf.addKeyListener(mainFrameKeyListener); - //mf.revalidate(); - //mf.setVisible(true); - changeGUIStateTo(GUIStates.MAIN_MENU); } }); @@ -107,10 +101,8 @@ public class GraphicsMaster extends GraphicsMasterAbstraction { */ @Override public void exitGUI() { - ((MainFrame)mainFrame).setVisible(false); - //Maybe "dispose" is not as definitive as the method exitGUI() should be - ((MainFrame)mainFrame).dispose(); - //TODO: make it terminates the program + InputConfiguration.UpdateConfigurationWhenGameLeaves(); + mainFrame.dispatchEvent(new WindowEvent(mainFrame, WindowEvent.WINDOW_CLOSING)); } /** @@ -134,8 +126,6 @@ public class GraphicsMaster extends GraphicsMasterAbstraction { private void setGUIStateTo(GUIStates arg_guiState) { PanelAbstraction guiPanelToDisplay = mapGUIStatesToGUIPanel.get(arg_guiState); mainFrame.add(guiPanelToDisplay); - //mainFrame.revalidate(); - //mainFrame.repaint(); guiPanelToDisplay.initialise(); guiState = arg_guiState; } diff --git a/src/graphics/guiSkeleton/MainFrame.java b/src/graphics/guiSkeleton/MainFrame.java index 913701e..2219a13 100644 --- a/src/graphics/guiSkeleton/MainFrame.java +++ b/src/graphics/guiSkeleton/MainFrame.java @@ -19,10 +19,10 @@ public class MainFrame extends JFrame implements FrameAbstraction { private static final long serialVersionUID = 1L; public MainFrame() { //Annoying for network tests -// setInFullScreen(); - setSize(new Dimension(500,500)); + setInFullScreen(); +// setSize(new Dimension(500,500)); -// setResizable(false); + setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); RepaintTimer.getInstance().setMainFrameToRepaint(this); try { diff --git a/src/graphics/guiSkeleton/RepaintTimer.java b/src/graphics/guiSkeleton/RepaintTimer.java index 2e7eebb..6d7f06e 100644 --- a/src/graphics/guiSkeleton/RepaintTimer.java +++ b/src/graphics/guiSkeleton/RepaintTimer.java @@ -31,8 +31,6 @@ public class RepaintTimer { int i = 0; private int PLAYING_FRAMERATE = 33; // unit: ms - ///TODO not used ? - // private int COOL_FRAMERATE = 5000; // unit: ms private boolean mainFrameToRepaintSet = false; private MainFrame mainFrameToRepaint; // the java Timer the class RepaintTimer uses @@ -63,10 +61,6 @@ public class RepaintTimer { * Set the delay of the RepaintTimer to PLAYING_FRAMERATE */ public void enterPlayingFramerateMode() { - //swingTimer.setDelay(PLAYING_FRAMERATE); -// //TODO: should maybe restart the timer here -// swingTimer.restart(); - if(debug){LOGGER.info("playingFramerateMode entered");} swingTimer = new javax.swing.Timer(PLAYING_FRAMERATE, repaintActionListener); @@ -77,9 +71,6 @@ public class RepaintTimer { * Set the delay of the RepaintTimer to COOL_FRAMERATE */ public void exitPlayingFrameRateMode() { -// swingTimer.setDelay(COOL_FRAMERATE); -// //TODO: should maybe restart the timer here -// swingTimer.restart(); if(debug){LOGGER.info("playingFramerateMode exited");} swingTimer.stop(); -- GitLab