Skip to content

Commit

Permalink
Merge pull request #45 from TeodorHMX1/annotation
Browse files Browse the repository at this point in the history
Annotation
  • Loading branch information
teogor authored Jul 18, 2020
2 parents 35de2fc + d9dc3ff commit 647eb3f
Show file tree
Hide file tree
Showing 14 changed files with 212 additions and 84 deletions.
14 changes: 13 additions & 1 deletion src/app/enumerations/TeamMembers.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: TeamMembers.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 26/05/20
*/
package app.enumerations;

public enum TeamMembers {
public enum TeamMembers
{
players_2,
players_4
}
11 changes: 11 additions & 0 deletions src/app/game/Game.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: Game.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.2 game controls added
* Date: 14/06/20
*/
package app.game;

import app.game.control.GameControls;
Expand Down
15 changes: 11 additions & 4 deletions src/app/game/control/GameControls.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: GameControls.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.8 speed added
* Date: 18/06/20
*/
package app.game.control;

import app.utils.AppUtils;
Expand All @@ -8,11 +19,7 @@
import app.utils.material.MaterialSlider;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class GameControls
{
Expand Down
16 changes: 12 additions & 4 deletions src/app/game/options/GameOptions.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: GameOptions.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.9 compass label added
* Date: 17/06/20
*/
package app.game.options;

import app.enumerations.TeamMembers;
import app.game.world.GameWorld;
import app.interfaces.GameSpeed;
import app.utils.AppUtils;
import app.utils.enums.*;
import app.utils.enums.Directions;
import app.utils.material.MaterialButton;
import app.utils.material.MaterialElements;
import app.utils.material.MaterialLabel;

import javax.swing.*;
import java.awt.*;
import javax.swing.Timer;

public class GameOptions
{
Expand Down
23 changes: 16 additions & 7 deletions src/app/game/world/GameWorld.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: GameWorld.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 2.3 middle wall added
* Date: 19/06/20
*/
package app.game.world;

import app.enumerations.TeamMembers;
Expand All @@ -15,7 +26,6 @@

import static app.utils.AssetsUtils.IMG_BRICKS;
import static app.utils.AssetsUtils.IMG_WHITE_SQUARE;
import static java.lang.String.valueOf;

public class GameWorld
{
Expand Down Expand Up @@ -173,8 +183,7 @@ private void moveBallTo(Directions direction)
{
bounceBall();
}
}
else
} else
{
if (isCollidingB(mPlayers.get(i).getLocation(), mBallObj.getLocation()))
{
Expand Down Expand Up @@ -315,7 +324,7 @@ private void addTeamA()
Player mPlayer1 = AppUtils.getPlayer(1);

MaterialLabel mPlayerLabel = materialElements.createLabel("");
mPlayerLabel.setIcon(mPlayer1.getBabyImage());
mPlayerLabel.setIcon(mPlayer1.getPlayerImg());
mPlayerLabel.setLocation(0, 0);

JPanel mPlayerJPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
Expand All @@ -330,7 +339,7 @@ private void addTeamA()
Player mPlayer3 = AppUtils.getPlayer(3);

mPlayerLabel = materialElements.createLabel("");
mPlayerLabel.setIcon(mPlayer3.getBabyImage());
mPlayerLabel.setIcon(mPlayer3.getPlayerImg());
mPlayerLabel.setLocation(0, 0);

mPlayerJPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
Expand All @@ -355,7 +364,7 @@ private void addTeamB()
Player mPlayer1 = AppUtils.getPlayer(2);

MaterialLabel mPlayerLabel = materialElements.createLabel("");
mPlayerLabel.setIcon(mPlayer1.getBabyImage());
mPlayerLabel.setIcon(mPlayer1.getPlayerImg());
mPlayerLabel.setLocation(0, 0);

JPanel mPlayerJPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
Expand All @@ -370,7 +379,7 @@ private void addTeamB()
Player mPlayer3 = AppUtils.getPlayer(4);

mPlayerLabel = materialElements.createLabel("");
mPlayerLabel.setIcon(mPlayer3.getBabyImage());
mPlayerLabel.setIcon(mPlayer3.getPlayerImg());
mPlayerLabel.setLocation(0, 0);

mPlayerJPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
Expand Down
17 changes: 15 additions & 2 deletions src/app/interfaces/BallCallback.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: BallCallback.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 02/06/20
*/
package app.interfaces;

import app.utils.enums.Directions;

public interface BallCallback {
public interface BallCallback
{

interface AutoMoveBall {
interface AutoMoveBall
{
void moveTo(Directions direction);
}

Expand Down
14 changes: 13 additions & 1 deletion src/app/interfaces/GameSpeed.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: GameSpeed.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 23/06/20
*/
package app.interfaces;

public interface GameSpeed {
public interface GameSpeed
{
void onSpeedChanged();
}
17 changes: 15 additions & 2 deletions src/app/interfaces/GameTimer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: GameTimer.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 15/06/20
*/
package app.interfaces;

public interface GameTimer {
public interface GameTimer
{

interface GameStarted {
interface GameStarted
{
void isRunning(boolean running);
}

Expand Down
14 changes: 13 additions & 1 deletion src/app/interfaces/TeamMembersNumber.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: TeamMembersNumber.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 12/06/20
*/
package app.interfaces;

import app.enumerations.TeamMembers;

public interface TeamMembersNumber {
public interface TeamMembersNumber
{
void onMembersChanged(TeamMembers players);
}
35 changes: 28 additions & 7 deletions src/app/menu/MenuActivity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: MenuActivity.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.3 HelpOption Menu Added
* Date: 18/05/20
*/
package app.menu;

import javax.swing.*;
import java.awt.event.*;
import java.awt.event.KeyEvent;

import static app.utils.AppUtils.getAppWindow;

/**
* MenuActivity Class creates the menu from the top
* of the window
*/
public class MenuActivity
{

Expand Down Expand Up @@ -40,7 +55,8 @@ public void prepareMenu()

}

private JMenu fileOptionMenu() {
private JMenu fileOptionMenu()
{

var fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
Expand All @@ -54,39 +70,44 @@ private JMenu fileOptionMenu() {

}

private JMenu scenarioOptionMenu() {
private JMenu scenarioOptionMenu()
{

var scenarioMenu = new JMenu("Scenario");
scenarioMenu.setMnemonic(KeyEvent.VK_S);
return scenarioMenu;

}

private JMenu editOptionMenu() {
private JMenu editOptionMenu()
{

var editMenu = new JMenu("Edit");
editMenu.setMnemonic(KeyEvent.VK_E);
return editMenu;

}

private JMenu controlsOptionMenu() {
private JMenu controlsOptionMenu()
{

var controlsMenu = new JMenu("Controls");
controlsMenu.setMnemonic(KeyEvent.VK_C);
return controlsMenu;

}

private JMenu toolsOptionMenu() {
private JMenu toolsOptionMenu()
{

var controlsMenu = new JMenu("Tools");
controlsMenu.setMnemonic(KeyEvent.VK_T);
return controlsMenu;

}

private JMenu helpOptionMenu() {
private JMenu helpOptionMenu()
{

var helpMenu = new JMenu("Help");
helpMenu.setMnemonic(KeyEvent.VK_H);
Expand Down
17 changes: 16 additions & 1 deletion src/app/menu/MenuUI.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
/**
* Program: Assignment 2: Application – Baby Ball Bounce
* Filename: Menu UI.java
*
* @author: © Teodor Grigor (GitHub - TeodorHMX1)
* Course: BSc Computing Year 1
* Module: CSY1020 Problem Solving & Programming
* Tutor: Gary Hill
* @version: 1.0 File created
* Date: 17/05/20
*/
package app.menu;

import javax.swing.*;
import java.awt.*;

/**
* MenuUI changes the style for an element
*/
public class MenuUI extends JMenuBar
{

@Override
protected void paintComponent(Graphics g) {
protected void paintComponent(Graphics g)
{

super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
Expand Down
Loading

0 comments on commit 647eb3f

Please sign in to comment.