From a5d13508154a0926135076cd877f63785e19a219 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 5 Mar 2019 16:07:48 -0500 Subject: [PATCH] Removed map screenshot key / Basic zone guide --- build.gradle | 2 +- core/src/io/anuke/mindustry/core/Control.java | 13 ++--- .../src/io/anuke/mindustry/core/Renderer.java | 56 ++----------------- core/src/io/anuke/mindustry/core/UI.java | 18 +++--- .../src/io/anuke/mindustry/input/Binding.java | 1 - .../mindustry/ui/dialogs/DeployDialog.java | 9 ++- 6 files changed, 24 insertions(+), 75 deletions(-) diff --git a/build.gradle b/build.gradle index 8fb24f284b..d5c67790b1 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ allprojects{ ext{ versionNumber = '4' - versionModifier = 'alpha' + versionModifier = 'beta' if(!project.hasProperty("versionType")) versionType = 'official' appName = 'Mindustry' gdxVersion = '1.9.9' diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 9294872d85..e890f7c0a9 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -7,7 +7,6 @@ import io.anuke.arc.graphics.Color; import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.TextureAtlas; import io.anuke.arc.input.KeyCode; -import io.anuke.arc.scene.ui.TextField; import io.anuke.arc.util.Interval; import io.anuke.arc.util.Strings; import io.anuke.arc.util.Time; @@ -280,16 +279,16 @@ public class Control implements ApplicationListener{ if(!Core.settings.getBool("4.0-warning-2", false)){ Time.run(5f, () -> { - FloatingDialog dialog = new FloatingDialog("WARNING!"); + FloatingDialog dialog = new FloatingDialog("VERY IMPORTANT"); dialog.buttons.addButton("$ok", () -> { dialog.hide(); Core.settings.put("4.0-warning-2", true); Core.settings.save(); }).size(100f, 60f); - dialog.cont.add("Reminder: The alpha version you are about to play is very unstable, and is [accent]not representative of the final 4.0 release.[]\n\n " + + dialog.cont.add("Reminder: The alpha version you are about to play is very unstable, and is [accent]not representative of the final v4 release.[]\n\n " + "\nThere is currently[scarlet] no sound implemented[]; this is intentional.\n" + - "All current art and UI is temporary, and will be re-drawn before release. " + - "\n\n[accent]Saves and maps may be corrupted without warning between updates.").wrap().width(400f); + "All current art and UI is unfinished, and will be changed before release. " + + "\n\n[accent]Saves may be corrupted without warning between updates.").wrap().width(400f); dialog.show(); }); } @@ -339,10 +338,6 @@ public class Control implements ApplicationListener{ } } - if(!mobile && Core.input.keyTap(Binding.screenshot) && !(scene.getKeyboardFocus() instanceof TextField) && !ui.chatfrag.chatOpen()){ - //renderer.takeMapScreenshot(); - } - }else{ if(!state.isPaused()){ Time.update(); diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 8b3ce9bc72..5bc7a270ce 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -2,13 +2,10 @@ package io.anuke.mindustry.core; import io.anuke.arc.ApplicationListener; import io.anuke.arc.Core; -import io.anuke.arc.files.FileHandle; import io.anuke.arc.function.Consumer; import io.anuke.arc.function.Predicate; import io.anuke.arc.graphics.Camera; import io.anuke.arc.graphics.Color; -import io.anuke.arc.graphics.Pixmap; -import io.anuke.arc.graphics.PixmapIO; import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.SpriteBatch; @@ -16,7 +13,9 @@ import io.anuke.arc.graphics.glutils.FrameBuffer; import io.anuke.arc.math.Mathf; import io.anuke.arc.math.geom.Rectangle; import io.anuke.arc.math.geom.Vector2; -import io.anuke.arc.util.*; +import io.anuke.arc.util.ScreenRecorder; +import io.anuke.arc.util.Time; +import io.anuke.arc.util.Tmp; import io.anuke.arc.util.pooling.Pools; import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.core.GameState.State; @@ -288,54 +287,7 @@ public class Renderer implements ApplicationListener{ public void clampScale(){ float s = io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f); - targetscale = Mathf.clamp(targetscale, s * 2.5f, Math.round(s * 4)); - } - - public void takeMapScreenshot(){ - //TODO implement properly - - float vpW = camera.width, vpH = camera.height; - int w = world.width()*tilesize, h = world.height()*tilesize; - - disableUI = true; - - FrameBuffer buffer = new FrameBuffer(w, h); - Vector2 prev = camera.position.cpy(); - - camera.width = w; - camera.height = h; - camera.position.x = w/2f + tilesize/2f; - camera.position.y = h/2f + tilesize/2f; - - buffer.begin(); - - draw(); - blocks.drawShadows(); - - buffer.end(); - - disableUI = false; - camera.width = vpW; - camera.height = vpH; - - buffer.begin(); - byte[] lines = ScreenUtils.getFrameBufferPixels(0, 0, w, h, true); - for(int i = 0; i < lines.length; i+= 4){ - lines[i + 3] = (byte)255; - } - buffer.end(); - - Pixmap fullPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888); - - BufferUtils.copy(lines, 0, fullPixmap.getPixels(), lines.length); - FileHandle file = screenshotDirectory.child("screenshot-" + Time.millis() + ".png"); - PixmapIO.writePNG(file, fullPixmap); - fullPixmap.dispose(); - - buffer.dispose(); - camera.position.set(prev); - - ui.showInfoFade(Core.bundle.format("screenshot", file.toString())); + targetscale = Mathf.clamp(targetscale, s * 2.5f, Math.round(s * 5)); } } diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index 85cf266f77..5bbccaf79a 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -250,17 +250,6 @@ public class UI implements ApplicationListener{ }}.show(); } - public void showInfo(String info, Runnable clicked){ - new Dialog("", "dialog"){{ - getCell(cont).growX(); - cont.margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center); - buttons.addButton("$ok", () -> { - clicked.run(); - hide(); - }).size(90, 50).pad(4); - }}.show(); - } - public void showError(String text){ new Dialog("$error.title", "dialog"){{ cont.margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center); @@ -275,6 +264,13 @@ public class UI implements ApplicationListener{ }}.show(); } + public void showInfoText(String titleText, String text){ + new Dialog(titleText, "dialog"){{ + cont.margin(15).add(text).width(400f).wrap().left().get().setAlignment(Align.left, Align.left); + buttons.addButton("$ok", this::hide).size(90, 50).pad(4); + }}.show(); + } + public void showConfirm(String title, String text, Runnable confirmed){ FloatingDialog dialog = new FloatingDialog(title); dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center); diff --git a/core/src/io/anuke/mindustry/input/Binding.java b/core/src/io/anuke/mindustry/input/Binding.java index d588f0c612..3e4068dfb2 100644 --- a/core/src/io/anuke/mindustry/input/Binding.java +++ b/core/src/io/anuke/mindustry/input/Binding.java @@ -26,7 +26,6 @@ public enum Binding implements KeyBind{ menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE), pause(KeyCode.SPACE), toggle_menus(KeyCode.C), - screenshot(KeyCode.P), player_list(KeyCode.TAB, "multiplayer"), chat(KeyCode.ENTER), chat_history_prev(KeyCode.UP), diff --git a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java index d2b2f64d90..ea3594e79c 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java @@ -48,6 +48,13 @@ public class DeployDialog extends FloatingDialog{ titleTable.remove(); margin(0f).marginBottom(8); + if(!Core.settings.getBool("zone-info", false)){ + Core.app.post(() -> ui.showInfoText("TEMPORARY GUIDE ON HOW TO PLAY ZONES", "- deploy to zones by selecting them here\n- most zones require items to deploy\n- once you survive a set amount of waves, you can launch all the resources in your core\n- use these items to research in the tech tree or uncover new zones")); + + Core.settings.put("zone-info", true); + Core.settings.save(); + } + cont.stack(control.saves.getZoneSlot() == null ? new View() : new Table(){{ SaveSlot slot = control.saves.getZoneSlot(); @@ -64,7 +71,7 @@ public class DeployDialog extends FloatingDialog{ }catch(SaveException e){ //make sure to handle any save load errors! e.printStackTrace(); if(control.saves.getZoneSlot() != null) control.saves.getZoneSlot().delete(); - ui.showInfo("$save.corrupted"); + Core.app.post(() -> ui.showInfo("$save.corrupted")); show(); } });