Android Open Source - DivisionByZero Core






From Project

Back to project page DivisionByZero.

License

The source code is released under:

Apache License

If you think the Android project DivisionByZero 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.ggstudios.divisionbyzero;
//ww w .j  a va2s  . c o m
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Handler;

public class Core{
  /*
   * This is the number of drawables used in the top level of drawing.
   * Since drawing is separated into several collections, we modify
   * those collections to added or remove UI elements and not the
   * top level drawable. So we can save a few CPU cycles if we make
   * the top level drawable an fixed length array. 
   * 
   * WARNING: THIS CONSTANT IS USED IN GAMERENDERER. 
   * Check onDraw before changing...
   */
  public static final int PRIMARY_DRAWABLES_USED = 10;
  
  static GLSurfaceView glView;
  static GameRenderer gr;
  static GameUpdater gu;
  static Game game;
  static Grid grid;
  
  static int currentLevelResId;
  
  static float zoom = 1f;
  
  static Player player;
  
  static float[] matrix = new float[16];
  static float[] mixedMatrix = new float[16];
  
  static float originalTouchX, originalTouchY;

  final static int A_POSITION_HANDLE = 0;
  final static int A_TEX_COORD_HANDLE = 2;

  static int U_MIXED_MATRIX_HANDLE;
  static int U_TRANSLATION_MATRIX_HANDLE;
  static int U_TEXTURE_HANDLE;
  static int U_TEX_COLOR_HANDLE;
  
  static int indiceHandle = 0;
  
  static Hud hud;

  static boolean forceVisible;
  
  static float canvasWidth = -1;
  static float canvasHeight = -1;
  
  /**
   * May be used as a hint on whether an object is on the screen or not.
   */
  static float cullR, cullB;

  /**
   * SDP and SDP_H are like DPs in Android and are density independent.
   */
  static float SDP;
  static float SDP_H;
  
  /**
   * This is the size of a tile on the current map.
   */
  static float MAP_SDP;

  static Drawable[] drawables;
  static List<Clickable> clickables;

  static Handler handler;
  static Context context;
  
  static TextureManager tm;
  static FontManager fm;
  static LevelManager lm;
  static SpawnManager sm;
  
  static Handler guiHandler;
  
  static float offX = 0.0f, offY = 0.0f;
  
  // buffers for general use
  public static class GeneralBuffers{
    static VBO fullscreen;
    static VBO tile;
    static VBO tile_not_centered;
    static VBO map_tile;
    static VBO map_half_tile;
    static VBO half_tile;
    static VBO half_tile_not_centered;
  }
  
  public static void addClickable(Clickable c){
    synchronized(clickables){
      clickables.add(c);
    }
  }
  
  public static void removeClickable(Object c){
    synchronized(clickables){
      clickables.remove(c);
    }
  }
  
  public static void onZoomChanged() {
    cullR = (canvasWidth + SDP_H) / zoom;
    cullB = (canvasHeight + SDP_H) / zoom;
  }
  
  public static void reset() {
    glView = null;
    gr = null;
    game = null;
    gu = null;
    grid = null;
    
    player = null;

    hud  = null;

    drawables = null;
    clickables = null;

    handler = null;
    context = null;
    
    tm = null;
    fm = null;
    lm = null;
    sm = null;
    guiHandler = null;
  }
  
  public static void finishActivity() {
    ((Activity)context).finish();
  }
}




Java Source Code List

