Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/utils/math/rect/RectMutable.java

89 lines
1.4 KiB

package mightypork.utils.math.rect;
import mightypork.utils.math.vect.Vect;
/**
* Mutable rectangle; operations change it's state.
*
* @author MightyPork
*/
public abstract class RectMutable extends Rect {
/**
* Set to other rect's coordinates
*
* @param rect other rect
*/
public void setTo(Rect rect)
{
setTo(rect.origin(), rect.size());
}
/**
* Set to given size and position
*
* @param origin new origin
* @param width new width
* @param height new height
*/
public void setTo(Vect origin, double width, double height)
{
setTo(origin, Vect.make(width, height));
}
/**
* Set to given size and position
*
* @param x origin.x
* @param y origin.y
* @param width new width
* @param height new height
*/
public void setTo(double x, double y, double width, double height)
{
setTo(Vect.make(x, y), Vect.make(width, height));
}
/**
* Set to given size and position
*
* @param origin new origin
* @param size new size
*/
public void setTo(Vect origin, Vect size)
{
setOrigin(origin);
setSize(size);
}
/**
* Set to zero
*/
public void reset()
{
setTo(Vect.ZERO, Vect.ZERO);
}
/**
* Set new origin
*
* @param origin new origin
*/
public abstract void setOrigin(Vect origin);
/**
* Set new size
*
* @param size new size
*/
public abstract void setSize(Vect size);
}