Skip to content

Commit

Permalink
Final JGameGUI v 0.1 beta patch. There were some javadoc issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanZeigler committed May 4, 2016
1 parent a0af5b6 commit c59c769
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
32 changes: 15 additions & 17 deletions src/main/java/com/ethanzeigler/jgamegui/JGameGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.ethanzeigler.jgamegui.sound.AudioClip;

import javax.swing.*;
import javax.xml.bind.SchemaOutputResolver;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
Expand Down Expand Up @@ -175,8 +174,7 @@ public void addElement(AbstractElement e) {
* @return true if ImageElement was removed from the list of Elements
*/
public boolean removeElement(AbstractElement e) {
boolean returnBool = elements.remove(e);
return returnBool;
return elements.remove(e);
}

/**
Expand All @@ -191,6 +189,7 @@ public void removeAllElements() {
* if priorities are changed within an element this must be called to update the drawing order.
*/
public void updateDrawPriorities() {
//noinspection unchecked
Collections.sort(elements);
}

Expand Down Expand Up @@ -221,7 +220,6 @@ public void paint(Graphics g) {
// create buffer to prevent issues with windows
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D bufferGraphic = bufferedImage.createGraphics();
Graphics2D g2dComponent = (Graphics2D) g;
super.paint(bufferGraphic);
for (AbstractElement element: elements) element.paint(bufferGraphic);
++tickCount;
Expand All @@ -237,7 +235,7 @@ private void onTick() {

/**
* <p>Called before the GUI is updated each frame and can be used to update ImageElement positions.
* This is invoked <i><s>before</s></i> {@link JGameGUI#onScreenUpdate(JGameGUI)} and before
* This is invoked <i><s>before</s></i>
* any animations defined in {@link ImageElement#setAnimation(Animation)}</p>
*
* @param gui The JGameGUI instance that is updating
Expand Down Expand Up @@ -267,7 +265,7 @@ public void stop() {
* Invoked when the mouse button has been clicked (pressed
* and released) on a component.
*
* @param e
* @param e the MouseEvent
*/
@Override
public final void mouseClicked(MouseEvent e) {
Expand All @@ -279,7 +277,7 @@ public final void mouseClicked(MouseEvent e) {
/**
* Invoked when a mouse button has been pressed on a component.
*
* @param e
* @param e the MouseEvent
*/
@Override
public void mousePressed(MouseEvent e) {
Expand All @@ -289,8 +287,8 @@ public void mousePressed(MouseEvent e) {
/**
* Loads an image file from the given path. Use this instead of ImageIcon's constructor, as it is
* temperamental with files.
* @param filePath
* @return
* @param filePath the path to the image file
* @return the ImageIcon if found
*/
public static ImageIcon loadImageFromFile(String filePath) {
return new ImageIcon(JGameGUI.class.getResource("/" + filePath));
Expand All @@ -299,7 +297,7 @@ public static ImageIcon loadImageFromFile(String filePath) {
/**
* Invoked when a mouse button has been released on a component.
*
* @param e
* @param e the MouseEvent
*/
@Override
public void mouseReleased(MouseEvent e) {
Expand All @@ -309,7 +307,7 @@ public void mouseReleased(MouseEvent e) {
/**
* Invoked when the mouse enters a component.
*
* @param e
* @param the MouseEvent
*/
@Override
public void mouseEntered(MouseEvent e) {
Expand All @@ -319,7 +317,7 @@ public void mouseEntered(MouseEvent e) {
/**
* Invoked when the mouse exits a component.
*
* @param e
* @param e the MouseEvent
*/
@Override
public void mouseExited(MouseEvent e) {
Expand All @@ -337,7 +335,7 @@ public void mouseExited(MouseEvent e) {
* <code>MOUSE_DRAGGED</code> events may not be delivered during a native
* Drag&amp;Drop operation.
*
* @param e
* @param e the MouseEvent
*/
@Override
public void mouseDragged(MouseEvent e) {
Expand All @@ -348,7 +346,7 @@ public void mouseDragged(MouseEvent e) {
* Invoked when the mouse cursor has been moved onto a component
* but no buttons have been pushed.
*
* @param e
* @param e the MouseEvent
*/
@Override
public void mouseMoved(MouseEvent e) {
Expand All @@ -361,7 +359,7 @@ public void mouseMoved(MouseEvent e) {
* See the class description for {@link KeyEvent} for a definition of
* a key typed event.
*
* @param e
* @param e the KeyEvent
*/
@Override
public void keyTyped(KeyEvent e) {
Expand All @@ -373,7 +371,7 @@ public void keyTyped(KeyEvent e) {
* See the class description for {@link KeyEvent} for a definition of
* a key pressed event.
*
* @param e
* @param e the KeyEvent
*/
@Override
public void keyPressed(KeyEvent e) {
Expand All @@ -385,7 +383,7 @@ public void keyPressed(KeyEvent e) {
* See the class description for {@link KeyEvent} for a definition of
* a key released event.
*
* @param e
* @param e the KeyEvent
*/
@Override
public void keyReleased(KeyEvent e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/ethanzeigler/jgamegui/element/Sized.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ethanzeigler.jgamegui.element;

/**
* Created by ethanzeigler on 4/5/16.
* Represents an elemet with size
*/
public interface Sized {
/**
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/ethanzeigler/jgamegui/sound/AudioClip.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ public AudioClip(String fileName) {
e.printStackTrace();
System.out.println("File type is unsupported. Convert your file to a \".wav\"");
isOpen = false;
} catch (IOException e) {
e.printStackTrace();
isOpen = false;
} catch (LineUnavailableException e) {
} catch (IOException | LineUnavailableException e) {
e.printStackTrace();
isOpen = false;
}
Expand Down

0 comments on commit c59c769

Please sign in to comment.