Code owners
Assign users and groups as approvers for specific file changes. Learn more.
GameActivity.java 1.29 KiB
package com.example.a8_bitinvader;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.graphics.Point; // necessary to get ScreenWidth and ScreenHeight
import android.view.WindowManager;
public class GameActivity extends AppCompatActivity {
private GameView gameView;
/**
* Create an instance of the activity based on the saved state. Then initialize the gameview and display the gameview onto the screen
* @param savedInstanceState The cached game state
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// puts app into fullscreen when GameActivity is running
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Point point = new Point();
getWindowManager().getDefaultDisplay().getSize(point);
gameView = new GameView(this, point.x, point.y);
setContentView(gameView);
}
/**
* Pause the game
*/
@Override
protected void onPause() {
super.onPause();
gameView.pause();
}
/**
* Resume the game
*/
@Override
protected void onResume() {
super.onResume();
gameView.resume();
}
}