Skip to content
Snippets Groups Projects
Commit 68fd3207 authored by Mike Li's avatar Mike Li
Browse files

Finished doxygen comments

parent 98318ac4
No related branches found
No related tags found
No related merge requests found
/**
* Authors: Mike Li, Jasper Leung, Sanjula Ganepola, Ahmed Al Koasmh
* Revised: March 29th, 2021
*
* Description: KeyboardListener class
*/
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/**
* @brief A class that handles keyboard inputs
*/
public class KeyboardListener extends KeyAdapter {
/**
* @brief Handles keyboard input behavior
* @param e The key that is pressed by the user
*/
public void keyPressed(KeyEvent e) {
switch(e.getKeyCode()) {
......
/**
* Authors: Mike Li, Jasper Leung, Sanjula Ganepola, Ahmed Al Koasmh
* Revised: March 29th, 2021
*
* Description: SquareData class
*/
import java.util.ArrayList;
import java.awt.Color;
/**
* @brief A class that holds the data of a square on the grid
*/
public class SquareData {
//ArrayList that'll contain the colors
ArrayList<Color> colors = new ArrayList<Color>();
int currentColor; //2: empty , 1: food, 0: snake
SquarePanel square;
/**
* @brief Initializes a SquareData object
* @param col A color that the square is set to
*/
public SquareData(int col){
//Lets add the color to the arrayList
......@@ -28,6 +43,11 @@ public class SquareData {
currentColor = col;
square = new SquarePanel(colors.get(currentColor));
}
/**
* @brief Changes the color of the square
* @param c The color the square is to be changed to
*/
public void lightMeUp(int c){
square.changeColor(colors.get(c));
}
......
/**
* Authors: Mike Li, Jasper Leung, Sanjula Ganepola, Ahmed Al Koasmh
* Revised: March 29th, 2021
*
* Description: SquarePanel class
*/
import java.awt.Color;
import javax.swing.JPanel;
/**
* @brief A class that provides an individual square on a grid
* @details Each square has a color that can be changed
*/
public class SquarePanel extends JPanel{
private static final long serialVersionUID = 1L;
/**
* @brief Initializes a SquarePanel object
* @param d A color that the square is set to
*/
public SquarePanel(Color d){
this.setBackground(d);
}
/**
* @brief Changes the color of the square
* @param d The color the square is to be changed to
*/
public void changeColor(Color d){
this.setBackground(d);
this.repaint();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment