本文整理汇总了Java中com.badlogic.gdx.math.Rectangle.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.contains方法的具体用法?Java Rectangle.contains怎么用?Java Rectangle.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.Rectangle
的用法示例。
在下文中一共展示了Rectangle.contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pickPiece
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
public boolean pickPiece() {
Vector2 mouse = new Vector2(
Gdx.input.getX(),
Gdx.graphics.getHeight() - Gdx.input.getY()); // Y axis is inverted
final float perPieceWidth = area.width / count;
for (int i = 0; i < count; ++i) {
if (pieces[i] != null) {
Rectangle maxPieceArea = new Rectangle(
area.x + i * perPieceWidth, area.y, perPieceWidth, area.height);
if (maxPieceArea.contains(mouse)) {
heldPiece = i;
return true;
}
}
}
heldPiece = -1;
return false;
}
示例2: query
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
/**�߿ռ�����*/
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
// System.out.println("query side begin ---------- ");
// System.out.println("rect = " + rect + " type = " + type + "min, max, centerX, centerY = "
// + min + " " + max + " " + centerX + " " + centerY);
boolean flag = false;
switch(type) {
case 0:
if(rect.contains(min, centerY)) {
flag = true;
}
break;
case 1:
if(rect.contains(centerX, min)) {
flag = true;
}
break;
case 2:
if(rect.contains(max, centerY)) {
flag = true;
}
break;
case 3:
if(rect.contains(centerX, max)) {
flag = true;
}
break;
}
if(!flag) {return;}
// System.out.println("query side success ---------- ");
if(children != null) {
// System.out.println("query child side begin ---------- ");
children[0].query(rect, ret);
children[1].query(rect, ret);
// System.out.println("query child side end ---------- ");
}
for(int i = objs.size - 1; i >= 0; --i) {
ret.add(objs.get(i));
}
// System.out.println(this + " ret = " + objs.size);
}
示例3: query
import com.badlogic.gdx.math.Rectangle; //导入方法依赖的package包/类
/**�߿ռ�����*/
public void query(Rectangle rect, Array<IQuadTreeObject> ret) {
// System.out.println("query side begin ---------- ");
// System.out.println("rect = " + rect + " type = " + type + "min, max, centerX, centerY = "
// + min + " " + max + " " + centerX + " " + centerY);
boolean flag = false;
switch(type) {
case 0:
if(rect.contains(min, centerY)) {
flag = true;
}
break;
case 1:
if(rect.contains(centerX, min)) {
flag = true;
}
break;
case 2:
if(rect.contains(max, centerY)) {
flag = true;
}
break;
case 3:
if(rect.contains(centerX, max)) {
flag = true;
}
break;
}
if(!flag) {return;}
// System.out.println("query side success ---------- ");
if(children != null) {
// System.out.println("query child side begin ---------- ");
children[0].query(rect, ret);
children[1].query(rect, ret);
// System.out.println("query child side end ---------- ");
}
ret.addAll(objs);
// System.out.println(this + " ret = " + objs.size);
}