Various fixes

This commit is contained in:
Anuken
2019-06-30 00:07:04 -04:00
parent 8bc59fb67c
commit 12bff75586
30 changed files with 6260 additions and 4825 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -456,6 +456,7 @@ setting.animatedshields.name = Animated Shields
setting.antialias.name = Antialias[LIGHT_GRAY] (requires restart)[] setting.antialias.name = Antialias[LIGHT_GRAY] (requires restart)[]
setting.indicators.name = Enemy/Ally Indicators setting.indicators.name = Enemy/Ally Indicators
setting.autotarget.name = Auto-Target setting.autotarget.name = Auto-Target
setting.keyboard.name = Mouse+Keyboard Controls
setting.fpscap.name = Max FPS setting.fpscap.name = Max FPS
setting.fpscap.none = None setting.fpscap.none = None
setting.fpscap.text = {0} FPS setting.fpscap.text = {0} FPS

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 KiB

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 377 KiB

View File

@@ -61,6 +61,8 @@ public class Vars{
public static final int iconsize = 48; public static final int iconsize = 48;
/** size of UI icons (small)*/ /** size of UI icons (small)*/
public static final int iconsizesmall = 32; public static final int iconsizesmall = 32;
/** size of UI icons (medium)*/
public static final int iconsizemed = 42;
/** units outside of this bound will simply die instantly */ /** units outside of this bound will simply die instantly */
public static final float finalWorldBounds = worldBounds + 500; public static final float finalWorldBounds = worldBounds + 500;
/** ticks spent out of bound until self destruct. */ /** ticks spent out of bound until self destruct. */

View File

@@ -112,7 +112,7 @@ public class Renderer implements ApplicationListener{
}else{ }else{
camera.position.lerpDelta(position, 0.08f); camera.position.lerpDelta(position, 0.08f);
} }
}else if(!mobile){ }else if(!mobile || settings.getBool("keyboard")){
camera.position.lerpDelta(position, 0.08f); camera.position.lerpDelta(position, 0.08f);
} }

View File

