Time.delta cleanup / Basic mobile input

This commit is contained in:
Anuken
2020-07-19 12:21:21 -04:00
parent f9ed74c15a
commit a074010eb7
91 changed files with 414 additions and 247 deletions

View File

@@ -17,7 +17,7 @@ public class MultiReqImage extends Stack{
public void act(float delta){
super.act(delta);
time += Time.delta() / 60f;
time += Time.delta / 60f;
displays.each(req -> req.visible(false));

View File

@@ -62,7 +62,7 @@ public class DatabaseDialog extends BaseDialog{
image.addListener(listener);
if(!Vars.mobile && unlocked(unlock)){
image.addListener(new HandCursorListener());
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta()));
image.update(() -> image.getColor().lerp(!listener.isOver() ? Color.lightGray : Color.white, 0.4f * Time.delta));
}
if(unlocked(unlock)){

View File

@@ -416,7 +416,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.update(() -> {
if(selected != null){
if(launching){
stable.getColor().sub(0, 0, 0, 0.05f * Time.delta());
stable.getColor().sub(0, 0, 0, 0.05f * Time.delta);
}else{
//fade out UI when not facing selected sector
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();

View File

@@ -110,13 +110,13 @@ public class BlockInventoryFragment extends Fragment{
hide();
}else{
if(tile.items.total() == 0){
emptyTime += Time.delta();
emptyTime += Time.delta;
}else{
emptyTime = 0f;
}
if(holding && lastItem != null){
holdTime += Time.delta();
holdTime += Time.delta;
if(holdTime >= holdWithdraw){
int amount = Math.min(tile.items.get(lastItem), player.unit().maxAccepted(lastItem));
@@ -140,7 +140,7 @@ public class BlockInventoryFragment extends Fragment{
shrinkHoldTimes[i] = 0f;
dirty |= !had;
}else if(had){
shrinkHoldTimes[i] += Time.delta();
shrinkHoldTimes[i] += Time.delta;
dirty |= shrinkHoldTimes[i] >= holdShrink;
}
}

View File

@@ -164,7 +164,7 @@ public class ChatFragment extends Table{
Draw.color();
if(fadetime > 0 && !shown)
fadetime -= Time.delta() / 180f;
fadetime -= Time.delta / 180f;
}
private void sendMessage(){

View File

@@ -257,7 +257,7 @@ public class HudFragment extends Fragment{
coreAttackOpacity[0] = Mathf.lerpDelta(coreAttackOpacity[0], 0f, 0.1f);
}
coreAttackTime[0] -= Time.delta();
coreAttackTime[0] -= Time.delta;
return coreAttackOpacity[0] > 0;
});

View File

@@ -90,7 +90,7 @@ public class PlacementFragment extends Fragment{
scrollPositions.put(currentCategory, blockPane.getScrollY());
if(Core.input.keyDown(Binding.pick) && player.isBuilder()){ //mouse eyedropper select
Building tile = world.entWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
Building tile = world.buildWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
Block tryRecipe = tile == null ? null : tile.block();
Object tryConfig = tile == null ? null : tile.config();
@@ -449,7 +449,7 @@ public class PlacementFragment extends Fragment{
//check tile being hovered over
Tile hoverTile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
if(hoverTile != null){
//if the tile has an entity, display it
//if the tile has a building, display it
if(hoverTile.build != null){
hoverTile.build.updateFlow(true);
return hoverTile.build;