log start time

This commit is contained in:
yugecin 2017-01-09 23:10:51 +01:00
parent 9c0eaca4ee
commit 0ceff03bdd
3 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,8 @@ import com.google.inject.Inject;
import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLException;
import yugecin.opsudance.core.DisplayContainer; import yugecin.opsudance.core.DisplayContainer;
import static yugecin.opsudance.kernel.Entrypoint.log;
public class OpsuDance { public class OpsuDance {
private final DisplayContainer container; private final DisplayContainer container;
@ -31,6 +33,7 @@ public class OpsuDance {
} }
public void start() { public void start() {
log("initialized");
try { try {
container.run(); container.run();
} catch (LWJGLException e) { } catch (LWJGLException e) {

View File

@ -34,6 +34,8 @@ import yugecin.opsudance.utils.GLHelper;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import static yugecin.opsudance.kernel.Entrypoint.log;
/** /**
* based on org.newdawn.slick.AppGameContainer * based on org.newdawn.slick.AppGameContainer
*/ */
@ -68,6 +70,7 @@ public class DisplayContainer {
demux.init(); demux.init();
demux.switchStateNow(new EmptyRedState(null, null)); demux.switchStateNow(new EmptyRedState(null, null));
setup(); setup();
log("ready");
while(!(Display.isCloseRequested() && demux.onCloseRequest())) { while(!(Display.isCloseRequested() && demux.onCloseRequest())) {
// TODO: lower fps when not visible Display.isVisible // TODO: lower fps when not visible Display.isVisible
int delta = getDelta(); int delta = getDelta();

View File

@ -21,8 +21,20 @@ import yugecin.opsudance.OpsuDance;
public class Entrypoint { public class Entrypoint {
public static final long startTime = System.currentTimeMillis();
public static final boolean isJarRunning = Entrypoint.class.getResource(String.format("%s.class", Entrypoint.class.getSimpleName())).toString().startsWith("jar:");
public static void main(String[] args) { public static void main(String[] args) {
log("launched");
InstanceContainerImpl.initialize().provide(OpsuDance.class).start(); InstanceContainerImpl.initialize().provide(OpsuDance.class).start();
} }
public static long runtime() {
return System.currentTimeMillis() - startTime;
}
public static void log(String message) {
System.out.println(String.format("[%7d] %s", runtime(), message));
}
} }