@@ -564,10 +564,10 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
data.unlockContent(mech); data.unlockContent(mech);
} }
if(mobile){ if(mobile && !Core.settings.getBool("keyboard")){
updateFlying(); updateTouch();
}else{ }else{
updateMech(); updateKeyboard();
} }
isTyping = ui.chatfrag.chatOpen(); isTyping = ui.chatfrag.chatOpen();
@@ -579,7 +579,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
} }
} }
protected void updateMech(){ protected void updateKeyboard(){
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
isBoosting = Core.input.keyDown(Binding.dash) && !mech.flying; isBoosting = Core.input.keyDown(Binding.dash) && !mech.flying;
@@ -646,7 +646,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
} }
} }
protected void updateFlying(){ protected void updateTouch(){
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){ if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){
target = null; target = null;
} }
@@ -657,6 +657,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
float targetX = Core.camera.position.x, targetY = Core.camera.position.y; float targetX = Core.camera.position.x, targetY = Core.camera.position.y;
float attractDst = 15f; float attractDst = 15f;
float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed;
if(moveTarget != null && !moveTarget.isDead()){ if(moveTarget != null && !moveTarget.isDead()){
targetX = moveTarget.getX(); targetX = moveTarget.getX();
@@ -680,7 +681,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
moveTarget = null; moveTarget = null;
} }
movement.set((targetX - x) / Time.delta(), (targetY - y) / Time.delta()).limit(isBoosting && !mech.flying ? mech.boostSpeed : mech.speed); movement.set((targetX - x) / Time.delta(), (targetY - y) / Time.delta()).limit(speed);
movement.setAngle(Mathf.slerp(movement.angle(), velocity.angle(), 0.05f)); movement.setAngle(Mathf.slerp(movement.angle(), velocity.angle(), 0.05f));
if(dst(targetX, targetY) < attractDst){ if(dst(targetX, targetY) < attractDst){

View File

@@ -141,7 +141,7 @@ public class DesktopInput extends InputHandler{
if(state.is(State.menu) || Core.scene.hasDialog()) return; if(state.is(State.menu) || Core.scene.hasDialog()) return;
//zoom and rotate things //zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){ if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom)); renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
} }

View File

@@ -265,7 +265,7 @@ public class MobileInput extends InputHandler implements GestureListener{
table.row(); table.row();
table.left().margin(0f).defaults().size(48f); table.left().margin(0f).defaults().size(48f);
table.addImageButton("icon-break", "clear-toggle-partial", iconsize, () -> { table.addImageButton("icon-break-small", "clear-toggle-partial", iconsizesmall, () -> {
mode = mode == breaking ? block == null ? none : placing : breaking; mode = mode == breaking ? block == null ? none : placing : breaking;
lastBlock = block; lastBlock = block;
if(mode == breaking){ if(mode == breaking){
@@ -274,17 +274,17 @@ public class MobileInput extends InputHandler implements GestureListener{
}).update(l -> l.setChecked(mode == breaking)); }).update(l -> l.setChecked(mode == breaking));
//diagonal swap button //diagonal swap button
table.addImageButton("icon-diagonal", "clear-toggle-partial", iconsize, () -> { table.addImageButton("icon-diagonal-small", "clear-toggle-partial", iconsizesmall, () -> {
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal")); Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
Core.settings.save(); Core.settings.save();
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal"))); }).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
//rotate button //rotate button
table.addImageButton("icon-arrow", "clear-partial", iconsize, () -> rotation = Mathf.mod(rotation + 1, 4)) table.addImageButton("icon-arrow-small", "clear-partial", iconsizesmall, () -> rotation = Mathf.mod(rotation + 1, 4))
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center)).visible(() -> block != null && block.rotate); .update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center)).visible(() -> block != null && block.rotate);
//confirm button //confirm button
table.addImageButton("icon-check", "clear-partial", iconsize, () -> { table.addImageButton("icon-check-small", "clear-partial", iconsizesmall, () -> {
for(PlaceRequest request : selection){ for(PlaceRequest request : selection){
Tile tile = request.tile(); Tile tile = request.tile();
@@ -475,7 +475,10 @@ public class MobileInput extends InputHandler implements GestureListener{
//call tap events //call tap events
if(pointer == 0 && !selecting && mode == none){ if(pointer == 0 && !selecting && mode == none){
tryTapPlayer(worldx, worldy); if(!tryTapPlayer(worldx, worldy) && Core.settings.getBool("keyboard")){
//shoot on touch down when in keyboard mode
player.isShooting = true;
}
} }
return false; return false;
@@ -598,6 +601,27 @@ public class MobileInput extends InputHandler implements GestureListener{
mode = none; mode = none;
} }
//zoom things
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
}
if(!Core.settings.getBool("keyboard")){
//move camera around
float camSpeed = 6f;
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
}
if(Core.settings.getBool("keyboard")){
if(Core.input.keyRelease(Binding.select)){
player.isShooting = false;
}
if(player.isShooting && !canShoot()){
player.isShooting = false;
}
}
//reset state when not placing //reset state when not placing
if(mode == none){ if(mode == none){
selecting = false; selecting = false;
@@ -678,7 +702,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean pan(float x, float y, float deltaX, float deltaY){ public boolean pan(float x, float y, float deltaX, float deltaY){
if(Core.scene.hasDialog()) return false; if(Core.scene.hasDialog() || Core.settings.getBool("keyboard")) return false;
float scale = Core.camera.width / Core.graphics.getWidth(); float scale = Core.camera.width / Core.graphics.getWidth();
deltaX *= scale; deltaX *= scale;
@@ -723,6 +747,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override @Override
public boolean zoom(float initialDistance, float distance){ public boolean zoom(float initialDistance, float distance){
if(Core.settings.getBool("keyboard")) return false;
if(lastDistance == -1) lastDistance = initialDistance; if(lastDistance == -1) lastDistance = initialDistance;
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta(); float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();

View File

@@ -64,7 +64,7 @@ public class MapPlayDialog extends FloatingDialog{
buttons.clearChildren(); buttons.clearChildren();
addCloseButton(); addCloseButton();
buttons.addImageTextButton("$play", "icon-play", 8*3, () -> { buttons.addImageTextButton("$play", "icon-play", iconsize, () -> {
control.playMap(map, rules); control.playMap(map, rules);
hide(); hide();
ui.custom.hide(); ui.custom.hide();

View File

@@ -70,7 +70,7 @@ public class PausedDialog extends FloatingDialog{
}else{ }else{
cont.defaults().size(120f).pad(5); cont.defaults().size(120f).pad(5);
float isize = 14f * 4; float isize = iconsize;
cont.addRowImageTextButton("$back", "icon-play-2", isize, this::hide); cont.addRowImageTextButton("$back", "icon-play-2", isize, this::hide);
cont.addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show); cont.addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show);

View File

@@ -12,7 +12,6 @@ import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.Setting; import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.Setting;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Align; import io.anuke.arc.util.Align;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.graphics.Pal; import io.anuke.mindustry.graphics.Pal;
@@ -76,12 +75,10 @@ public class SettingsMenuDialog extends SettingsDialog{
menu.addButton("$settings.graphics", () -> visible(1)); menu.addButton("$settings.graphics", () -> visible(1));
menu.row(); menu.row();
menu.addButton("$settings.sound", () -> visible(2)); menu.addButton("$settings.sound", () -> visible(2));
if(!Vars.mobile){
menu.row();
menu.addButton("$settings.controls", ui.controls::show);
}
menu.row(); menu.row();
menu.addButton("$settings.language", ui.language::show); menu.addButton("$settings.language", ui.language::show);
menu.row();
menu.addButton("$settings.controls", ui.controls::show).visible(() -> !mobile || Core.settings.getBool("keyboard"));
prefs.clearChildren(); prefs.clearChildren();
prefs.add(menu); prefs.add(menu);
@@ -125,6 +122,7 @@ public class SettingsMenuDialog extends SettingsDialog{
game.screenshakePref(); game.screenshakePref();
if(mobile){ if(mobile){
game.checkPref("autotarget", true); game.checkPref("autotarget", true);
game.checkPref("keyboard", false);
} }
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Core.bundle.format("setting.seconds", i)); game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Core.bundle.format("setting.seconds", i));

View File

@@ -274,7 +274,7 @@ public class PlacementFragment extends Fragment{
continue; continue;
} }
categories.addImageButton("icon-" + cat.name(), "clear-toggle", iconsize, () -> { categories.addImageButton("icon-" + cat.name() + "-med", "clear-toggle", iconsizemed, () -> {
currentCategory = cat; currentCategory = cat;
rebuildCategory.run(); rebuildCategory.run();
}).group(group).update(i -> i.setChecked(currentCategory == cat)); }).group(group).update(i -> i.setChecked(currentCategory == cat));

View File

@@ -105,14 +105,14 @@ public class PlayerListFragment extends Fragment{
button.table(t -> { button.table(t -> {
t.defaults().size(bs); t.defaults().size(bs);
t.addImageButton("icon-ban", "clear-partial", iconsize, t.addImageButton("icon-ban-small", "clear-partial", iconsizesmall,
() -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban))); () -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban)));
t.addImageButton("icon-cancel", "clear-partial", iconsize, t.addImageButton("icon-cancel-small", "clear-partial", iconsizesmall,
() -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick))); () -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick)));
t.row(); t.row();
t.addImageButton("icon-admin", "clear-toggle-partial", iconsize, () -> { t.addImageButton("icon-admin-small", "clear-toggle-partial", iconsizesmall, () -> {
if(Net.client()) return; if(Net.client()) return;
String id = user.uuid; String id = user.uuid;
@@ -128,7 +128,7 @@ public class PlayerListFragment extends Fragment{
.touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled) .touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled)
.checked(user.isAdmin); .checked(user.isAdmin);
t.addImageButton("icon-zoom", "clear-partial", iconsize, () -> Call.onAdminRequest(user, AdminAction.trace)); t.addImageButton("icon-zoom-small", "clear-partial", iconsizesmall, () -> Call.onAdminRequest(user, AdminAction.trace));
}).padRight(12).size(bs + 10f, bs); }).padRight(12).size(bs + 10f, bs);
} }

View File

@@ -14,8 +14,9 @@ import io.anuke.arc.util.Time;
public class Upscaler{ public class Upscaler{
static Res[] resolutions = { static Res[] resolutions = {
new Res(Vars.iconsizesmall, "-small"),
new Res(Vars.iconsizemed, "-med"),
new Res(Vars.iconsize, ""), new Res(Vars.iconsize, ""),
new Res(Vars.iconsizesmall, "-small")
}; };
public static void main(String[] args){ public static void main(String[] args){
@@ -37,11 +38,12 @@ public class Upscaler{
Log.info("Upscaling icons..."); Log.info("Upscaling icons...");
Time.mark(); Time.mark();
FileHandle[] list = file.list();
for(Res res : resolutions){ for(Res res : resolutions){
SquareMarcher marcher = new SquareMarcher(res.size); SquareMarcher marcher = new SquareMarcher(res.size);
for(FileHandle img : file.list()){ for(FileHandle img : list){
if(img.extension().equals("png")){ if(img.extension().equals("png")){
marcher.render(new Pixmap(img), img.sibling(img.nameWithoutExtension() + res.suffix + ".png")); marcher.render(new Pixmap(img), img.sibling(img.nameWithoutExtension() + res.suffix + ".png"));
} }