Java Code Examples for com.badlogic.gdx.math.Rectangle#setX()

The following examples show how to use com.badlogic.gdx.math.Rectangle#setX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Scene2dUtils.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
public static Rectangle localToStageBounds(Actor actor, float x0, float y0, float x1, float y1) {
    Rectangle stageRect = Scene2dUtils.tmpRect;
    actor.localToStageCoordinates(tmpVec2.set(x0, y0));
    stageRect.setX(tmpVec2.x);
    stageRect.setY(tmpVec2.y);
    actor.localToStageCoordinates(tmpVec2.set(x1, y1));
    stageRect.setWidth(tmpVec2.x - stageRect.x);
    stageRect.setHeight(tmpVec2.y - stageRect.y);
    return stageRect;
}
 
Example 2
Source File: Scene2dUtils.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
public static Rectangle stageToLocalBounds(Actor actor, float x0, float y0, float x1, float y1) {
    Rectangle localRect = Scene2dUtils.tmpRect;
    actor.stageToLocalCoordinates(tmpVec2.set(x0, y0));
    localRect.setX(tmpVec2.x);
    localRect.setY(tmpVec2.y);
    actor.stageToLocalCoordinates(tmpVec2.set(x1, y1));
    localRect.setWidth(tmpVec2.x - localRect.x);
    localRect.setHeight(tmpVec2.y - localRect.y);
    return localRect;
}