Temporary loading screen

This commit is contained in:
Anuken
2019-06-23 14:09:29 -04:00
parent c5e7ddaf7a
commit 649d527dcf
5 changed files with 44 additions and 18 deletions

View File

@@ -1,6 +1,10 @@
package io.anuke.mindustry;
import io.anuke.arc.*;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Texture;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.SpriteBatch;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Time;
@@ -8,6 +12,7 @@ import io.anuke.mindustry.core.*;
import io.anuke.mindustry.game.EventType.GameLoadEvent;
import io.anuke.mindustry.io.BundleLoader;
import static io.anuke.arc.Core.batch;
import static io.anuke.mindustry.Vars.*;
public class Mindustry extends ApplicationCore{
@@ -21,27 +26,38 @@ public class Mindustry extends ApplicationCore{
Time.mark();
Vars.init();
Log.setUseColors(false);
BundleLoader.load();
content.load();
content.loadColors();
batch = new SpriteBatch();
add(logic = new Logic());
add(world = new World());
add(control = new Control());
add(renderer = new Renderer());
add(ui = new UI());
add(netServer = new NetServer());
add(netClient = new NetClient());
Core.app.post(() -> Core.app.post(() -> {
drawLoading();
Core.app.post(() -> Core.app.post(() -> {
Vars.init();
Log.setUseColors(false);
BundleLoader.load();
content.load();
content.loadColors();
add(logic = new Logic());
add(world = new World());
add(control = new Control());
add(renderer = new Renderer());
add(ui = new UI());
add(netServer = new NetServer());
add(netClient = new NetClient());
for(ApplicationListener listener : modules){
listener.init();
}
Log.info("Time to load [total]: {0}", Time.elapsed());
Events.fire(new GameLoadEvent());
}));
}));
}
@Override
public void init(){
super.init();
Log.info("Time to load [total]: {0}", Time.elapsed());
Events.fire(new GameLoadEvent());
setup();
}
@Override
@@ -65,4 +81,15 @@ public class Mindustry extends ApplicationCore{
}
}
void drawLoading(){
Core.graphics.clear(Color.BLACK);
Draw.proj().setOrtho(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
Texture icon = new Texture("sprites/logotext.png");
Draw.rect(Draw.wrap(icon), Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f);
Draw.flush();
icon.dispose();
}
}

View File

@@ -42,7 +42,6 @@ public class Renderer implements ApplicationListener{
private float shakeIntensity, shaketime;
public Renderer(){
batch = new SpriteBatch(4096);
camera = new Camera();
Lines.setCircleVertices(20);
Shaders.init();

View File

@@ -40,7 +40,7 @@ public class Rules{
/** No-build zone around enemy core radius. */
public float enemyCoreBuildRadius = 400f;
/** Radius around enemy wave drop zones.*/
public float dropZoneRadius = 380f;
public float dropZoneRadius = 300f;
/** Player respawn time in ticks. */
public float respawnTime = 60 * 4;
/** Time between waves in ticks. */