Android Open Source - Fluffy-Sheep Main Activity






From Project

Back to project page Fluffy-Sheep.

License

The source code is released under:

Apache License

If you think the Android project Fluffy-Sheep 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.sheep.fluffysheep;
//from  www.java2s.  co m
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {

  private GameView gameView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    // Go to fullscreen
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // Create the framebuffer
    DisplayMetrics dm = new DisplayMetrics(); 
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    Bitmap frameBuffer = Bitmap.createBitmap(dm.widthPixels, dm.heightPixels, Config.ARGB_8888);
    
    gameView = new GameView(this, frameBuffer);
      setContentView(gameView);
  }
  
  @Override
    public void onResume() {
        super.onResume();
        //screen.resume();
        gameView.resume();
    }

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

}




Java Source Code List

com.sheep.fluffysheep.GameView.java
com.sheep.fluffysheep.MainActivity.java