com.codingame.gameengine.module.entities.Rectangle Maven / Gradle / Ivy
package com.codingame.gameengine.module.entities;
/**
*
* A Rectangle specifies an area in a the world
enclosed by the Rectangle's upper-left point (x,y), its width, and its height.
*
* The coordinates, width and height are in world units.
*/
public class Rectangle extends Shape {
private int width, height;
Rectangle() {
super();
}
/**
* Sets the width of this Rectangle
in world units.
*
* @param width
* the width for this Rectangle
.
* @return this Rectangle
*/
public Rectangle setWidth(int width) {
return setWidth(width, null);
}
/**
* Sets the width of this Rectangle
in world units.
*
* @param width
* the width for this Rectangle
.
* @param curve
* the transition to animate between values of this property.
* @return this Rectangle
*/
public Rectangle setWidth(int width, Curve curve) {
this.width = width;
set("width", width, curve);
return this;
}
/**
* Returns the width of this Rectangle
in world units.
*
* Default is 100.
*
*
* @return the width of this Rectangle
.
*/
public int getWidth() {
return width;
}
/**
* Sets the height of this Rectangle
in world units.
*
* @param height
* the height for this Rectangle
.
* @return this Rectangle
*/
public Rectangle setHeight(int height) {
return setHeight(height, null);
}
/**
* Sets the height of this Rectangle
in world units.
*
* @param height
* the height for this Rectangle
.
* @param curve
* the transition to animate between values of this property.
* @return this Rectangle
*/
public Rectangle setHeight(int height, Curve curve) {
this.height = height;
set("height", height, curve);
return this;
}
/**
* Returns the height of this Rectangle
in world units.
*
* Default is 100.
*
*
* @return the height of this Rectangle
.
*/
public int getHeight() {
return height;
}
@Override
Entity.Type getType() {
return Entity.Type.RECTANGLE;
}
}