From 6a2a02d9597ed5ed4efbbd1e5698306b97c31602 Mon Sep 17 00:00:00 2001 From: GabrielMagnus Date: Mon, 3 Feb 2020 14:06:36 +0100 Subject: [PATCH] Implementert basic DrawableObject med Steinar og Kristian Lagd to konstruktorer, en med noen default verdier --- .../inf112/skeleton/app/DrawableObject.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/main/java/inf112/skeleton/app/DrawableObject.java diff --git a/src/main/java/inf112/skeleton/app/DrawableObject.java b/src/main/java/inf112/skeleton/app/DrawableObject.java new file mode 100644 index 0000000..3ad6669 --- /dev/null +++ b/src/main/java/inf112/skeleton/app/DrawableObject.java @@ -0,0 +1,70 @@ +package inf112.skeleton.app; + +public class DrawableObject implements IDrawableObject { + + private int xPos; + private int yPos; + private int width = 64; + private int height = 64; + private int rotation = 0; + private GameTexture texture; + private boolean flipX = false; + private boolean flipY = false; + + public DrawableObject(int xPos, int yPos, GameTexture texture, int rotation, int width, int height, boolean flipX, boolean flipY) { + this.xPos = xPos; + this.yPos = yPos; + this.rotation = rotation; + this.texture = texture; + this.width = width; + this.height = height; + this.flipX = flipX; + this.flipY = flipY; + } + + public DrawableObject(int xPos, int yPos, GameTexture texture) { + this.xPos = xPos; + this.yPos = yPos; + this.texture = texture; + } + + @Override + public GameTexture getTexture() { + return texture; + } + + @Override + public int getXPosition() { + return xPos; + } + + @Override + public int getYPosition() { + return yPos; + } + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public int getRotation() { + return rotation; + } + + @Override + public boolean flipX() { + return flipX; + } + + @Override + public boolean flipY() { + return flipY; + } +}