Android Open Source - tapdefence Game Activity






From Project

Back to project page tapdefence.

License

The source code is released under:

MIT License

If you think the Android project tapdefence 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.kulinich.tapdefence;
//from   w  w  w . j a va2 s. com
import android.annotation.SuppressLint;
import android.graphics.Point;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Display;
import android.view.Window;
import android.view.WindowManager;

import com.kulinich.tapdefence.engine.GameSurface;
import com.kulinich.tapdefence.engine.GameThread;

@SuppressLint("NewApi")
public class GameActivity extends FragmentActivity {
  
    private GameThread mGameThread;
    private GameSurface mGameSurface;
    
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
    Display display = getWindowManager().getDefaultDisplay();
    int width, height;
    if (android.os.Build.VERSION.SDK_INT < 13) {
      width = display.getWidth();
      height = display.getHeight();
    } else {
      Point size = new Point();
      display.getSize(size);
      width = size.x;
      height = size.y;  
    }
    
    mGameSurface = new GameSurface(this);
    
    setContentView(mGameSurface);
    
    mGameThread = mGameSurface.getThread();
    mGameThread.setSurfaceSize(width, height);
    mGameThread.doStart();
  }  
  
  @Override
  protected void onPause() {
    super.onPause();
    
    if (mGameThread != null) {
      mGameThread.pause();
    }
  }

  public void showScoreDialog(long score) {
      ScoreDialog scoreDialog = new ScoreDialog();
      scoreDialog.score = score;
      scoreDialog.show(getSupportFragmentManager(), "scoreDialog");
  }
}




Java Source Code List

com.kulinich.tapdefence.GameActivity.java
com.kulinich.tapdefence.MainActivity.java
com.kulinich.tapdefence.ScoreDialog.java
com.kulinich.tapdefence.engine.Constants.java
com.kulinich.tapdefence.engine.Enemy.java
com.kulinich.tapdefence.engine.GameSurface.java
com.kulinich.tapdefence.engine.GameThread.java
com.kulinich.tapdefence.engine.Game.java
com.kulinich.tapdefence.engine.InputHandler.java
com.kulinich.tapdefence.engine.Line.java
com.kulinich.tapdefence.engine.Particle.java
com.kulinich.tapdefence.engine.Point.java
com.kulinich.tapdefence.engine.Star.java
com.kulinich.tapdefence.engine.Utils.java
com.kulinich.tapdefence.engine.Wall.java