fixed most compile errors caused by constraint system refactoring
This commit is contained in:
@@ -13,8 +13,7 @@ import mightypork.gamecore.control.bus.events.ResourceLoadRequest;
|
||||
import mightypork.gamecore.control.timing.Updateable;
|
||||
import mightypork.utils.math.Calc.Buffers;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectMutable;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.vect.VectVar;
|
||||
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.AL10;
|
||||
@@ -31,7 +30,7 @@ public class SoundSystem extends RootBusNode implements Updateable {
|
||||
private static final Vect INITIAL_LISTENER_POS = Vect.ZERO;
|
||||
private static final int MAX_SOURCES = 256;
|
||||
|
||||
private static VectMutable listener = VectMutable.zero();
|
||||
private static VectVar listener = Vect.makeVar();
|
||||
private static boolean soundSystemInited = false;
|
||||
|
||||
|
||||
@@ -60,9 +59,9 @@ public class SoundSystem extends RootBusNode implements Updateable {
|
||||
/**
|
||||
* @return listener coordinate
|
||||
*/
|
||||
public static VectView getListener()
|
||||
public static Vect getListener()
|
||||
{
|
||||
return listener.view();
|
||||
return listener;
|
||||
}
|
||||
|
||||
// -- instance --
|
||||
|
||||
@@ -3,7 +3,6 @@ package mightypork.gamecore.control.bus.events;
|
||||
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -78,9 +77,9 @@ public class MouseButtonEvent implements Event<MouseButtonEvent.Listener> {
|
||||
/**
|
||||
* @return mouse position when the event occurred
|
||||
*/
|
||||
public VectView getPos()
|
||||
public Vect getPos()
|
||||
{
|
||||
return pos.view();
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package mightypork.gamecore.control.bus.events;
|
||||
|
||||
import mightypork.gamecore.control.bus.events.types.UnloggedEvent;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectVal;
|
||||
import mightypork.utils.math.vect.VectConst;
|
||||
|
||||
|
||||
/**
|
||||
@@ -14,8 +14,8 @@ import mightypork.utils.math.vect.VectVal;
|
||||
@UnloggedEvent
|
||||
public class MouseMotionEvent implements Event<MouseMotionEvent.Listener> {
|
||||
|
||||
private final VectVal move;
|
||||
private final VectVal pos;
|
||||
private final VectConst move;
|
||||
private final VectConst pos;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,15 +23,15 @@ public class MouseMotionEvent implements Event<MouseMotionEvent.Listener> {
|
||||
* @param move move vector
|
||||
*/
|
||||
public MouseMotionEvent(Vect pos, Vect move) {
|
||||
this.move = move.copy();
|
||||
this.pos = pos.copy();
|
||||
this.move = move.freeze();
|
||||
this.pos = pos.freeze();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return movement since last {@link MouseMotionEvent}
|
||||
*/
|
||||
public VectVal getMove()
|
||||
public VectConst getMove()
|
||||
{
|
||||
return move;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class MouseMotionEvent implements Event<MouseMotionEvent.Listener> {
|
||||
/**
|
||||
* @return current mouse position
|
||||
*/
|
||||
public VectVal getPos()
|
||||
public VectConst getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package mightypork.gamecore.control.bus.events;
|
||||
|
||||
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -50,9 +49,9 @@ public class ScreenChangeEvent implements Event<ScreenChangeEvent.Listener> {
|
||||
/**
|
||||
* @return new screen size
|
||||
*/
|
||||
public VectView getScreenSize()
|
||||
public Vect getScreenSize()
|
||||
{
|
||||
return screenSize.view();
|
||||
return screenSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ package mightypork.gamecore.gui.components;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.control.AppSubModule;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
|
||||
|
||||
public abstract class AbstractComponent extends AppSubModule implements PluggableRenderable {
|
||||
@@ -25,7 +25,7 @@ public abstract class AbstractComponent extends AppSubModule implements Pluggabl
|
||||
|
||||
|
||||
@Override
|
||||
public RectView getRect()
|
||||
public Rect getRect()
|
||||
{
|
||||
return context.getRect();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package mightypork.gamecore.gui.components;
|
||||
|
||||
import mightypork.utils.math.constraints.PluggableRectBound;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ public interface PluggableRenderable extends Renderable, PluggableRectBound {
|
||||
|
||||
|
||||
@Override
|
||||
RectView getRect();
|
||||
Rect getRect();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.RectBoundAdapter;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ public abstract class AbstractPainter extends RectBoundAdapter implements Plugga
|
||||
|
||||
|
||||
@Override
|
||||
public RectView getRect()
|
||||
public Rect getRect()
|
||||
{
|
||||
return super.getRect();
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ import mightypork.gamecore.render.fonts.FontRenderer;
|
||||
import mightypork.gamecore.render.fonts.FontRenderer.Align;
|
||||
import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectMutable;
|
||||
import mightypork.utils.math.vect.VectVar;
|
||||
import mightypork.utils.string.StringProvider;
|
||||
import mightypork.utils.string.StringProvider.StringWrapper;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TextPainter extends AbstractPainter {
|
||||
private boolean shadow;
|
||||
|
||||
private RGB shadowColor = RGB.BLACK;
|
||||
private final VectMutable shadowOffset = VectMutable.make(1, 1);
|
||||
private final VectVar shadowOffset = Vect.makeVar(1, 1);
|
||||
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ public class TextPainter extends AbstractPainter {
|
||||
if (text == null) return;
|
||||
|
||||
final String str = text.getString();
|
||||
final RectView rect = getRect();
|
||||
final Rect rect = getRect();
|
||||
|
||||
if (shadow) {
|
||||
font.draw(str, rect.move(shadowOffset), align, shadowColor);
|
||||
|
||||
@@ -11,7 +11,7 @@ import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.annotations.DefaultImpl;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class Screen extends AppSubModule implements Renderable, KeyBind
|
||||
|
||||
|
||||
@Override
|
||||
public RectView getRect()
|
||||
public Rect getRect()
|
||||
{
|
||||
return getDisplay().getRect();
|
||||
}
|
||||
@@ -169,4 +169,17 @@ public abstract class Screen extends AppSubModule implements Renderable, KeyBind
|
||||
* @return screen identifier to be used for requests.
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
|
||||
protected final Rect bounds()
|
||||
{
|
||||
return getRect();
|
||||
}
|
||||
|
||||
|
||||
protected final Vect mouse()
|
||||
{
|
||||
return getInput().getMousePos();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ import mightypork.gamecore.input.KeyBindingPool;
|
||||
import mightypork.gamecore.input.KeyStroke;
|
||||
import mightypork.utils.annotations.DefaultImpl;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,11 +25,6 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
|
||||
|
||||
private final KeyBindingPool keybindings = new KeyBindingPool();
|
||||
|
||||
/** Mouse position constraint */
|
||||
protected final VectView cMousePos = getInput().getMousePos();
|
||||
/** Screen size constraint */
|
||||
protected final VectView cScreenSize = getDisplay().getSize();
|
||||
|
||||
|
||||
/**
|
||||
* @param screen parent screen
|
||||
@@ -67,7 +61,7 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
|
||||
|
||||
|
||||
@Override
|
||||
public RectView getRect()
|
||||
public Rect getRect()
|
||||
{
|
||||
return screen.getRect();
|
||||
}
|
||||
@@ -129,4 +123,16 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
|
||||
*/
|
||||
public abstract int getPriority();
|
||||
|
||||
|
||||
protected final Rect bounds()
|
||||
{
|
||||
return screen.bounds();
|
||||
}
|
||||
|
||||
|
||||
protected final Vect mouse()
|
||||
{
|
||||
return screen.mouse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import mightypork.gamecore.control.bus.events.MouseMotionEvent;
|
||||
import mightypork.gamecore.control.timing.Updateable;
|
||||
import mightypork.rogue.events.ActionRequest;
|
||||
import mightypork.rogue.events.ActionRequest.RequestType;
|
||||
import mightypork.utils.math.vect.VectMutable;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectVar;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -29,7 +29,7 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
private final KeyBindingPool keybindings;
|
||||
|
||||
/** Current mouse position */
|
||||
private final VectView mousePos = new VectView() {
|
||||
private final Vect mousePos = new Vect() {
|
||||
|
||||
@Override
|
||||
public double x()
|
||||
@@ -103,8 +103,8 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
}
|
||||
|
||||
// counters as fields to save memory.
|
||||
private final VectMutable mouseMove = VectMutable.zero();
|
||||
private final VectMutable mouseLastPos = VectMutable.zero();
|
||||
private final VectVar mouseMove = VectVar.makeVar();
|
||||
private final VectVar mouseLastPos = VectVar.makeVar();
|
||||
|
||||
|
||||
@Override
|
||||
@@ -140,13 +140,13 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
}
|
||||
|
||||
|
||||
private void onMouseEvent(VectMutable moveSum, VectMutable lastPos)
|
||||
private void onMouseEvent(VectVar moveSum, VectVar lastPos)
|
||||
{
|
||||
final int button = Mouse.getEventButton();
|
||||
final boolean down = Mouse.getEventButtonState();
|
||||
|
||||
final VectMutable pos = VectMutable.make(Mouse.getEventX(), Mouse.getEventY());
|
||||
final VectMutable move = VectMutable.make(Mouse.getEventDX(), Mouse.getEventDY());
|
||||
final VectVar pos = Vect.makeVar(Mouse.getEventX(), Mouse.getEventY());
|
||||
final VectVar move = Vect.makeVar(Mouse.getEventDX(), Mouse.getEventDY());
|
||||
|
||||
final int wheeld = Mouse.getEventDWheel();
|
||||
|
||||
@@ -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.copy(), button, down, wheeld));
|
||||
getEventBus().send(new MouseButtonEvent(pos.freeze(), button, down, wheeld));
|
||||
}
|
||||
|
||||
moveSum.add(move);
|
||||
@@ -178,7 +178,7 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
*
|
||||
* @return mouse position
|
||||
*/
|
||||
public VectView getMousePos()
|
||||
public Vect getMousePos()
|
||||
{
|
||||
return mousePos;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,8 @@ import mightypork.gamecore.control.bus.events.ScreenChangeEvent;
|
||||
import mightypork.gamecore.control.timing.FpsMeter;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.rect.RectVal;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
@@ -33,7 +32,7 @@ public class DisplaySystem extends AppModule implements RectBound {
|
||||
private FpsMeter fpsMeter;
|
||||
|
||||
/** Current screen size */
|
||||
private final VectView screenSize = new VectView() {
|
||||
private final Vect screenSize = new Vect() {
|
||||
|
||||
@Override
|
||||
public double y()
|
||||
@@ -49,6 +48,8 @@ public class DisplaySystem extends AppModule implements RectBound {
|
||||
}
|
||||
};
|
||||
|
||||
private final Rect rect = Rect.make(screenSize);
|
||||
|
||||
|
||||
/**
|
||||
* @param app app access
|
||||
@@ -189,7 +190,7 @@ public class DisplaySystem extends AppModule implements RectBound {
|
||||
*
|
||||
* @return size
|
||||
*/
|
||||
public VectView getSize()
|
||||
public Vect getSize()
|
||||
{
|
||||
return screenSize;
|
||||
}
|
||||
@@ -240,9 +241,9 @@ public class DisplaySystem extends AppModule implements RectBound {
|
||||
|
||||
|
||||
@Override
|
||||
public RectView getRect()
|
||||
public Rect getRect()
|
||||
{
|
||||
return RectVal.make(getSize());
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +256,7 @@ public class DisplaySystem extends AppModule implements RectBound {
|
||||
}
|
||||
|
||||
|
||||
public VectView getCenter()
|
||||
public Vect getCenter()
|
||||
{
|
||||
return getSize().half();
|
||||
}
|
||||
|
||||
@@ -10,10 +10,8 @@ import mightypork.utils.files.FileUtils;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.rect.RectView;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectVal;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.vect.VectConst;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.newdawn.slick.opengl.Texture;
|
||||
@@ -29,9 +27,9 @@ import org.newdawn.slick.util.ResourceLoader;
|
||||
*/
|
||||
public class Render {
|
||||
|
||||
public static final VectView AXIS_X = VectVal.make(1, 0, 0);
|
||||
public static final VectView AXIS_Y = VectVal.make(0, 1, 0);
|
||||
public static final VectView AXIS_Z = VectVal.make(0, 0, 1);
|
||||
public static final VectConst AXIS_X = Vect.make(1, 0, 0);
|
||||
public static final VectConst AXIS_Y = Vect.make(0, 1, 0);
|
||||
public static final VectConst AXIS_Z = Vect.make(0, 0, 1);
|
||||
|
||||
|
||||
/**
|
||||
@@ -214,7 +212,7 @@ public class Render {
|
||||
*/
|
||||
public static void rotate(double angle, Vect axis)
|
||||
{
|
||||
final Vect vec = axis.view().norm(1);
|
||||
final Vect vec = axis.norm(1);
|
||||
glRotated(angle, vec.x(), vec.y(), vec.z());
|
||||
}
|
||||
|
||||
@@ -352,12 +350,10 @@ public class Render {
|
||||
*/
|
||||
public static void quad(Rect quad)
|
||||
{
|
||||
final RectView rv = quad.view();
|
||||
|
||||
final double x1 = rv.left().value();
|
||||
final double y1 = rv.top().value();
|
||||
final double x2 = rv.right().value();
|
||||
final double y2 = rv.bottom().value();
|
||||
final double x1 = quad.left().value();
|
||||
final double y1 = quad.top().value();
|
||||
final double x2 = quad.right().value();
|
||||
final double y2 = quad.bottom().value();
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
@@ -394,15 +390,15 @@ public class Render {
|
||||
*/
|
||||
public static void quadUV_nobound(Rect quad, Rect uvs)
|
||||
{
|
||||
final double x1 = quad.left();
|
||||
final double y1 = quad.top();
|
||||
final double x2 = quad.right();
|
||||
final double y2 = quad.bottom();
|
||||
final double x1 = quad.left().value();
|
||||
final double y1 = quad.top().value();
|
||||
final double x2 = quad.right().value();
|
||||
final double y2 = quad.bottom().value();
|
||||
|
||||
final double tx1 = uvs.left();
|
||||
final double ty1 = uvs.top();
|
||||
final double tx2 = uvs.right();
|
||||
final double ty2 = uvs.bottom();
|
||||
final double tx1 = uvs.left().value();
|
||||
final double ty1 = uvs.top().value();
|
||||
final double tx2 = uvs.right().value();
|
||||
final double ty2 = uvs.bottom().value();
|
||||
|
||||
// quad with texture
|
||||
glTexCoord2d(tx1, ty2);
|
||||
@@ -440,10 +436,10 @@ public class Render {
|
||||
*/
|
||||
public static void quadColor(Rect quad, RGB colorHMinVMin, RGB colorHMaxVMin, RGB colorHMaxVMax, RGB colorHMinVMax)
|
||||
{
|
||||
final double x1 = quad.left();
|
||||
final double y1 = quad.top();
|
||||
final double x2 = quad.right();
|
||||
final double y2 = quad.bottom();
|
||||
final double x1 = quad.left().value();
|
||||
final double y1 = quad.top().value();
|
||||
final double x2 = quad.right().value();
|
||||
final double y2 = quad.bottom().value();
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
@@ -547,7 +543,7 @@ public class Render {
|
||||
*
|
||||
* @param size viewport size (screen size)
|
||||
*/
|
||||
public static void setupOrtho(VectView size)
|
||||
public static void setupOrtho(Vect size)
|
||||
{
|
||||
// fix projection for changed size
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
||||
@@ -5,8 +5,7 @@ import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectMutable;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.vect.VectVar;
|
||||
|
||||
|
||||
/**
|
||||
@@ -110,7 +109,7 @@ public class FontRenderer {
|
||||
{
|
||||
Render.pushMatrix();
|
||||
|
||||
Render.translate(pos.copy().round());
|
||||
Render.translate(pos.freeze().round());
|
||||
Render.scaleXY(getScale(height));
|
||||
|
||||
font.draw(text, color);
|
||||
@@ -144,7 +143,7 @@ public class FontRenderer {
|
||||
*/
|
||||
public void draw(String text, Rect bounds, Align align, RGB color)
|
||||
{
|
||||
VectView start;
|
||||
Vect start;
|
||||
|
||||
switch (align) {
|
||||
case LEFT:
|
||||
@@ -161,7 +160,7 @@ public class FontRenderer {
|
||||
break;
|
||||
}
|
||||
|
||||
draw(text, start, bounds.height(), align, color);
|
||||
draw(text, start, bounds.height().value(), align, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +192,7 @@ public class FontRenderer {
|
||||
|
||||
final double w = getWidth(text, height);
|
||||
|
||||
final VectMutable start = VectMutable.make(pos);
|
||||
final VectVar start = Vect.makeVar(pos);
|
||||
|
||||
switch (align) {
|
||||
case LEFT:
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.gamecore.render.fonts;
|
||||
|
||||
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ public interface GLFont {
|
||||
* @param text string to check
|
||||
* @return coord (width, height)
|
||||
*/
|
||||
VectView getNeededSpace(String text);
|
||||
Vect getNeededSpace(String text);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ import mightypork.gamecore.render.fonts.GLFont;
|
||||
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.VectConst;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
@@ -294,8 +294,7 @@ public class CachedFont implements GLFont {
|
||||
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(newI);
|
||||
} else {
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder())
|
||||
.put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
|
||||
byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder()).put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
|
||||
}
|
||||
|
||||
byteBuffer.flip();
|
||||
@@ -412,8 +411,7 @@ public class CachedFont implements GLFont {
|
||||
chtx = chars.get(charCurrent);
|
||||
|
||||
if (chtx != null) {
|
||||
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY
|
||||
+ chtx.height);
|
||||
drawQuad((totalwidth), 0, (totalwidth + chtx.width), (chtx.height), chtx.texPosX, chtx.texPosY, chtx.texPosX + chtx.width, chtx.texPosY + chtx.height);
|
||||
totalwidth += chtx.width;
|
||||
}
|
||||
}
|
||||
@@ -424,9 +422,9 @@ public class CachedFont implements GLFont {
|
||||
|
||||
|
||||
@Override
|
||||
public VectVal getNeededSpace(String text)
|
||||
public VectConst getNeededSpace(String text)
|
||||
{
|
||||
return VectVal.make(getWidth(text), getLineHeight());
|
||||
return VectConst.make(getWidth(text), getLineHeight());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import mightypork.utils.annotations.Alias;
|
||||
import mightypork.utils.files.FileUtils;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -130,7 +129,7 @@ public class DeferredFont extends DeferredResource implements GLFont {
|
||||
*/
|
||||
protected Font getAwtFont(String resource, float size, int style) throws FontFormatException, IOException
|
||||
{
|
||||
try(InputStream in = FileUtils.getResource(resource)) {
|
||||
try (InputStream in = FileUtils.getResource(resource)) {
|
||||
|
||||
Font awtFont = Font.createFont(Font.TRUETYPE_FONT, in);
|
||||
|
||||
@@ -164,7 +163,7 @@ public class DeferredFont extends DeferredResource implements GLFont {
|
||||
* @return coord (width, height)
|
||||
*/
|
||||
@Override
|
||||
public VectView getNeededSpace(String text)
|
||||
public Vect getNeededSpace(String text)
|
||||
{
|
||||
if (!ensureLoaded()) return Vect.ZERO;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.vect.Vect;
|
||||
import mightypork.utils.math.vect.VectView;
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,7 +22,7 @@ public class NullFont implements GLFont {
|
||||
|
||||
|
||||
@Override
|
||||
public VectView getNeededSpace(String str)
|
||||
public Vect getNeededSpace(String str)
|
||||
{
|
||||
return Vect.ZERO;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package mightypork.gamecore.render.textures;
|
||||
|
||||
|
||||
import mightypork.utils.math.rect.Rect;
|
||||
import mightypork.utils.math.rect.RectVal;
|
||||
import mightypork.utils.math.rect.RectConst;
|
||||
|
||||
import org.newdawn.slick.opengl.Texture;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TxQuad {
|
||||
* @param y2 right bottom Y (0-1)
|
||||
*/
|
||||
public TxQuad(Texture tx, double x1, double y1, double x2, double y2) {
|
||||
this(tx, RectVal.make(x1, y1, x2, y2));
|
||||
this(tx, RectConst.make(x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user