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() {
return new DefaultThreadImpl();
}
@Override
public boolean isDebug() {
return false;
}
};
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.
#Mon Feb 12 18:20:29 EST 2018
#Tue Feb 13 17:19:41 EST 2018
version=beta
androidBuildCode=180
androidBuildCode=183
name=Mindustry
code=3.3
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.Colors;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureWrap;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
@ -48,6 +49,7 @@ public class Renderer extends RendererModule{
public Surface shadowSurface, shieldSurface, indicatorSurface;
private int targetscale = baseCameraScale;
private Texture background = new Texture("sprites/background.png");
private FloatArray shieldHits = new FloatArray();
private Array<Callable> shieldDraws = new Array<>();
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
@ -67,9 +69,11 @@ public class Renderer extends RendererModule{
}
}
});
clearColor = Hue.lightness(0.4f);
clearColor.a = 1f;
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
}
@Override
@ -172,6 +176,8 @@ public class Renderer extends RendererModule{
//clears shield surface
Graphics.surface(shieldSurface);
Graphics.surface();
drawPadding();
blocks.drawFloor();
blocks.processBlocks();
@ -215,11 +221,39 @@ public class Renderer extends RendererModule{
control.input().resetCursor();
camera.position.set(player.x, player.y, 0);
}
@Override
public void dispose() {
background.dispose();
}
public void 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(){
GlyphLayout layout = Pools.obtain(GlyphLayout.class);
@ -505,7 +539,7 @@ public class Renderer extends RendererModule{
}
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();
new button("time", () -> {
Timers.resetTime(10368000);
Timers.resetTime(1080000/2f);
});
row();
new button("time2", () -> {

View file

@ -120,7 +120,7 @@ public class Block{
public void configure(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){

View file

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