Android Open Source - OpenFlappyBird Screen Size Helper






From Project

Back to project page OpenFlappyBird.

License

The source code is released under:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2014 Dean Wild <dw86@kent.ac.uk> Everyone is permitted to copy and distribute ver...

If you think the Android project OpenFlappyBird listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.co.deanwild.openflappybird.game;
/*from w  ww  . j a va 2 s .com*/
import android.app.Activity;
import android.util.DisplayMetrics;

public class ScreenSizeHelper {

  public static float calculateScreenWidth(Activity context, float windowHeight){    
        DisplayMetrics dm = new DisplayMetrics();
        context.getWindowManager().getDefaultDisplay().getMetrics(dm);
        final int realHeight = dm.heightPixels;
        final int realWidth = dm.widthPixels;
        float ratio = (float)realWidth / (float)realHeight;
        return windowHeight * ratio;
  }
}




Java Source Code List

uk.co.deanwild.openflappybird.ApplicationTest.java
uk.co.deanwild.openflappybird.game.Bird.java
uk.co.deanwild.openflappybird.game.MainActivity.java
uk.co.deanwild.openflappybird.game.PipePair.java
uk.co.deanwild.openflappybird.game.ResourceManager.java
uk.co.deanwild.openflappybird.game.SceneManager.java
uk.co.deanwild.openflappybird.game.ScoreManager.java
uk.co.deanwild.openflappybird.game.ScreenSizeHelper.java