all compiles and "works" now.
This commit is contained in:
@@ -15,7 +15,7 @@ import mightypork.gamecore.render.DisplaySystem;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class AppSubModule extends BusNode implements AppAccess {
|
||||
public class AppSubModule extends BusNode implements AppAccess {
|
||||
|
||||
private final AppAccess app;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import mightypork.gamecore.control.bus.EventBus;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class BusNode implements BusAccess, DelegatingClient, ToggleableClient {
|
||||
public abstract class BusNode implements BusAccess, ClientHub {
|
||||
|
||||
private final BusAccess busAccess;
|
||||
|
||||
@@ -58,6 +58,7 @@ public abstract class BusNode implements BusAccess, DelegatingClient, Toggleable
|
||||
*
|
||||
* @param client
|
||||
*/
|
||||
@Override
|
||||
public final void addChildClient(Object client)
|
||||
{
|
||||
if (client instanceof RootBusNode) {
|
||||
@@ -75,6 +76,7 @@ public abstract class BusNode implements BusAccess, DelegatingClient, Toggleable
|
||||
*
|
||||
* @param client subscriber to remove
|
||||
*/
|
||||
@Override
|
||||
public final void removeChildClient(Object client)
|
||||
{
|
||||
if (client != null) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package mightypork.gamecore.control.bus.clients;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import mightypork.gamecore.control.bus.EventBus;
|
||||
|
||||
|
||||
/**
|
||||
* Common methods for client hubs (ie delegating vlient implementations)
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface ClientHub extends DelegatingClient, ToggleableClient {
|
||||
|
||||
@Override
|
||||
public boolean doesDelegate();
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<Object> getChildClients();
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isListening();
|
||||
|
||||
|
||||
/**
|
||||
* Add a child subscriber to the {@link EventBus}.<br>
|
||||
*
|
||||
* @param client
|
||||
*/
|
||||
public void addChildClient(Object client);
|
||||
|
||||
|
||||
/**
|
||||
* Remove a child subscriber
|
||||
*
|
||||
* @param client subscriber to remove
|
||||
*/
|
||||
void removeChildClient(Object client);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package mightypork.gamecore.control.interf;
|
||||
|
||||
|
||||
/**
|
||||
* Can be enabled or disabled.<br>
|
||||
* Implementations should take appropriate action (ie. stop listening to events,
|
||||
* updating etc.)
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface Enableable {
|
||||
|
||||
/**
|
||||
* Change enabled state
|
||||
*
|
||||
* @param yes enabled
|
||||
*/
|
||||
public void enable(boolean yes);
|
||||
|
||||
|
||||
/**
|
||||
* @return true if enabled
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package mightypork.gamecore.gui;
|
||||
|
||||
|
||||
/**
|
||||
* Element that can be hidden or visible
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface Hideable {
|
||||
|
||||
void setVisible(boolean yes);
|
||||
|
||||
|
||||
boolean isVisible();
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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.constraints.rect.Rect;
|
||||
|
||||
|
||||
public abstract class AbstractComponent extends AppSubModule implements PluggableRenderable {
|
||||
|
||||
private RectBound context;
|
||||
|
||||
|
||||
public AbstractComponent(AppAccess app) {
|
||||
super(app);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRect(RectBound context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Rect getRect()
|
||||
{
|
||||
return context.getRect();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import mightypork.gamecore.audio.SoundSystem;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.control.AppSubModule;
|
||||
import mightypork.gamecore.control.bus.EventBus;
|
||||
import mightypork.gamecore.control.bus.clients.ClientHub;
|
||||
import mightypork.gamecore.input.InputSystem;
|
||||
import mightypork.gamecore.render.DisplaySystem;
|
||||
import mightypork.utils.annotations.DefaultImpl;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public abstract class BusEnabledPainter extends SimplePainter implements ClientHub, Component, AppAccess {
|
||||
|
||||
private RectBound context;
|
||||
private boolean enabled;
|
||||
private boolean visible = true;
|
||||
|
||||
private final AppSubModule subModule;
|
||||
|
||||
|
||||
public BusEnabledPainter(AppAccess app) {
|
||||
this.subModule = new AppSubModule(app);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRect(RectBound context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Rect getRect()
|
||||
{
|
||||
return context.getRect();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EventBus getEventBus()
|
||||
{
|
||||
return subModule.getEventBus();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<Object> getChildClients()
|
||||
{
|
||||
return subModule.getChildClients();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean doesDelegate()
|
||||
{
|
||||
return subModule.doesDelegate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isListening()
|
||||
{
|
||||
return subModule.isListening();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SoundSystem getSoundSystem()
|
||||
{
|
||||
return subModule.getSoundSystem();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InputSystem getInput()
|
||||
{
|
||||
return subModule.getInput();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DisplaySystem getDisplay()
|
||||
{
|
||||
return subModule.getDisplay();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void shutdown()
|
||||
{
|
||||
subModule.shutdown();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addChildClient(Object client)
|
||||
{
|
||||
subModule.addChildClient(client);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeChildClient(Object client)
|
||||
{
|
||||
subModule.removeChildClient(client);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void enable(boolean yes)
|
||||
{
|
||||
subModule.setDelegating(yes);
|
||||
subModule.setListening(yes);
|
||||
enabled = yes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void render()
|
||||
{
|
||||
if (!visible) return;
|
||||
paint();
|
||||
}
|
||||
|
||||
|
||||
protected abstract void paint();
|
||||
|
||||
|
||||
@Override
|
||||
@DefaultImpl
|
||||
public void update(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.gamecore.control.bus.clients.ToggleableClient;
|
||||
import mightypork.gamecore.control.interf.Enableable;
|
||||
import mightypork.gamecore.control.timing.Updateable;
|
||||
import mightypork.gamecore.gui.Hideable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
/**
|
||||
* UI component interface
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface Component extends Hideable, PluggableRenderable, Updateable, Enableable, ToggleableClient {
|
||||
|
||||
/**
|
||||
* Enable the component. This includes listening to event bus, and any
|
||||
* event-related actions.
|
||||
*/
|
||||
@Override
|
||||
void enable(boolean yes);
|
||||
|
||||
|
||||
@Override
|
||||
boolean isEnabled();
|
||||
|
||||
|
||||
/**
|
||||
* Set visible. When not visible, the component should not render.
|
||||
*/
|
||||
@Override
|
||||
void setVisible(boolean yes);
|
||||
|
||||
|
||||
@Override
|
||||
boolean isVisible();
|
||||
|
||||
|
||||
@Override
|
||||
Rect getRect();
|
||||
|
||||
|
||||
@Override
|
||||
void setRect(RectBound rect);
|
||||
|
||||
|
||||
@Override
|
||||
void render();
|
||||
|
||||
|
||||
@Override
|
||||
void update(double delta);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isListening();
|
||||
}
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
package mightypork.gamecore.gui.components.painters;
|
||||
package mightypork.gamecore.gui.components;
|
||||
|
||||
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectBoundAdapter;
|
||||
@@ -13,7 +11,7 @@ import mightypork.utils.math.constraints.rect.RectBoundAdapter;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class AbstractPainter extends RectBoundAdapter implements PluggableRenderable {
|
||||
public abstract class SimplePainter extends RectBoundAdapter implements PluggableRenderable {
|
||||
|
||||
@Override
|
||||
public abstract void render();
|
||||
@@ -5,20 +5,20 @@ import java.util.LinkedList;
|
||||
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.control.bus.EventBus;
|
||||
import mightypork.gamecore.gui.components.AbstractComponent;
|
||||
import mightypork.gamecore.gui.components.BusEnabledPainter;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.gamecore.gui.components.painters.AbstractPainter;
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
|
||||
|
||||
/**
|
||||
* Bag for {@link AbstractPainter} elements with constraints.<br>
|
||||
* Bag for {@link SimplePainter} elements with constraints.<br>
|
||||
* Elements are exposed to {@link EventBus}.
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class AbstractLayout extends AbstractComponent {
|
||||
public abstract class AbstractLayout extends BusEnabledPainter {
|
||||
|
||||
final LinkedList<PluggableRenderable> elements = new LinkedList<>();
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractLayout extends AbstractComponent {
|
||||
|
||||
|
||||
@Override
|
||||
public void render()
|
||||
public void paint()
|
||||
{
|
||||
for (final Renderable element : elements) {
|
||||
element.render();
|
||||
|
||||
@@ -4,6 +4,7 @@ package mightypork.gamecore.gui.components.layout;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.TiledRect;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,18 +14,18 @@ import mightypork.utils.math.constraints.RectBound;
|
||||
*/
|
||||
public class ColumnHolder extends AbstractLayout {
|
||||
|
||||
private final int cols;
|
||||
private final TiledRect tiler;
|
||||
private int col = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @param app app access
|
||||
* @param context context
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
*/
|
||||
public ColumnHolder(AppAccess app, RectBound context, int rows) {
|
||||
public ColumnHolder(AppAccess app, RectBound context, int cols) {
|
||||
super(app, context);
|
||||
this.cols = rows;
|
||||
this.tiler = getRect().columns(cols).zeroBased();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +34,10 @@ public class ColumnHolder extends AbstractLayout {
|
||||
* Context must be assigned before rendering.
|
||||
*
|
||||
* @param app app access
|
||||
* @param rows number of rows
|
||||
* @param cols number of columns
|
||||
*/
|
||||
public ColumnHolder(AppAccess app, int rows) {
|
||||
super(app);
|
||||
this.cols = rows;
|
||||
public ColumnHolder(AppAccess app, int cols) {
|
||||
this(app, null, cols);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ColumnHolder extends AbstractLayout {
|
||||
{
|
||||
if (elem == null) return;
|
||||
|
||||
elem.setRect(column(this, cols, col++));
|
||||
elem.setRect(tiler.column(col++));
|
||||
|
||||
attach(elem);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package mightypork.gamecore.gui.components.layout;
|
||||
import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.gui.components.PluggableRenderable;
|
||||
import mightypork.utils.math.constraints.RectBound;
|
||||
import mightypork.utils.math.constraints.rect.TiledRect;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,21 +14,10 @@ import mightypork.utils.math.constraints.RectBound;
|
||||
*/
|
||||
public class RowHolder extends AbstractLayout {
|
||||
|
||||
private final int rows;
|
||||
private final TiledRect tiler;
|
||||
private int row = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @param app app access
|
||||
* @param context bounding context
|
||||
* @param rows number of rows
|
||||
*/
|
||||
public RowHolder(AppAccess app, RectBound context, int rows) {
|
||||
super(app, context);
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make a row holder.<br>
|
||||
* Context must be assigned before rendering.
|
||||
@@ -36,8 +26,18 @@ public class RowHolder extends AbstractLayout {
|
||||
* @param rows number of rows
|
||||
*/
|
||||
public RowHolder(AppAccess app, int rows) {
|
||||
super(app);
|
||||
this.rows = rows;
|
||||
this(app, null, rows);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param app app access
|
||||
* @param context bounding context
|
||||
* @param rows number of rows
|
||||
*/
|
||||
public RowHolder(AppAccess app, RectBound context, int rows) {
|
||||
super(app, context);
|
||||
this.tiler = getRect().rows(rows).zeroBased();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RowHolder extends AbstractLayout {
|
||||
{
|
||||
if (elem == null) return;
|
||||
|
||||
elem.setRect(row(this, rows, row++));
|
||||
elem.setRect(tiler.row(row++));
|
||||
|
||||
attach(elem);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mightypork.gamecore.gui.components.painters;
|
||||
|
||||
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.gamecore.render.textures.TxQuad;
|
||||
|
||||
@@ -10,7 +11,7 @@ import mightypork.gamecore.render.textures.TxQuad;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class ImagePainter extends AbstractPainter {
|
||||
public class ImagePainter extends SimplePainter {
|
||||
|
||||
private TxQuad texture;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mightypork.gamecore.gui.components.painters;
|
||||
|
||||
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.annotations.FactoryMethod;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
@@ -11,7 +12,7 @@ import mightypork.utils.math.color.RGB;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class QuadPainter extends AbstractPainter {
|
||||
public class QuadPainter extends SimplePainter {
|
||||
|
||||
private final RGB colorHMinVMin;
|
||||
private final RGB colorHMaxVMin;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mightypork.gamecore.gui.components.painters;
|
||||
|
||||
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.gamecore.render.fonts.FontRenderer;
|
||||
import mightypork.gamecore.render.fonts.FontRenderer.Align;
|
||||
import mightypork.gamecore.render.fonts.GLFont;
|
||||
@@ -19,7 +20,7 @@ import mightypork.utils.string.StringProvider.StringWrapper;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public class TextPainter extends AbstractPainter {
|
||||
public class TextPainter extends SimplePainter {
|
||||
|
||||
private final FontRenderer font;
|
||||
private RGB color;
|
||||
|
||||
@@ -2,6 +2,7 @@ package mightypork.gamecore.gui.screens;
|
||||
|
||||
|
||||
import mightypork.gamecore.control.AppSubModule;
|
||||
import mightypork.gamecore.gui.Hideable;
|
||||
import mightypork.gamecore.gui.components.Renderable;
|
||||
import mightypork.gamecore.input.KeyBinder;
|
||||
import mightypork.gamecore.input.KeyBindingPool;
|
||||
@@ -17,7 +18,7 @@ import mightypork.utils.math.constraints.vect.Vect;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class ScreenLayer extends AppSubModule implements Comparable<ScreenLayer>, Renderable, RectBound, KeyBinder {
|
||||
public abstract class ScreenLayer extends AppSubModule implements Comparable<ScreenLayer>, Renderable, RectBound, KeyBinder, Hideable {
|
||||
|
||||
private final Screen screen;
|
||||
|
||||
@@ -67,12 +68,14 @@ public abstract class ScreenLayer extends AppSubModule implements Comparable<Scr
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
|
||||
@@ -103,8 +103,8 @@ public class InputSystem extends RootBusNode implements Updateable, KeyBinder {
|
||||
}
|
||||
|
||||
// counters as fields to save memory.
|
||||
private final VectVar mouseMove = VectVar.makeVar();
|
||||
private final VectVar mouseLastPos = VectVar.makeVar();
|
||||
private final VectVar mouseMove = Vect.makeVar();
|
||||
private final VectVar mouseLastPos = Vect.makeVar();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -114,9 +114,12 @@ public class AsyncResourceLoader extends Thread implements ResourceLoadRequest.L
|
||||
}
|
||||
|
||||
|
||||
// apparently, destroy method exists on thread :/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
Log.i("Stopping resource loader thread.");
|
||||
stopped = true;
|
||||
exs.shutdownNow();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import mightypork.utils.files.FileUtils;
|
||||
import mightypork.utils.logging.Log;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectDigest;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
import mightypork.utils.math.constraints.vect.VectConst;
|
||||
|
||||
@@ -350,20 +351,18 @@ public class Render {
|
||||
*/
|
||||
public static void quad(Rect quad)
|
||||
{
|
||||
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 RectDigest q = quad.digest();
|
||||
System.out.println(q);
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
|
||||
// quad
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(x1, y2);
|
||||
glVertex2d(x2, y2);
|
||||
glVertex2d(x2, y1);
|
||||
glVertex2d(x1, y1);
|
||||
glVertex2d(q.left, q.bottom);
|
||||
glVertex2d(q.right, q.bottom);
|
||||
glVertex2d(q.right, q.top);
|
||||
glVertex2d(q.left, q.top);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
@@ -390,25 +389,22 @@ public class Render {
|
||||
*/
|
||||
public static void quadUV_nobound(Rect quad, Rect uvs)
|
||||
{
|
||||
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 RectDigest q = quad.digest();
|
||||
|
||||
final double tx1 = uvs.left().value();
|
||||
final double ty1 = uvs.top().value();
|
||||
final double tx2 = uvs.right().value();
|
||||
final double ty2 = uvs.bottom().value();
|
||||
final RectDigest u = uvs.digest();
|
||||
|
||||
// quad with texture
|
||||
glTexCoord2d(tx1, ty2);
|
||||
glVertex2d(x1, y2);
|
||||
glTexCoord2d(tx2, ty2);
|
||||
glVertex2d(x2, y2);
|
||||
glTexCoord2d(tx2, ty1);
|
||||
glVertex2d(x2, y1);
|
||||
glTexCoord2d(tx1, ty1);
|
||||
glVertex2d(x1, y1);
|
||||
glTexCoord2d(u.left, u.bottom);
|
||||
glVertex2d(q.left, q.bottom);
|
||||
|
||||
glTexCoord2d(u.right, u.bottom);
|
||||
glVertex2d(q.right, q.bottom);
|
||||
|
||||
glTexCoord2d(u.right, u.top);
|
||||
glVertex2d(q.right, q.top);
|
||||
|
||||
glTexCoord2d(u.left, u.top);
|
||||
glVertex2d(q.left, q.top);
|
||||
}
|
||||
|
||||
|
||||
@@ -436,24 +432,23 @@ public class Render {
|
||||
*/
|
||||
public static void quadColor(Rect quad, RGB colorHMinVMin, RGB colorHMaxVMin, RGB colorHMaxVMax, RGB colorHMinVMax)
|
||||
{
|
||||
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 RectDigest r = quad.digest();
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
setColor(colorHMinVMax);
|
||||
glVertex2d(x1, y2);
|
||||
glVertex2d(r.left, r.bottom);
|
||||
|
||||
setColor(colorHMaxVMax);
|
||||
glVertex2d(x2, y2);
|
||||
glVertex2d(r.right, r.bottom);
|
||||
|
||||
setColor(colorHMaxVMin);
|
||||
glVertex2d(x2, y1);
|
||||
glVertex2d(r.right, r.top);
|
||||
|
||||
setColor(colorHMinVMin);
|
||||
glVertex2d(x1, y1);
|
||||
glVertex2d(r.left, r.top);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +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.constraints.vect.Vect;
|
||||
import mightypork.utils.math.constraints.vect.VectConst;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -426,7 +427,7 @@ public class CachedFont implements GLFont {
|
||||
@Override
|
||||
public VectConst getNeededSpace(String text)
|
||||
{
|
||||
return VectConst.make(getWidth(text), getLineHeight());
|
||||
return Vect.make(getWidth(text), getLineHeight());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package mightypork.gamecore.render.textures;
|
||||
|
||||
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.rect.RectConst;
|
||||
|
||||
import org.newdawn.slick.opengl.Texture;
|
||||
|
||||
@@ -65,7 +64,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, RectConst.make(x1, y1, x2, y2));
|
||||
this(tx, Rect.make(x1, y1, x2, y2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user