package com.codegym.task.task24.task2413;
public class Canvas {
private int width;
private int height;
private char[][] matrix;
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public char[][] getMatrix() {
return matrix;
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height) {
this.height = height;
}
public void setMatrix(char[][] matrix) {
this.matrix = matrix;
}
public Canvas(int width, int height){
this.width = width;
this.height = height;
this.matrix = new char[height+2][width+2];
}
public void setPoint(double x, double y, char c){
int ix = (int) Math.round(x);
int iy =(int) Math.round(y);
if( x < 0 || y < 0 || y >= matrix.length || x >= matrix[0].length){
// do Nothing
}else
matrix[iy][ix] = c;
}
public void drawMatrix(double x, double y, int[][] matrix, char c){
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[0].length; j++) {
if (matrix[i][j] != 0) {
setPoint(x + j, y + i, c);
}
}
}
}
public void clear(){
matrix = new char[height+2][width+2];
}
public void print(){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[0].length; j++){
System.out.println(matrix[j][i]);
}
}
}
}
package com.codegym.task.task24.task2413;
import java.util.List;
public class Arkanoid {
private int width;
private int height;
private Ball ball;
private Paddle paddle;
private List<Brick> bricks;
public static Arkanoid game;
public static void main(String[] args){
}
public int getWidth(){
return width;
}
public int getHeight(){
return height;
}
public Ball getBall(){
return ball;
}
public Paddle getPaddle(){
return paddle;
}
public List<Brick> getBricks(){
return bricks;
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height){
this.height = height;
}
public void setBall(Ball ball){
this.ball = ball;
}
public void setPaddle(Paddle paddle){
this.paddle = paddle;
}
public void setBricks(List<Brick> bricks){
this.bricks = bricks;
}
public Arkanoid(int width, int height){
this.width = width;
this.height = height;
}
public void run(){
}
public void move(){
}
}