use of io.anuke.mindustry.Mindustry in project Mindustry by Anuken.
the class DesktopLauncher method main.
public static void main(String[] arg) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setTitle("Mindustry");
config.setMaximized(true);
config.setWindowedMode(960, 540);
config.setWindowIcon("sprites/icon.png");
Platform.instance = new DesktopPlatform(arg);
Net.setClientProvider(new KryoClient());
Net.setServerProvider(new KryoServer());
try {
new Lwjgl3Application(new Mindustry(), config);
} catch (Throwable e) {
CrashHandler.handle(e);
}
}
use of io.anuke.mindustry.Mindustry in project Mindustry by Anuken.
the class HtmlLauncher method createApplicationListener.
@Override
public ApplicationListener createApplicationListener() {
instance = this;
setLogLevel(LOG_NONE);
setLoadingListener(new LoadingListener() {
@Override
public void beforeSetup() {
}
@Override
public void afterSetup() {
scaleCanvas();
setupResizeHook();
}
});
Net.setClientProvider(new WebsocketClient());
Platform.instance = new Platform() {
DateTimeFormat format = DateTimeFormat.getFormat("EEE, dd MMM yyyy HH:mm:ss");
@Override
public String format(Date date) {
return format.format(date);
}
@Override
public String format(int number) {
return NumberFormat.getDecimalFormat().format(number);
}
@Override
public boolean canJoinGame() {
String ref = Document.get().getReferrer();
return !ref.startsWith("https") && !ref.contains("itch.io");
}
@Override
public byte[] getUUID() {
Settings.defaults("uuid", "");
String uuid = Settings.getString("uuid");
if (uuid.isEmpty()) {
byte[] result = new byte[8];
new Random().nextBytes(result);
uuid = new String(Base64Coder.encode(result));
Settings.putString("uuid", uuid);
Settings.save();
return result;
}
return Base64Coder.decode(uuid);
}
};
return new Mindustry();
}
Aggregations