Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genie_logiciel_2015
the_dungeon_project
Commits
1152216b
Commit
1152216b
authored
Jan 06, 2016
by
Mathieu Hilaire
Browse files
Merge remote-tracking branch 'origin/master'
Conflicts: src/graphics/display_test/GamePanelTermTest.java
parents
0fed7da0
15d37246
Changes
56
Hide whitespace changes
Inline
Side-by-side
src/artificial_intelligence/AlphaStar/AITile.java
View file @
1152216b
...
...
@@ -40,8 +40,7 @@ public class AITile {
}
public
boolean
isObstacle
(
Map
map
){
//Map map=AbstractEntity.GetMap();
//Relayer relayer=AbstractEntity.GetRelay();
Tile
tile
=
map
.
getTileAt
(
x
/
32
,
y
/
32
);
TilePropertyVector
tpv
=
tile
.
getTilePropertyVector
();
List
list
=
new
ArrayList
<
TilePropertyVector
.
TileProperty
>();
...
...
@@ -91,7 +90,4 @@ public class AITile {
return
Direction
.
NONE
;
}
}
// others information could be here and be handled by Case Comparator if u want.
}
\ No newline at end of file
src/artificial_intelligence/AlphaStar/AITileComparator.java
View file @
1152216b
package
artificial_intelligence.AlphaStar
;
import
artificial_intelligence.AlphaStar.AITile
;
import
java.util.Comparator
;
...
...
@@ -21,12 +20,11 @@ public class AITileComparator implements Comparator<AITile> {
* Allows to compare two tiles with respect to their distances to the obj tile.
* @param c1
* @param c2
* @return
* @return
heuristic distance between both element
*/
@Override
public
int
compare
(
AITile
c1
,
AITile
c2
)
{
// juste pour tester, mais il faudra changer car la conversion est trop violente
return
heuristique
(
c1
)-
heuristique
(
c2
);
}
...
...
src/artificial_intelligence/AlphaStar/AITileQueueElement.java
View file @
1152216b
...
...
@@ -5,14 +5,14 @@ import java.util.Objects;
/**
* @author Yann RAMUSAT and Remy GARNIER
*
*
Specific
queue for
the
A*
a
lgorithm
.
*
Implement a
queue for A*
A
lgorithm
s
*/
public
class
AITileQueueElement
implements
Comparable
<
AITileQueueElement
>{
private
AITile
caseElement
;
private
double
value
;
/**
*
En
queue.
*
Add an eleement to the
queue.
* @param element
* @param d
*/
...
...
@@ -29,7 +29,7 @@ public class AITileQueueElement implements Comparable<AITileQueueElement>{
return
caseElement
;
}
@Override
public
int
compareTo
(
AITileQueueElement
cqe
)
{
return
(
value
>
cqe
.
value
)?
1
:-
1
;
...
...
src/gameloop/DummyLocalGameLoop.java
View file @
1152216b
package
gameloop
;
import
core.event.Event
;
import
core.event.MapChangeEvent
;
import
core.event.MapInit
;
import
core.event.ToClientDeathEvent
;
import
core.gamestate.GameContent
;
...
...
@@ -149,6 +150,9 @@ public class DummyLocalGameLoop extends Thread{
setFollowedRelayer
(
firstEntityRelayer
);
relayerSemaphore
.
release
();
}
if
(
eventToReceive
instanceof
MapChangeEvent
){
GraphicsMasterAbstraction
.
getInstance
().
changeGUIStateTo
(
GraphicsMasterAbstraction
.
GUIStates
.
GAME_WIN
);
}
if
(
eventToReceive
instanceof
ToClientDeathEvent
&&
((
ToClientDeathEvent
)
eventToReceive
).
getEntityID
()==
followedRelayer
.
getCharacter
().
getID
())
{
GraphicsMasterAbstraction
.
getInstance
().
changeGUIStateTo
(
GraphicsMasterAbstraction
.
GUIStates
.
GAME_OVER
);
...
...
@@ -159,7 +163,7 @@ public class DummyLocalGameLoop extends Thread{
}
else
{
try
{
sleep
(
10
);
sleep
(
10
0
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
...
...
src/graphics/display_test/GamePanelTermTest.java
View file @
1152216b
...
...
@@ -6,7 +6,6 @@ package graphics.display_test;
import
artificial_intelligence.AIControler
;
import
artificial_intelligence.AIEntities.AgressiveEntity
;
import
artificial_intelligence.AIEntities.EnumBehaviourType
;
/** import com.sun.javafx.scene.traversal.Direction; had to comment because it led to error in compilation for me **/
import
gameloop.DummyLocalGameLoop
;
import
gameloop.GameStarter
;
import
graphics.graphical_abstraction.GraphicsMasterAbstraction
;
...
...
src/graphics/graphical_abstraction/GraphicsMasterAbstraction.java
View file @
1152216b
...
...
@@ -39,7 +39,8 @@ public abstract class GraphicsMasterAbstraction {
LOST_CONNECTION
,
PLEASE_WAIT
,
SERVER_ADDRESS_PANEL
,
SERVER_CREATED_PANEL
SERVER_CREATED_PANEL
,
GAME_WIN
;
}
//This map indicates to graphicsMaster which guiPanel is associated to each GUIState, it is filled in Graphicsmaster's constructor
protected
HashMap
<
GUIStates
,
PanelAbstraction
>
mapGUIStatesToGUIPanel
=
new
HashMap
<>();
...
...
src/graphics/graphical_utility/applicationData/lounge/Lounge.java
deleted
100644 → 0
View file @
0fed7da0
package
graphics.graphical_utility.applicationData.lounge
;
import
java.util.ArrayList
;
/**
* Created by dupriez on 06/12/15.
*
* This class defines a Lounge, without any link to the gui.
* It allows listeners to subscribe to the changes made to the content of the slots. (observer pattern)
* For this reason, it makes sure that no one can ever have a pointer to one of the PlayerInformation stored in it,
* because they would be able to bypass the modification notification system.
*/
public
class
Lounge
{
//Number of players able to be in the Lounge (hence the number of players of a session of the game)
private
int
numberOfSlots
;
private
PlayerInformation
[]
slots
;
//This array stores whether the slots are occupied or not
private
boolean
[]
slotsOccupation
;
private
int
numberOfOccupiedSlots
=
0
;
/** Implementation of the observer pattern **/
private
ArrayList
<
LoungeModificationListener
>
listeners
=
new
ArrayList
<>();
public
void
subscribeToModification
(
LoungeModificationListener
subscriber
){
listeners
.
add
(
subscriber
);
}
private
void
slotModified
(
int
modifiedSlotNumber
){
for
(
LoungeModificationListener
listener
:
listeners
)
{
listener
.
loungeModificationHandler
(
modifiedSlotNumber
);
}
}
public
Lounge
(
int
numberOfSlots
)
{
this
.
numberOfSlots
=
numberOfSlots
;
slots
=
new
PlayerInformation
[
numberOfSlots
];
slotsOccupation
=
new
boolean
[
numberOfSlots
];
//Filling the slots with EmptyPlayerDefinitions, and filling slotsOccupation with false
for
(
int
i
=
0
;
i
<
numberOfSlots
;
i
++)
{
slots
[
i
]
=
PlayerInformation
.
makeEmptyPlayerInformation
();
slotsOccupation
[
i
]
=
false
;
}
}
/**
* If there is one, create another PlayerInformation object with the same values as playerInformation_ReadOnly,
* puts it in the slot and outputs the number of the slot.
* If no free slot exists, does nothing and outputs -1
* @param playerInformation
* @return
*/
public
int
addPlayer
(
PlayerInformation
playerInformation
)
{
int
firstFreeSlot
=
-
1
;
for
(
int
i
=
0
;
i
<
slotsOccupation
.
length
;
i
++)
{
if
(!
slotsOccupation
[
i
]){
firstFreeSlot
=
i
;
break
;
}
}
if
(
firstFreeSlot
==-
1
){
//No free slot found
return
-
1
;
}
PlayerInformation
newPlayerInformation
=
playerInformation
.
clone
();
slots
[
firstFreeSlot
]
=
newPlayerInformation
;
slotsOccupation
[
firstFreeSlot
]
=
true
;
numberOfOccupiedSlots
++;
//Notify listeners of the modification
slotModified
(
firstFreeSlot
);
return
firstFreeSlot
;
}
/**
* If there was a player at slot number slotNumber, creates another PlayerInformation object with the same values as
* playerInformation_ReadOnly and put it in the slot whose number is slotNumber and outputs 1.
* If the slot number slotNumber is empty, does nothing and outputs -1.
* @param playerInformation
* @param slotNumber
* @return
*/
public
int
updatePlayer
(
PlayerInformation
playerInformation
,
int
slotNumber
)
{
if
(
slotsOccupation
[
slotNumber
]){
//Player found at the slot
PlayerInformation
newPlayerInformation
=
playerInformation
.
clone
();
slots
[
slotNumber
]
=
newPlayerInformation
;
//Notify the listeners of the change
slotModified
(
slotNumber
);
return
1
;
}
return
-
1
;
}
/**
* Removes the playerInformation of the slot whose number is given in argument. Fills the slot with an EmptyPlayerInformation.
* Outputs 1 if there was a player at the slot, -1 if not.
* @param slotNumber
* @return
*/
public
int
removePlayer
(
int
slotNumber
)
{
if
(
slotsOccupation
[
slotNumber
])
{
//Player found at the slot
slots
[
slotNumber
]
=
PlayerInformation
.
makeEmptyPlayerInformation
();
slotsOccupation
[
slotNumber
]
=
false
;
numberOfOccupiedSlots
--;
//Notify listeners of the modification
slotModified
(
slotNumber
);
return
1
;
}
return
-
1
;
}
/**
* Return the PlayerInformation stored at the slot whose number is given as argument.
* @param slotNumber
* @return
*/
public
PlayerInformation_ReadOnly
getPlayerAtSlot
(
int
slotNumber
)
{
return
slots
[
slotNumber
];
}
public
int
getNumberOfSlots
()
{
return
numberOfSlots
;
}
/**
* Outputs whether the Lounge is full of non-empty PlayerInformation
* @return
*/
public
boolean
isFull
(){
return
numberOfOccupiedSlots
==
numberOfSlots
;
}
}
src/graphics/graphical_utility/applicationData/lounge/LoungeModificationListener.java
deleted
100644 → 0
View file @
0fed7da0
package
graphics.graphical_utility.applicationData.lounge
;
/**
* Created by dupriez on 06/12/15.
*
* To be implemented by anyone interested in the changes done to a Lounge (PlayerInformationList_SubPanel for instance)
*/
public
interface
LoungeModificationListener
{
//What to do when a slot of the Lounge is modified
void
loungeModificationHandler
(
int
modifiedSlotNumber
);
}
src/graphics/graphical_utility/applicationData/lounge/PlayerInformation.java
deleted
100644 → 0
View file @
0fed7da0
package
graphics.graphical_utility.applicationData.lounge
;
/**
* Created by dupriez on 06/12/15.
*
* Define a player on the LoungePanel, so that it can be displayed in the PlayerInformationList_SubPanel
*/
public
class
PlayerInformation
implements
PlayerInformation_ReadOnly
{
private
String
playerName
;
private
boolean
ready
=
false
;
public
PlayerInformation
(
String
playerName
)
{
this
.
playerName
=
playerName
;
}
static
public
PlayerInformation
makeEmptyPlayerInformation
()
{
return
new
PlayerInformation
(
"Empty"
);
}
/**
* Build another instance of PlayerInformation, whose fields contain the same values as "this".
* @return
*/
@Override
public
PlayerInformation
clone
()
{
PlayerInformation
result
=
new
PlayerInformation
(
this
.
playerName
);
result
.
setReady
(
this
.
isReady
());
return
result
;
}
@Override
public
PlayerInformation
cloneAsEditableVersion
()
{
return
this
.
clone
();
}
/** Getters and Setters **/
@Override
public
String
getPlayerName
()
{
return
playerName
;
}
public
void
setPlayerName
(
String
playerName
)
{
this
.
playerName
=
playerName
;
}
@Override
public
boolean
isReady
()
{
return
ready
;
}
public
void
setReady
(
boolean
ready
)
{
this
.
ready
=
ready
;
}
}
src/graphics/graphical_utility/applicationData/lounge/PlayerInformation_ReadOnly.java
deleted
100644 → 0
View file @
0fed7da0
package
graphics.graphical_utility.applicationData.lounge
;
/**
* Created by dupriez on 06/12/15.
*
* A different view of the class PlayerInformation, with only the getters method.
*/
public
interface
PlayerInformation_ReadOnly
{
String
getPlayerName
();
boolean
isReady
();
/**
* Returns a PlayerInformation object, whose fields contain the same values as this PlayerInformation_ReadOnly
* @return
*/
PlayerInformation
cloneAsEditableVersion
();
}
src/graphics/guiSkeleton/GraphicsMaster.java
View file @
1152216b
...
...
@@ -10,11 +10,8 @@ import graphics.guiSkeleton.guiPanel.menuPanel.configuration.ConfigurationPanel;
import
graphics.guiSkeleton.guiPanel.menuPanel.gameCreation.MultiPlayer_GameCreationPanel
;
import
graphics.guiSkeleton.guiPanel.menuPanel.gameCreation.SinglePlayer_GameCreationPanel
;
import
graphics.guiSkeleton.guiPanel.menuPanel.gameLoad.SinglePlayer_LoadGamePanel
;
import
graphics.guiSkeleton.guiPanel.menuPanel.loungePanel.LoungePanel
;
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.*
;
...
...
@@ -36,12 +33,12 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
/** Singleton pattern implementation **/
//private static GraphicsMaster thisGraphicsMaster
//protected MainFrame mainFrame;
//protected MainFrame mainFrame;
//protected static GraphicsMasterAbstraction thisGraphicsMaster = new GraphicsMaster();
private
GraphicsMaster
()
{
//this.thisGraphicsMaster = new GraphicsMaster();
//this.thisGraphicsMaster = new GraphicsMaster();
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
UNINITIALISED
,
new
UnitialisedGUIPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
MAIN_MENU
,
new
MainMenuPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
GAME_PANEL
,
new
GamePanel
(
this
));
...
...
@@ -50,7 +47,6 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
INPUT_CONFIG_PANEL
,
new
ConfigurationPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
IGP_PANEL
,
new
IGPpanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
LOUNGE
,
new
LoungePanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
MULTIPLAYER_GAME_CREATION
,
new
MultiPlayer_GameCreationPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
MULTIPLAYER_CHARACTER_CHOICE
,
new
MultiPlayer_CharacterChoicePanel
(
this
));
...
...
@@ -61,8 +57,8 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
PLEASE_WAIT
,
new
PleaseWaitPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
SERVER_ADDRESS_PANEL
,
new
ServerAddressPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
SERVER_CREATED_PANEL
,
new
SeverCreatedPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
GAME_OVER
,
new
GameOverPanel
(
this
));
mapGUIStatesToGUIPanel
.
put
(
GUIStates
.
GAME_WIN
,
new
GameWinPanel
(
this
));
}
public
static
void
build
()
{
...
...
@@ -88,10 +84,10 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
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);
//mf.setFocusable(true); //For the keyListener to work
//mf.addKeyListener(mainFrameKeyListener);
//mf.revalidate();
//mf.setVisible(true);
changeGUIStateTo
(
GUIStates
.
MAIN_MENU
);
}
...
...
@@ -109,10 +105,9 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
*/
@Override
public
void
exitGUI
()
{
((
MainFrame
)
mainFrame
).
setVisible
(
false
);
((
MainFrame
)
mainFrame
).
setVisible
(
false
);
//Maybe "dispose" is not as definitive as the method exitGUI() should be
((
MainFrame
)
mainFrame
).
dispose
();
InputConfiguration
.
UpdateConfigurationWhenGameLeaves
();
((
MainFrame
)
mainFrame
).
dispose
();
//TODO: make it terminates the program
}
...
...
@@ -136,9 +131,9 @@ public class GraphicsMaster extends GraphicsMasterAbstraction {
*/
private
void
setGUIStateTo
(
GUIStates
arg_guiState
)
{
PanelAbstraction
guiPanelToDisplay
=
mapGUIStatesToGUIPanel
.
get
(
arg_guiState
);
mainFrame
.
add
(
guiPanelToDisplay
);
//mainFrame.revalidate();
//mainFrame.repaint();
mainFrame
.
add
(
guiPanelToDisplay
);
//mainFrame.revalidate();
//mainFrame.repaint();
guiPanelToDisplay
.
initialise
();
guiState
=
arg_guiState
;
}
...
...
src/graphics/guiSkeleton/entityDisplayer/EntityDisplayer.java
View file @
1152216b
...
...
@@ -20,7 +20,7 @@ import graphics.guiSkeleton.sprites.Sprite;
/**
* Created by dupriez on 14/11/15.
*
* Each entity should have one instance of
a subclass of
this class
* Each entity should have one instance of this class
* It is used by the gui to know how to display the said entity
*/
public
class
EntityDisplayer
implements
Serializable
{
...
...
@@ -78,7 +78,6 @@ public class EntityDisplayer implements Serializable {
public
char
getTermSprite
()
{
return
charForTerminalSprite
;
}
//abstract public PositionedSpriteTerm getPositionedSpriteTerm(GraphicsMapTerm graphicsMap);
public
Entity
getAssociatedEntity
()
{
return
associatedEntity
;
...
...
src/graphics/guiSkeleton/entityDisplayer/EntityDisplayer2.java
deleted
100644 → 0
View file @
0fed7da0
package
graphics.guiSkeleton.entityDisplayer
;
import
java.io.Serializable
;
/**
* Created by dupriez on 14/11/15.
*
* Each entity should have one instance of a subclass of this class
* It is used by the gui to know how to display the said entity
*/
abstract
public
class
EntityDisplayer2
implements
Serializable
{
// // les images doivent avoir leurs animations alignées horizontalement
// //The Entity this Displayer is associated to
// private Entity associatedEntity;
// int sprite_num; // le numéro d'image où on en est de l'animation
// int persofixe[][] = new int[8][4]; // dim 1 : directions, dim 2 : case 0: position sur la sprite, 1: hauteur, 2: largeur, 3: nb_images
// int marche[][] = new int[8][4];
// int attaque[][] = new int[8][4];
// int touche[][] = new int[8][4];
// final static int DEFAULT_SPRITE=1;
//
// public EntityDisplayer2(Entity associatedEntity, int sprite_num, int[] nb_images,
// int[][] persofixe, int[][] marche, int[][] attaque1, int[][] hit) {
// this.associatedEntity = associatedEntity;
// this.sprite_num = sprite_num;
// for (int i =0; i<persofixe.length-1; i++){
// System.arraycopy(persofixe[i], 0, this.persofixe[i], 0, this.persofixe[i].length);
// System.arraycopy(marche[i], 0, this.marche[i], 0, this.marche[i].length);
// System.arraycopy(attaque[i], 0, this.attaque[i], 0, this.attaque[i].length);
// System.arraycopy(touche[i], 0, this.touche[i], 0, this.touche[i].length);
// }
// }
//
// public PositionedSprite getPositionedSprite(GraphicsMap graphicsMap) {
// /**
// * The purpose of this function is to be called by the gui when it displays the entity related to this displayer
// * @param graphicsMap: the GraphicsMap of the map the associatedEntity is on
// * @return The PositionedSprite that the gui should display to represent this entity
// */
// Sprite sprite = SpriteStorage.getInstance().getRonflex();
//
// Entity entity = getAssociatedEntity();
// GraphicsMapPoint entityPositionGraphicsMapPoint = graphicsMap.makeMapPointFromCoreCoordinates(entity.getX(), entity.getY());
// //applying translation
// GraphicsMapPoint spriteTopLeftGraphicsMapPoint = entityPositionGraphicsMapPoint.translate(-sprite_width / 2, -sprite_height / 2);
// int direction = entity.getDirection().ordinal();
// int x_sprite = 0;
// int y_sprite = 0;
// int sprite_height = 0;
// int sprite_width = 0;
// int nbSprites = DEFAULT_SPRITE;
// int index = direction / 45;
// if (entity.hasAction(STAND)) {
// y_sprite = persofixe[index][0];
// sprite_height = persofixe[index][1];
// sprite_width = persofixe[index][2];
// nbSprites = persofixe[index][3];
// } else if (entity.hasAction(WALK)) {
// y_sprite = marche[index][0];
// sprite_height = marche[index][1];
// sprite_width = marche[index][2];
// nbSprites = marche[index][3];
// } else if (entity.hasAction(ATTACK)) {
// y_sprite = attaque[index][0];
// sprite_height = attaque[index][1];
// sprite_width = attaque[index][2];
// nbSprites = attaque[index][3];
// } else if (entity.hasAction(HIT)) {
// y_sprite = touche[index][0];
// sprite_height = touche[index][1];
// sprite_width = touche[index][2];
// nbSprites = touche[index][3];
// }
//
//
// sprite_num = (sprite_num + 1) % (10 * nbSprites);
// for (int u = 0; u < nbSprites; u++) {
// if (sprite_num < 10 * u) x_sprite = x_sprite + sprite_width;
// }
// Sprite res = new Sprite((sprite.getSpriteImage()).getSubimage(x_sprite, y_sprite, sprite_height, sprite_width));
// return PositionedSprite.PositionSprite(res, spriteTopLeftGraphicsMapPoint);
// }
// public Entity getAssociatedEntity() {
// return associatedEntity;
// }
}
src/graphics/guiSkeleton/entityDisplayer/HealthBarDisplayer.java
View file @
1152216b
...
...
@@ -28,13 +28,10 @@ public class HealthBarDisplayer {
private
static
int
xOffsetForHealthBar
=
2
;
private
static
int
yOffsetForHealthBar
=
2
;
//These 2 variables are are multiplied to the dimensions of the images of healthBar and healthBarContainer to reduce them
// private static float xShrinkRatio = ((float)2)/3;
// private static float yShrinkRatio = ((float)4)/5;
private
static
float
xShrinkRatio
=
((
float
)
2
)/
3
;
private
static
float
yShrinkRatio
=
((
float
)
2
)/
3
;
//TODO topleft unused ?
public
static
PositionedSprite
getPositionedSpriteOfHealthBar
(
Being
being
,
GraphicsMap
graphicsMap
)
{
public
static
PositionedSprite
getPositionedSpriteOfHealthBar
(
Being
being
)
{
int
hp
=
being
.
getHP
();
int
maxHP
=
being
.
getMaxHP
();
float
healthRatio
=
((
float
)
hp
)/
maxHP
;
...
...
src/graphics/guiSkeleton/guiPanel/GUIPanel.java
View file @
1152216b
...
...
@@ -11,8 +11,6 @@ import javax.swing.*;
* The gui changes what it displays by swapping GUIPanels in the mainFrame.
*/
public
abstract
class
GUIPanel
extends
JPanel
implements
PanelAbstraction
{
//The following line is commented because KeyListener does not seem to work in a JPanel
//Private KeyListenerForGUIPanel associatedKeyHandler;
//Store the graphicsMaster that created the guiPanel (there should be only one GraphicsMaster instanciation per application,
// this variable is just there to give the guiPanel the right to call the method changeGUIStateTo de graphicsMaster)
...
...
@@ -24,66 +22,6 @@ public abstract class GUIPanel extends JPanel implements PanelAbstraction{
public
GUIPanel
(
GraphicsMaster
graphicsMaster
)
{
this
.
graphicsMaster
=
graphicsMaster
;
//The following 2 lines are commented because KeyListener does not seem to work in a JPanel
//associatedKeyHandler = new KeyListenerForGUIPanel(this);
setFocusable
(
true
);
}
/**
* This method is called by the gui before displaying the panel
*/
//abstract void initialise();
/**
* This method is called by the gui after this panel is no more displayed
*/
//abstract void finalise();
/**
* Define here what should happen if a key is pressed while this panel has the focus
* @param e
*/
//abstract void keyPressedHandler(KeyEvent e);
//Example of a body one could give to the keyPressedHandler method when implementing a guiPanel
//if(e.getKeyCode() == 27) { // 27 -> Escape
// System.out.println("Escape has been pressed");
//}
/**
* Define here what should happen if a key is released while this panel has the focus
* @param e
*/
//abstract void keyReleasedHandler(KeyEvent e);
/**
* Define here what should happen if a key is typed while this panel has the focus
* @param e
*/
//abstract void keyTypedHandler(KeyEvent e);
}
// The following code is commented because KeyListener does not seem to work on a JPanel
///**
// * This class detects the KeyEvents coming from the keyboard (KeyPressed, KeyReleased and KeyTyped) when the guiPanel
// * it is associated with has the focus, and call the corresponding KeyEvent handler of the associated guiPanel
// */
//class KeyListenerForGUIPanel implements KeyListener {