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

📄 rect.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.util;public class Rect implements Cloneable {	public int x = 0;	public int y = 0;	public int width = 0;	public int height = 0;    public Rect() {    }    public Rect(int x, int y, int w, int h) {		this.x = x;		this.y = y;		this.width = w;		this.height = h;    }	public String toString() {		return "x = " + Integer.toString(x) + " " +				"y = " + Integer.toString(y) + " " +				"width = " + Integer.toString(width) + " " +				"height = " + Integer.toString(height);	}	public boolean equalse(Rect r) {		return (r.x == x) &&				(r.y == y) &&				(r.width == width) &&				(r.height == height);	}	/** 判断两个矩形区域是否相交 */	public boolean intersects(Rect r) {		return !((r.x + r.width <= x) ||				(r.y + r.height <= y) ||				(x + width <= r.x) ||				(y + height <= r.y));	}	/** 区域是否包含Pos点 */	public boolean contains(Pos pos) {		return !((pos.x <= x) ||					(pos.x >= x + width) ||					(pos.y <= y) ||					(pos.y >= y + height));		/*		return !((pos.x < x) ||					(pos.x > x + width) ||					(pos.y < y) ||					(pos.y > y + height));		*/	}	public Object clone() {		Object o = null;		try {			o = super.clone();		}catch (CloneNotSupportedException ex) {			System.out.println(">>fail to clone Rect");		}		return o;	}}

⌨️ 快捷键说明

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