本文整理匯總了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);
}