Android Open Source - Tanks Game Context






From Project

Back to project page Tanks.

License

The source code is released under:

MIT License

If you think the Android project Tanks 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 com.ThirtyNineEighty.System;
//w  w w  . jav a 2s . com
import android.content.Context;
import android.content.pm.ApplicationInfo;

public class GameContext
{
  public static final float EtalonHeight = 1080f;
  public static final float EtalonWidth  = 1920f;
  public static final float EtalonAspect = EtalonWidth / EtalonHeight;

  public static final float Left = EtalonWidth / -2f;
  public static final float Right = EtalonWidth / 2f;
  public static final float Bottom = EtalonHeight / -2f;
  public static final float Top = EtalonHeight / 2f;

  private static boolean isFirst;
  private static long delta;
  private static long lastTick;

  private static Context appContext;
  private static IContent content;

  private static boolean debuggable;

  private static float width;
  private static float height;

  public static Context getAppContext() { return appContext; }
  public static void setAppContext(Context value)
  {
    appContext = value;

    int flags = appContext.getApplicationInfo().flags;
    debuggable = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
  }

  public static IContent getContent() { return content; }
  public static void setContent(IContent value) { content = value; }

  public static float updateTime()
  {
    long currentTick;

    if (isFirst)
    {
      currentTick = System.currentTimeMillis();
      lastTick = currentTick;
      isFirst = false;
    }

    currentTick = System.currentTimeMillis();
    delta = currentTick - lastTick;
    lastTick = currentTick;

    return delta / 1000.0f;
  }

  public static float getDelta()
  {
    float d = delta / 1000.0f;

    if (d >= 1.0f)
      return 1.0f;

    return d;
  }

  public static boolean isDebuggable() { return debuggable; }
  public static float getAspect() { return width / height; }
  public static float getWidth() { return width; }
  public static void setWidth(float value) { width = value; }
  public static float getHeight() { return height; }
  public static void setHeight(float value) { height = value; }
}




Java Source Code List

com.ThirtyNineEighty.Game.EngineObject.java
com.ThirtyNineEighty.Game.IEngineObject.java
com.ThirtyNineEighty.Game.Collisions.Collidable.java
com.ThirtyNineEighty.Game.Collisions.Collision2D.java
com.ThirtyNineEighty.Game.Collisions.Collision3D.java
com.ThirtyNineEighty.Game.Collisions.CollisionManager.java
com.ThirtyNineEighty.Game.Collisions.Collision.java
com.ThirtyNineEighty.Game.Collisions.ICollidable.java
com.ThirtyNineEighty.Game.Gameplay.Bullet.java
com.ThirtyNineEighty.Game.Gameplay.GameObject.java
com.ThirtyNineEighty.Game.Gameplay.Tank.java
com.ThirtyNineEighty.Game.Gameplay.Characteristics.CharacteristicFactory.java
com.ThirtyNineEighty.Game.Gameplay.Characteristics.Characteristic.java
com.ThirtyNineEighty.Game.Gameplay.Characteristics.Upgrade.java
com.ThirtyNineEighty.Game.Menu.BaseMenu.java
com.ThirtyNineEighty.Game.Menu.GameMenu.java
com.ThirtyNineEighty.Game.Menu.IMenu.java
com.ThirtyNineEighty.Game.Menu.Controls.Button.java
com.ThirtyNineEighty.Game.Menu.Controls.IControl.java
com.ThirtyNineEighty.Game.Worlds.GameWorld.java
com.ThirtyNineEighty.Game.Worlds.IWorld.java
com.ThirtyNineEighty.Helpers.Plane.java
com.ThirtyNineEighty.Helpers.Vector2.java
com.ThirtyNineEighty.Helpers.Vector3.java
com.ThirtyNineEighty.Helpers.VectorUtils.java
com.ThirtyNineEighty.Helpers.Vector.java
com.ThirtyNineEighty.Renderable.Renderable.java
com.ThirtyNineEighty.Renderable.Shader2D.java
com.ThirtyNineEighty.Renderable.Shader3D.java
com.ThirtyNineEighty.Renderable.Shader.java
com.ThirtyNineEighty.Renderable.Renderable2D.I2DRenderable.java
com.ThirtyNineEighty.Renderable.Renderable2D.Label.java
com.ThirtyNineEighty.Renderable.Renderable2D.Sprite.java
com.ThirtyNineEighty.Renderable.Renderable3D.I3DRenderable.java
com.ThirtyNineEighty.Renderable.Renderable3D.Model3D.java
com.ThirtyNineEighty.System.ConfigChooser.java
com.ThirtyNineEighty.System.Content.java
com.ThirtyNineEighty.System.GameActivity.java
com.ThirtyNineEighty.System.GameContext.java
com.ThirtyNineEighty.System.IContent.java
com.ThirtyNineEighty.System.ISubprogram.java