Created
October 8, 2016 19:24
-
-
Save irrationnelle/c34bbe422bc3734324693039afca1477 to your computer and use it in GitHub Desktop.
테트리스 피스 enum 클래스
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package team_project; | |
import java.awt.Color; | |
enum Tetrominoes { | |
NoShape(new int[][] { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, new Color(0, 0, 0)), | |
ZShape(new int[][] { { 0, -1 }, { 0, 0 }, { -1, 0 }, { -1, 1 } }, new Color(204, 102, 102)), | |
SShape(new int[][] { { 0, -1 }, { 0, 0 }, { 1, 0 }, { 1, 1 } }, new Color(102, 204, 102)), | |
IShape(new int[][] { { 0, -1 }, { 0, 0 }, { 0, 1 }, { 0, 2 } }, new Color(102, 102, 204)), | |
TShape(new int[][] { { -1, 0 }, { 0, 0 }, { 1, 0 }, { 0, 1 } }, new Color(204, 204, 102)), | |
OShape(new int[][] { { 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 } }, new Color(204, 102, 204)), | |
LShape(new int[][] { { -1, -1 }, { 0, -1 }, { 0, 0 }, { 0, 1 } }, new Color(102, 204, 204)), | |
JShape(new int[][] { { 1, -1 }, { 0, -1 }, { 0, 0 }, { 0, 1 } }, new Color(218, 170, 0)); | |
public int[][] coords; // 블록 피스의 좌표값을 가지고 있는 enum의 변수 | |
public Color color; // 블록 피스의 색값을 가지고 있는 enum의 변수 | |
private Tetrominoes(int[][] coords, Color color) { // 각 상수들의 생성자 매개 변수 | |
this.coords = coords; | |
this.color = color; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment