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


Java Actor類代碼示例

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


Actor類屬於com.badlogic.gdx.scenes.scene2d包,在下文中一共展示了Actor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fireEventOnActor

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
protected boolean fireEventOnActor(Actor actor, InputEvent.Type type, int pointer, Actor related) {
    if (actor == null || !isActorFocussable(actor) || !isActorHittable(actor))
        return false;

    InputEvent event = Pools.obtain(InputEvent.class);
    event.setType(type);
    event.setStage(this);
    event.setRelatedActor(related);
    event.setPointer(pointer);
    event.setButton(-1);

    actor.fire(event);

    boolean handled = event.isHandled();
    Pools.free(event);
    return handled;
}
 
開發者ID:MrStahlfelge,項目名稱:gdx-controllerutils,代碼行數:18,代碼來源:ControllerMenuStage.java

示例2: AddWindowButton

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
	final TextButton btn = new TextButton(buttonText, skin);

	btn.addListener(new ChangeListener()
	{
		@Override
		public void changed(ChangeEvent event, Actor actor)
		{
			if (window.isShowing())
				window.hide();
			else
				window.show();
		}
	});

	table.add(btn);
	table.row();
}
 
開發者ID:bp2008,項目名稱:blueirisviewer,代碼行數:20,代碼來源:MainOptionsWnd.java