com.ggstudios.divisionbyzero.ActivityAbout.java
com.ggstudios.divisionbyzero.ActivityLevelSelection.java
com.ggstudios.divisionbyzero.ActivityMainMenu.java
com.ggstudios.divisionbyzero.ActivitySettings.java
com.ggstudios.divisionbyzero.ActivitySplashScreen.java
com.ggstudios.divisionbyzero.ApplicationMain.java
com.ggstudios.divisionbyzero.BaseActivity.java
com.ggstudios.divisionbyzero.BaseDialog.java
com.ggstudios.divisionbyzero.BulletManager.java
com.ggstudios.divisionbyzero.Bullet.java
com.ggstudios.divisionbyzero.Button.java
com.ggstudios.divisionbyzero.Circle.java
com.ggstudios.divisionbyzero.ClickableCollection.java
com.ggstudios.divisionbyzero.Clickable.java
com.ggstudios.divisionbyzero.ConfirmDialog.java
com.ggstudios.divisionbyzero.Core.java
com.ggstudios.divisionbyzero.CustomGLSurfaceView.java
com.ggstudios.divisionbyzero.DialogManager.java
com.ggstudios.divisionbyzero.DrawableCollection.java
com.ggstudios.divisionbyzero.DrawableString.java
com.ggstudios.divisionbyzero.Drawable.java
com.ggstudios.divisionbyzero.EndDialog.java
com.ggstudios.divisionbyzero.Event.java
com.ggstudios.divisionbyzero.ExplosionGenerator.java
com.ggstudios.divisionbyzero.ExtrasManager.java
com.ggstudios.divisionbyzero.FontManager.java
com.ggstudios.divisionbyzero.GameRenderer.java
com.ggstudios.divisionbyzero.GameUpdater.java
com.ggstudios.divisionbyzero.Game.java
com.ggstudios.divisionbyzero.Grid.java
com.ggstudios.divisionbyzero.Hud.java
com.ggstudios.divisionbyzero.InGameMenu.java
com.ggstudios.divisionbyzero.InfoDialog.java
com.ggstudios.divisionbyzero.Label.java
com.ggstudios.divisionbyzero.LevelManager.java
com.ggstudios.divisionbyzero.LevelMap.java
com.ggstudios.divisionbyzero.LineGuide.java
com.ggstudios.divisionbyzero.MainActivity.java
com.ggstudios.divisionbyzero.Map.java
com.ggstudios.divisionbyzero.MessageDialog.java
com.ggstudios.divisionbyzero.ParticleEngine.java
com.ggstudios.divisionbyzero.PathFinder.java
com.ggstudios.divisionbyzero.PauseMenu.java
com.ggstudios.divisionbyzero.PictureBox.java
com.ggstudios.divisionbyzero.Player.java
com.ggstudios.divisionbyzero.PopupMenu.java
com.ggstudios.divisionbyzero.Rectangle.java
com.ggstudios.divisionbyzero.Shader.java
com.ggstudios.divisionbyzero.SpawnManager.java
com.ggstudios.divisionbyzero.SpriteAnimation.java
com.ggstudios.divisionbyzero.SpriteManager.java
com.ggstudios.divisionbyzero.Sprite.java
com.ggstudios.divisionbyzero.Statbar.java
com.ggstudios.divisionbyzero.StateManager.java
com.ggstudios.divisionbyzero.TargetRectangle.java
com.ggstudios.divisionbyzero.TextureManager.java
com.ggstudios.divisionbyzero.TowerInfoDialog.java
com.ggstudios.divisionbyzero.TowerLibrary.java
com.ggstudios.divisionbyzero.TowerManager.java
com.ggstudios.divisionbyzero.TowerMenu.java
com.ggstudios.divisionbyzero.Tower.java
com.ggstudios.divisionbyzero.UpdatableCollection.java
com.ggstudios.divisionbyzero.Updatable.java
com.ggstudios.divisionbyzero.UpgradeDialog.java
com.ggstudios.divisionbyzero.Utils.java
com.ggstudios.divisionbyzero.VBO.java
com.ggstudios.divisionbyzero.WaveControlDialog.java
com.ggstudios.divisionbyzero.WaveControlHud.java
com.ggstudios.divisionbyzero.ZoomControl.java
com.ggstudios.utils.BitmapUtils.java
com.ggstudios.utils.BufferUtils.java
com.ggstudios.utils.DebugLog.java
com.ggstudios.utils.ShaderUtils.java
com.ggstudios.widget.LevelMapBackground.java
fix.android.opengl.GLES20.java