⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nextblockboard.java

📁 俄罗斯方块。适用于初学者学习。想念很好
💻 JAVA
字号:
package xn.tetris;


import org.eclipse.swt.widgets.Display;
/**
 * 显示下一个将要下落的方块的面板
 * */
public class NextBlockBoard {
	
	private Block nextBlock;
	private Block currentBlock;
	private int currentBlockType;
	private int nextBlockType;
	private Display display;

	public NextBlockBoard(int currentBlockType, int nextBlockType, Display display){	
	
		this.display = display;
		
		this.currentBlockType = currentBlockType;
		this.nextBlockType = nextBlockType;
		
	}
	
	public NextBlockBoard(Display display){
		
		this.display =  display;
	}
	//通过传进来的当前方块类型,得到当前方块
	public Block getCurrentBlock(){
		this.currentBlock = new Block(60, 60 ,currentBlockType, display);
		return currentBlock;
	}
	//传入方块类型,设置当前方块
	public void setCurrentBlock(int blockType){
		this.currentBlockType = blockType;
	}
	//通过传进来的下一个方块类型,得到下一个方块
	public Block getNextBlock(){
		this.nextBlock = new Block(60, 60, nextBlockType, display);
		return nextBlock;
	}
	//传入方块类型,设置下一个方块
	public void setNextBlock(int blockType){
		this.nextBlockType = blockType;
	}
	//擦除当前方块,画出下一个方块
	public void draw(){

		getCurrentBlock().clear();
		getNextBlock().draw();

	}
	//清空整个面板
	public void clear(){

		getNextBlock().clear();

	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -