use of com.badlogic.gdx.scenes.scene2d.Group in project libgdx by libgdx.
the class WidgetGroup method invalidateHierarchy.
public void invalidateHierarchy() {
invalidate();
Group parent = getParent();
if (parent instanceof Layout)
((Layout) parent).invalidateHierarchy();
}
use of com.badlogic.gdx.scenes.scene2d.Group in project libgdx by libgdx.
the class WidgetGroup method validate.
public void validate() {
if (!layoutEnabled)
return;
Group parent = getParent();
if (fillParent && parent != null) {
float parentWidth, parentHeight;
Stage stage = getStage();
if (stage != null && parent == stage.getRoot()) {
parentWidth = stage.getWidth();
parentHeight = stage.getHeight();
} else {
parentWidth = parent.getWidth();
parentHeight = parent.getHeight();
}
if (getWidth() != parentWidth || getHeight() != parentHeight) {
setWidth(parentWidth);
setHeight(parentHeight);
invalidate();
}
}
if (!needsLayout)
return;
needsLayout = false;
layout();
}
use of com.badlogic.gdx.scenes.scene2d.Group in project netthreads-libgdx by alistairrutherford.
the class SceneHelper method hit.
/**
* Find hit class.
*
* @param x
* Current x position.
* @param y
* Current y position
* @param group
* The starting Group.
* @param targetClass
* The target class type.
*
* @return The target or null if not found.
*/
@SuppressWarnings("rawtypes")
public static Actor hit(float x, float y, Group group, Class targetClass) {
SnapshotArray<Actor> children = group.getChildren();
Actor hit = null;
boolean found = false;
int index = children.size - 1;
while (!found && index >= 0) {
Actor child = children.get(index);
if (child.getClass().isAssignableFrom(targetClass)) {
point.x = x;
point.y = y;
group.localToDescendantCoordinates(child, point);
if (child.hit(point.x, point.y, true) != null) {
found = true;
hit = child;
} else if (child instanceof Group) {
child = hit(x, y, (Group) child, targetClass);
}
}
index--;
}
return hit;
}
use of com.badlogic.gdx.scenes.scene2d.Group in project netthreads-libgdx by alistairrutherford.
the class SceneHelper method hit.
/**
* Look for target hit of specified class.
*
* @param x
* Current x position.
* @param y
* Current y position
* @param stage
* The starting stage.
* @param targetClass
* The target class type.
* @return Target class or null if not found.
*/
@SuppressWarnings("rawtypes")
public static Actor hit(float x, float y, Stage stage, Class targetClass) {
Group root = stage.getRoot();
SnapshotArray<Actor> children = root.getChildren();
Actor hit = null;
boolean found = false;
int index = children.size - 1;
while (!found && index >= 0) {
Actor child = children.get(index);
point.x = x;
point.y = y;
root.localToDescendantCoordinates(child, point);
Actor childHit = root.hit(point.x, point.y, true);
if (childHit != null && childHit.getClass().isAssignableFrom(targetClass)) {
found = true;
hit = childHit;
} else {
index--;
}
}
return hit;
}
Aggregations