Reflecting engine changes, some init task improvements

master
Ondřej Hruška 11 years ago
parent e368877b6e
commit cf096bcce5
  1. 1
      .gitignore
  2. 41
      src/mightypork/rogue/RogueApp.java
  3. 2
      src/mightypork/rogue/init/RogueAddResources.java
  4. 6
      src/mightypork/rogue/init/RogueInitUI.java
  5. 4
      src/mightypork/rogue/init/RogueSetupConfig.java
  6. 2
      src/mightypork/rogue/init/RogueSetupDisplay.java
  7. 4
      src/mightypork/rogue/init/RogueSetupGlobalKeys.java
  8. 4
      src/mightypork/rogue/init/RogueSetupWorkdir.java
  9. 8
      src/mightypork/rogue/screens/RogueScreen.java
  10. 4
      src/mightypork/rogue/screens/game/InvSlot.java
  11. 4
      src/mightypork/rogue/screens/game/ScreenGame.java
  12. 3
      src/mightypork/rogue/screens/story/ScreenStory.java
  13. 4
      src/mightypork/rogue/world/gen/ScratchMap.java
  14. 4
      src/mightypork/rogue/world/item/Item.java
  15. 4
      src/mightypork/rogue/world/tile/Tile.java

1
.gitignore vendored

