當前位置: 首頁>>代碼示例>>Java>>正文


Java Group.getX方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.Group.getX方法的典型用法代碼示例。如果您正苦於以下問題:Java Group.getX方法的具體用法?Java Group.getX怎麽用?Java Group.getX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.Group的用法示例。


在下文中一共展示了Group.getX方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPositionAndSizeGui

import com.badlogic.gdx.scenes.scene2d.Group; //導入方法依賴的package包/類
@Override
public float[] getPositionAndSizeGui(String name) {
    IGui gui = GaiaSky.instance.mainGui;
    Actor actor = gui.getGuiStage().getRoot().findActor(name);
    if (actor != null) {
        float x = actor.getX();
        float y = actor.getY();
        // x and y relative to parent, so we need to add coordinates of
        // parents up to top
        Group parent = actor.getParent();
        while (parent != null) {
            x += parent.getX();
            y += parent.getY();
            parent = parent.getParent();
        }
        return new float[] { x, y, actor.getWidth(), actor.getHeight() };
    } else {
        return null;
    }

}
 
開發者ID:langurmonkey,項目名稱:gaiasky,代碼行數:22,代碼來源:EventScriptingInterface.java

示例2: a

import com.badlogic.gdx.scenes.scene2d.Group; //導入方法依賴的package包/類
public static Vector2 a(Actor paramActor)
{
  Group localGroup = paramActor.getParent();
  float f1 = 0.0F + paramActor.getX();
  float f2 = 0.0F + paramActor.getY();
  while (localGroup != null)
  {
    if ((localGroup instanceof Group))
    {
      f1 += localGroup.getX();
      f2 += localGroup.getY();
    }
    localGroup = localGroup.getParent();
  }
  return new Vector2(f1, f2);
}
 
開發者ID:isnuryusuf,項目名稱:ingress-indonesia-dev,代碼行數:17,代碼來源:b.java

示例3: getValues

import com.badlogic.gdx.scenes.scene2d.Group; //導入方法依賴的package包/類
@Override
public int getValues(Group target, int tweenType, float[] returnValues) {
    switch (tweenType) {
    case POSITION:
        returnValues[0] = target.getX();
        returnValues[1] = target.getY();
        return 2;
    case ROTATION:
        returnValues[0] = target.getRotation();
        return 1;
    case SCALE:
        returnValues[0] = target.getScaleX();
        returnValues[1] = target.getScaleY();
        return 2;
    case X:
        returnValues[0] = target.getX();
        return 1;
    case Y:
        returnValues[0] = target.getY();
        return 1;
    case SCALE_X:
        returnValues[0] = target.getScaleX();
        return 1;
    case SCALE_Y:
        returnValues[0] = target.getScaleY();
        return 1;
    }
    return 0;
}
 
開發者ID:e-ucm,項目名稱:ead,代碼行數:30,代碼來源:GroupAccessor.java

示例4: execute

import com.badlogic.gdx.scenes.scene2d.Group; //導入方法依賴的package包/類
@Override
public void execute(Entity target, ChangeParent effect) {
    if (!(target instanceof EngineEntity)) {
        Gdx.app.debug(CHANGE_PARENT_EXECUTOR,
                "Can't execute effect - target is not of type EngineEntity");
        return;
    }

    Object value = variablesManager.evaluateExpression(effect
            .getNewParent());
    EngineEntity newParent = null;
    if (value instanceof EngineEntity) {
        newParent = (EngineEntity) value;
    } else if (value instanceof Array) {
        Array array = (Array) value;
        if (array.size > 0 && array.get(0) instanceof EngineEntity) {
            newParent = (EngineEntity) array.get(0);
        }
    }

    if (newParent == null) {
        Gdx.app.debug(CHANGE_PARENT_EXECUTOR,
                "Can't execute effect - new parent is not of type EngineEntity");
        return;
    }

    EngineEntity child = (EngineEntity) target;
    Group childGroup = child.getGroup();
    Vector2 stageOrigin = new Vector2(childGroup.getX(), childGroup.getY());
    stageOrigin = childGroup.localToStageCoordinates(stageOrigin);
    childGroup.remove();
    newParent.getGroup().addActor(childGroup);
    Vector2 newLocalCoordinates = childGroup
            .stageToLocalCoordinates(stageOrigin);
    childGroup.setX(newLocalCoordinates.x);
    childGroup.setY(newLocalCoordinates.y);
}
 
開發者ID:e-ucm,項目名稱:ead,代碼行數:38,代碼來源:ChangeParentExecutor.java


注:本文中的com.badlogic.gdx.scenes.scene2d.Group.getX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。