Base of Constraints system.
This commit is contained in:
@@ -2,7 +2,6 @@ package mightypork.rogue.display;
|
||||
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
import mightypork.rogue.App;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package mightypork.rogue.display.constraints;
|
||||
|
||||
import mightypork.utils.math.coord.Coord;
|
||||
|
||||
|
||||
public abstract class Constraint implements ConstraintContext {
|
||||
|
||||
protected ConstraintContext context;
|
||||
|
||||
|
||||
public Constraint(ConstraintContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
public void setContext(ConstraintContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
public ConstraintContext getContext()
|
||||
{
|
||||
return context;
|
||||
}
|
||||
|
||||
protected Coord origin() {
|
||||
return context.getRect().getOrigin();
|
||||
}
|
||||
|
||||
protected Coord size() {
|
||||
return context.getRect().getSize();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package mightypork.rogue.display.constraints;
|
||||
|
||||
import mightypork.utils.math.coord.Coord;
|
||||
import mightypork.utils.math.coord.Rect;
|
||||
|
||||
|
||||
public interface ConstraintContext {
|
||||
public Rect getRect();
|
||||
}
|
||||
Reference in New Issue
Block a user