Added tile background to background for large screens

This commit is contained in:
Anuken
2018-02-13 17:21:14 -05:00
parent a8a402745f
commit 6b42525f8a
7 changed files with 55 additions and 9 deletions

View File

@@ -92,6 +92,11 @@ public class AndroidLauncher extends AndroidApplication{
public ThreadProvider getThreadProvider() { public ThreadProvider getThreadProvider() {
return new DefaultThreadImpl(); return new DefaultThreadImpl();
} }
@Override
public boolean isDebug() {
return false;
}
}; };
if(doubleScaleTablets && isTablet(this.getContext())){ if(doubleScaleTablets && isTablet(this.getContext())){

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Mon Feb 12 18:20:29 EST 2018 #Tue Feb 13 17:19:41 EST 2018
version=beta version=beta
androidBuildCode=180 androidBuildCode=183
name=Mindustry name=Mindustry
code=3.3 code=3.3
build=custom build build=custom build

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.graphics.Colors;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureWrap;
import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
@@ -48,6 +49,7 @@ public class Renderer extends RendererModule{
public Surface shadowSurface, shieldSurface, indicatorSurface; public Surface shadowSurface, shieldSurface, indicatorSurface;
private int targetscale = baseCameraScale; private int targetscale = baseCameraScale;
private Texture background = new Texture("sprites/background.png");
private FloatArray shieldHits = new FloatArray(); private FloatArray shieldHits = new FloatArray();
private Array<Callable> shieldDraws = new Array<>(); private Array<Callable> shieldDraws = new Array<>();
private Rectangle rect = new Rectangle(), rect2 = new Rectangle(); private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
@@ -70,6 +72,8 @@ public class Renderer extends RendererModule{
clearColor = Hue.lightness(0.4f); clearColor = Hue.lightness(0.4f);
clearColor.a = 1f; clearColor.a = 1f;
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
} }
@Override @Override
@@ -173,6 +177,8 @@ public class Renderer extends RendererModule{
Graphics.surface(shieldSurface); Graphics.surface(shieldSurface);
Graphics.surface(); Graphics.surface();
drawPadding();
blocks.drawFloor(); blocks.drawFloor();
blocks.processBlocks(); blocks.processBlocks();
blocks.drawBlocks(false); blocks.drawBlocks(false);
@@ -216,10 +222,38 @@ public class Renderer extends RendererModule{
camera.position.set(player.x, player.y, 0); camera.position.set(player.x, player.y, 0);
} }
@Override
public void dispose() {
background.dispose();
}
public void clearTiles(){ public void clearTiles(){
blocks.clearTiles(); blocks.clearTiles();
} }
void drawPadding(){
float vw = world.width() * tilesize;
float cw = camera.viewportWidth * camera.zoom;
float ch = camera.viewportHeight * camera.zoom;
if(vw < cw){
batch.draw(background,
camera.position.x + vw/2,
Mathf.round(camera.position.y - ch/2, tilesize),
(cw - vw) /2,
ch + tilesize,
0, ch / tilesize + 1,
((cw - vw) / 2 / tilesize), 0);
batch.draw(background,
camera.position.x - vw/2,
Mathf.round(camera.position.y - ch/2, tilesize),
-(cw - vw) /2,
ch + tilesize,
0, ch / tilesize + 1,
-((cw - vw) / 2 / tilesize), 0);
}
}
void drawPlayerNames(){ void drawPlayerNames(){
GlyphLayout layout = Pools.obtain(GlyphLayout.class); GlyphLayout layout = Pools.obtain(GlyphLayout.class);
@@ -505,7 +539,7 @@ public class Renderer extends RendererModule{
} }
public void clampScale(){ public void clampScale(){
targetscale = Mathf.clamp(targetscale, Math.round(Unit.dp.scl(2)), Math.round(Unit.dp.scl((5)))); targetscale = Mathf.clamp(targetscale, Math.round(Unit.dp.scl(1)), Math.round(Unit.dp.scl((5))));
} }
} }

View File

@@ -68,7 +68,7 @@ public class DebugFragment implements Fragment {
}); });
row(); row();
new button("time", () -> { new button("time", () -> {
Timers.resetTime(10368000); Timers.resetTime(1080000/2f);
}); });
row(); row();
new button("time2", () -> { new button("time2", () -> {

View File

@@ -120,7 +120,7 @@ public class Block{
public void configure(Tile tile, byte data){} public void configure(Tile tile, byte data){}
public void setConfigure(Tile tile, byte data){ public void setConfigure(Tile tile, byte data){
NetEvents.handleBlockConfig(tile, data); if(Net.active()) NetEvents.handleBlockConfig(tile, data);
} }
public boolean isConfigurable(Tile tile){ public boolean isConfigurable(Tile tile){

View File

@@ -4,6 +4,8 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet; import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetEvents;
import io.anuke.mindustry.resource.Item; import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.PowerBlock; import io.anuke.mindustry.world.blocks.types.PowerBlock;
@@ -133,8 +135,13 @@ public class Teleporter extends PowerBlock{
Array<Tile> links = findLinks(tile); Array<Tile> links = findLinks(tile);
if(links.size > 0){ if(links.size > 0){
if(Net.server() || !Net.active()){
Tile target = links.random(); Tile target = links.random();
target.entity.addItem(item, 1); target.entity.addItem(item, 1);
if(Net.server()) NetEvents.handleItemAdd(target, item);
}
} }
entity.power -= powerPerItem; entity.power -= powerPerItem;