示例3: getActorType

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
private static Class getActorType(Actor actor){
    if (actor instanceof Label){
        return Label.class;
    }else if (actor instanceof CheckBox){
        return CheckBox.class;
    }else if (actor instanceof Image){
        return Image.class;
    }else if (actor instanceof TextField){
        return TextField.class;
    }else if (actor instanceof Button){
        return Button.class;
    }else if (actor instanceof Group){
        return Group.class;
    }else {
        return Actor.class;
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:18,代碼來源:XmlUtils.java

示例4: drag

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
@Override
public void drag(InputEvent event, float x, float y, int pointer) {
    if (pointer == -1) return;
    Actor actor = event.getListenerActor();
    actor.moveBy(x - getTouchDownX(), y - getTouchDownY());
    if (getAllActor().contains(SelectGroup.this.getParent(),false)){
        return;
    }
    for (Actor child : getAllActor()){
        if (child instanceof MainWindow){
            break;
        }else {
            child.moveBy(x-getTouchDownX(),y-getTouchDownY());
        }
    }
    Actor lastActor = selection.getLastSelected();
    if (lastActor!=null){
        EditorManager.getInstance().getEventBus().post(new AttrEvent(lastActor));
        if (getParent() instanceof MainWindow){
            MainWindow mainWindow = (MainWindow) getParent();
            if (mainWindow.getEditorLister()!=null) mainWindow.getEditorLister().change();
        }
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:25,代碼來源:SelectGroup.java

示例5: isInsideCub

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
private void isInsideCub(Group group){
    for (Actor child:group.getChildren()){
        if (EditorManager.getInstance().getActorType(child).equals(Group.class)){
            isInsideCub((Group) child);
        }
        if (child instanceof SelectGroup) continue;
        Vector2 childVect2 = child.getParent().localToStageCoordinates(new Vector2(child.getX(),child.getY()));
        childRect.set(childVect2.x,childVect2.y,child.getWidth(),child.getHeight());
        if (getCullingArea().overlaps(childRect)){
            if (!selection.contains(child)){
                child.debug();
                selection.add(child);
            }
        }else if (selection.contains(child)){
            selection.remove(child);
            child.setDebug(false);
        }
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:20,代碼來源:SelectGroup.java

示例6: getActorByName

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public Actor getActorByName(String name){
    switch (name){
        case "Group":
            return new Group();
        case "Label":
            return new NativeLabel("",getMainFont());
        case "CheckBox":
            return new VisCheckBox("");
        case "Image":
            return new Image(assetManager.get("badlogic.jpg",Texture.class));
        case "Button":
            return new VisImageButton(VisUI.getSkin().get(VisImageButton.VisImageButtonStyle.class));
        case "TextField":
            return new TextField("",VisUI.getSkin());
        default:
            return new Actor();
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:19,代碼來源:EditorManager.java

示例7: arrange

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public static void arrange(float x, float y, float width, float height, Direction direction, Actor... actors) {
  switch (direction) {
    case Above:
    case Below:
      height = height / actors.length;
      break;
    case Left:
    case Right:
      width = width / actors.length;
      break;
  }
  if (direction == Direction.Below) {
    y -= height;
  }
  setSize(width, height, actors);
  Actor prev = actors[0];
  setPos(x, y, prev);
  for (int i = 1; i < actors.length; i++) {
    Actor curr = actors[i];
    move(curr, direction, prev);
    prev = curr;
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:24,代碼來源:MenuTools.java

示例8: refreshAttr

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public void refreshAttr(Actor actor){
    if (xTextField == null){
        initGeneralAttr();
    }
    xTextField.setText(String.format("%.2f",actor.getX()));
    yTextField.setText(String.format("%.2f",actor.getY()));
    nameTextField.setText(actor.getName());
    scaleXTF.setText(String.valueOf(actor.getScaleX()));
    scaleYTF.setText(String.valueOf(actor.getScaleY()));
    orignYTextField.setText(String.format("%.2f",actor.getOriginY()));
    orignXTextField.setText(String.format("%.2f",actor.getOriginX()));
    widthText.setText(String.format("%.2f",actor.getWidth()));
    heightText.setText(String.format("%.2f",actor.getHeight()));
    rotationText.setText(String.format("%.2f",actor.getRotation()));
    colorImage.setColor(actor.getColor());
    picker.setColor(actor.getColor());
    visibleBox.setChecked(actor.isVisible());
    zIndexTF.setText(String.valueOf(actor.getZIndex()));
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:20,代碼來源:AttrGeneralWindow.java

示例9: refreshAttr

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public void refreshAttr(Actor actor) {
    if (uniqueTable == null) {
        uniqueTable = new VisTable(true);
        uniqueTable.left().padLeft(10f).top().padTop(20);
        VisScrollPane scrollPane = new VisScrollPane(uniqueTable);
        scrollPane.setScrollingDisabled(true,false);
        add(scrollPane).expand().fill();
    }
    uniqueTable.clearChildren();
    if (actor instanceof Label) {
        initLabelAttr((Label) actor, uniqueTable);
    } else if (actor instanceof Image) {
        initImageAttr((Image) actor, uniqueTable);
    }  else if (actor instanceof TextField){
        initTextFieldAttr((TextField) actor,uniqueTable);
    }else if (actor instanceof CheckBox){
        initCheckBoxAttr((CheckBox) actor,uniqueTable);
    }else if (actor instanceof Button) {
        initButtonAttr((Button) actor, uniqueTable);
    }

}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:23,代碼來源:AttrUniqueWindow.java

示例10: build

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public void build(FileItem fileItem) {
    clearChildren();
    if (fileItem == null) {
        addItem(new MenuItem("New Scene", new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {

            }
        }));
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:12,代碼來源:AssetWindow.java

示例11: MultiplayerConnectMenu

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:25,代碼來源:MultiplayerConnectMenu.java

示例12: setUpPlayButton

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public void setUpPlayButton() {
    playButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
    playButton.setPosition(Constants.WIDTH / 4 - playButton.getWidth() * 2 / 5,
            Constants.HEIGHT / 2 - playButton.getHeight() * 2.5f -2);
    playButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            //FlappySpinner.gameManager.hideAd();
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new GameScreen(game, 0, false));
                }
            }, delay);
        }
    });
    stage.addActor(playButton);
}
 
開發者ID:ZephyrVentum,項目名稱:FlappySpinner,代碼行數:21,代碼來源:MenuScreen.java

示例13: isActorFocussable

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
/**
 * checks if the given actor is focussable: in the list of focussable actors, visible, touchable, and on the stage
 *
 * @param actor
 * @return true if focussable
 */
protected boolean isActorFocussable(Actor actor) {
    if (!focussableActors.contains(actor, true))
        return false;

    if (!actor.isVisible())
        return false;

    if (!actor.isTouchable())
        return false;

    if (actor.getStage() != this)
        return false;

    return true;
}
 
開發者ID:MrStahlfelge,項目名稱:gdx-controllerutils,代碼行數:22,代碼來源:ControllerMenuStage.java

示例14: ServerSetupMenu

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:26,代碼來源:ServerSetupMenu.java

示例15: TradeOfferItem

import com.badlogic.gdx.scenes.scene2d.Actor; //導入依賴的package包/類
TradeOfferItem(String player, ResourceMap offer, Skin skin) {
    this.skin = skin;

    resources = new ArrayList<>(offer.size());
    counts = new ArrayList<>(offer.size());
    label = new Label(player, skin);
    accept = new TextButton("Accept", skin);
    accept.setWidth(accept.getWidth() + 40);
    accept.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (acceptListener != null) {
                acceptListener.onAcceptClicked(getOwner(), TradeOfferItem.this.offer);
            }
        }
    });

    setOffer(offer);

    if (resources.isEmpty())
        return;

    addActor(label);

    addActor(accept);
}
 
開發者ID:teobaranga,項目名稱:Catan,代碼行數:27,代碼來源:TradeOfferItem.java


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