Renamed constraints to bounds.
This commit is contained in:
@@ -62,7 +62,7 @@ public class SoundSystem extends RootBusNode implements Updateable {
|
||||
*/
|
||||
public static VectView getListener()
|
||||
{
|
||||
return listener.view();
|
||||
return listener.getView();
|
||||
}
|
||||
|
||||
// -- instance --
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.gamecore.control.bus.events;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class MouseButtonEvent implements Event<MouseButtonEvent.Listener> {
|
||||
*/
|
||||
public VectView getPos()
|
||||
{
|
||||
return pos.view();
|
||||
return pos.getView();
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MouseButtonEvent implements Event<MouseButtonEvent.Listener> {
|
||||
* @param rect rect region
|
||||
* @return was over
|
||||
*/
|
||||
public boolean isOver(RectConstraint rect)
|
||||
public boolean isOver(RectBound rect)
|
||||
{
|
||||
return rect.getRect().contains(pos);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class MouseMotionEvent implements Event<MouseMotionEvent.Listener> {
|
||||
* @param move move vector
|
||||
*/
|
||||
public MouseMotionEvent(Vect pos, Vect move) {
|
||||
this.move = move.value();
|
||||
this.pos = pos.value();
|
||||
this.move = move.getValue();
|
||||
this.pos = pos.getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ScreenChangeEvent implements Event<ScreenChangeEvent.Listener> {
|
||||
*/
|
||||
public VectView getScreenSize()
|
||||
{
|
||||
return screenSize.view();
|
||||
return screenSize.getView();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.PluggableRect;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ public interface PluggableRenderable extends Renderable, PluggableRect {
|
||||
|
||||
|
||||
@Override
|
||||
void setContext(RectConstraint rect);
|
||||
void setContext(RectBound rect);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.ContextAdapter;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class PluggableRenderer extends ContextAdapter implements Plugga
|
||||
|
||||
|
||||
@Override
|
||||
public void setContext(RectConstraint rect)
|
||||
public void setContext(RectBound rect)
|
||||
{
|
||||
super.setContext(rect);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package mightypork.gamecore.gui.components.layout;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Constraints.*;
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ public class ColumnHolder extends ElementHolder {
|
||||
* @param context context
|
||||
* @param rows number of rows
|
||||
*/
|
||||
public ColumnHolder(AppAccess app, RectConstraint context, int rows) {
|
||||
public ColumnHolder(AppAccess app, RectBound context, int rows) {
|
||||
super(app, context);
|
||||
this.cols = rows;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class ColumnHolder extends ElementHolder {
|
||||
{
|
||||
if (elem == null) return;
|
||||
|
||||
elem.setContext(cColumn(this, cols, col++));
|
||||
elem.setContext(column(this, cols, col++));
|
||||
|
||||
attach(elem);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import mightypork.gamecore.control.bus.clients.BusNode;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderer;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import mightypork.utils.math.rect.RectView;
|
||||
public abstract class ElementHolder extends BusNode implements PluggableRenderable {
|
||||
|
||||
private final LinkedList<PluggableRenderable> elements = new LinkedList<>();
|
||||
private RectConstraint context;
|
||||
private RectBound context;
|
||||
|
||||
|
||||
/**
|
||||
@@ -37,14 +37,14 @@ public abstract class ElementHolder extends BusNode implements PluggableRenderab
|
||||
* @param app app access
|
||||
* @param context boudning context
|
||||
*/
|
||||
public ElementHolder(AppAccess app, RectConstraint context) {
|
||||
public ElementHolder(AppAccess app, RectBound context) {
|
||||
super(app);
|
||||
setContext(context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setContext(RectConstraint context)
|
||||
public void setContext(RectBound context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package mightypork.gamecore.gui.components.layout;
|
||||
|
||||
|
||||
import static mightypork.utils.math.constraints.Constraints.*;
|
||||
import static mightypork.utils.math.constraints.Bounds.*;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ public class RowHolder extends ElementHolder {
|
||||
* @param context bounding context
|
||||
* @param rows number of rows
|
||||
*/
|
||||
public RowHolder(AppAccess app, RectConstraint context, int rows) {
|
||||
public RowHolder(AppAccess app, RectBound context, int rows) {
|
||||
super(app, context);
|
||||
this.rows = rows;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class RowHolder extends ElementHolder {
|
||||
{
|
||||
if (elem == null) return;
|
||||
|
||||
elem.setContext(cRow(this, rows, row++));
|
||||
elem.setContext(row(this, rows, row++));
|
||||
|
||||
attach(elem);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import mightypork.gamecore.input.KeyBinder;
|
||||
import mightypork.gamecore.input.KeyBindingPool;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
|
||||
@@ -20,7 +20,7 @@ import mightypork.utils.math.vect.Vect;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class Screen extends AppSubModule implements Renderable, KeyBinder, RectConstraint, ScreenChangeEvent.Listener {
|
||||
public abstract class Screen extends AppSubModule implements Renderable, KeyBinder, RectBound, ScreenChangeEvent.Listener {
|
||||
|
||||
private final KeyBindingPool keybindings = new KeyBindingPool();
|
||||
|
||||
@@ -66,7 +66,7 @@ public abstract class Screen extends AppSubModule implements Renderable, KeyBind
|
||||
active = true;
|
||||
needSetupViewport = true;
|
||||
|
||||
onSizeChanged(getRect().getSize());
|
||||
onSizeChanged(getRect().size());
|
||||
onScreenEnter();
|
||||
|
||||
// enable events
|
||||
|
||||
@@ -7,7 +7,7 @@ import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.gamecore.input.KeyBinder;
|
||||
import mightypork.gamecore.input.KeyBindingPool;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
@@ -18,7 +18,7 @@ import mightypork.utils.math.vect.VectView;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class ScreenLayer extends AppSubModule implements Comparable<ScreenLayer>, Renderable, RectConstraint, KeyBinder {
|
||||
public abstract class ScreenLayer extends AppSubModule implements Comparable<ScreenLayer>, Renderable, RectBound, KeyBinder {
|
||||
|
||||
private final Screen screen;
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
move.mul(1, -1, 1);
|
||||
|
||||
if (button != -1 || wheeld != 0) {
|
||||
getEventBus().send(new MouseButtonEvent(pos.value(), button, down, wheeld));
|
||||
getEventBus().send(new MouseButtonEvent(pos.getValue(), button, down, wheeld));
|
||||
}
|
||||
|
||||
moveSum.add(move);
|
||||
|
||||
@@ -10,7 +10,7 @@ import mightypork.gamecore.control.AppModule;
|
||||
import mightypork.gamecore.control.bus.events.ScreenChangeEvent;
|
||||
import mightypork.gamecore.control.timing.FpsMeter;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.constraints.RectConstraint;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectVal;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
@@ -26,7 +26,7 @@ import org.lwjgl.opengl.DisplayMode;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class DisplaySystem extends AppModule implements RectConstraint {
|
||||
public class DisplaySystem extends AppModule implements RectBound {
|
||||
|
||||
private DisplayMode windowDisplayMode;
|
||||
private int targetFps;
|
||||
|
||||
@@ -213,7 +213,7 @@ public class Render {
|
||||
*/
|
||||
public static void rotate(double angle, Vect axis)
|
||||
{
|
||||
final Vect vec = axis.view().norm(1);
|
||||
final Vect vec = axis.getView().norm(1);
|
||||
glRotated(angle, vec.x(), vec.y(), vec.z());
|
||||
}
|
||||
|
||||
@@ -351,10 +351,10 @@ public class Render {
|
||||
*/
|
||||
public static void quad(Rect quad)
|
||||
{
|
||||
final double x1 = quad.xMin();
|
||||
final double y1 = quad.yMin();
|
||||
final double x2 = quad.xMax();
|
||||
final double y2 = quad.yMax();
|
||||
final double x1 = quad.getLeft();
|
||||
final double y1 = quad.top();
|
||||
final double x2 = quad.right();
|
||||
final double y2 = quad.bottom();
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
@@ -391,15 +391,15 @@ public class Render {
|
||||
*/
|
||||
public static void quadUV_nobound(Rect quad, Rect uvs)
|
||||
{
|
||||
final double x1 = quad.xMin();
|
||||
final double y1 = quad.yMin();
|
||||
final double x2 = quad.xMax();
|
||||
final double y2 = quad.yMax();
|
||||
final double x1 = quad.getLeft();
|
||||
final double y1 = quad.top();
|
||||
final double x2 = quad.right();
|
||||
final double y2 = quad.bottom();
|
||||
|
||||
final double tx1 = uvs.xMin();
|
||||
final double ty1 = uvs.yMin();
|
||||
final double tx2 = uvs.xMax();
|
||||
final double ty2 = uvs.yMax();
|
||||
final double tx1 = uvs.getLeft();
|
||||
final double ty1 = uvs.top();
|
||||
final double tx2 = uvs.right();
|
||||
final double ty2 = uvs.bottom();
|
||||
|
||||
// quad with texture
|
||||
glTexCoord2d(tx1, ty2);
|
||||
@@ -437,10 +437,10 @@ public class Render {
|
||||
*/
|
||||
public static void quadColor(Rect quad, RGB colorHMinVMin, RGB colorHMaxVMin, RGB colorHMaxVMax, RGB colorHMinVMax)
|
||||
{
|
||||
final double x1 = quad.xMin();
|
||||
final double y1 = quad.yMin();
|
||||
final double x2 = quad.xMax();
|
||||
final double y2 = quad.yMax();
|
||||
final double x1 = quad.getLeft();
|
||||
final double y1 = quad.top();
|
||||
final double x2 = quad.right();
|
||||
final double y2 = quad.bottom();
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
|
||||
@@ -110,7 +110,7 @@ public class FontRenderer {
|
||||
{
|
||||
Render.pushMatrix();
|
||||
|
||||
Render.translate(pos.value().round());
|
||||
Render.translate(pos.getValue().round());
|
||||
Render.scaleXY(getScale(height));
|
||||
|
||||
font.draw(text, color);
|
||||
@@ -148,20 +148,20 @@ public class FontRenderer {
|
||||
|
||||
switch (align) {
|
||||
case LEFT:
|
||||
start = bounds.getTopLeft();
|
||||
start = bounds.topLeft();
|
||||
break;
|
||||
|
||||
case CENTER:
|
||||
start = bounds.getTopCenter();
|
||||
start = bounds.topCenter();
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
default:
|
||||
start = bounds.getTopRight();
|
||||
start = bounds.topRight();
|
||||
break;
|
||||
}
|
||||
|
||||
draw(text, start, bounds.getHeight(), align, color);
|
||||
draw(text, start, bounds.height(), align, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ public class FontRenderer {
|
||||
|
||||
final double w = getWidth(text, height);
|
||||
|
||||
final VectMutable start = pos.mutable();
|
||||
final VectMutable start = VectMutable.make(pos);
|
||||
|
||||
switch (align) {
|
||||
case LEFT:
|
||||
|
||||
@@ -24,7 +24,6 @@ import mightypork.gamecore.render.textures.FilterMode;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.vect.VectVal;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
Reference in New Issue
Block a user