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/constraints/rect/RectCache.java

37 lines
547 B

package mightypork.utils.math.constraints.rect;
public class RectCache extends RectAdapter {
private final RectVar cache = Rect.makeVar();
private final Rect source;
private boolean inited = false;
public RectCache(Rect source) {
this.source = source;
}
@Override
protected Rect getSource()
{
if (!inited) poll();
return cache;
}
/**
* Update cached value and cached digest (if digest caching is enabled)
*/
@Override
public void poll()
{
inited = true;
cache.setTo(source);
super.poll();
}
}