Digest caching, oh boy! Such commit! Wow!
This commit is contained in:
@@ -29,6 +29,20 @@ import mightypork.utils.logging.LogWriter;
|
||||
*/
|
||||
public class App extends BaseApp {
|
||||
|
||||
/**
|
||||
* Launcher
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Config.init();
|
||||
Config.save();
|
||||
|
||||
(new App()).start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected LogWriter createLog()
|
||||
{
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package mightypork.rogue;
|
||||
|
||||
|
||||
public class Main {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Config.init();
|
||||
Config.save();
|
||||
|
||||
(new App()).start();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package mightypork.rogue.screens.test_bouncyboxes;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mightypork.gamecore.control.bus.events.ScreenChangeEvent;
|
||||
import mightypork.gamecore.control.timing.Updateable;
|
||||
import mightypork.gamecore.gui.components.SimplePainter;
|
||||
import mightypork.gamecore.render.Render;
|
||||
@@ -13,7 +14,7 @@ import mightypork.utils.math.constraints.num.Num;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
|
||||
|
||||
public class BouncyBox extends SimplePainter implements Updateable {
|
||||
public class BouncyBox extends SimplePainter implements Updateable, ScreenChangeEvent.Listener {
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
@@ -30,6 +31,7 @@ public class BouncyBox extends SimplePainter implements Updateable {
|
||||
abox = abox.shrink(height().perc(10));
|
||||
|
||||
box = abox;
|
||||
box.enableDigestCaching(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +57,17 @@ public class BouncyBox extends SimplePainter implements Updateable {
|
||||
@Override
|
||||
public void update(double delta)
|
||||
{
|
||||
pos.update(delta);
|
||||
if (pos.isInProgress()) {
|
||||
pos.update(delta);
|
||||
box.poll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void receive(ScreenChangeEvent event)
|
||||
{
|
||||
box.poll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import mightypork.gamecore.input.Keys;
|
||||
import mightypork.gamecore.render.fonts.FontRenderer.Align;
|
||||
import mightypork.rogue.Res;
|
||||
import mightypork.utils.math.color.RGB;
|
||||
import mightypork.utils.math.constraints.num.Num;
|
||||
import mightypork.utils.math.constraints.rect.Rect;
|
||||
import mightypork.utils.math.constraints.vect.Vect;
|
||||
|
||||
@@ -50,9 +51,9 @@ public class LayerBouncyBoxes extends ScreenLayer {
|
||||
|
||||
final Rect holder_rect = b.shrink(b.height().perc(8));
|
||||
|
||||
addChildClient(layout = new RowHolder(screen, holder_rect, 2));
|
||||
addChildClient(layout = new RowHolder(screen, holder_rect, 100));
|
||||
|
||||
for (int i = 0; i <= 0; i++) {
|
||||
for (int i = 0; i < 99; i++) {
|
||||
final BouncyBox bbr = new BouncyBox();
|
||||
layout.add(bbr);
|
||||
boxes.add(bbr);
|
||||
@@ -60,7 +61,10 @@ public class LayerBouncyBoxes extends ScreenLayer {
|
||||
|
||||
final TextPainter tp = new TextPainter(Res.getFont("default"), Align.LEFT, RGB.WHITE);
|
||||
tp.setText("Press \"C\" for \"Cat\" screen.");
|
||||
tp.setShadow(RGB.RED, Vect.make(2, 2));
|
||||
|
||||
final Num shadowOffset = tp.height().div(16 * 2); // half pixel if 16px font
|
||||
|
||||
tp.setShadow(RGB.RED, Vect.make(shadowOffset, shadowOffset));
|
||||
|
||||
layout.add(tp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user