Added comments for Game Activity.
This commit is contained in:
parent
0094ad7af0
commit
e33112dcb0
@ -12,39 +12,68 @@ import android.widget.TextView;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* {@code GameActivity} is the activity that displays the game.
|
||||
*
|
||||
* @autor Alexeï Kadir, Lyanis Souidi, Hugo Dimitrijevic
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GameActivity extends AppCompatActivity {
|
||||
|
||||
/**
|
||||
* The key used to store the size of the cross in the {@code Intent}.
|
||||
*/
|
||||
public static final String SIZE_KEY = "SIZE";
|
||||
|
||||
|
||||
/**
|
||||
* The default size of the cross.
|
||||
*/
|
||||
public static final int DEFAULT_SIZE = 10;
|
||||
|
||||
|
||||
/**
|
||||
* The key used to store whether the game is in hard mode in the {@code Intent}.
|
||||
*/
|
||||
public static final String HARD_MODE_KEY = "HARD_MODE";
|
||||
|
||||
|
||||
/**
|
||||
* Whether the game is in hard mode by default.
|
||||
*/
|
||||
public static final boolean DEFAULT_HARD_MODE = false;
|
||||
|
||||
|
||||
/**
|
||||
* The key used to store the {@code Set} of {@code Line}s in the {@code Bundle}.
|
||||
*/
|
||||
private static final String LINES_KEY = "LINES";
|
||||
|
||||
|
||||
/**
|
||||
* The key used to store the x-coordinate of the offset in the {@code Bundle}.
|
||||
*/
|
||||
private static final String OFFSET_X_KEY = "OFFSET_X";
|
||||
|
||||
|
||||
/**
|
||||
* The key used to store the y-coordinate of the offset in the {@code Bundle}.
|
||||
*/
|
||||
private static final String OFFSET_Y_KEY = "OFFSET_Y";
|
||||
|
||||
|
||||
/**
|
||||
* The {@code GameView} that displays the game.
|
||||
*/
|
||||
private GameView view;
|
||||
|
||||
|
||||
/**
|
||||
* The {@code GameModel} that represents the game.
|
||||
*/
|
||||
private GameModel model;
|
||||
|
||||
|
||||
/**
|
||||
* The {@code GameController} that controls the game.
|
||||
*/
|
||||
private GameController controller;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the activity.
|
||||
*
|
||||
* @param savedState The saved state of the activity.
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedState) {
|
||||
super.onCreate(savedState);
|
||||
@ -61,7 +90,11 @@ public class GameActivity extends AppCompatActivity {
|
||||
this.controller = new GameController(this, this.view, this.model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves the state of the activity in the specified {@code Bundle}.
|
||||
*
|
||||
* @param state The state of the activity.
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle state) {
|
||||
super.onSaveInstanceState(state);
|
||||
@ -74,7 +107,11 @@ public class GameActivity extends AppCompatActivity {
|
||||
state.putInt(OFFSET_Y_KEY, offset.y);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restores the state of the activity.
|
||||
*
|
||||
* @param savedState The saved state of the activity.
|
||||
*/
|
||||
@Override
|
||||
protected void onRestoreInstanceState(@NonNull Bundle savedState) {
|
||||
super.onSaveInstanceState(savedState);
|
||||
|
Loading…
Reference in New Issue
Block a user