Base of spritesheet system
This commit is contained in:
@@ -132,7 +132,7 @@ public final class App extends BaseApp {
|
||||
// this will work only with reusable events (such as requests)
|
||||
bindToKey(new ActionRequest(RequestType.FULLSCREEN), Keys.F11);
|
||||
bindToKey(new ActionRequest(RequestType.SCREENSHOT), Keys.F2);
|
||||
bindToKey(new ActionRequest(RequestType.SHUTDOWN), Keys.L_CONTROL, Keys.Q);
|
||||
bindToKey(new CrossfadeRequest(null), Keys.L_CONTROL, Keys.Q);
|
||||
bindToKey(new CrossfadeRequest("main_menu"), Keys.L_CONTROL, Keys.M);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,7 @@ import mightypork.gamecore.render.fonts.FontBank;
|
||||
import mightypork.gamecore.render.fonts.GLFont;
|
||||
import mightypork.gamecore.render.fonts.Glyphs;
|
||||
import mightypork.gamecore.render.fonts.impl.DeferredFont;
|
||||
import mightypork.gamecore.render.textures.DeferredTexture;
|
||||
import mightypork.gamecore.render.textures.FilterMode;
|
||||
import mightypork.gamecore.render.textures.TextureBank;
|
||||
import mightypork.gamecore.render.textures.TxQuad;
|
||||
import mightypork.gamecore.render.textures.WrapMode;
|
||||
import mightypork.gamecore.render.textures.*;
|
||||
import mightypork.util.constraints.rect.Rect;
|
||||
|
||||
import org.newdawn.slick.opengl.Texture;
|
||||
@@ -83,22 +79,20 @@ public final class Res {
|
||||
texture.setFilter(FilterMode.NEAREST);
|
||||
texture.setWrap(WrapMode.CLAMP);
|
||||
textures.loadTexture("gui1", texture);
|
||||
|
||||
final double p16 = 0.25D;
|
||||
final double p8 = 0.125D;
|
||||
QuadGrid guiGrid = texture.grid(4, 4);
|
||||
|
||||
//@formatter:off
|
||||
textures.makeQuad("item_frame", Rect.make(0, 0, p16, p16));
|
||||
textures.makeQuad("sword", Rect.make(p16, 0, p16, p16));
|
||||
textures.makeQuad("meat", Rect.make(p16*2, 0, p16, p16));
|
||||
textures.addQuad("item_frame", guiGrid.makeQuad(0, 0));
|
||||
textures.addQuad("sword", guiGrid.makeQuad(1, 0));
|
||||
textures.addQuad("meat", guiGrid.makeQuad(2, 0));
|
||||
|
||||
textures.makeQuad("heart_on", Rect.make(0, p16, p8, p8));
|
||||
textures.makeQuad("heart_off", Rect.make(p8, p16, p8, p8));
|
||||
textures.addQuad("heart_on", guiGrid.makeQuad(.0, 1, .5, .5));
|
||||
textures.addQuad("heart_off", guiGrid.makeQuad(.5, 1, .5, .5));
|
||||
|
||||
textures.makeQuad("xp_on", Rect.make(0, p16+p8, p8, p8));
|
||||
textures.makeQuad("xp_off", Rect.make(p8, p16+p8, p8, p8));
|
||||
textures.addQuad("xp_on", guiGrid.makeQuad(0, 1.5, .5, .5));
|
||||
textures.addQuad("xp_off", guiGrid.makeQuad(.5, 1.5, .5, .5));
|
||||
|
||||
textures.makeQuad("panel", Rect.make(0, p16*4-p8/2, p16*4, p8/2));
|
||||
textures.addQuad("panel", guiGrid.makeQuad(0, 3.75, 4, .25));
|
||||
//@formatter:off
|
||||
}
|
||||
|
||||
@@ -113,7 +107,7 @@ public final class Res {
|
||||
|
||||
public static TxQuad getTxQuad(String key)
|
||||
{
|
||||
return textures.getTxQuad(key);
|
||||
return textures.getQuad(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import mightypork.gamecore.control.AppAccess;
|
||||
import mightypork.gamecore.control.events.ScreenRequestEvent;
|
||||
import mightypork.gamecore.gui.components.painters.QuadPainter;
|
||||
import mightypork.gamecore.gui.screens.Overlay;
|
||||
import mightypork.rogue.events.ActionRequest;
|
||||
import mightypork.rogue.events.ActionRequest.RequestType;
|
||||
import mightypork.util.constraints.num.mutable.NumAnimated;
|
||||
import mightypork.util.control.timing.TimedTask;
|
||||
import mightypork.util.math.Easing;
|
||||
@@ -26,8 +28,11 @@ public class CrossfadeOverlay extends Overlay implements CrossfadeRequest.Listen
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (requestedScreenName == null) shutdown();
|
||||
getEventBus().send(new ScreenRequestEvent(requestedScreenName));
|
||||
if (requestedScreenName == null) {
|
||||
getEventBus().send(new ActionRequest(RequestType.SHUTDOWN));
|
||||
} else {
|
||||
getEventBus().send(new ScreenRequestEvent(requestedScreenName));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user