Android Open Source - pong-android Game Activity






From Project

Back to project page pong-android.

License

The source code is released under:

MIT License

If you think the Android project pong-android 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 me.zamecnik.android.pong;
/*from   w w w . j a  va 2  s.  com*/
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

public class GameActivity extends Activity {

  static final String LOG_TAG = "Game";

  private GameView gameView;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    TextView fpsTextView = (TextView) findViewById(R.id.fpsTextView);
    FpsCounter fpsCounter = new FpsCounter(fpsTextView);

    LinearLayout layout = (LinearLayout) findViewById(R.id.frame);
    

    gameView = new PongGameView(getApplicationContext());
    gameView.setFpsCounter(fpsCounter);

    layout.addView(gameView);
  }

  @Override
  protected void onPause() {
    super.onPause();
    gameView.pause();
  }
}




Java Source Code List

me.zamecnik.android.pong.FpsCounter.java
me.zamecnik.android.pong.GameActivity.java
me.zamecnik.android.pong.GameView.java
me.zamecnik.android.pong.PongGameView.java
me.zamecnik.android.pong.ScalarExpSmoother.java