use of com.badlogic.gdx.math.Rectangle in project commons-gdx by gemserk.
the class CameraRestrictedImpl method setWorldBounds.
public void setWorldBounds(Rectangle rectangle) {
this.worldBounds = new Rectangle(rectangle);
recalculatePosition();
recalculateZoom();
}
use of com.badlogic.gdx.math.Rectangle in project commons-gdx by gemserk.
the class CameraRestrictedImpl method setWorldBounds.
public void setWorldBounds(float x1, float y1, float x2, float y2) {
this.worldBounds = new Rectangle(x1, y1, x2 - x1, y2 - y1);
recalculatePosition();
recalculateZoom();
}
use of com.badlogic.gdx.math.Rectangle in project commons-gdx by gemserk.
the class ToggleableImageButtonTest method shouldNotToggleIfPointerIsNotPressed.
@Test
public void shouldNotToggleIfPointerIsNotPressed() {
MockPointer pointer = new MockPointer();
MockToggleHandler toggleHandler = new MockToggleHandler();
ToggleableImageButton toggleableImageButton = new ToggleableImageButton() {
@Override
protected void recalculateBounds() {
}
};
toggleableImageButton.setPointer(pointer);
toggleableImageButton.setToggleHandler(toggleHandler);
toggleableImageButton.setPosition(0f, 0f);
toggleableImageButton.setBounds(new Rectangle(20, 20, 100, 100));
pointer.wasReleased = false;
toggleableImageButton.update();
assertThat(toggleHandler.toggleCalled, IsEqual.equalTo(false));
}
use of com.badlogic.gdx.math.Rectangle in project commons-gdx by gemserk.
the class CameraRestrictedImplTest method shouldRecalculateZoomIfBoundsChanged3.
@Test
public void shouldRecalculateZoomIfBoundsChanged3() {
CameraRestrictedImpl camera = new CameraRestrictedImpl(0f, 0f, 40f, 0f, 800f, 480f, new Rectangle(0f, 0f, 20f, 12f));
assertThat(camera.getZoom(), IsEqual.equalTo(40f));
camera.setZoom(1f);
assertThat(camera.getZoom(), IsEqual.equalTo(40f));
}
use of com.badlogic.gdx.math.Rectangle in project libgdx by libgdx.
the class SplitPane method layout.
@Override
public void layout() {
if (!vertical)
calculateHorizBoundsAndPositions();
else
calculateVertBoundsAndPositions();
Actor firstWidget = this.firstWidget;
if (firstWidget != null) {
Rectangle firstWidgetBounds = this.firstWidgetBounds;
firstWidget.setBounds(firstWidgetBounds.x, firstWidgetBounds.y, firstWidgetBounds.width, firstWidgetBounds.height);
if (firstWidget instanceof Layout)
((Layout) firstWidget).validate();
}
Actor secondWidget = this.secondWidget;
if (secondWidget != null) {
Rectangle secondWidgetBounds = this.secondWidgetBounds;
secondWidget.setBounds(secondWidgetBounds.x, secondWidgetBounds.y, secondWidgetBounds.width, secondWidgetBounds.height);
if (secondWidget instanceof Layout)
((Layout) secondWidget).validate();
}
}
Aggregations