本文整理了Java中com.badlogic.gdx.math.Rectangle.contains
方法的一些代码示例,展示了Rectangle.contains
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.contains
方法的具体详情如下:
包路径:com.badlogic.gdx.math.Rectangle
类名称:Rectangle
方法名:contains
暂无
代码示例来源:origin: libgdx/libgdx
/** @param point The coordinates vector
* @return whether the point is contained in the rectangle */
public boolean contains (Vector2 point) {
return contains(point.x, point.y);
}
代码示例来源:origin: libgdx/libgdx
public boolean mouseMoved (InputEvent event, float x, float y) {
cursorOverHandle = handleBounds.contains(x, y);
return false;
}
});
代码示例来源:origin: libgdx/libgdx
/** @param point The coordinates vector
* @return whether the point is contained in the rectangle */
public boolean contains (Vector2 point) {
return contains(point.x, point.y);
}
代码示例来源:origin: libgdx/libgdx
public boolean mouseMoved (InputEvent event, float x, float y) {
cursorOverHandle = handleBounds.contains(x, y);
return false;
}
});
代码示例来源:origin: libgdx/libgdx
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
if (handleBounds.contains(x, y)) {
draggingPointer = pointer;
lastPoint.set(x, y);
handlePosition.set(handleBounds.x, handleBounds.y);
return true;
}
return false;
}
代码示例来源:origin: libgdx/libgdx
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (draggingPointer != -1) return false;
if (pointer == 0 && button != 0) return false;
if (handleBounds.contains(x, y)) {
draggingPointer = pointer;
lastPoint.set(x, y);
handlePosition.set(handleBounds.x, handleBounds.y);
return true;
}
return false;
}
代码示例来源:origin: libgdx/libgdx
public Actor hit (float x, float y, boolean touchable) {
if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) return null;
if (touchable && getTouchable() == Touchable.enabled && isVisible()) {
if (scrollX && touchScrollH && hScrollBounds.contains(x, y)) return this;
if (scrollY && touchScrollV && vScrollBounds.contains(x, y)) return this;
}
return super.hit(x, y, touchable);
}
代码示例来源:origin: libgdx/libgdx
public Actor hit (float x, float y, boolean touchable) {
if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) return null;
if (touchable && getTouchable() == Touchable.enabled && isVisible()) {
if (scrollX && touchScrollH && hScrollBounds.contains(x, y)) return this;
if (scrollY && touchScrollV && vScrollBounds.contains(x, y)) return this;
}
return super.hit(x, y, touchable);
}
代码示例来源:origin: libgdx/libgdx
if (scrollBarTouch && scrollX && hScrollBounds.contains(x, y)) {
event.stop();
setScrollbarsVisible(true);
if (hKnobBounds.contains(x, y)) {
lastPoint.set(x, y);
handlePosition = hKnobBounds.x;
return true;
if (scrollBarTouch && scrollY && vScrollBounds.contains(x, y)) {
event.stop();
setScrollbarsVisible(true);
if (vKnobBounds.contains(x, y)) {
lastPoint.set(x, y);
handlePosition = vKnobBounds.y;
代码示例来源:origin: libgdx/libgdx
if (scrollBarTouch && scrollX && hScrollBounds.contains(x, y)) {
event.stop();
setScrollbarsVisible(true);
if (hKnobBounds.contains(x, y)) {
lastPoint.set(x, y);
handlePosition = hKnobBounds.x;
return true;
if (scrollBarTouch && scrollY && vScrollBounds.contains(x, y)) {
event.stop();
setScrollbarsVisible(true);
if (vKnobBounds.contains(x, y)) {
lastPoint.set(x, y);
handlePosition = vKnobBounds.y;
代码示例来源:origin: libgdx/libgdx
/** Determines whether the given rectangle and segment intersect
* @param startX x-coordinate start of line segment
* @param startY y-coordinate start of line segment
* @param endX y-coordinate end of line segment
* @param endY y-coordinate end of line segment
* @param rectangle rectangle that is being tested for collision
* @return whether the rectangle intersects with the line segment */
public static boolean intersectSegmentRectangle (float startX, float startY, float endX, float endY, Rectangle rectangle) {
float rectangleEndX = rectangle.x + rectangle.width;
float rectangleEndY = rectangle.y + rectangle.height;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangle.y, rectangle.x, rectangleEndY, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangle.y, rectangleEndX, rectangle.y, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangleEndX, rectangle.y, rectangleEndX, rectangleEndY, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangleEndY, rectangleEndX, rectangleEndY, null))
return true;
return rectangle.contains(startX, startY);
}
代码示例来源:origin: libgdx/libgdx
/** Determines whether the given rectangle and segment intersect
* @param startX x-coordinate start of line segment
* @param startY y-coordinate start of line segment
* @param endX y-coordinate end of line segment
* @param endY y-coordinate end of line segment
* @param rectangle rectangle that is being tested for collision
* @return whether the rectangle intersects with the line segment */
public static boolean intersectSegmentRectangle (float startX, float startY, float endX, float endY, Rectangle rectangle) {
float rectangleEndX = rectangle.x + rectangle.width;
float rectangleEndY = rectangle.y + rectangle.height;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangle.y, rectangle.x, rectangleEndY, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangle.y, rectangleEndX, rectangle.y, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangleEndX, rectangle.y, rectangleEndX, rectangleEndY, null))
return true;
if (intersectSegments(startX, startY, endX, endY, rectangle.x, rectangleEndY, rectangleEndX, rectangleEndY, null))
return true;
return rectangle.contains(startX, startY);
}
代码示例来源:origin: libgdx/libgdx
@Test
public void testRectangle () {
Rectangle r1 = new Rectangle(0, 0, 1, 1);
Rectangle r2 = new Rectangle(1, 0, 2, 1);
assertTrue(r1.overlaps(r1));
assertFalse(r1.overlaps(r2));
assertTrue(r1.contains(0, 0));
}
}
代码示例来源:origin: libgdx/libgdx
if (viewBounds.contains(imageBounds) || viewBounds.overlaps(imageBounds)) {
final float u1 = region.getU();
final float v1 = region.getV2();
代码示例来源:origin: libgdx/libgdx
if (viewBounds.contains(imageBounds) || viewBounds.overlaps(imageBounds)) {
final float u1 = region.getU();
final float v1 = region.getV2();
代码示例来源:origin: kotcrab/vis-ui
@Override
protected boolean contains (float x, float y) {
return firstWidgetBounds.contains(x, y) || secondWidgetBounds.contains(x, y) || handleBounds.contains(x, y);
}
});
代码示例来源:origin: kotcrab/vis-ui
private Rectangle getHandleContaining (float x, float y) {
for (Rectangle rect : handleBounds) {
if (rect.contains(x, y)) {
return rect;
}
}
return null;
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** @param point The coordinates vector
* @return whether the point is contained in the rectangle */
public boolean contains (Vector2 point) {
return contains(point.x, point.y);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public Actor hit (float x, float y, boolean touchable) {
if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) return null;
if (touchable && getTouchable() == Touchable.enabled && isVisible()) {
if (scrollX && touchScrollH && hScrollBounds.contains(x, y)) return this;
if (scrollY && touchScrollV && vScrollBounds.contains(x, y)) return this;
}
return super.hit(x, y, touchable);
}
代码示例来源:origin: kotcrab/vis-ui
private void updateScrollPosition () {
if (cullingArea == null || getParent() instanceof ScrollPane == false) return;
ScrollPane scrollPane = (ScrollPane) getParent();
if (cullingArea.contains(getCursorX(), cullingArea.y) == false) {
scrollPane.setScrollPercentX(getCursorX() / getWidth());
}
if (cullingArea.contains(cullingArea.x, (getHeight() - getCursorY())) == false) {
scrollPane.setScrollPercentY(getCursorY() / getHeight());
}
}
内容来源于网络,如有侵权,请联系作者删除!