Fixed minor bug with camera panning out of bounds
This commit is contained in:
@@ -13,6 +13,7 @@ import io.anuke.mindustry.input.GestureHandler;
|
|||||||
import io.anuke.mindustry.input.Input;
|
import io.anuke.mindustry.input.Input;
|
||||||
import io.anuke.mindustry.world.Generator;
|
import io.anuke.mindustry.world.Generator;
|
||||||
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
import io.anuke.mindustry.world.blocks.ProductionBlocks;
|
||||||
|
import io.anuke.ucore.UCore;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.graphics.Atlas;
|
import io.anuke.ucore.graphics.Atlas;
|
||||||
@@ -23,7 +24,6 @@ import io.anuke.ucore.util.Timers;
|
|||||||
public class Control extends RendererModule{
|
public class Control extends RendererModule{
|
||||||
public int rangex = 10, rangey = 10;
|
public int rangex = 10, rangey = 10;
|
||||||
public float targetzoom = 1f;
|
public float targetzoom = 1f;
|
||||||
private float targetx, targety;
|
|
||||||
//GifRecorder recorder = new GifRecorder(batch);
|
//GifRecorder recorder = new GifRecorder(batch);
|
||||||
|
|
||||||
public Control(){
|
public Control(){
|
||||||
@@ -148,8 +148,15 @@ public class Control extends RendererModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateShake();
|
updateShake();
|
||||||
|
float prevx = camera.position.x, prevy = camera.position.y;
|
||||||
clampCamera(-tilesize / 2f, -tilesize / 2f, pixsize - tilesize / 2f, pixsize - tilesize / 2f);
|
clampCamera(-tilesize / 2f, -tilesize / 2f, pixsize - tilesize / 2f, pixsize - tilesize / 2f);
|
||||||
|
|
||||||
|
if(android){
|
||||||
|
UCore.log(camera.position.x-prevx, camera.position.y-prevy);
|
||||||
|
player.x += camera.position.x-prevx;
|
||||||
|
player.y += camera.position.y-prevy;
|
||||||
|
}
|
||||||
|
|
||||||
float lastx = camera.position.x, lasty = camera.position.y;
|
float lastx = camera.position.x, lasty = camera.position.y;
|
||||||
|
|
||||||
if(android){
|
if(android){
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ public class AndroidInput extends InputAdapter{
|
|||||||
|
|
||||||
Tile sel = selected();
|
Tile sel = selected();
|
||||||
|
|
||||||
|
if(sel == null) return;
|
||||||
|
|
||||||
if(warmup > warmupDelay && sel.block() != ProductionBlocks.core && sel.breakable()){
|
if(warmup > warmupDelay && sel.block() != ProductionBlocks.core && sel.breakable()){
|
||||||
breaktime += Mathf.delta();
|
breaktime += Mathf.delta();
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ public class GestureHandler extends GestureAdapter{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pinch (Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
|
public boolean pinch (Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
|
||||||
if(recipe == null)
|
if(recipe == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user