Improved menu, small fixes

This commit is contained in:
Anuken 2017-11-19 15:53:53 -05:00
parent 8e602a8b5b
commit 06baed836a
17 changed files with 343 additions and 276 deletions

View File

@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java"
dependencies {
//compile 'com.github.anuken:ucore:99b9102221'
compile 'com.github.anuken:ucore:eb772dd77d'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -25,6 +25,7 @@ io.anuke.ucore.scene.Skin$TintedDrawable: {
},
io.anuke.ucore.scene.ui.Button$ButtonStyle: {
default: {down: button-down, up: button },
menu: {up: text-sides, over: text-sides-over, down: text-sides-down},
toggle: {checked: button-down, down: button-down, up: button }
},
io.anuke.ucore.scene.ui.TextButton$TextButtonStyle: {

View File

@ -150,7 +150,9 @@ public class Renderer extends RendererModule{
renderPixelOverlay();
drawEnemyMarkers();
if(Settings.getBool("indicators")){
drawEnemyMarkers();
}
}
@Override

View File

@ -3,7 +3,6 @@ package io.anuke.mindustry;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
@ -173,6 +172,7 @@ public class UI extends SceneModule{
prefs.checkPref("fps", "Show FPS", false);
prefs.checkPref("noshadows", "Disable shadows", false);
prefs.checkPref("smoothcam", "Smooth Camera", true);
prefs.checkPref("indicators", "Enemy Indicators", true);
prefs.hidden(()->{
if(!GameState.is(State.menu)){
@ -191,6 +191,13 @@ public class UI extends SceneModule{
menu.hide();
}
});
if(!android){
prefs.content().row();
prefs.content().addButton("Controls", () -> {
keys.show(scene);
}).size(300f, 50f).pad(5f).units(Unit.dp);
}
keys = new MindustryKeybindDialog();
@ -416,49 +423,27 @@ public class UI extends SceneModule{
//menu table
new table(){{
new table("pane"){{
defaults().size(220, 48).pad(3);
new button("Play", () -> {
levels.show();
});
new table(){{
float scale = 4f;
defaults().size(100*scale, 21*scale).pad(-10f).units(Unit.dp);
add(new MenuButton("text-play", ()-> levels.show()));
row();
new button("Tutorial", ()->{
control.playMap(Map.tutorial);
});
if(Gdx.app.getType() != ApplicationType.WebGL){
row();
new button("Load Game", () -> {
load.show();
});
}
row();
new button("Settings", () -> {
prefs.show(scene);
});
add(new MenuButton("text-tutorial", ()-> control.playMap(Map.tutorial)));
row();
if(!android){
new button("Controls", () -> {
keys.show(scene);
});
if(!gwt){
add(new MenuButton("text-load", ()-> load.show()));
row();
}
if(Gdx.app.getType() != ApplicationType.WebGL && !android){
new button("Exit", () -> {
Gdx.app.exit();
});
}
add(new MenuButton("text-settings", ()-> prefs.show()));
row();
if(!gwt){
add(new MenuButton("text-exit", ()-> Gdx.app.exit()));
}
get().pad(Unit.dp.inPixels(16));
}};

View File

@ -9,6 +9,8 @@ import io.anuke.ucore.scene.ui.layout.Unit;
public class Vars{
//shorthand for whether or not this is running on android
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android);
//shorthand for whether or not this is running on GWT
public static final boolean gwt = (Gdx.app.getType() == ApplicationType.WebGL);
//how far away from the player blocks can be placed
public static final float placerange = 66;
//respawn time in frames

View File

@ -0,0 +1,21 @@
package io.anuke.mindustry.ui;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Scaling;
import io.anuke.ucore.function.Listenable;
import io.anuke.ucore.scene.ui.Button;
import io.anuke.ucore.scene.ui.Image;
public class MenuButton extends Button{
public MenuButton(String icon, Listenable clicked){
super("menu");
Image image = new Image(icon);
image.setScaling(Scaling.fit);
image.setScale(4f);
image.setOrigin(Align.center);
add(image);
clicked(clicked);
}
}