Removed map screenshot key / Basic zone guide

This commit is contained in:
Anuken
2019-03-05 16:07:48 -05:00
parent 82e44397ff
commit a5d1350815
6 changed files with 24 additions and 75 deletions

View File

@@ -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();

View File

@@ -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));
}
}

View File

@@ -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);

View File

@@ -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),

View File

@@ -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();
}
});