MCPcopy Create free account
hub / github.com/TanaStudy/Java-Study / Main

Method Main

8. Demo/Java/src/main/LeetCode/Tetris/Main.java:26–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 private boolean running; // 用于判断游戏是否结束
25 /*无参构造函数*/
26 public Main() {
27 grids = new JTextArea[26][12];//设置游戏区域行和列
28 data = new int[26][12];//开辟data数组空间与游戏区域行和列一致
29 allRect = new int[] { 0x00cc, 0x8888, 0x000f, 0x0c44, 0x002e, 0x088c, 0x00e8, 0x0c88, 0x00e2, 0x044c, 0x008e,
30 0x08c4, 0x006c, 0x04c8, 0x00c6, 0x08c8, 0x004e, 0x04c4, 0x00e4 };//19种方块形状,如0x00cc就是 0000 表示一个2*2的正方形方块
31 //0000
32 //1100
33 //1100
34 label = new JLabel("score: 0"); //此标签存放得分情况,初始化为0分
35 label1 = new JLabel("开始游戏"); //此标签为提示游戏状态:开始还是结束
36 running = false; //为标志变量,false为游戏结束,true为游戏正在进行
37 init(); // 游戏界面初始化
38 }
39 /*游戏界面初始化函数*/
40 public void init() {
41 JPanel center = new JPanel(); //此面板为游戏核心区域

Callers

nothing calls this directly

Calls 1

initMethod · 0.95

Tested by

no test coverage detected