In layouts "end/start" complemented with "right/left" for lower api compability

This commit is contained in:
= 2018-05-19 17:15:18 +02:00
parent 3d3de3feed
commit b28877e08e
24 changed files with 58 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -73,7 +73,7 @@ public class Player extends Entity {
public void preMoveUpdate(Timer timer) {
if (hasSuperPower && superPowerParticles != null) {
currentSuperPowerDuration += timer.getFrameTimeSeconds();
currentSuperPowerDuration += timer.getFrameTimeMilliseconds();
hasSuperPower = superPowerDuration >= currentSuperPowerDuration;
superPowerParticles.setPosition(new Vector(super.getPosition()));
}

View File

@ -64,7 +64,7 @@ public class Particle extends Entity {
public void update(Timer timer) {
if (active) {
passedLifetime += timer.getFrameTimeSeconds();
passedLifetime += timer.getFrameTimeMilliseconds();
if (passedLifetime >= maxLife)
active = false;
float lifetimePercent = passedLifetime / maxLife;

View File

@ -57,17 +57,17 @@ public class ParticleSource {
public void update(Timer timer) {
if (alife) {
passedTime += timer.getFrameTimeSeconds();
passedTime += timer.getFrameTimeMilliseconds();
lifePercent = passedTime / maxTime;
if (passedTime >= currentDelay) {
passedEmittPause += timer.getFrameTimeSeconds();
passedEmittPause += timer.getFrameTimeMilliseconds();
while (passedEmittPause >= emittPause) {
passedEmittPause -= emittPause;
emitt();
}
passedSecond += timer.getFrameTimeSeconds();
passedSecond += timer.getFrameTimeMilliseconds();
if (passedSecond >= 1000) {
passedSecond -= 1000;
calcEmittPause();
@ -90,7 +90,7 @@ public class ParticleSource {
iter.remove();
} else {
particle.move(
new Vector(particle.getMovement()).mul(timer.getFrameTimeSeconds() / 1000));
new Vector(particle.getMovement()).mul(timer.getFrameTimeMilliseconds() / 1000));
}
}
activeParticleLock.unlock();

View File

@ -1,6 +1,7 @@
package de.frajul.endlessroll.entities.textures;
import android.content.Context;
import android.opengl.GLES20;
import android.support.annotation.DrawableRes;
import de.frajul.endlessroll.R;

View File

@ -5,7 +5,6 @@ import de.frajul.endlessroll.entities.DestroyEffect;
import de.frajul.endlessroll.entities.Obstacle;
import de.frajul.endlessroll.entities.Player;
import de.frajul.endlessroll.entities.collision.geometry.Geometry;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.game.Timer;
/**
@ -30,7 +29,7 @@ public class Bomb extends Tool {
public void update(Timer timer) {
super.update(timer);
float explosionDuration = ToolType.BOMB.getCurrentUpgradeValue(ToolUpgradeType.DURATION);
delta += timer.getFrameTimeSeconds();
delta += timer.getFrameTimeMilliseconds();
int currentExplosionState = Math.min((int) (delta / (explosionDuration / 3f)), 3);
if (attachedObstacle != null) {
if(attachedObstacle.isMoving())

View File

@ -57,7 +57,7 @@ public class Magnet extends Tool {
float fromPlayerYDistance = super.getPosition().y - player.getPosition().y;
float force = 0.0000012f / (fromPlayerDistanceGreaterFour * fromPlayerDistanceGreaterFour);
force *= ToolType.MAGNET.getCurrentUpgradeValue(ToolUpgradeType.FORCE) / 100;
force *= timer.getFrameTimeSeconds();
force *= timer.getFrameTimeMilliseconds();
if (fromPlayerYDistance < 0) {
force = -force;

View File

@ -13,7 +13,7 @@ public class Camera {
private float x, y;
public void update(float playerY, Timer timer){
float frameTime = timer.getFrameTimeSeconds() / 1000f;
float frameTime = timer.getFrameTimeMilliseconds() / 1000f;
float maxY = Math.min(playerY - 1 + 0.6f, MAX_Y);
if(playerY >= 0.5f){
y += MOVE_SPEED_UP * frameTime;

View File

@ -146,7 +146,7 @@ public class Game extends Rendering<GameScene> {
float playerProgress = player.getProgress();
viewManager.update(gameState == GameState.RUNNING, timer, playerProgress);
toolButtonBar.update(timer.getFrameTimeSeconds(), gameState == GameState.RUNNING);
toolButtonBar.update(timer.getFrameTimeMilliseconds(), gameState == GameState.RUNNING);
switch (gameState) {
case RUNNING:
if (player.getPosition().y < -2f) {
@ -166,7 +166,7 @@ public class Game extends Rendering<GameScene> {
collisionManager.update(physics, scene, timer);
break;
case COUNTDOWN:
countdown.update(timer.getFrameTimeSeconds());
countdown.update(timer.getFrameTimeMilliseconds());
break;
}
} catch (Exception e) {

View File

@ -23,6 +23,7 @@ import de.frajul.endlessroll.entities.tileLists.Terrain;
import de.frajul.endlessroll.entities.tools.Tool;
import de.frajul.endlessroll.levels.worlds.World;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.GameLog;
/**
* Created by Julian on 20.07.2016.
@ -107,7 +108,7 @@ public abstract class Scene {
if (entity instanceof Obstacle) {
Obstacle obstacle = (Obstacle) entity;
if (obstacle.isMoving())
obstacle.moveWithMoveComponent(timer.getFrameTimeSeconds(),
obstacle.moveWithMoveComponent(timer.getFrameTimeMilliseconds(),
player.getSpeed());
}
boolean remove = updateEntity(entity, timer);
@ -122,7 +123,7 @@ public abstract class Scene {
((AnimatedEntity) entity).update(timer);
if (!(entity instanceof Obstacle)) {
Vector movement = entity.getMovement();
Vector finalMovement = new Vector(movement).mul(timer.getFrameTimeSeconds());
Vector finalMovement = new Vector(movement).mul(timer.getFrameTimeMilliseconds());
if (finalMovement.y < MAX_Y_MOVEMENT)
finalMovement.y = MAX_Y_MOVEMENT;
entity.move(finalMovement);

View File

@ -21,10 +21,18 @@ public class TestScreenScene extends Scene {
uncategorizedEntities
.add(new Entity(World.GRASSLANDS.getBackgroundTextures().get(0), new Vector(), 1,
1));
uncategorizedEntities
.add(new Entity(World.ICY_MOUNTAINS.getBackgroundTextures().get(0), new Vector(-1,0), 1,
1));
uncategorizedEntities
.add(new Entity(World.ICY_MOUNTAINS.getBackgroundTextures().get(0), new Vector(1,0), 1,
1));
try {
guis.addAll(new ToolButtonBar(texturePack, null,
new ToolSlotSettings("RAMP", "STASIS", "BOMB", "MAGNET", 1)).toGuiList());
} catch (Exception ignore) {
}
camera.moveX(1);
}
}

View File

@ -31,7 +31,7 @@ public class Timer {
}
}
public float getFrameTimeSeconds() {
public float getFrameTimeMilliseconds() {
return delta;
}

View File

@ -39,7 +39,7 @@ public class Physics {
}
public void applyGravity(GameScene scene, Timer timer) {
float gravity = GRAVITY_FORCE * timer.getFrameTimeSeconds();
float gravity = GRAVITY_FORCE * timer.getFrameTimeMilliseconds();
scene.getPlayer().setGravityForce(-gravity);

View File

@ -4,6 +4,7 @@ import android.opengl.Matrix;
import de.frajul.endlessroll.data.Vector;
import de.frajul.endlessroll.entities.Entity;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.game.Camera;
/**

View File

@ -54,13 +54,15 @@
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"/>
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"/>
<include
android:id="@+id/goal_message_next_level"
layout="@layout/goal_message_levelbutton"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>

View File

@ -7,7 +7,7 @@
<include
android:id="@+id/settings_topbar"
layout="@layout/topbar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"/>

View File

@ -6,7 +6,7 @@
<include
android:id="@+id/shape_shop_topbar"
layout="@layout/topbar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<RelativeLayout
@ -71,7 +71,8 @@
layout="@layout/shape_inspector"
android:layout_width="@dimen/shape_inspector_width"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"/>
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>

View File

@ -20,9 +20,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_below="@+id/startscreen_gain_90_ep"
android:layout_marginBottom="2dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="@string/start_screen_unlock_all_levels"
android:visibility="visible"/>
@ -32,9 +34,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/startscreen_to_gl_test_screen"
android:layout_marginBottom="2dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="@string/start_screen_gain_90_ep"
android:visibility="visible"/>

View File

@ -29,6 +29,7 @@
android:layout_height="45dp"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/tools_ramp_button"/>
<include

View File

@ -6,7 +6,7 @@
<include
android:id="@+id/toolshop_topbar"
layout="@layout/topbar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>

View File

@ -9,6 +9,7 @@
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_marginLeft="3dp"
@ -23,7 +24,9 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_toEndOf="@id/topbar_back_button"
android:layout_toRightOf="@id/topbar_back_button"
android:orientation="vertical">
<TextView
@ -51,6 +54,7 @@
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/topbar_levellayout"
android:layout_toRightOf="@id/topbar_levellayout"
android:background="@drawable/currency_star"/>
<ImageView
@ -70,6 +74,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/topbar_starview"
android:layout_toRightOf="@+id/topbar_starview"
android:text="@string/placeholder_number"
android:textSize="25sp"/>
@ -79,6 +84,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/topbar_energyview"
android:layout_toRightOf="@+id/topbar_energyview"
android:text="@string/placeholder_number"
android:textSize="25sp"/>
@ -87,8 +93,10 @@
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/xml_selector_settingsbutton"/>
<Button
@ -98,7 +106,9 @@
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_toLeftOf="@+id/topbar_settings"
android:layout_toStartOf="@+id/topbar_settings"
android:background="@drawable/xml_selector_toolshopbutton"/>
<Button
@ -108,7 +118,9 @@
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_toLeftOf="@+id/topbar_toolshop"
android:layout_toStartOf="@id/topbar_toolshop"
android:background="@drawable/xml_selector_shapeshopbutton"/>
<TextView
@ -116,6 +128,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/topbar_starcount"
android:layout_alignRight="@id/topbar_starcount"
android:layout_centerVertical="true"
android:text="@string/placeholder_number"
android:textSize="20sp"
@ -126,6 +139,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/topbar_energycount"
android:layout_alignRight="@id/topbar_energycount"
android:layout_centerVertical="true"
android:text="@string/placeholder_number"
android:textSize="20sp"

View File

@ -56,6 +56,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="@string/world_button_progress_placeholder"
android:textSize="20sp"/>
@ -71,6 +72,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="@string/world_button_progress_placeholder"
android:textSize="20sp"/>

View File

@ -6,7 +6,7 @@
<include
android:id="@+id/worlds_topbar"
layout="@layout/topbar"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>

View File

@ -70,7 +70,7 @@
<string name="tutorial_leveled_up_to_toolshop">Glückwunsch! Du bist ein Level aufgestiegen! Jetzt gehe in den Toolshop</string>
<string name="tutorial_switch_tools_two_neccessary">Für dieses Level müssen zwei Tools ausgerüstet sein</string>
<string name="tutorial_switch_tools_switch">Um ein Tool auszuwählen, klicke einfach darauf</string>
<string name="tutorial_place_ramp_gap">Setzte die Rampe vor die Lücke</string>
<string name="tutorial_place_ramp_gap">Setze die Rampe vor die Lücke</string>
<string name="credits_author">von Frajul</string>
<string name="credits_testers_title">TESTER</string>
<string name="credits_music_title">MUSIK</string>