Functional play button

This commit is contained in:
Anuken 2019-01-03 20:42:34 -05:00
parent 153e6c5f1b
commit 0a6f7ac817
4 changed files with 9 additions and 5 deletions

View File

@ -223,7 +223,7 @@ public class MapView extends Element implements GestureListener{
} }
private void clampZoom(){ private void clampZoom(){
zoom = Mathf.clamp(zoom, 0.2f, 12f); zoom = Mathf.clamp(zoom, 0.2f, 20f);
} }
private Point2 project(float x, float y){ private Point2 project(float x, float y){
@ -273,6 +273,10 @@ public class MapView extends Element implements GestureListener{
editor.renderer().draw(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight); editor.renderer().draw(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight);
Draw.reset(); Draw.reset();
if(!ScissorStack.pushScissors(rect.set(x, y, width, height))){
return;
}
if(grid){ if(grid){
Draw.color(Color.GRAY); Draw.color(Color.GRAY);
image.setBounds(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight); image.setBounds(centerx - sclwidth / 2, centery - sclheight / 2, sclwidth, sclheight);
@ -326,6 +330,7 @@ public class MapView extends Element implements GestureListener{
Draw.reset(); Draw.reset();
ScissorStack.popScissors(); ScissorStack.popScissors();
ScissorStack.popScissors();
} }
private boolean active(){ private boolean active(){

View File

@ -13,7 +13,6 @@ import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.Difficulty; import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.MappableContent; import io.anuke.mindustry.game.MappableContent;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.BlockPart; import io.anuke.mindustry.world.blocks.BlockPart;
@ -92,7 +91,6 @@ public abstract class SaveFileVersion{
short width = stream.readShort(); short width = stream.readShort();
short height = stream.readShort(); short height = stream.readShort();
world.setMap(new Map("unknown", width, height));
world.beginMapLoad(); world.beginMapLoad();
Tile[][] tiles = world.createTiles(width, height); Tile[][] tiles = world.createTiles(width, height);

View File

@ -29,6 +29,7 @@ public class Save16 extends SaveFileVersion{
byte mode = stream.readByte(); byte mode = stream.readByte();
String mapname = stream.readUTF(); String mapname = stream.readUTF();
Map map = world.maps.getByName(mapname); Map map = world.maps.getByName(mapname);
if(map == null) map = new Map("unknown", 1, 1);
world.setMap(map); world.setMap(map);
int wave = stream.readInt(); int wave = stream.readInt();

View File

@ -146,9 +146,9 @@ public class MenuFragment extends Fragment{
dialog.addCloseButton(); dialog.addCloseButton();
dialog.content().defaults().height(66f).width(w).padRight(5f); dialog.content().defaults().height(66f).width(w).padRight(5f);
dialog.content().add(new MenuButton("icon-play-2", "$text.sectors", () -> { dialog.content().add(new MenuButton("icon-play-2", "$text.map.random", () -> {
dialog.hide(); dialog.hide();
ui.showInfo("aaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa"); world.generator.playRandomMap();
})).width(bw).colspan(2); })).width(bw).colspan(2);
dialog.content().row(); dialog.content().row();