Implemented basic minimap
This commit is contained in:
@@ -44,7 +44,7 @@ public class DebugFragment implements Fragment {
|
||||
new table(){{
|
||||
visible(() -> debug);
|
||||
|
||||
atop().aright();
|
||||
abottom().aleft();
|
||||
|
||||
new table("pane"){{
|
||||
defaults().fillX();
|
||||
|
||||
@@ -2,16 +2,21 @@ package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.ImageButton;
|
||||
import io.anuke.ucore.scene.ui.Label;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
@@ -131,6 +136,36 @@ public class HudFragment implements Fragment{
|
||||
visible(() -> control.tutorial().active());
|
||||
}}.end();
|
||||
|
||||
new table(){{
|
||||
visible(() -> state.is(State.playing));
|
||||
atop();
|
||||
aright();
|
||||
|
||||
new table("button"){{
|
||||
margin(5);
|
||||
marginBottom(10);
|
||||
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion());
|
||||
Image image = new Image(){
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
super.draw(batch, parentAlpha);
|
||||
if(renderer.minimap().getTexture() != null){
|
||||
renderer.minimap().drawEntities(x, y, width, height);
|
||||
}
|
||||
}
|
||||
};
|
||||
image.setDrawable(draw);
|
||||
image.update(() -> {
|
||||
if (renderer.minimap().getTexture() == null) {
|
||||
draw.getRegion().setRegion(Draw.region("white"));
|
||||
} else {
|
||||
draw.getRegion().setRegion(renderer.minimap().getRegion());
|
||||
}
|
||||
});
|
||||
add(image).size(140f, 140f);
|
||||
}}.end();
|
||||
}}.end();
|
||||
|
||||
//paused table
|
||||
new table(){{
|
||||
visible(() -> state.is(State.paused) && !Net.active());
|
||||
|
||||
Reference in New Issue
Block a user