Aufgabe 2.1 + reindent project
This commit is contained in:
parent
1f5c6edd03
commit
c9f87ace17
@ -6,7 +6,6 @@ import java.awt.Color;
|
|||||||
* A class that contains all constant values to configure the game
|
* A class that contains all constant values to configure the game
|
||||||
*
|
*
|
||||||
* @author dmlux, modified by I. Schumacher
|
* @author dmlux, modified by I. Schumacher
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import break_out.view.View;
|
|||||||
* are initialized here.
|
* are initialized here.
|
||||||
*
|
*
|
||||||
* @author dmlux, modified by I. Schumacher
|
* @author dmlux, modified by I. Schumacher
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ import break_out.view.View;
|
|||||||
* The controller takes care of the input events and reacts on those events by
|
* The controller takes care of the input events and reacts on those events by
|
||||||
* manipulating the view and updates the model.
|
* manipulating the view and updates the model.
|
||||||
*
|
*
|
||||||
* @author dmlux, modified by I. Schumacher and I. Traupe
|
* @author dmlux, modified by I. Schumacher and I. Traupe, modified by Gruppe 175
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Controller implements ActionListener, KeyListener {
|
public class Controller implements ActionListener, KeyListener {
|
||||||
|
|
||||||
@ -32,8 +31,7 @@ public class Controller implements ActionListener, KeyListener {
|
|||||||
/**
|
/**
|
||||||
* The constructor expects a view to construct itself.
|
* The constructor expects a view to construct itself.
|
||||||
*
|
*
|
||||||
* @param view
|
* @param view The view that is connected to this controller
|
||||||
* The view that is connected to this controller
|
|
||||||
*/
|
*/
|
||||||
public Controller(View view) {
|
public Controller(View view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
@ -101,6 +99,7 @@ public class Controller implements ActionListener, KeyListener {
|
|||||||
/**
|
/**
|
||||||
* This method will be called, after a key was typed. This means, that the key
|
* This method will be called, after a key was typed. This means, that the key
|
||||||
* was pressed and released, before this method get called.
|
* was pressed and released, before this method get called.
|
||||||
|
*
|
||||||
* @param e The key event
|
* @param e The key event
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -110,6 +109,7 @@ public class Controller implements ActionListener, KeyListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called, after a key was pressed down.
|
* This method will be called, after a key was pressed down.
|
||||||
|
*
|
||||||
* @param e The key event
|
* @param e The key event
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -119,6 +119,7 @@ public class Controller implements ActionListener, KeyListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called, after a key was released.
|
* This method will be called, after a key was released.
|
||||||
|
*
|
||||||
* @param e The key event
|
* @param e The key event
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,7 +7,6 @@ import break_out.Constants;
|
|||||||
*
|
*
|
||||||
* @author iSchumacher
|
* @author iSchumacher
|
||||||
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Ball implements IBall {
|
public class Ball implements IBall {
|
||||||
|
|
||||||
@ -31,12 +30,13 @@ public class Ball implements IBall{
|
|||||||
this.direction.rescale();
|
this.direction.rescale();
|
||||||
|
|
||||||
// start at bottom-center
|
// start at bottom-center
|
||||||
this.position.setX((Constants.SCREEN_WIDTH - Constants.BALL_DIAMETER)/2);
|
this.position.setX((Constants.SCREEN_WIDTH - Constants.BALL_DIAMETER) / 2.0);
|
||||||
this.position.setY(Constants.SCREEN_HEIGHT-Constants.BALL_DIAMETER);
|
this.position.setY(Constants.SCREEN_HEIGHT - Constants.BALL_DIAMETER - Constants.PADDLE_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The getter for the balls position
|
* The getter for the balls position
|
||||||
|
*
|
||||||
* @return position The balls current position
|
* @return position The balls current position
|
||||||
*/
|
*/
|
||||||
public Position getPosition() {
|
public Position getPosition() {
|
||||||
@ -45,6 +45,7 @@ public class Ball implements IBall{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The getter for the balls direction
|
* The getter for the balls direction
|
||||||
|
*
|
||||||
* @return direction The balls current direction
|
* @return direction The balls current direction
|
||||||
*/
|
*/
|
||||||
public Vector2D getDirection() {
|
public Vector2D getDirection() {
|
||||||
|
@ -9,8 +9,7 @@ import break_out.view.View;
|
|||||||
/**
|
/**
|
||||||
* This class contains information about the game (the model in MVC)
|
* This class contains information about the game (the model in MVC)
|
||||||
*
|
*
|
||||||
* @author dmlux, modified by I. Schumacher
|
* @author dmlux, modified by I. Schumacher, modified by Gruppe 175
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Game {
|
public class Game {
|
||||||
|
|
||||||
@ -47,8 +46,7 @@ public class Game {
|
|||||||
/**
|
/**
|
||||||
* The constructor creates a new game instance with the given Controller
|
* The constructor creates a new game instance with the given Controller
|
||||||
*
|
*
|
||||||
* @param controller
|
* @param controller The controller to manage this instance (MVC-patter)
|
||||||
* The controller to manage this instance (MVC-patter)
|
|
||||||
*/
|
*/
|
||||||
public Game(Controller controller) {
|
public Game(Controller controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
@ -102,10 +100,8 @@ public class Game {
|
|||||||
* maxLevel. If the current level is higher than maxLevel the view will be
|
* maxLevel. If the current level is higher than maxLevel the view will be
|
||||||
* switched to the startScreen.
|
* switched to the startScreen.
|
||||||
*
|
*
|
||||||
* @param levelnr
|
* @param levelnr The number for the next level
|
||||||
* The number for the next level
|
* @param score The current players score after finishing the previous level.
|
||||||
* @param score
|
|
||||||
* The current players score after finishing the previous level.
|
|
||||||
*/
|
*/
|
||||||
public void createLevel(int levelnr, int score) {
|
public void createLevel(int levelnr, int score) {
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package break_out.model;
|
package break_out.model;
|
||||||
|
|
||||||
|
|
||||||
|
import break_out.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains information about the running game
|
* This class contains information about the running game
|
||||||
*
|
*
|
||||||
@ -8,7 +10,7 @@ package break_out.model;
|
|||||||
* @author I. Schumacher
|
* @author I. Schumacher
|
||||||
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
||||||
*/
|
*/
|
||||||
public class Level extends Thread {
|
public class Level extends Thread implements ILevel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The game to which the level belongs
|
* The game to which the level belongs
|
||||||
@ -35,9 +37,15 @@ public class Level extends Thread {
|
|||||||
*/
|
*/
|
||||||
private boolean ballWasStarted = true;
|
private boolean ballWasStarted = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The paddles of the level
|
||||||
|
*/
|
||||||
|
private Paddle paddleTop, paddleBottom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor creates a new level object and needs the current game object,
|
* The constructor creates a new level object and needs the current game object,
|
||||||
* the number of the level to be created and the current score
|
* the number of the level to be created and the current score
|
||||||
|
*
|
||||||
* @param game The game object
|
* @param game The game object
|
||||||
* @param levelnr The number of the new level object
|
* @param levelnr The number of the new level object
|
||||||
* @param score The score
|
* @param score The score
|
||||||
@ -48,11 +56,20 @@ public class Level extends Thread {
|
|||||||
this.score = score;
|
this.score = score;
|
||||||
this.ball = new Ball();
|
this.ball = new Ball();
|
||||||
|
|
||||||
|
// calc paddle positions
|
||||||
|
Position posPaddleTop = new Position((Constants.SCREEN_WIDTH - Constants.PADDLE_WIDTH) / 2.0, 0);
|
||||||
|
Position posPaddleBottom = new Position((Constants.SCREEN_WIDTH - Constants.PADDLE_WIDTH) / 2.0, Constants.SCREEN_HEIGHT - Constants.PADDLE_HEIGHT);
|
||||||
|
|
||||||
|
// set paddles
|
||||||
|
this.paddleTop = new Paddle(posPaddleTop);
|
||||||
|
this.paddleBottom = new Paddle(posPaddleBottom);
|
||||||
|
|
||||||
loadLevelData(levelnr);
|
loadLevelData(levelnr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The getter for the ball object
|
* The getter for the ball object
|
||||||
|
*
|
||||||
* @return ball The ball of the level
|
* @return ball The ball of the level
|
||||||
*/
|
*/
|
||||||
public Ball getBall() {
|
public Ball getBall() {
|
||||||
@ -75,6 +92,7 @@ public class Level extends Thread {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the ball is moving or stopped
|
* Returns if the ball is moving or stopped
|
||||||
|
*
|
||||||
* @return ballWasStarted True: the ball is moving; false: the ball is stopped
|
* @return ballWasStarted True: the ball is moving; false: the ball is stopped
|
||||||
*/
|
*/
|
||||||
public boolean ballWasStarted() {
|
public boolean ballWasStarted() {
|
||||||
@ -114,12 +132,31 @@ public class Level extends Thread {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the information for the level from a json-file located in the folder /res of the project
|
* Loads the information for the level from a json-file located in the folder /res of the project
|
||||||
|
*
|
||||||
* @param levelnr The number X for the LevelX.json file
|
* @param levelnr The number X for the LevelX.json file
|
||||||
*/
|
*/
|
||||||
private void loadLevelData(int levelnr) {
|
private void loadLevelData(int levelnr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the top paddle object
|
||||||
|
*
|
||||||
|
* @return paddleTop The top paddle of the level
|
||||||
|
*/
|
||||||
|
public Paddle getPaddleTop() {
|
||||||
|
return paddleTop;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the bottom paddle object
|
||||||
|
*
|
||||||
|
* @return paddleBottom The bottom paddle of the level
|
||||||
|
*/
|
||||||
|
public Paddle getPaddleBottom() {
|
||||||
|
return paddleBottom;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
115
src/break_out/model/Paddle.java
Normal file
115
src/break_out/model/Paddle.java
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
package break_out.model;
|
||||||
|
|
||||||
|
import break_out.Constants;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the information about the paddles characteristics and behavior
|
||||||
|
*
|
||||||
|
* @author Gruppe 175: Moritz Henseleit, Ruben Meyer
|
||||||
|
*/
|
||||||
|
public class Paddle implements IPaddle {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The paddles position on the playground
|
||||||
|
*/
|
||||||
|
private Position position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The paddles sizing
|
||||||
|
*/
|
||||||
|
private double width;
|
||||||
|
private double height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The paddles color
|
||||||
|
*/
|
||||||
|
private Color color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor of a paddle
|
||||||
|
*/
|
||||||
|
public Paddle(Position position) {
|
||||||
|
this.position = position;
|
||||||
|
|
||||||
|
// set sizing
|
||||||
|
width = Constants.PADDLE_WIDTH;
|
||||||
|
height = Constants.PADDLE_HEIGHT;
|
||||||
|
|
||||||
|
// set color
|
||||||
|
color = Color.CYAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the paddles position
|
||||||
|
*
|
||||||
|
* @return position The paddles current position
|
||||||
|
*/
|
||||||
|
public Position getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setter for the paddles position
|
||||||
|
*
|
||||||
|
* @param position The paddles new position
|
||||||
|
*/
|
||||||
|
public void setPosition(Position position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the paddles color
|
||||||
|
*
|
||||||
|
* @return color The paddles current color
|
||||||
|
*/
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setter for the paddles color
|
||||||
|
*
|
||||||
|
* @param color The paddles new color
|
||||||
|
*/
|
||||||
|
public void setColor(Color color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the paddles width
|
||||||
|
*
|
||||||
|
* @return width The paddles current width
|
||||||
|
*/
|
||||||
|
public double getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setter for the paddles width
|
||||||
|
*
|
||||||
|
* @param width The paddles new width
|
||||||
|
*/
|
||||||
|
public void setWidth(double width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The getter for the paddles height
|
||||||
|
*
|
||||||
|
* @return height The paddles current height
|
||||||
|
*/
|
||||||
|
public double getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The setter for the paddles height
|
||||||
|
*
|
||||||
|
* @param height The paddles new height
|
||||||
|
*/
|
||||||
|
public void setHeight(double height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,6 @@ package break_out.model;
|
|||||||
* This class represents a position within the board in pixel coordinates
|
* This class represents a position within the board in pixel coordinates
|
||||||
*
|
*
|
||||||
* @author dmlux
|
* @author dmlux
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class Position {
|
public class Position {
|
||||||
|
|
||||||
@ -41,6 +40,7 @@ public class Position {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the x-coordinate
|
* Setter for the x-coordinate
|
||||||
|
*
|
||||||
* @param x The new x-coordinate
|
* @param x The new x-coordinate
|
||||||
*/
|
*/
|
||||||
public void setX(double x) {
|
public void setX(double x) {
|
||||||
@ -58,6 +58,7 @@ public class Position {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the y-coordinate
|
* Setter for the y-coordinate
|
||||||
|
*
|
||||||
* @param y The new y-coordinate
|
* @param y The new y-coordinate
|
||||||
*/
|
*/
|
||||||
public void setY(double y) {
|
public void setY(double y) {
|
||||||
|
@ -61,6 +61,7 @@ public class Field extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the background color
|
* Change the background color
|
||||||
|
*
|
||||||
* @param color The new color
|
* @param color The new color
|
||||||
*/
|
*/
|
||||||
public void changeBackground(Color color) {
|
public void changeBackground(Color color) {
|
||||||
@ -70,6 +71,7 @@ public class Field extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called when painting/repainting the playground
|
* This method is called when painting/repainting the playground
|
||||||
|
*
|
||||||
* @param g the graphics object
|
* @param g the graphics object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -101,10 +103,17 @@ public class Field extends JPanel {
|
|||||||
// Calls the method for drawing the grid
|
// Calls the method for drawing the grid
|
||||||
drawGrid(g2);
|
drawGrid(g2);
|
||||||
|
|
||||||
|
// Calls the method for drawing the bottom paddle
|
||||||
|
drawPaddleBottom(g2);
|
||||||
|
|
||||||
|
// Calls the method for drawing the top paddle
|
||||||
|
drawPaddleTop(g2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the ball
|
* Draws the ball
|
||||||
|
*
|
||||||
* @param g2 The graphics object
|
* @param g2 The graphics object
|
||||||
*/
|
*/
|
||||||
private void drawBall(Graphics2D g2) {
|
private void drawBall(Graphics2D g2) {
|
||||||
@ -116,6 +125,7 @@ public class Field extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the grid
|
* Draws the grid
|
||||||
|
*
|
||||||
* @param g2 The graphics object
|
* @param g2 The graphics object
|
||||||
*/
|
*/
|
||||||
private void drawGrid(Graphics2D g2) {
|
private void drawGrid(Graphics2D g2) {
|
||||||
@ -135,4 +145,34 @@ public class Field extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the bottom paddle
|
||||||
|
*
|
||||||
|
* @param g2 The graphics object
|
||||||
|
*/
|
||||||
|
private void drawPaddleBottom(Graphics2D g2) {
|
||||||
|
// fillRoundRect(x, y, width, height, arcWidth, arcHeight)
|
||||||
|
g2.fillRoundRect((int) view.getGame().getLevel().getPaddleBottom().getPosition().getX(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleBottom().getPosition().getY(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleBottom().getWidth(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleBottom().getHeight(),
|
||||||
|
10,
|
||||||
|
10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the top paddle
|
||||||
|
*
|
||||||
|
* @param g2 The graphics object
|
||||||
|
*/
|
||||||
|
private void drawPaddleTop(Graphics2D g2) {
|
||||||
|
// fillRoundRect(x, y, width, height, arcWidth, arcHeight)
|
||||||
|
g2.fillRoundRect((int) view.getGame().getLevel().getPaddleTop().getPosition().getX(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleTop().getPosition().getY(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleTop().getWidth(),
|
||||||
|
(int) view.getGame().getLevel().getPaddleTop().getHeight(),
|
||||||
|
10,
|
||||||
|
10);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import javax.swing.JPanel;
|
|||||||
* This panel represents the background for special divisions in this application
|
* This panel represents the background for special divisions in this application
|
||||||
*
|
*
|
||||||
* @author dmlux
|
* @author dmlux
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SectionPanel extends JPanel {
|
public class SectionPanel extends JPanel {
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import net.miginfocom.swing.MigLayout;
|
|||||||
* This screen serves the configuration of the game.
|
* This screen serves the configuration of the game.
|
||||||
*
|
*
|
||||||
* @author dmlux, modified by I. Schumacher
|
* @author dmlux, modified by I. Schumacher
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class StartScreen extends JPanel {
|
public class StartScreen extends JPanel {
|
||||||
|
|
||||||
@ -142,6 +141,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an action listener to the start button
|
* Adds an action listener to the start button
|
||||||
|
*
|
||||||
* @param l The actionListener
|
* @param l The actionListener
|
||||||
*/
|
*/
|
||||||
public void addActionListenerToStartButton(ActionListener l) {
|
public void addActionListenerToStartButton(ActionListener l) {
|
||||||
@ -150,6 +150,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the start button
|
* Returns the start button
|
||||||
|
*
|
||||||
* @return startGame The button for starting the game
|
* @return startGame The button for starting the game
|
||||||
*/
|
*/
|
||||||
public JButton getStartButton() {
|
public JButton getStartButton() {
|
||||||
@ -158,6 +159,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an action listener to the quit button
|
* Adds an action listener to the quit button
|
||||||
|
*
|
||||||
* @param l The actionListener
|
* @param l The actionListener
|
||||||
*/
|
*/
|
||||||
public void addActionListenerToQuitButton(ActionListener l) {
|
public void addActionListenerToQuitButton(ActionListener l) {
|
||||||
@ -166,6 +168,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the quit button
|
* Returns the quit button
|
||||||
|
*
|
||||||
* @return quitGame The button for ending the game
|
* @return quitGame The button for ending the game
|
||||||
*/
|
*/
|
||||||
public JButton getQuitButton() {
|
public JButton getQuitButton() {
|
||||||
@ -174,6 +177,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the players name
|
* Returns the players name
|
||||||
|
*
|
||||||
* @return The name of the player in the JTextField playersName
|
* @return The name of the player in the JTextField playersName
|
||||||
*/
|
*/
|
||||||
public String getPlayersName() {
|
public String getPlayersName() {
|
||||||
@ -182,6 +186,7 @@ public class StartScreen extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows an error in the menu
|
* Shows an error in the menu
|
||||||
|
*
|
||||||
* @param message The String to be shown
|
* @param message The String to be shown
|
||||||
*/
|
*/
|
||||||
public void showError(String message) {
|
public void showError(String message) {
|
||||||
|
@ -13,7 +13,6 @@ import break_out.model.Game;
|
|||||||
*
|
*
|
||||||
* @author dmlux
|
* @author dmlux
|
||||||
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
* @author modified by Gruppe 175: Moritz Henseleit, Ruben Meyer
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class View extends JFrame {
|
public class View extends JFrame {
|
||||||
|
|
||||||
@ -78,6 +77,7 @@ public class View extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the start screen
|
* Getter for the start screen
|
||||||
|
*
|
||||||
* @return startScreen
|
* @return startScreen
|
||||||
*/
|
*/
|
||||||
public StartScreen getStartScreen() {
|
public StartScreen getStartScreen() {
|
||||||
@ -86,6 +86,7 @@ public class View extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the playground
|
* Getter for the playground
|
||||||
|
*
|
||||||
* @return field
|
* @return field
|
||||||
*/
|
*/
|
||||||
public Field getField() {
|
public Field getField() {
|
||||||
@ -94,6 +95,7 @@ public class View extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the game
|
* Getter for the game
|
||||||
|
*
|
||||||
* @return game
|
* @return game
|
||||||
*/
|
*/
|
||||||
public Game getGame() {
|
public Game getGame() {
|
||||||
@ -102,6 +104,7 @@ public class View extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the game
|
* Setter for the game
|
||||||
|
*
|
||||||
* @param game The current game
|
* @param game The current game
|
||||||
*/
|
*/
|
||||||
public void setGame(Game game) {
|
public void setGame(Game game) {
|
||||||
@ -112,6 +115,7 @@ public class View extends JFrame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a given screen if the card layout contains this screen
|
* Shows a given screen if the card layout contains this screen
|
||||||
|
*
|
||||||
* @param screenName The screen to be shown
|
* @param screenName The screen to be shown
|
||||||
*/
|
*/
|
||||||
public void showScreen(String screenName) {
|
public void showScreen(String screenName) {
|
||||||
@ -121,6 +125,7 @@ public class View extends JFrame {
|
|||||||
/**
|
/**
|
||||||
* Called by game.notifyObservers() in the run()-method of Level class
|
* Called by game.notifyObservers() in the run()-method of Level class
|
||||||
* to repaint the playground
|
* to repaint the playground
|
||||||
|
*
|
||||||
* @param game The game to observe
|
* @param game The game to observe
|
||||||
*/
|
*/
|
||||||
public void modelChanged(Game game) {
|
public void modelChanged(Game game) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user