Cleaned PropertyManager, refactored GameLoop to external package.
This commit is contained in:
@@ -56,6 +56,7 @@ public class App implements AppAccess {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Config.init();
|
||||
Config.save();
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package mightypork.rogue;
|
||||
|
||||
|
||||
import mightypork.utils.files.PropertyManager;
|
||||
import mightypork.utils.config.PropertyManager;
|
||||
import mightypork.utils.logging.Log;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Config {
|
||||
mgr.cfgNewlineBeforeComments(true);
|
||||
mgr.cfgSeparateSections(true);
|
||||
|
||||
mgr.putInteger(PK_LAST_RUN_VERSION, def_LAST_RUN_VERSION);
|
||||
mgr.putInteger(PK_LAST_RUN_VERSION, def_LAST_RUN_VERSION, null);
|
||||
mgr.putBoolean(PK_START_IN_FS, def_START_IN_FS, "Go to fullscreen on startup.");
|
||||
|
||||
load(); // load what has been "put"
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Const {
|
||||
public static final String TITLEBAR = APP_NAME + " v." + VERSION;
|
||||
|
||||
// AUDIO
|
||||
public static final int FPS_RENDER = 80; // max
|
||||
public static final int FPS_RENDER = 100; // max
|
||||
|
||||
// INITIAL WINDOW SIZE
|
||||
public static final int WINDOW_W = 1024;
|
||||
|
||||
@@ -11,24 +11,8 @@ import mightypork.rogue.util.Utils;
|
||||
|
||||
public class MainLoop extends GameLoop implements ActionRequest.Listener {
|
||||
|
||||
final Renderable renderable;
|
||||
|
||||
|
||||
public MainLoop(App app, Renderable masterRenderable) {
|
||||
super(app);
|
||||
|
||||
if (masterRenderable == null) {
|
||||
throw new NullPointerException("Master renderable must not be null.");
|
||||
}
|
||||
|
||||
this.renderable = masterRenderable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
renderable.render();
|
||||
super(app, masterRenderable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import mightypork.gamecore.render.DisplaySystem;
|
||||
import mightypork.gamecore.render.DisplaySystem.Screenshot;
|
||||
import mightypork.gamecore.render.Screenshot;
|
||||
import mightypork.utils.logging.Log;
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,13 @@ public class LayerBouncyBoxes extends ScreenLayer {
|
||||
boxes.add(bbr);
|
||||
}
|
||||
|
||||
layout.add(new TextRenderer(Res.getFont("default"), "This is a text, yo!", RGB.WHITE, Align.LEFT));
|
||||
layout.add(new TextRenderer(Res.getFont("default"), RGB.WHITE, Align.LEFT) {
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return "Running at " + disp().getFps() + " fps!";
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
|
||||
);
|
||||
//@formatter:on
|
||||
|
||||
text = new TextRenderer(Res.getFont("default"), "YO", RGB.YELLOW, Align.CENTER);
|
||||
text = new TextRenderer(Res.getFont("default"), RGB.YELLOW, Align.CENTER);
|
||||
text.setContext(flyingFontBox);
|
||||
|
||||
bindKeyStroke(new KeyStroke(Keys.KEY_RETURN), new Runnable() {
|
||||
@@ -87,6 +87,7 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
|
||||
final double t = 2;
|
||||
|
||||
size.fadeTo(100 + rand.nextInt(700), t / 2D);
|
||||
|
||||
xPos.fadeTo(pos.x, t);
|
||||
yPos.fadeTo(pos.y, t);
|
||||
}
|
||||
@@ -96,7 +97,7 @@ public class LayerFlyingCat extends ScreenLayer implements Updateable, MouseButt
|
||||
public void render()
|
||||
{
|
||||
cat.render();
|
||||
text.render();
|
||||
text.render(disp().getFps()+" fps");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user