📄 zonrect.java
字号:
package zonja;
public class ZonRect {
public ZonRect() {
super();
// TODO Auto-generated constructor stub
}
public int x;
public int y;
public int dx;
public int dy;
public void setRect(int x, int y, int dx, int dy){
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
}
public static boolean checkRectCollisdes(ZonRect rectA, ZonRect rectB){
if ((rectA.x + rectA.dx > rectB.x) && (rectA.y + rectA.dy > rectB.y)
&& (rectB.x + rectB.dx > rectA.x) && (rectB.y + rectB.dy > rectA.y)){
return true;
} else {
return false;
}
}
public static boolean checkDropCollides(ZonRect rectMain, ZonRect rectObj){
if ((rectMain.x + rectMain.dx > rectObj.x &&
rectMain.x + rectMain.dx < rectObj.x + rectObj.dx &&
rectMain.y + rectMain.dy > rectObj.y &&
rectMain.y + rectMain.dy < rectObj.y + rectObj.dy)
|| (rectMain.x > rectObj.x &&
rectMain.x < rectObj.x + rectObj.dx &&
rectMain.y + rectMain.dy > rectObj.y &&
rectMain.y + rectMain.dy < rectObj.y + rectObj.dy)){
return true;
} else {
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -