Minor vect/rect changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue.screens;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
import mightypork.gamecore.gui.Action;
|
||||
import mightypork.gamecore.gui.components.painters.TextPainter;
|
||||
import mightypork.gamecore.gui.screens.Screen;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue.screens.test_bouncyboxes;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -11,7 +11,7 @@ import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.math.animation.AnimDouble;
|
||||
import mightypork.utils.math.animation.Easing;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.constraints.NumberBound;
|
||||
import mightypork.utils.math.constraints.NumBound;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
|
||||
|
||||
@@ -26,15 +26,28 @@ public class BouncyBox extends PluggableRenderer implements Updateable {
|
||||
|
||||
public BouncyBox() {
|
||||
// create box
|
||||
final NumberBound side = height(this);
|
||||
final NumBound side = height(this);
|
||||
RectBound abox = box(this, side, side);
|
||||
|
||||
// move
|
||||
final NumberBound move_length = sub(width(this), side);
|
||||
final NumberBound offset = mul(move_length, pos);
|
||||
final NumBound move_length = sub(width(this), side);
|
||||
final NumBound offset = mul(move_length, pos);
|
||||
abox = move(abox, offset, 0);
|
||||
|
||||
// add padding
|
||||
/*
|
||||
* leftEdge(this)
|
||||
* .growRight(height(this))
|
||||
* .move(
|
||||
* width(this)
|
||||
* .sub(height(this))
|
||||
* .mul(pos),
|
||||
* 0)
|
||||
* .shrink(
|
||||
* height(this)
|
||||
* .perc(10)
|
||||
* )
|
||||
*/
|
||||
abox = shrink(abox, perc(side, 10));
|
||||
|
||||
box = abox;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue.screens.test_bouncyboxes;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue.screens.test_cat_sound;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -19,17 +19,15 @@ 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.constraints.Bounds;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectMutable;
|
||||
import mightypork.utils.math.vect.VectMutableAnim;
|
||||
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 VectMutableAnim pos = VectMutable.makeAnim(Easing.ELASTIC_OUT);
|
||||
private final VectAnimated pos = VectAnimated.make(Easing.ELASTIC_OUT);
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
@@ -46,6 +44,7 @@ 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));
|
||||
|
||||
tp = new TextPainter(Res.getFont("default"));
|
||||
@@ -54,9 +53,12 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
|
||||
tp.setText("Meow!");
|
||||
tp.setShadow(RGB.dark(0.8), VectVal.make(2, 2));
|
||||
|
||||
// Bounds.box(64,64).centerTo(cMousePos)
|
||||
tp.setContext(centerTo(box(64, 64), cMousePos));
|
||||
|
||||
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));
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package mightypork.rogue.screens.test_font;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.painters.TextPainter;
|
||||
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.NumberBound;
|
||||
import mightypork.utils.math.constraints.NumBound;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ScreenTestFont extends Screen {
|
||||
tp = new TextPainter(Res.getFont("default"), Align.CENTER, RGB.GREEN);
|
||||
tp.setText("Hello World!");
|
||||
|
||||
final NumberBound fontHeight = mul(getDisplay().getSize().yc(), 0.1);
|
||||
final NumBound fontHeight = mul(getDisplay().getSize().yc(), 0.1);
|
||||
|
||||
final RectBound strbox = centerTo(box(fontHeight), this);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue.screens.test_render;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import static mightypork.utils.math.constraints.ConstraintFactory.*;
|
||||
import mightypork.gamecore.control.timing.Poller;
|
||||
import mightypork.gamecore.gui.screens.Screen;
|
||||
import mightypork.gamecore.gui.screens.ScreenLayer;
|
||||
|
||||
Reference in New Issue
Block a user