Digest caching, oh boy! Such commit! Wow!
This commit is contained in:
@@ -198,30 +198,28 @@ final public class EventBus implements Destroyable {
|
||||
{
|
||||
assertLive();
|
||||
|
||||
synchronized (this) {
|
||||
channels.setBuffering(true);
|
||||
clients.setBuffering(true);
|
||||
|
||||
boolean sent = false;
|
||||
boolean accepted = false;
|
||||
|
||||
final boolean singular = event.getClass().isAnnotationPresent(SingleReceiverEvent.class);
|
||||
|
||||
for (final EventChannel<?, ?> b : channels) {
|
||||
if (b.canBroadcast(event)) {
|
||||
accepted = true;
|
||||
sent |= b.broadcast(event, clients);
|
||||
}
|
||||
|
||||
if (sent && singular) break;
|
||||
channels.setBuffering(true);
|
||||
clients.setBuffering(true);
|
||||
|
||||
boolean sent = false;
|
||||
boolean accepted = false;
|
||||
|
||||
final boolean singular = event.getClass().isAnnotationPresent(SingleReceiverEvent.class);
|
||||
|
||||
for (final EventChannel<?, ?> b : channels) {
|
||||
if (b.canBroadcast(event)) {
|
||||
accepted = true;
|
||||
sent |= b.broadcast(event, clients);
|
||||
}
|
||||
|
||||
if (!accepted) Log.e("<bus> Not accepted by any channel: " + Log.str(event));
|
||||
if (!sent && shallLog(event)) Log.w("<bus> Not delivered: " + Log.str(event));
|
||||
|
||||
channels.setBuffering(false);
|
||||
clients.setBuffering(false);
|
||||
if (sent && singular) break;
|
||||
}
|
||||
|
||||
if (!accepted) Log.e("<bus> Not accepted by any channel: " + Log.str(event));
|
||||
if (!sent && shallLog(event)) Log.w("<bus> Not delivered: " + Log.str(event));
|
||||
|
||||
channels.setBuffering(false);
|
||||
clients.setBuffering(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package mightypork.gamecore.gui;
|
||||
|
||||
|
||||
import mightypork.gamecore.control.interf.Enableable;
|
||||
|
||||
|
||||
/**
|
||||
* Triggered action
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public abstract class Action implements Runnable {
|
||||
public abstract class Action implements Runnable, Enableable {
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
@@ -16,7 +19,8 @@ public abstract class Action implements Runnable {
|
||||
*
|
||||
* @param enable true to enable
|
||||
*/
|
||||
public void setEnabled(boolean enable)
|
||||
@Override
|
||||
public final void enable(boolean enable)
|
||||
{
|
||||
this.enabled = enable;
|
||||
}
|
||||
@@ -25,14 +29,15 @@ public abstract class Action implements Runnable {
|
||||
/**
|
||||
* @return true if this action is enabled.
|
||||
*/
|
||||
public boolean isEnabled()
|
||||
@Override
|
||||
public final boolean isEnabled()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
public final void run()
|
||||
{
|
||||
if (enabled) execute();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ 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;
|
||||
|
||||
@@ -153,11 +152,4 @@ public abstract class BusEnabledPainter extends SimplePainter implements ClientH
|
||||
|
||||
protected abstract void paint();
|
||||
|
||||
|
||||
@Override
|
||||
@DefaultImpl
|
||||
public void update(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -14,7 +13,7 @@ import mightypork.utils.math.constraints.rect.Rect;
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface Component extends Hideable, PluggableRenderable, Updateable, Enableable, ToggleableClient {
|
||||
public interface Component extends Hideable, PluggableRenderable, Enableable, ToggleableClient {
|
||||
|
||||
/**
|
||||
* Enable the component. This includes listening to event bus, and any
|
||||
@@ -51,10 +50,6 @@ public interface Component extends Hideable, PluggableRenderable, Updateable, En
|
||||
void render();
|
||||
|
||||
|
||||
@Override
|
||||
void update(double delta);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isListening();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
import mightypork.utils.math.constraints.vect.VectVar;
|
||||
import mightypork.utils.string.StringProvider;
|
||||
import mightypork.utils.string.StringProvider.StringWrapper;
|
||||
|
||||
@@ -29,7 +28,7 @@ public class TextPainter extends SimplePainter {
|
||||
private boolean shadow;
|
||||
|
||||
private RGB shadowColor = RGB.BLACK;
|
||||
private final VectVar shadowOffset = Vect.makeVar(1, 1);
|
||||
private Vect shadowOffset = Vect.make(1, 1);
|
||||
|
||||
|
||||
/**
|
||||
@@ -116,7 +115,7 @@ public class TextPainter extends SimplePainter {
|
||||
|
||||
public void setShadowOffset(Vect shadowOffset)
|
||||
{
|
||||
this.shadowOffset.setTo(shadowOffset);
|
||||
this.shadowOffset = shadowOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,6 +92,17 @@ public class Render {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate with coord, discard Z
|
||||
*
|
||||
* @param coord coord
|
||||
*/
|
||||
public static void translateXY(Vect coord)
|
||||
{
|
||||
glTranslated(coord.x(), coord.y(), 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scale
|
||||
*
|
||||
@@ -352,7 +363,6 @@ public class Render {
|
||||
public static void quad(Rect quad)
|
||||
{
|
||||
final RectDigest q = quad.digest();
|
||||
System.out.println(q);
|
||||
|
||||
// draw with color
|
||||
unbindTexture();
|
||||
|
||||
@@ -5,7 +5,6 @@ import mightypork.gamecore.render.Render;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
import mightypork.utils.math.constraints.vect.VectVar;
|
||||
|
||||
|
||||
/**
|
||||
@@ -109,7 +108,7 @@ public class FontRenderer {
|
||||
{
|
||||
Render.pushMatrix();
|
||||
|
||||
Render.translate(pos.freeze().round());
|
||||
Render.translateXY(pos.round());
|
||||
Render.scaleXY(getScale(height));
|
||||
|
||||
font.draw(text, color);
|
||||
@@ -192,19 +191,20 @@ public class FontRenderer {
|
||||
|
||||
final double w = getWidth(text, height);
|
||||
|
||||
final VectVar start = Vect.makeVar(pos);
|
||||
Vect start;
|
||||
|
||||
switch (align) {
|
||||
case LEFT:
|
||||
start = pos;
|
||||
break;
|
||||
|
||||
case CENTER:
|
||||
start.sub(w / 2D, 0);
|
||||
start = pos.sub(w / 2D, 0);
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
default:
|
||||
start.sub(w, 0);
|
||||
start = pos.sub(w, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user