Change over to gradle build system

Signed-off-by: Chris Cromer <chris@cromer.cl>
This commit is contained in:
2019-10-03 20:16:37 -03:00
parent 6b39c45d79
commit 7d48b1ccb5
312 changed files with 502 additions and 331 deletions

View File

@@ -1,15 +0,0 @@
Manifest-Version: 1.0
Main-Class: cl.cromer.azaraka.Main
Class-Path: lib/gson-2.8.5.jar lib/junit-jupiter-5.5.2.jar lib/junit-jupiter-api-5.5
.2.jar lib/apiguardian-api-1.1.0.jar lib/opentest4j-1.2.0.jar lib/junit-platform-co
mmons-1.5.2.jar lib/junit-jupiter-params-5.5.2.jar lib/junit-jupiter-engine-5.5
.2.jar lib/junit-platform-engine-1.5.2.jar
Name: cl/cromer/game/
Specification-Title: La Aventura de Azaraka
Specification-Version: 1.0
Specification-Vendor: Chris Cromer
Implementation-Title: cl.cromer.azaraka
Implementation-Version: build1
Implementation-Vendor: Chris Cromer
Name: cl/cromer/game/
Sealed: true

View File

@@ -57,10 +57,11 @@ public class Celda extends JComponent implements Constantes {
/**
* Initialize the cell with its coordinates
*
* @param xPixels The x graphical coordinate
* @param yPixels The y graphical coordinate
* @param x The x coordinate of the cell
* @param y The y coordinate of the cell
* @param x The x coordinate of the cell
* @param y The y coordinate of the cell
*/
public Celda(int xPixels, int yPixels, int x, int y) {
this.xPixels = xPixels;
@@ -135,6 +136,7 @@ public class Celda extends JComponent implements Constantes {
/**
* Override the paintComponent method of JComponent to paint the cell based on type
*
* @param g The graphics object to paint
*/
@Override
@@ -144,6 +146,7 @@ public class Celda extends JComponent implements Constantes {
/**
* Override the update method of JComponent to do double buffering
*
* @param g The graphics object to paint
*/
@Override

View File

@@ -34,35 +34,6 @@ public interface Constantes {
* The name of the game
*/
String TITLE = "La Aventura de Azaraka";
/**
* Get a logger object to use for debugging
*
* @param logClass The class that is in need of a logger
* @param logLevel What log level to use
* @return Returns the logger
*/
default Logger getLogger(Class logClass, LogLevel logLevel) {
String className = logClass.getName();
Logger logger;
if (GLOBAL_LOG) {
logger = Logger.getGlobal();
}
else {
logger = Logger.getLogger(className);
}
if (logger.getHandlers().length == 0) {
initializeLogger(logClass);
}
if (GLOBAL_LOG) {
logger.setLevel(LogLevel.GLOBAL.getLevel());
}
else {
logger.setLevel(logLevel.getLevel());
}
return logger;
}
/**
* Use a global log if true or individual logs if false
*/
@@ -144,6 +115,34 @@ public interface Constantes {
*/
Font FONT = new Font("monospaced", Font.PLAIN, FONT_SIZE);
/**
* Get a logger object to use for debugging
*
* @param logClass The class that is in need of a logger
* @param logLevel What log level to use
* @return Returns the logger
*/
default Logger getLogger(Class logClass, LogLevel logLevel) {
String className = logClass.getName();
Logger logger;
if (GLOBAL_LOG) {
logger = Logger.getGlobal();
}
else {
logger = Logger.getLogger(className);
}
if (logger.getHandlers().length == 0) {
initializeLogger(logClass);
}
if (GLOBAL_LOG) {
logger.setLevel(LogLevel.GLOBAL.getLevel());
}
else {
logger.setLevel(logLevel.getLevel());
}
return logger;
}
/**
* Generate a random number between given min and max
*

View File

@@ -55,6 +55,10 @@ public class Escenario extends JComponent implements Constantes {
* The cells of the game
*/
private final Celda[][] celdas;
/**
* The logger
*/
private final Logger logger;
/**
* A collection of tiles that can be used in the scene
*/
@@ -63,10 +67,6 @@ public class Escenario extends JComponent implements Constantes {
* Whether or not the door is closed yet
*/
private boolean doorClosed = false;
/**
* The logger
*/
private final Logger logger;
/**
* Initialize the scene
@@ -463,6 +463,7 @@ public class Escenario extends JComponent implements Constantes {
/**
* Get the parent canvas of this scene
*
* @return Returns the parent canvas
*/
public Lienzo getCanvas() {

View File

@@ -40,22 +40,10 @@ public class Lienzo extends Canvas implements Constantes {
* The game scene
*/
private final Escenario escenario;
/**
* The graphics buffer
*/
private Graphics graphicBuffer;
/**
* The image buffer
*/
private Image imageBuffer;
/**
* The threads for the objects
*/
private final HashMap<Object, Thread> threads = new HashMap<>();
/**
* The player
*/
private Player player;
/**
* The enemies
*/
@@ -68,10 +56,6 @@ public class Lienzo extends Canvas implements Constantes {
* The chests
*/
private final ArrayList<Chest> chests = new ArrayList<>();
/**
* The magic portal
*/
private Portal portal;
/**
* The logger
*/
@@ -80,6 +64,22 @@ public class Lienzo extends Canvas implements Constantes {
* The game over animation
*/
private final Animation gameOverAnimation;
/**
* The graphics buffer
*/
private Graphics graphicBuffer;
/**
* The image buffer
*/
private Image imageBuffer;
/**
* The player
*/
private Player player;
/**
* The magic portal
*/
private Portal portal;
/**
* The hearts animation
*/
@@ -196,6 +196,7 @@ public class Lienzo extends Canvas implements Constantes {
/**
* Override the paint method of Canvas to paint all the scene components
*
* @param g The graphics object to paint
*/
@Override

View File

@@ -37,9 +37,10 @@ public class Main implements Constantes {
/**
* Open the main window
*
* @param args The arguments passed to the application
*/
public static void main (String[]args) {
public static void main(String[] args) {
new Main();
}

View File

@@ -40,8 +40,9 @@ public class Chest extends Object implements Constantes {
/**
* Initialize the chest
*
* @param escenario The scene the chest is in
* @param celda The cell that contains the chest
* @param celda The cell that contains the chest
*/
public Chest(Escenario escenario, Celda celda) {
super(escenario, celda);
@@ -91,19 +92,6 @@ public class Chest extends Object implements Constantes {
return state;
}
/**
* Play the chest opening sound
*/
private void playChestOpenSound() {
try {
sound.setVolume(getEscenario().getCanvas().getVolume());
sound.play();
}
catch (SoundException e) {
getLogger().warning(e.getMessage());
}
}
/**
* Sets the state of the chest
*
@@ -130,6 +118,19 @@ public class Chest extends Object implements Constantes {
}
}
/**
* Play the chest opening sound
*/
private void playChestOpenSound() {
try {
sound.setVolume(getEscenario().getCanvas().getVolume());
sound.play();
}
catch (SoundException e) {
getLogger().warning(e.getMessage());
}
}
/**
* Animate the chest opening
*/

View File

@@ -30,6 +30,10 @@ import java.util.concurrent.locks.Lock;
* This class handles the enemy object
*/
public class Enemy extends Object implements Constantes {
/**
* The lock helps prevent race conditions when checking positioning
*/
private final Lock lock;
/**
* The current direction the enemy is facing
*/
@@ -38,10 +42,6 @@ public class Enemy extends Object implements Constantes {
* The speed of the enemy
*/
private int speed = 500;
/**
* The lock helps prevent race conditions when checking positioning
*/
private final Lock lock;
/**
* The enemy attack sound
*/
@@ -51,8 +51,8 @@ public class Enemy extends Object implements Constantes {
* Initialize the enemy
*
* @param escenario The scene the enemy is in
* @param celda The cell this enemy is in
* @param lock The lock used to prevent the threads from conflicting
* @param celda The cell this enemy is in
* @param lock The lock used to prevent the threads from conflicting
*/
public Enemy(Escenario escenario, Celda celda, Lock lock) {
super(escenario, celda);

View File

@@ -27,6 +27,16 @@ public class Gem extends Object {
*/
private State state = State.TAINTED;
/**
* Initialize the gem object
*
* @param escenario The scene the gem is in
* @param celda The cell the gem is in
*/
public Gem(Escenario escenario, Celda celda) {
super(escenario, celda);
}
/**
* The possible states of the gem
*/
@@ -40,14 +50,4 @@ public class Gem extends Object {
*/
PURIFIED
}
/**
* Initialize the gem object
*
* @param escenario The scene the gem is in
* @param celda The cell the gem is in
*/
public Gem(Escenario escenario, Celda celda) {
super(escenario, celda);
}
}

View File

@@ -29,6 +29,10 @@ import java.util.logging.Logger;
* All game objects extend this class
*/
public class Object implements Runnable {
/**
* The scene the object is in
*/
private final Escenario escenario;
/**
* The current x position of the object
*/
@@ -37,10 +41,6 @@ public class Object implements Runnable {
* The current y position of the object
*/
private int y;
/**
* The scene the object is in
*/
private final Escenario escenario;
/**
* The cell the object is in
*/
@@ -129,6 +129,15 @@ public class Object implements Runnable {
return celda;
}
/**
* Get the cell the object is in
*
* @param celda The cell
*/
protected void setCelda(Celda celda) {
this.celda = celda;
}
/**
* Get the current animation
*
@@ -212,15 +221,6 @@ public class Object implements Runnable {
}
}
/**
* Get the cell the object is in
*
* @param celda The cell
*/
protected void setCelda(Celda celda) {
this.celda = celda;
}
/**
* Get the logger
*

View File

@@ -32,14 +32,14 @@ public class Player extends Object implements Constantes {
* The maximum health of the player
*/
public final static int MAX_HEALTH = 8;
/**
* The current health of the player
*/
private int health = MAX_HEALTH;
/**
* Objects that the player is carrying
*/
private final ArrayList<Object> carrying = new ArrayList<>();
/**
* The current health of the player
*/
private int health = MAX_HEALTH;
/**
* Initialize the player

View File

@@ -42,7 +42,7 @@ public class Portal extends Object implements Constantes {
* Initialize the portal
*
* @param escenario The scene that contains the portal
* @param celda The cell the portal is in
* @param celda The cell the portal is in
*/
public Portal(Escenario escenario, Celda celda) {
super(escenario, celda);

View File

@@ -27,10 +27,6 @@ import java.util.logging.Logger;
* This class handles sound
*/
public class Sound implements Constantes {
/**
* The sound clip to play
*/
private Clip sound;
/**
* The path to the sound
*/
@@ -39,6 +35,10 @@ public class Sound implements Constantes {
* The logger
*/
private final Logger logger;
/**
* The sound clip to play
*/
private Clip sound;
/**
* Load the sound
@@ -71,6 +71,7 @@ public class Sound implements Constantes {
/**
* Play the sound
*
* @throws SoundException Thrown if the sound clip is null
*/
public void play() throws SoundException {
@@ -104,6 +105,7 @@ public class Sound implements Constantes {
/**
* Stop the sound
*
* @throws SoundException Thrown if the sound clip is null
*/
public void stop() throws SoundException {
@@ -119,6 +121,7 @@ public class Sound implements Constantes {
/**
* Set the number of loops to play
*
* @param loops The number of loops, should be n-1
* @throws SoundException Thrown if the sound is null
*/

View File

@@ -29,6 +29,14 @@ import java.util.logging.Logger;
* This class handles loading the images and animating the sprite
*/
public class Animation implements Cloneable, Constantes {
/**
* The collection of all the images that make up the object
*/
private final HashMap<Direction, ArrayList<BufferedImage>> imageHash;
/**
* The logger
*/
private final Logger logger;
/**
* The current frame the sprite should be showing
*/
@@ -45,14 +53,6 @@ public class Animation implements Cloneable, Constantes {
* The direction of the image to show
*/
private Direction currentDirection = Direction.NONE;
/**
* The collection of all the images that make up the object
*/
private final HashMap<Direction, ArrayList<BufferedImage>> imageHash;
/**
* The logger
*/
private final Logger logger;
/**
* Initialize the sprite
@@ -65,8 +65,8 @@ public class Animation implements Cloneable, Constantes {
/**
* Scale an image
*
* @param image The image to scale
* @param width The new width
* @param image The image to scale
* @param width The new width
* @param height The new height
* @return Returns the scaled image
*/
@@ -141,7 +141,7 @@ public class Animation implements Cloneable, Constantes {
* Add an image to the animation
*
* @param direction The direction to add the image to
* @param path The path to the sprite e.g. res/player/image.png
* @param path The path to the sprite e.g. res/player/image.png
*/
public void addImage(Direction direction, String path) {
try {
@@ -157,7 +157,7 @@ public class Animation implements Cloneable, Constantes {
/**
* Add an image to the animation
*
* @param direction The direction to add the image to
* @param direction The direction to add the image to
* @param bufferedImage The path to the sprite e.g. res/player/image.png
*/
public void addImage(Direction direction, BufferedImage bufferedImage) {

View File

@@ -35,9 +35,9 @@ public class Sheet implements Constantes {
/**
* Initialize the texture collection
*
* @param path The path to the image
* @param path The path to the image
* @param height The height of the textures in the image
* @param width The width of the textures in the image
* @param width The width of the textures in the image
*/
public Sheet(String path, int height, int width) {
images = new ArrayList<>();
@@ -63,8 +63,8 @@ public class Sheet implements Constantes {
/**
* Returns the selected texture
*
* @return Returns the current texture
* @param textureNumber The texture to get from the collection
* @return Returns the current texture
* @throws SheetException Thrown when there are no images in the texture collection
*/
public BufferedImage getTexture(int textureNumber) throws SheetException {

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

BIN
src/main/resources/img/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1007 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 977 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More