@ -2,6 +2,7 @@
/target/
/~local/
/.rogue-save/
/rogue-workdir/
/build/out/*.jar
/build/in/*.jar
*.log

@ -6,15 +6,10 @@ import java.util.logging.Level;
import mightypork.gamecore.backends.lwjgl.LwjglBackend;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.DeltaMainLoop;
import mightypork.gamecore.core.MainLoop;
import mightypork.gamecore.core.events.MainLoopRequest;
import mightypork.gamecore.core.init.InitTaskCrashHandler;
import mightypork.gamecore.core.init.InitTaskIonizables;
import mightypork.gamecore.core.init.InitTaskLog;
import mightypork.gamecore.core.init.InitTaskLogHeader;
import mightypork.gamecore.core.init.InitTaskMainLoop;
import mightypork.gamecore.core.init.InitTaskResourceLoaderAsync;
import mightypork.gamecore.core.plugins.screenshot.InitTaskPluginScreenshot;
import mightypork.gamecore.core.plugins.screenshot.ScreenshotRequestListener;
import mightypork.gamecore.gui.events.ViewportChangeEvent;
@ -22,12 +17,12 @@ import mightypork.gamecore.gui.events.ViewportChangeListener;
import mightypork.gamecore.resources.Res;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.rogue.init.AddResources;
import mightypork.rogue.init.InitScreens;
import mightypork.rogue.init.SetupConfig;
import mightypork.rogue.init.SetupDisplay;
import mightypork.rogue.init.SetupGlobalKeys;
import mightypork.rogue.init.SetupWorkdir;
import mightypork.rogue.init.RogueAddResources;
import mightypork.rogue.init.RogueInitUI;
import mightypork.rogue.init.RogueSetupConfig;
import mightypork.rogue.init.RogueSetupDisplay;
import mightypork.rogue.init.RogueSetupGlobalKeys;
import mightypork.rogue.init.RogueSetupWorkdir;
import mightypork.rogue.world.Inventory;
import mightypork.utils.ion.Ion;
import mightypork.utils.logging.Log;
@ -65,10 +60,9 @@ public final class RogueApp extends App implements ViewportChangeListener, Scree
}
});
addInitTask(new InitTaskCrashHandler());
addInitTask(new SetupWorkdir(workdir));
addInitTask(new RogueSetupWorkdir(workdir));
addInitTask(new SetupConfig());
addInitTask(new RogueSetupConfig());
addInitTask(new InitTaskPluginScreenshot("screenshots"));
@ -83,21 +77,10 @@ public final class RogueApp extends App implements ViewportChangeListener, Scree
});
addInitTask(new SetupDisplay());
addInitTask(new SetupGlobalKeys());
addInitTask(new InitTaskResourceLoaderAsync());
addInitTask(new AddResources());
addInitTask(new InitTaskMainLoop() {
@Override
protected MainLoop getLoopImpl()
{
return new DeltaMainLoop();
}
});
addInitTask(new InitScreens());
addInitTask(new RogueSetupDisplay());
addInitTask(new RogueSetupGlobalKeys());
addInitTask(new RogueAddResources());
addInitTask(new RogueInitUI());
}

@ -15,7 +15,7 @@ import mightypork.gamecore.graphics.textures.WrapMode;
import mightypork.utils.math.constraints.rect.Rect;
public class AddResources extends InitTaskResources {
public class RogueAddResources extends InitTaskResources {
@Override
public void addFonts(FontRegistry fonts)

@ -2,7 +2,7 @@ package mightypork.rogue.init;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.init.InitTaskScreens;
import mightypork.gamecore.core.init.InitTaskUI;
import mightypork.gamecore.graphics.Renderable;
import mightypork.gamecore.gui.screens.ScreenRegistry;
import mightypork.gamecore.gui.screens.impl.CrossfadeOverlay;
@ -16,10 +16,10 @@ import mightypork.rogue.screens.story.ScreenStory;
import mightypork.rogue.world.WorldProvider;
public class InitScreens extends InitTaskScreens {
public class RogueInitUI extends InitTaskUI {
@Override
protected Renderable getMainRenderableImpl()
protected Renderable createMainRenderable()
{
final ScreenRegistry screens = new ScreenRegistry();
app.addChildClient(screens);

@ -2,10 +2,10 @@ package mightypork.rogue.init;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.config.InitTaskConfig;
import mightypork.gamecore.core.init.InitTaskConfig;
public class SetupConfig extends InitTaskConfig {
public class RogueSetupConfig extends InitTaskConfig {
@Override
protected Config buildConfig()

@ -6,7 +6,7 @@ import mightypork.gamecore.core.init.InitTaskDisplay;
import mightypork.rogue.Const;
public class SetupDisplay extends InitTaskDisplay {
public class RogueSetupDisplay extends InitTaskDisplay {
@Override
public void init()

@ -9,7 +9,7 @@ import mightypork.gamecore.input.Trigger;
import mightypork.utils.eventbus.BusEvent;
public class SetupGlobalKeys extends InitTask {
public class RogueSetupGlobalKeys extends InitTask {
@Override
@ -55,6 +55,6 @@ public class SetupGlobalKeys extends InitTask {
@Override
public String[] getDependencies()
{
return new String[] { "config" };
return new String[] { "config", "backend" };
}
}

@ -6,9 +6,9 @@ import java.io.File;
import mightypork.gamecore.core.init.InitTaskWorkdir;
public class SetupWorkdir extends InitTaskWorkdir {
public class RogueSetupWorkdir extends InitTaskWorkdir {
public SetupWorkdir(File workdir)
public RogueSetupWorkdir(File workdir)
{
super(workdir, true);
}

@ -2,20 +2,20 @@ package mightypork.rogue.screens;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.events.ShutdownEvent;
import mightypork.gamecore.core.events.ShutdownListener;
import mightypork.gamecore.core.events.ShutdownRequest;
import mightypork.gamecore.core.events.ShutdownRequestListener;
import mightypork.gamecore.gui.screens.LayeredScreen;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.utils.annotations.Stub;
public class RogueScreen extends LayeredScreen implements ShutdownListener {
public class RogueScreen extends LayeredScreen implements ShutdownRequestListener {
@Override
@Stub
public void onShutdown(ShutdownEvent event)
public void onShutdownRequested(ShutdownRequest event)
{
App.bus().send(new RogueStateRequest(RogueState.EXIT));
//event.consume(); FIXME we need a "shutdown request" event AND "shutdown" event.

@ -11,7 +11,7 @@ import mightypork.rogue.world.PlayerFacade;
import mightypork.rogue.world.WorldProvider;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.item.ItemType;
import mightypork.utils.Support;
import mightypork.utils.Str;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.color.Color;
import mightypork.utils.math.color.pal.RGB;
@ -137,7 +137,7 @@ public class InvSlot extends ClickableComponent {
}
if (itm.getType() == ItemType.FOOD) {
rtTxP.setText(Support.str(itm.getFoodPoints() / 2D));
rtTxP.setText(Str.val(itm.getFoodPoints() / 2D));
rtTxP.setColor(RGB.GREEN);
rtTxP.render();
} else if (itm.getType() == ItemType.WEAPON) {

@ -5,7 +5,7 @@ import java.io.File;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.events.ShutdownEvent;
import mightypork.gamecore.core.events.ShutdownRequest;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.ActionGroup;
import mightypork.gamecore.input.Trigger;
@ -346,7 +346,7 @@ public class ScreenGame extends RogueScreen implements PlayerDeathHandler, GameW
@Override
public void onShutdown(ShutdownEvent event)
public void onShutdownRequested(ShutdownRequest event)
{
// if player is dead, don't ask don't ask for save
final PlayerFacade pl = WorldProvider.get().getPlayer();

@ -106,8 +106,7 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
{
super(screen);
final TextPainter help = new TextPainter(Res.font("tiny"), AlignX.CENTER, RGB.WHITE.withAlpha(txProceedAlpha.mul(0.3)),
"Space / click to proceed.");
final TextPainter help = new TextPainter(Res.font("tiny"), AlignX.CENTER, RGB.WHITE.withAlpha(txProceedAlpha.mul(0.3)), "Space / click to proceed.");
help.setRect(root.bottomEdge().growUp(root.height().perc(4)));
help.setVPaddingPercent(5);
root.add(help);

@ -13,7 +13,7 @@ import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.Tiles;
import mightypork.utils.Support;
import mightypork.utils.Str;
import mightypork.utils.logging.Log;
import mightypork.utils.math.Calc;
import mightypork.utils.math.algo.Coord;
@ -621,7 +621,7 @@ public class ScratchMap {
//@formatter:off
throw new WorldGenError(
"Could not put entity into a level map: e_pos=" + pos
+ ", tile: " + Support.str(t)
+ ", tile: " + Str.val(t)
+ ", t.wa " + t.isWalkable()
+ ", t.oc " + t.isOccupied()
+ ", ent.. " + e.getVisualName());

@ -2,7 +2,7 @@ package mightypork.rogue.world.item;
import mightypork.rogue.world.PlayerFacade;
import mightypork.utils.Support;
import mightypork.utils.Str;
import mightypork.utils.annotations.Stub;
import mightypork.utils.ion.IonBundled;
import mightypork.utils.ion.IonDataBundle;
@ -156,7 +156,7 @@ public abstract class Item implements IonBundled {
@Override
public String toString()
{
return Support.str(getClass()) + " x " + getAmount();
return Str.val(getClass()) + " x " + getAmount();
}

@ -8,7 +8,7 @@ import mightypork.rogue.world.World;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.utils.Support;
import mightypork.utils.Str;
import mightypork.utils.annotations.Stub;
import mightypork.utils.ion.IonBinary;
import mightypork.utils.ion.IonInput;
@ -77,7 +77,7 @@ public abstract class Tile implements IonBinary {
renderer = makeRenderer();
if (renderer == /*still*/null) {
Log.w("No renderer for tile " + Support.str(this));
Log.w("No renderer for tile " + Str.val(this));
renderer = TileRenderer.NONE;
return;
}

Loading…
Cancel
Save