parent
8073c5d712
commit
8e8e15355e
@ -0,0 +1,58 @@ |
||||
package mightypork.rogue.fonts; |
||||
|
||||
|
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public class FontRenderer { |
||||
|
||||
private final GLFont font; |
||||
|
||||
|
||||
public FontRenderer(GLFont font) { |
||||
|
||||
if (font == null) throw new NullPointerException("Font cannot be null."); |
||||
|
||||
this.font = font; |
||||
} |
||||
|
||||
|
||||
public void draw(String text, Coord pos, double height, RGB color) |
||||
{ |
||||
Render.pushState(); |
||||
|
||||
Render.translate(pos.round()); |
||||
Render.scaleXY(getScale(height)); |
||||
|
||||
font.draw(text, color); |
||||
|
||||
Render.popState(); |
||||
} |
||||
|
||||
|
||||
public Coord getNeededSpace(String text, double height) |
||||
{ |
||||
return font.getNeededSpace(text).mul(getScale(height)); |
||||
} |
||||
|
||||
|
||||
public double getWidth(String text, double height) |
||||
{ |
||||
return getNeededSpace(text, height).x; |
||||
} |
||||
|
||||
|
||||
public Rect getBounds(String text, Coord pos, double height) |
||||
{ |
||||
return Rect.fromSize(getNeededSpace(text, height)).add(pos); |
||||
} |
||||
|
||||
|
||||
private double getScale(double height) |
||||
{ |
||||
return height / font.getHeight(); |
||||
} |
||||
} |
@ -1,92 +0,0 @@ |
||||
package mightypork.rogue.gui.constraints; |
||||
|
||||
|
||||
import java.util.LinkedList; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.bus.ChildClient; |
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.utils.control.bus.EventBus; |
||||
import mightypork.utils.math.constraints.ConstraintContext; |
||||
import mightypork.utils.math.constraints.RectConstraint; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* Bag for {@link PluggableRenderable} elements with constraints.<br> |
||||
* Elements are exposed to {@link EventBus}. |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public class ElementHolder extends ChildClient implements ConstraintContext, PluggableRenderable { |
||||
|
||||
private final LinkedList<PluggableRenderable> elements = new LinkedList<PluggableRenderable>(); |
||||
private ConstraintContext context; |
||||
|
||||
|
||||
public ElementHolder(AppAccess app) { |
||||
super(app); |
||||
} |
||||
|
||||
|
||||
public ElementHolder(AppAccess app, ConstraintContext context) { |
||||
super(app); |
||||
this.context = context; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void setContext(ConstraintContext context) |
||||
{ |
||||
this.context = context; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void render() |
||||
{ |
||||
for (final Renderable element : elements) { |
||||
element.render(); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Rect getRect() |
||||
{ |
||||
return context.getRect(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Add element to the holder. |
||||
* |
||||
* @param elem element; it's context will be set to the constraint. |
||||
* @param constraint Constraint to be used for the element. It's context |
||||
* will be set to this {@link ElementHolder} |
||||
*/ |
||||
public void add(PluggableRenderable elem, RectConstraint constraint) |
||||
{ |
||||
if (elem == null) return; |
||||
|
||||
constraint.setContext(this); |
||||
elem.setContext(constraint); |
||||
|
||||
elements.add(elem); |
||||
addChildClient(elem); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Remove element from the holder |
||||
* |
||||
* @param elem |
||||
*/ |
||||
public void remove(PluggableRenderable elem) |
||||
{ |
||||
if (elem == null) return; |
||||
elements.remove(elem); |
||||
removeChildClient(elem); |
||||
} |
||||
|
||||
} |
@ -1,15 +0,0 @@ |
||||
package mightypork.rogue.gui.constraints; |
||||
|
||||
|
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.utils.math.constraints.SettableContext; |
||||
|
||||
|
||||
/** |
||||
* {@link Renderable} with {@link SettableContext} |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface PluggableRenderable extends Renderable, SettableContext { |
||||
// methods from both interfaces
|
||||
} |
@ -0,0 +1,82 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
|
||||
|
||||
import java.util.LinkedList; |
||||
|
||||
import mightypork.rogue.AppAccess; |
||||
import mightypork.rogue.bus.ChildClient; |
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.utils.control.bus.EventBus; |
||||
import mightypork.utils.math.constraints.RectEvaluable; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* Bag for {@link PluggableRenderer} elements with constraints.<br> |
||||
* Elements are exposed to {@link EventBus}. |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class ElementHolder extends ChildClient implements PluggableRenderable { |
||||
|
||||
private final LinkedList<PluggableRenderable> elements = new LinkedList<PluggableRenderable>(); |
||||
private RectEvaluable context; |
||||
|
||||
|
||||
public ElementHolder(AppAccess app) { |
||||
super(app); |
||||
} |
||||
|
||||
|
||||
public ElementHolder(AppAccess app, RectEvaluable context) { |
||||
super(app); |
||||
setContext(context); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final void setContext(RectEvaluable context) |
||||
{ |
||||
this.context = context; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final void render() |
||||
{ |
||||
for (final Renderable element : elements) { |
||||
element.render(); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public final Rect getRect() |
||||
{ |
||||
return context.getRect(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Add element to the holder, setting it's context.<br> |
||||
* Element must then be attached using the <code>attach</code> method. |
||||
* |
||||
* @param elem element |
||||
*/ |
||||
public abstract void add(PluggableRenderable elem); |
||||
|
||||
|
||||
/** |
||||
* Connect to bus and add to element list |
||||
* |
||||
* @param elem element; it's context will be set to the constraint. |
||||
*/ |
||||
public final void attach(PluggableRenderable elem) |
||||
{ |
||||
if (elem == null) return; |
||||
|
||||
elements.add(elem); |
||||
addChildClient(elem); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,30 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.render.Render; |
||||
import mightypork.rogue.textures.TxQuad; |
||||
|
||||
|
||||
public class ImageRenderer extends PluggableRenderer { |
||||
|
||||
private TxQuad texture; |
||||
|
||||
|
||||
public ImageRenderer(TxQuad texture) { |
||||
this.texture = texture; |
||||
} |
||||
|
||||
|
||||
public void setTexture(TxQuad texture) |
||||
{ |
||||
this.texture = texture; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void render() |
||||
{ |
||||
Render.quadTextured(getRect(), texture); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.utils.math.constraints.PluggableContext; |
||||
import mightypork.utils.math.constraints.RectEvaluable; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public interface PluggableRenderable extends Renderable, PluggableContext { |
||||
|
||||
@Override |
||||
void render(); |
||||
|
||||
|
||||
@Override |
||||
Rect getRect(); |
||||
|
||||
|
||||
@Override |
||||
void setContext(RectEvaluable rect); |
||||
|
||||
} |
@ -0,0 +1,33 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.render.Renderable; |
||||
import mightypork.utils.math.constraints.ContextAdapter; |
||||
import mightypork.utils.math.constraints.RectEvaluable; |
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* {@link Renderable} with pluggable context |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class PluggableRenderer extends ContextAdapter implements PluggableRenderable { |
||||
|
||||
@Override |
||||
public abstract void render(); |
||||
|
||||
|
||||
@Override |
||||
public Rect getRect() |
||||
{ |
||||
return super.getRect(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void setContext(RectEvaluable rect) |
||||
{ |
||||
super.setContext(rect); |
||||
} |
||||
} |
@ -0,0 +1,82 @@ |
||||
package mightypork.rogue.gui.renderers; |
||||
|
||||
|
||||
import mightypork.rogue.fonts.FontRenderer; |
||||
import mightypork.rogue.fonts.GLFont; |
||||
import mightypork.utils.math.color.RGB; |
||||
import mightypork.utils.math.coord.Coord; |
||||
|
||||
|
||||
public class TextRenderer extends PluggableRenderer { |
||||
|
||||
public static enum Align |
||||
{ |
||||
LEFT, CENTER, RIGHT; |
||||
} |
||||
|
||||
private FontRenderer font; |
||||
private String text; |
||||
private RGB color; |
||||
private Align align; |
||||
|
||||
|
||||
public TextRenderer(GLFont font, String text, RGB color, Align align) { |
||||
this.font = new FontRenderer(font); |
||||
this.text = text; |
||||
this.color = color; |
||||
this.align = align; |
||||
} |
||||
|
||||
|
||||
public void setFont(FontRenderer font) |
||||
{ |
||||
this.font = font; |
||||
} |
||||
|
||||
|
||||
public void setText(String text) |
||||
{ |
||||
this.text = text; |
||||
} |
||||
|
||||
|
||||
public void setColor(RGB color) |
||||
{ |
||||
this.color = color; |
||||
} |
||||
|
||||
|
||||
public void setAlign(Align align) |
||||
{ |
||||
this.align = align; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void render() |
||||
{ |
||||
final double h = getRect().getHeight(); |
||||
|
||||
final double w = font.getWidth(text, h); |
||||
|
||||
final Coord start; |
||||
|
||||
switch (align) { |
||||
case LEFT: |
||||
start = getRect().getMin(); |
||||
break; |
||||
|
||||
case CENTER: |
||||
start = getRect().getCenterV1().sub_ip(w / 2D, 0); |
||||
break; |
||||
|
||||
case RIGHT: |
||||
default: |
||||
start = getRect().getX2Y1().sub_ip(w, 0); |
||||
break; |
||||
} |
||||
|
||||
font.draw(text, start, h, color); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,140 @@ |
||||
package mightypork.rogue.input; |
||||
|
||||
|
||||
import org.lwjgl.input.Keyboard; |
||||
|
||||
|
||||
/** |
||||
* Key constants, from LWJGL {@link Keyboard} |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface Keys { |
||||
|
||||
//@formatter:off
|
||||
|
||||
public static final int CHAR_NONE = '\0'; |
||||
|
||||
public static final int KEY_NONE = 0x00; |
||||
|
||||
public static final int KEY_ESCAPE = 0x01; |
||||
|
||||
public static final int KEY_1 = 0x02; |
||||
public static final int KEY_2 = 0x03; |
||||
public static final int KEY_3 = 0x04; |
||||
public static final int KEY_4 = 0x05; |
||||
public static final int KEY_5 = 0x06; |
||||
public static final int KEY_6 = 0x07; |
||||
public static final int KEY_7 = 0x08; |
||||
public static final int KEY_8 = 0x09; |
||||
public static final int KEY_9 = 0x0A; |
||||
public static final int KEY_0 = 0x0B; |
||||
|
||||
public static final int KEY_Q = 0x10; |
||||
public static final int KEY_W = 0x11; |
||||
public static final int KEY_E = 0x12; |
||||
public static final int KEY_R = 0x13; |
||||
public static final int KEY_T = 0x14; |
||||
public static final int KEY_Y = 0x15; |
||||
public static final int KEY_U = 0x16; |
||||
public static final int KEY_I = 0x17; |
||||
public static final int KEY_O = 0x18; |
||||
public static final int KEY_P = 0x19; |
||||
public static final int KEY_A = 0x1E; |
||||
public static final int KEY_S = 0x1F; |
||||
public static final int KEY_D = 0x20; |
||||
public static final int KEY_F = 0x21; |
||||
public static final int KEY_G = 0x22; |
||||
public static final int KEY_H = 0x23; |
||||
public static final int KEY_J = 0x24; |
||||
public static final int KEY_K = 0x25; |
||||
public static final int KEY_L = 0x26; |
||||
public static final int KEY_Z = 0x2C; |
||||
public static final int KEY_X = 0x2D; |
||||
public static final int KEY_C = 0x2E; |
||||
public static final int KEY_V = 0x2F; |
||||
public static final int KEY_B = 0x30; |
||||
public static final int KEY_N = 0x31; |
||||
public static final int KEY_M = 0x32; |
||||
|
||||
public static final int KEY_MINUS = 0x0C; |
||||
public static final int KEY_EQUALS = 0x0D; |
||||
public static final int KEY_SLASH = 0x35; |
||||
public static final int KEY_BACKSLASH = 0x2B; |
||||
public static final int KEY_LBRACKET = 0x1A; |
||||
public static final int KEY_RBRACKET = 0x1B; |
||||
public static final int KEY_SEMICOLON = 0x27; |
||||
public static final int KEY_APOSTROPHE = 0x28; |
||||
public static final int KEY_GRAVE = 0x29; |
||||
public static final int KEY_COMMA = 0x33; |
||||
public static final int KEY_PERIOD = 0x34; |
||||
|
||||
public static final int KEY_SPACE = 0x39; |
||||
public static final int KEY_BACKSPACE = 0x0E; |
||||
public static final int KEY_TAB = 0x0F; |
||||
|
||||
public static final int KEY_F1 = 0x3B; |
||||
public static final int KEY_F2 = 0x3C; |
||||
public static final int KEY_F3 = 0x3D; |
||||
public static final int KEY_F4 = 0x3E; |
||||
public static final int KEY_F5 = 0x3F; |
||||
public static final int KEY_F6 = 0x40; |
||||
public static final int KEY_F7 = 0x41; |
||||
public static final int KEY_F8 = 0x42; |
||||
public static final int KEY_F9 = 0x43; |
||||
public static final int KEY_F10 = 0x44; |
||||
public static final int KEY_F11 = 0x57; |
||||
public static final int KEY_F12 = 0x58; |
||||
public static final int KEY_F13 = 0x64; |
||||
public static final int KEY_F14 = 0x65; |
||||
public static final int KEY_F15 = 0x66; |
||||
|
||||
public static final int KEY_CAPSLOCK = 0x3A; |
||||
public static final int KEY_SCROLLLOCK = 0x46; |
||||
public static final int KEY_NUMLOCK = 0x45; |
||||
|
||||
public static final int KEY_SUBTRACT = 0x4A; /* - on numeric keypad */ |
||||
public static final int KEY_ADD = 0x4E; /* + on numeric keypad */ |
||||
public static final int KEY_NUMPAD0 = 0x52; |
||||
public static final int KEY_NUMPAD1 = 0x4F; |
||||
public static final int KEY_NUMPAD2 = 0x50; |
||||
public static final int KEY_NUMPAD3 = 0x51; |
||||
public static final int KEY_NUMPAD4 = 0x4B; |
||||
public static final int KEY_NUMPAD5 = 0x4C; |
||||
public static final int KEY_NUMPAD6 = 0x4D; |
||||
public static final int KEY_NUMPAD7 = 0x47; |
||||
public static final int KEY_NUMPAD8 = 0x48; |
||||
public static final int KEY_NUMPAD9 = 0x49; |
||||
public static final int KEY_DECIMAL = 0x53; /* . on numeric keypad */ |
||||
public static final int KEY_NUMPADENTER = 0x9C; /* Enter on numeric keypad */ |
||||
public static final int KEY_DIVIDE = 0xB5; /* / on numeric keypad */ |
||||
public static final int KEY_MULTIPLY = 0x37; /* * on numeric keypad */ |
||||
|
||||
public static final int KEY_LCONTROL = 0x1D; |
||||
public static final int KEY_RCONTROL = 0x9D; |
||||
public static final int KEY_LALT = 0x38; |
||||
public static final int KEY_RALT = 0xB8; |
||||
public static final int KEY_LSHIFT = 0x2A; |
||||
public static final int KEY_RSHIFT = 0x36; |
||||
public static final int KEY_LMETA = 0xDB; |
||||
public static final int KEY_RMETA = 0xDC; |
||||
|
||||
|
||||
public static final int KEY_UP = 0xC8; /* UpArrow on arrow keypad */ |
||||
public static final int KEY_DOWN = 0xD0; /* DownArrow on arrow keypad */ |
||||
public static final int KEY_LEFT = 0xCB; /* LeftArrow on arrow keypad */ |
||||
public static final int KEY_RIGHT = 0xCD; /* RightArrow on arrow keypad */ |
||||
|
||||
public static final int KEY_HOME = 0xC7; /* Home on arrow keypad */ |
||||
public static final int KEY_END = 0xCF; /* End on arrow keypad */ |
||||
|
||||
public static final int KEY_PAGEUP = 0xC9; /* PgUp on arrow keypad */ |
||||
public static final int KEY_PAGEDOWN = 0xD1; /* PgDn on arrow keypad */ |
||||
|
||||
public static final int KEY_RETURN = 0x1C; |
||||
public static final int KEY_PAUSE = 0xC5; /* Pause */ |
||||
public static final int KEY_INSERT = 0xD2; /* Insert on arrow keypad */ |
||||
public static final int KEY_DELETE = 0xD3; /* Delete on arrow keypad */ |
||||
|
||||
//@formatter:on
|
||||
} |
@ -1,58 +1,67 @@ |
||||
package mightypork.rogue.util; |
||||
|
||||
|
||||
import mightypork.utils.logging.LogInstance; |
||||
|
||||
import org.newdawn.slick.util.LogSystem; |
||||
|
||||
|
||||
public class SlickLogRedirector implements LogSystem { |
||||
|
||||
LogInstance l; |
||||
|
||||
|
||||
public SlickLogRedirector(LogInstance log) { |
||||
this.l = log; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void error(String msg, Throwable e) |
||||
{ |
||||
l.e(msg, e); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void error(Throwable e) |
||||
{ |
||||
l.e(e); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void error(String msg) |
||||
{ |
||||
l.e(msg); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void warn(String msg) |
||||
{ |
||||
l.w(msg); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void warn(String msg, Throwable e) |
||||
{ |
||||
l.e(msg, e); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void info(String msg) |
||||
{ |
||||
l.i(msg); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void debug(String msg) |
||||
{ |
||||
l.f3(msg); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
@ -1,58 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Coord; |
||||
|
||||
|
||||
/** |
||||
* A constraint based on a given {@link ConstraintContext} |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class Constraint implements SettableContext { |
||||
|
||||
private ConstraintContext context = null; |
||||
|
||||
|
||||
public Constraint(ConstraintContext context) { |
||||
this.context = context; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void setContext(ConstraintContext context) |
||||
{ |
||||
this.context = context; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return the context |
||||
*/ |
||||
public ConstraintContext getContext() |
||||
{ |
||||
return context; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return context rect origin |
||||
*/ |
||||
protected Coord getOrigin() |
||||
{ |
||||
if (context == null) return Coord.zero(); |
||||
|
||||
return context.getRect().getOrigin(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @return context rect size |
||||
*/ |
||||
protected Coord getSize() |
||||
{ |
||||
if (context == null) return Coord.zero(); |
||||
|
||||
return context.getRect().size(); |
||||
} |
||||
} |
@ -1,20 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* Context for constraints, with a bounding {@link Rect}. |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface ConstraintContext { |
||||
|
||||
/** |
||||
* Get context boundary |
||||
* |
||||
* @return bounding rectangle |
||||
*/ |
||||
public Rect getRect(); |
||||
} |
@ -0,0 +1,25 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public class ContextAdapter implements PluggableContext { |
||||
|
||||
private RectEvaluable backing = null; |
||||
|
||||
|
||||
@Override |
||||
public void setContext(RectEvaluable rect) |
||||
{ |
||||
this.backing = rect; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Rect getRect() |
||||
{ |
||||
return backing.getRect(); |
||||
} |
||||
|
||||
} |
@ -1,18 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
/** |
||||
* Constraint that provides size |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class NumConstraint extends Constraint { |
||||
|
||||
public NumConstraint(ConstraintContext context) { |
||||
super(context); |
||||
} |
||||
|
||||
|
||||
public abstract double getValue(); |
||||
|
||||
} |
@ -0,0 +1,8 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
public interface NumEvaluable { |
||||
|
||||
double getValue(); |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public interface PluggableContext extends RectEvaluable { |
||||
|
||||
abstract void setContext(RectEvaluable rect); |
||||
|
||||
|
||||
@Override |
||||
abstract Rect getRect(); |
||||
|
||||
} |
@ -1,22 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
/** |
||||
* Constraint that provides a rect ({@link ConstraintContext}) |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public abstract class RectConstraint extends Constraint implements ConstraintContext { |
||||
|
||||
public RectConstraint(ConstraintContext context) { |
||||
super(context); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public abstract Rect getRect(); |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
import mightypork.utils.math.coord.Rect; |
||||
|
||||
|
||||
public interface RectEvaluable { |
||||
|
||||
Rect getRect(); |
||||
} |
@ -1,17 +0,0 @@ |
||||
package mightypork.utils.math.constraints; |
||||
|
||||
|
||||
/** |
||||
* Can be assigned a context / changed context |
||||
* |
||||
* @author MightyPork |
||||
*/ |
||||
public interface SettableContext { |
||||
|
||||
/** |
||||
* Assign a context |
||||
* |
||||
* @param context context |
||||
*/ |
||||
void setContext(ConstraintContext context); |
||||
} |
Loading…
Reference in new issue