本文整理了Java中com.badlogic.gdx.scenes.scene2d.Actor.localToParentCoordinates()
方法的一些代码示例,展示了Actor.localToParentCoordinates()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Actor.localToParentCoordinates()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Actor
类名称:Actor
方法名:localToParentCoordinates
[英]Transforms the specified point in the actor's coordinates to be in the parent's coordinates.
[中]将参与者坐标中的指定点转换为父坐标中的指定点。
代码示例来源:origin: libgdx/libgdx
/** Converts coordinates for this actor to those of a parent actor. The ascendant does not need to be a direct parent. */
public Vector2 localToAscendantCoordinates (Actor ascendant, Vector2 localCoords) {
Actor actor = this;
do {
actor.localToParentCoordinates(localCoords);
actor = actor.parent;
if (actor == ascendant) break;
} while (actor != null);
return localCoords;
}
代码示例来源:origin: libgdx/libgdx
/** Converts coordinates for this actor to those of a parent actor. The ascendant does not need to be a direct parent. */
public Vector2 localToAscendantCoordinates (Actor ascendant, Vector2 localCoords) {
Actor actor = this;
do {
actor.localToParentCoordinates(localCoords);
actor = actor.parent;
if (actor == ascendant) break;
} while (actor != null);
return localCoords;
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** Converts coordinates for this actor to those of a parent actor. The ascendant does not need to be a direct parent. */
public Vector2 localToAscendantCoordinates (Actor ascendant, Vector2 localCoords) {
Actor actor = this;
do {
actor.localToParentCoordinates(localCoords);
actor = actor.parent;
if (actor == ascendant) break;
} while (actor != null);
return localCoords;
}
代码示例来源:origin: dingjibang/GDX-RPG
public static float absoluteX(Actor actor){
float val = 0;
val += actor.getX();
Actor parent = actor;
while(true){
Actor _p = parent.getParent();
if(_p == null) break;
val += parent.localToParentCoordinates(new Vector2(0,0)).x;
parent = _p;
}
return val;
}
代码示例来源:origin: dingjibang/GDX-RPG
public static float absoluteY(Actor actor){
float val = 0;
val += actor.getY();
Actor parent = actor;
while(true){
Actor _p = parent.getParent();
if(_p == null) break;
val += parent.localToParentCoordinates(new Vector2(parent.getX(),parent.getY())).y;
parent = parent.getParent();
}
return val;
}
内容来源于网络,如有侵权,请联系作者删除!