diff --git a/AndorsTrail/res/drawable-nodpi/ts_background.png b/AndorsTrail/res/drawable-nodpi/ts_background.png
new file mode 100644
index 000000000..4b439ec45
Binary files /dev/null and b/AndorsTrail/res/drawable-nodpi/ts_background.png differ
diff --git a/AndorsTrail/res/drawable-nodpi/ts_foreground.png b/AndorsTrail/res/drawable-nodpi/ts_foreground.png
index 9eb8f63ed..bce0113aa 100644
Binary files a/AndorsTrail/res/drawable-nodpi/ts_foreground.png and b/AndorsTrail/res/drawable-nodpi/ts_foreground.png differ
diff --git a/AndorsTrail/res/drawable-nodpi/ts_midground.png b/AndorsTrail/res/drawable-nodpi/ts_midground.png
new file mode 100644
index 000000000..52d801528
Binary files /dev/null and b/AndorsTrail/res/drawable-nodpi/ts_midground.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_l_01.png b/AndorsTrail/res/drawable/ts_clouds_l_01.png
index 19cfef8e4..f4360fd31 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_l_01.png and b/AndorsTrail/res/drawable/ts_clouds_l_01.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_l_02.png b/AndorsTrail/res/drawable/ts_clouds_l_02.png
index ecb89af2c..f46a4d2dc 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_l_02.png and b/AndorsTrail/res/drawable/ts_clouds_l_02.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_l_03.png b/AndorsTrail/res/drawable/ts_clouds_l_03.png
index 29dc86f51..d88482b25 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_l_03.png and b/AndorsTrail/res/drawable/ts_clouds_l_03.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_l_04.png b/AndorsTrail/res/drawable/ts_clouds_l_04.png
index e88f248ae..16f000365 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_l_04.png and b/AndorsTrail/res/drawable/ts_clouds_l_04.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_m_01.png b/AndorsTrail/res/drawable/ts_clouds_m_01.png
index 186ca5b99..afb4ead47 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_m_01.png and b/AndorsTrail/res/drawable/ts_clouds_m_01.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_m_02.png b/AndorsTrail/res/drawable/ts_clouds_m_02.png
index 104376e6e..dd90592ec 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_m_02.png and b/AndorsTrail/res/drawable/ts_clouds_m_02.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_s_01.png b/AndorsTrail/res/drawable/ts_clouds_s_01.png
index be372d72b..cc126d122 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_s_01.png and b/AndorsTrail/res/drawable/ts_clouds_s_01.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_s_02.png b/AndorsTrail/res/drawable/ts_clouds_s_02.png
index ef4aa324d..8af712018 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_s_02.png and b/AndorsTrail/res/drawable/ts_clouds_s_02.png differ
diff --git a/AndorsTrail/res/drawable/ts_clouds_s_03.png b/AndorsTrail/res/drawable/ts_clouds_s_03.png
index 42f994163..17cd63d3d 100644
Binary files a/AndorsTrail/res/drawable/ts_clouds_s_03.png and b/AndorsTrail/res/drawable/ts_clouds_s_03.png differ
diff --git a/AndorsTrail/res/layout-land/title_bg_layout.xml b/AndorsTrail/res/layout-land/title_bg_layout.xml
index 380813e79..d2a5be069 100644
--- a/AndorsTrail/res/layout-land/title_bg_layout.xml
+++ b/AndorsTrail/res/layout-land/title_bg_layout.xml
@@ -7,10 +7,9 @@
+ android:src="@drawable/ts_background"/>
+
+
+
+
+
+
+
+ android:orientation="horizontal" >
+ android:src="@drawable/ts_background"/>
+
+
+
+
+
+
+
+
+ android:orientation="vertical" >
-
+
+
+
\ No newline at end of file
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
index f3b67819a..6b0909c38 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
@@ -72,7 +72,12 @@ public final class StartScreenActivity extends FragmentActivity implements OnNew
development_version.setVisibility(View.VISIBLE);
}
- clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator);
+ clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_back);
+ clouds.setCloudsCount(40, 0, 0);
+ clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_mid);
+ clouds.setCloudsCount(0, 15, 0);
+ clouds = (CloudsAnimatorView) findViewById(R.id.ts_clouds_animator_front);
+ clouds.setCloudsCount(0, 0, 8);
View background = findViewById(R.id.title_bg);
if (background != null) {
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java
index 4fbec14e4..a53b8663a 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/view/CloudsAnimatorView.java
@@ -3,6 +3,7 @@ package com.gpl.rpg.AndorsTrail.view;
import java.util.concurrent.ConcurrentHashMap;
import android.content.Context;
+import android.content.res.Configuration;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@@ -20,26 +21,32 @@ import com.gpl.rpg.AndorsTrail.util.L;
public class CloudsAnimatorView extends FrameLayout {
private static final float Y_MIN = 0f;
- private static final float Y_MAX = 0.6f;
+ private static final float Y_MAX_LANDSCAPE = 0.55f;
+ private static final float Y_MAX_PORTRAIT = 0.65f;
- private static final int DEFAULT_DURATION = 30000;
+ private static final int DEFAULT_DURATION = 50000;
private static final float SPEED_VARIANCE = 0.2f;
private static final float BELOW_SPEED_FACTOR = 0.5f;
private static final float CENTER_SPEED_FACTOR = 1.0f;
private static final float ABOVE_SPEED_FACTOR = 1.5f;
- private static final int BELOW_CLOUD_COUNT = 30;
- private static final int CENTER_CLOUD_COUNT = 20;
- private static final int ABOVE_CLOUD_COUNT = 15;
+ private static final int BELOW_CLOUD_COUNT = 40;
+ private static final int CENTER_CLOUD_COUNT = 15;
+ private static final int ABOVE_CLOUD_COUNT = 8;
+
private static final int[] belowDrawablesId = new int[]{R.drawable.ts_clouds_s_01, R.drawable.ts_clouds_s_02, R.drawable.ts_clouds_s_03};
private static final int[] centerDrawablesId = new int[]{R.drawable.ts_clouds_m_01, R.drawable.ts_clouds_m_02};
private static final int[] aboveDrawablesId = new int[]{R.drawable.ts_clouds_l_01, R.drawable.ts_clouds_l_02, R.drawable.ts_clouds_l_03, R.drawable.ts_clouds_l_04};
- ViewGroup belowLayer, centerLayer, aboveLayer;
+ private int belowCount = BELOW_CLOUD_COUNT;
+ private int centerCount = CENTER_CLOUD_COUNT;
+ private int aboveCount = ABOVE_CLOUD_COUNT;
+ private ViewGroup belowLayer, centerLayer, aboveLayer;
private int duration = DEFAULT_DURATION;
+ private float yMax = Y_MAX_PORTRAIT;
- private final ConcurrentHashMap animations = new ConcurrentHashMap(BELOW_CLOUD_COUNT + CENTER_CLOUD_COUNT + ABOVE_CLOUD_COUNT);
+ private final ConcurrentHashMap animations = new ConcurrentHashMap(belowCount + centerCount + aboveCount);
public CloudsAnimatorView(Context context) {
@@ -57,15 +64,32 @@ public class CloudsAnimatorView extends FrameLayout {
init();
}
- public void init() {
+ private void init() {
setFocusable(false);
inflate(getContext(), R.layout.clouds_animator, this);
+ switch (getResources().getConfiguration().orientation) {
+ case Configuration.ORIENTATION_LANDSCAPE:
+ yMax = Y_MAX_LANDSCAPE;
+ break;
+ case Configuration.ORIENTATION_PORTRAIT:
+ yMax = Y_MAX_PORTRAIT;
+ break;
+ default:
+ yMax = Y_MAX_LANDSCAPE;
+ break;
+ }
belowLayer = (ViewGroup) findViewById(R.id.ts_clouds_below);
centerLayer = (ViewGroup) findViewById(R.id.ts_clouds_center);
aboveLayer = (ViewGroup) findViewById(R.id.ts_clouds_above);
}
+ public void setCloudsCount(int below, int center, int above) {
+ belowCount = below;
+ centerCount = center;
+ aboveCount = above;
+ }
+
private void createCloudBelow() {
createCloud(belowLayer, belowDrawablesId, BELOW_SPEED_FACTOR);
}
@@ -83,17 +107,18 @@ public class CloudsAnimatorView extends FrameLayout {
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layer.addView(iv, lp);
- final float y = Y_MIN + (float) (layer.getHeight() * Math.random() * (Y_MAX - Y_MIN));
+ final float y = (float) (layer.getHeight() * (Y_MIN + (Math.random() * (yMax - Y_MIN)))) - iv.getDrawable().getMinimumHeight();
float ratio = (float)Math.random();
- final float x = (float) (((1-ratio) * (iv.getWidth() + layer.getWidth())) - iv.getWidth());
+ final float x = (float) (((1-ratio) * (iv.getDrawable().getMinimumWidth() + layer.getWidth())) - iv.getDrawable().getMinimumWidth());
final long d = (long)((ratio * duration) / (speedFactor + (Math.random() * SPEED_VARIANCE)));
+ L.log("Cloud added at "+x+","+y);
prepareAnimation(iv, layer, speedFactor, x, y, d);
}
private void resetCloud(final ViewGroup layer, final float speedFactor, final ImageView iv) {
- final float y = Y_MIN + (float) (layer.getHeight() * Math.random() * (Y_MAX - Y_MIN));
+ final float y = (float) (layer.getHeight() * (Y_MIN + (Math.random() * (yMax - Y_MIN)))) - iv.getDrawable().getMinimumHeight();
final float x = -iv.getWidth();
final long d = (long)(duration / (speedFactor + (Math.random() * SPEED_VARIANCE)));
@@ -128,15 +153,15 @@ public class CloudsAnimatorView extends FrameLayout {
}
public void startAnimation() {
- int i = BELOW_CLOUD_COUNT;
+ int i = belowCount;
while (i-- > 0) {
createCloudBelow();
}
- i = CENTER_CLOUD_COUNT;
+ i = centerCount;
while (i-- > 0) {
createCloudCenter();
}
- i = ABOVE_CLOUD_COUNT;
+ i = aboveCount;
while (i-- > 0) {
createCloudAbove();
}