fixed most compile errors caused by constraint system refactoring

This commit is contained in:
ondra
2014-04-14 19:07:28 +02:00
parent 2690e6c5f3
commit 7011184c88
39 changed files with 410 additions and 309 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ public class LayerFps extends ScreenLayer {
final GLFont font = Res.getFont("default");
final RectBound constraint = box(add(topRight(this), -8, 8), 0, 32);
final RectBound constraint = bounds().topRight().add(-8, 8).expand(0, 0, 0, 32);
tp = new TextPainter(font, Align.RIGHT, RGB.WHITE, new StringProvider() {
@@ -14,7 +14,7 @@ import mightypork.gamecore.render.fonts.FontRenderer.Align;
import mightypork.rogue.Res;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.constraints.RectBound;
import mightypork.utils.math.vect.VectVal;
import mightypork.utils.math.vect.VectConst;
public class LayerBouncyBoxes extends ScreenLayer {
@@ -57,7 +57,7 @@ public class LayerBouncyBoxes extends ScreenLayer {
final TextPainter tp = new TextPainter(Res.getFont("default"), Align.LEFT, RGB.WHITE);
tp.setText("Press \"C\" for \"Cat\" screen.");
tp.setShadow(RGB.RED, VectVal.make(2, 2));
tp.setShadow(RGB.RED, VectConst.make(2, 2));
layout.add(tp);
}
@@ -17,15 +17,16 @@ import mightypork.rogue.Res;
import mightypork.utils.math.animation.AnimDouble;
import mightypork.utils.math.animation.Easing;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.num.Num;
import mightypork.utils.math.rect.Rect;
import mightypork.utils.math.vect.Vect;
import mightypork.utils.math.vect.VectAnimated;
import mightypork.utils.math.vect.VectVal;
public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButtonEvent.Listener {
private final AnimDouble size = new AnimDouble(400, Easing.SINE_BOTH);
private final VectAnimated pos = VectAnimated.make(Easing.ELASTIC_OUT);
private final VectAnimated pos = VectAnimated.makeVar(Easing.ELASTIC_OUT);
private final Random rand = new Random();
@@ -42,22 +43,19 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
cat = new ImagePainter(Res.getTxQuad("test.kitten"));
// Bounds.box(size,size).centerTo(pos)
cat.setContext(centerTo(box(size, size), pos));
cat.setContext(Rect.make(size, size).centerTo(pos));
tp = new TextPainter(Res.getFont("default"));
tp.setAlign(Align.CENTER);
tp.setColor(RGB.YELLOW);
tp.setText("Meow!");
tp.setShadow(RGB.dark(0.8), VectVal.make(2, 2));
tp.setShadow(RGB.dark(0.8), Vect.make(2, 2));
// Bounds.box(64,64).centerTo(cMousePos)
tp.setContext(centerTo(box(64, 64), cMousePos));
tp.setContext(Rect.make(64, 64).centerTo(mouse()));
qp = QuadPainter.gradV(RGB.YELLOW, RGB.RED);
// Bounds.wrap(cat).bottomLeft().expand(0,0,50,50)
qp.setContext(expand(bottomLeft(cat), 0, 0, 50, 50));
qp.setContext(cat.getRect().bottomLeft().expand(size.half(), Num.ZERO, Num.ZERO, size.half()));
/*
* Register keys
@@ -7,8 +7,8 @@ import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.render.fonts.FontRenderer.Align;
import mightypork.rogue.Res;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.constraints.NumBound;
import mightypork.utils.math.constraints.RectBound;
import mightypork.utils.math.num.Num;
import mightypork.utils.math.rect.Rect;
public class ScreenTestFont extends Screen {
@@ -22,9 +22,8 @@ public class ScreenTestFont extends Screen {
tp = new TextPainter(Res.getFont("default"), Align.CENTER, RGB.GREEN);
tp.setText("Hello World!");
final NumBound fontHeight = mul(getDisplay().getSize().yn(), 0.1);
final RectBound strbox = centerTo(box(fontHeight), this);
final Num h = bounds().height().mul(0.1);
final Rect strbox = Rect.make(Num.ZERO, h).centerTo(bounds());
tp.setContext(strbox);
}
@@ -1,19 +1,15 @@
package mightypork.rogue.screens.test_render;
import mightypork.gamecore.control.timing.Poller;
import mightypork.gamecore.gui.screens.Screen;
import mightypork.gamecore.gui.screens.ScreenLayer;
import mightypork.gamecore.render.Render;
import mightypork.utils.math.color.RGB;
import mightypork.utils.math.constraints.RectBound;
import mightypork.utils.math.vect.Vect;
public class LayerTestGradient extends ScreenLayer {
private final Poller p = new Poller();
private final RectBound pos1;
private final RectBound pos2;
@@ -21,8 +17,8 @@ public class LayerTestGradient extends ScreenLayer {
public LayerTestGradient(Screen screen) {
super(screen);
pos1 = cached(p, growDown(edgeTop(this), 64));
pos2 = cached(p, shrinkTop(growRight(edgeLeft(this), 64), 64));
pos1 = bounds().topEdge().growDown(64);
pos2 = bounds().leftEdge().growUp(-64).growRight(64);
}
@@ -41,11 +37,4 @@ public class LayerTestGradient extends ScreenLayer {
return 5;
}
@Override
protected void onSizeChanged(Vect size)
{
p.poll();
}
}