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

📄 room.java

📁 a java game code for java
💻 JAVA
字号:
/** * Title:        吃豆子<p> * Description:  小游戏<p> * Copyright:    Copyright (c) Nothing<p> * Company:      Raindrop<p> * @author Nothing * @version 1.0 */package eatbean;import eatbean.util.ImageTool;//import java.awt.*;import java.util.Hashtable;public class Room extends MapElement {	public static final int BASE_NUM = 20;	public static final int STYLE_DEFAULT = BASE_NUM + 1;	public static final int STYLE_EMPTY = BASE_NUM + 2;	public static final int STYLE_SPRITE_BORN = BASE_NUM + 3;	public static final int STYLE_FAIRY_BORN = BASE_NUM + 4;	private static Hashtable styleTable = new Hashtable();	static {	    styleTable.put(new Integer(STYLE_DEFAULT), "r1.gif");		styleTable.put(new Integer(STYLE_EMPTY), "r0.gif");		styleTable.put(new Integer(STYLE_SPRITE_BORN), "r0.gif");		styleTable.put(new Integer(STYLE_FAIRY_BORN), "r0.gif");	}	public static final int POINT = 10;	private Image img = null;	private static Hashtable imgBuffTable = new Hashtable();	public Room(int style, int x, int y) {		super(style, x, y);		img = getImage(style);	}	public void parseWidthAndHeight() {		width = ELEMENT_MAX_SIZE;		height = ELEMENT_MAX_SIZE;	}	public void draw(OffScreen offScreen) {		offScreen.drawImage(img, x, y);	}	public void setEmpty() {		if(style == STYLE_EMPTY) return;		style = STYLE_EMPTY;		img = getImage(style);	}	public boolean isEmpty() {	    return !(style == STYLE_DEFAULT);	}	private Image getImage(int imgIndex) {		Image result = null;		synchronized(imgBuffTable) {    //  同步,保证同一个Image不被调入内存两次			result = super.getImage(imgBuffTable, styleTable, imgIndex);		}		return result;	}}

⌨️ 快捷键说明

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