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/rogue/display/constraints/Constraint.java

59 lines
780 B

package mightypork.rogue.display.constraints;
import mightypork.utils.math.coord.Coord;
import mightypork.utils.math.coord.Rect;
public abstract class Constraint implements Bounding {
protected Bounding context;
public Constraint(Bounding context) {
this.context = context;
}
/**
* Assign a context
*
* @param context
*/
public void setContext(Bounding context)
{
this.context = context;
}
/**
* @return context
*/
public Bounding getContext()
{
return context;
}
/**
* @return context rect origin
*/
protected Coord origin()
{
return context.getRect().getOrigin();
}
/**
* @return context rect size
*/
protected Coord size()
{
return context.getRect().getSize();
}
@Override
public abstract Rect getRect();
}