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
2348118f
Commit
2348118f
authored
Jan 06, 2016
by
Thomas Dupriez
Browse files
Some cleanup ep2
parent
f16d0f12
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/graphics/guiSkeleton/guiPanel/GUIPanel.java
View file @
2348118f
...
...
@@ -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 {
//
// private guiPanel associatedGUIPanel;
//
// KeyListenerForGUIPanel(guiPanel associatedGUIPanel) {
// this.associatedGUIPanel = associatedGUIPanel;
// }
//
// public final void keyPressed(KeyEvent e) {
// associatedGUIPanel.keyPressedHandler(e);
// }
//
// public final void keyReleased(KeyEvent e) {
// associatedGUIPanel.keyReleasedHandler(e);
// }
//
// public final void keyTyped(KeyEvent e) {
// associatedGUIPanel.keyTypedHandler(e);
// }
//}
}
\ No newline at end of file
src/graphics/guiSkeleton/mapManagement/GamePanelMapPoint.java
View file @
2348118f
...
...
@@ -32,8 +32,4 @@ public class GamePanelMapPoint {
public
int
getY
()
{
return
Y
;
}
//TODO: Useful?
public
GraphicsMapPoint
getGraphicsMapPoint
()
{
return
graphicsMapPoint
;
}
}
src/graphics/guiSkeleton/sprites/Sprite.java
View file @
2348118f
...
...
@@ -5,7 +5,7 @@ import java.io.Serializable;
/**
* Created by dupriez on 03/11/15.
* Represents a basic sprite with no animation.
* Represents a basic sprite with no animation
(just an image in fact)
.
*/
public
class
Sprite
implements
Serializable
,
Displayable
{
...
...
src/graphics/guiSkeleton/sprites/SpriteLoader.java
View file @
2348118f
...
...
@@ -31,11 +31,9 @@ public abstract class SpriteLoader {
Sprite
newSprite
=
null
;
//The sprite asked is not in the map, so we load it and add it to the map
try
{
// newSprite = new Sprite(ImageIO.read(new File(path)));
URL
url
=
UsedForLoadingSprites
.
getInstance
().
getClass
().
getResource
(
path
);
if
(
url
==
null
)
throw
new
IllegalStateException
(
"Missing sprite :"
+
path
+
"!"
);
//System.out.println(url);
newSprite
=
new
Sprite
(
ImageIO
.
read
(
url
));
}
catch
(
IOException
e
)
{
Logging
.
getInstance
().
getLogger
().
severe
(
e
.
getMessage
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment