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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -1,6 +1,10 @@
package io.anuke.mindustry; package io.anuke.mindustry;
import io.anuke.arc.*; 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.math.Mathf;
import io.anuke.arc.util.Log; import io.anuke.arc.util.Log;
import io.anuke.arc.util.Time; 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.game.EventType.GameLoadEvent;
import io.anuke.mindustry.io.BundleLoader; import io.anuke.mindustry.io.BundleLoader;
import static io.anuke.arc.Core.batch;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
public class Mindustry extends ApplicationCore{ public class Mindustry extends ApplicationCore{
@@ -21,27 +26,38 @@ public class Mindustry extends ApplicationCore{
Time.mark(); Time.mark();
Vars.init(); batch = new SpriteBatch();
Log.setUseColors(false);
BundleLoader.load();
content.load();
content.loadColors();
add(logic = new Logic()); Core.app.post(() -> Core.app.post(() -> {
add(world = new World()); drawLoading();
add(control = new Control()); Core.app.post(() -> Core.app.post(() -> {
add(renderer = new Renderer()); Vars.init();
add(ui = new UI()); Log.setUseColors(false);
add(netServer = new NetServer()); BundleLoader.load();
add(netClient = new NetClient()); 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 @Override
public void init(){ public void init(){
super.init(); setup();
Log.info("Time to load [total]: {0}", Time.elapsed());
Events.fire(new GameLoadEvent());
} }
@Override @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; private float shakeIntensity, shaketime;
public Renderer(){ public Renderer(){
batch = new SpriteBatch(4096);
camera = new Camera(); camera = new Camera();
Lines.setCircleVertices(20); Lines.setCircleVertices(20);
Shaders.init(); Shaders.init();

View File

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