当前位置: 首页>>代码示例>>Java>>正文


Java WidgetGroup.addActor方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.addActor方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetGroup.addActor方法的具体用法?Java WidgetGroup.addActor怎么用?Java WidgetGroup.addActor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup的用法示例。


在下文中一共展示了WidgetGroup.addActor方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showWidgetGroup

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
private void showWidgetGroup() {
    clearActions();
    pack();

    mainMenuWidgetGroup = new WidgetGroup();
    mainMenuWidgetGroup.setName(this.name.toString());
    mainMenuWidgetGroup.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
    mainMenuWidgetGroup.addActor(this);

    if (this.parentMenu == null) {
        showingStage = StageManager.showOnNewStage(mainMenuWidgetGroup);
    } else {
        showingStage = StageManager.showOnActStage(mainMenuWidgetGroup);
    }

    if (this.parentMenu == null)
        addAction(sequence(Actions.alpha(0), Actions.fadeIn(CB.WINDOW_FADE_TIME, Interpolation.fade)));
    isShowing = true;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:20,代码来源:Menu.java

示例2: Map

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
public Map(GameMap map, GameState gameState, int width, int height, ButtonStyle mapIndicatorStyle) {
	mapTexture = MinimapGenerator.generate(map, gameState, width, height);
	this.gameMap = map;
	this.gameState = gameState;
	calculateRatios(width, height);
	
	Image image = new Image(mapTexture);
	image.addListener(this);
	// only add the current camera position indicator in case 
	// the camera does not show the whole map already
	if (xRatio > 1 || yRatio > 1) {
		indicator = new MapScreenIndicator(mapIndicatorStyle);
	}
	
	WidgetGroup group = new WidgetGroup();
	group.addActor(image);
	if (indicator != null) {
		group.addActor(indicator);
		indicator.addListener(this);
	}
	group.setWidth(width);
	group.setHeight(height);
	group.invalidate();
	add(group).width(width).height(height);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:Map.java

示例3: create

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
@Override
public void create() {
	Gdx.app.setLogLevel(Application.LOG_DEBUG);
	Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
	stage = new Stage(new ScreenViewport());
	WidgetGroup modalContainer = new WidgetGroup();
	modalContainer.setFillParent(true);

	WidgetGroup viewContainer = new WidgetGroup();
	viewContainer.setFillParent(true);

	stage.getRoot().addActor(viewContainer);
	stage.getRoot().addActor(modalContainer);
	Gdx.input.setInputProcessor(stage);
	actor = new LoadingIndicator();
	if (actor instanceof WidgetGroup) {
		((WidgetGroup) actor).setFillParent(true);
	}
	viewContainer.addActor(actor);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:21,代码来源:LoadingIndicatorDemo.java

示例4: act

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
public boolean act(float delta) {
    if (!added) {
        added = true;
        if (target instanceof WidgetGroup) {
            WidgetGroup group = (WidgetGroup) target;
            group.addActor(actor);
        }
    }
    return true;
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:11,代码来源:AddActorAction.java

示例5: setActor

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
/** @param group will replace the internally managed group. All current children will be moved to this group. */
@Override
public void setActor (final WidgetGroup group) {
	if (group == null) {
		throw new IllegalArgumentException("Group cannot be null.");
	}
	final Group previousGroup = getActor();
	super.setActor(group);
	attachListener(); // Attaches draggable to all previous group children.
	for (final Actor child : previousGroup.getChildren()) {
		group.addActor(child); // No need to attach draggable, child was already in pane.
	}
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:14,代码来源:DragPane.java

示例6: create

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
@Override
public void create() {
	Gdx.app.setLogLevel(Application.LOG_DEBUG);
	Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
	stage = new Stage(new ScreenViewport());
	WidgetGroup modalContainer = new WidgetGroup();
	modalContainer.setFillParent(true);

	WidgetGroup viewContainer = new WidgetGroup();
	viewContainer.setFillParent(true);

	stage.getRoot().addActor(viewContainer);
	stage.getRoot().addActor(modalContainer);
	controller = new MokapController(platform = new MockPlatform(),
			Gdx.files, viewContainer, modalContainer);
	controller.getCommands().pushStack();
	platform.setBatch(stage.getBatch());
	Gdx.input.setInputProcessor(stage);
	ApplicationAssets assets = controller.getApplicationAssets();
	actor = buildUI(assets.getSkin(), assets.getI18N());
	if (actor instanceof WidgetGroup) {
		((WidgetGroup) actor).setFillParent(true);
	}
	viewContainer.addActor(actor);

	stage.addListener(new ShortcutListener());
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:28,代码来源:UITest.java

示例7: refresh

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
@Override
protected void refresh() {
	// TODO just generate new item, all others must be reused
	WidgetGroup scrollActor = getLayoutActor();

	Set<T> removeSet = new HashSet<T>();
	removeSet.addAll(cacheMap.keySet());

	T currentSelectedItem = model.getCurrentSelectedItem();

	for (int i = model.getCount() - 1; i >= 0; i--) {
		T item = model.getItem(i);
		boolean selected = currentSelectedItem == item;
		Actor actor = createItem(item, skin, cacheMap.get(item), selected);
		if (actor != null) {
			Action inAnimation = inAnimation();
			if (inAnimation != null && firstTime) {
				actor.addAction(inAnimation);
			}
			cacheMap.put(item, actor);
			removeSet.remove(item);
			scrollActor.addActor(actor);
		}
	}
	for (T removeKey : removeSet) {
		cacheMap.remove(removeKey);
	}

	scrollActor.pack();
	scrollPane.setWidget(scrollActor);
	firstTime = false;
}
 
开发者ID:halfreal,项目名称:spezi-gdx,代码行数:33,代码来源:VerticalListWidget.java

示例8: StatusUI

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
public StatusUI(Stage stage) {
super("", Utils.UI_SKIN);
this.setMovable(false);

hpLabel = new Label("10 / 10", Utils.UI_SKIN);
hpBar = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("hp_bar"));
hpBarBorder = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("bar"));

mpLabel = new Label("15 / 15", Utils.UI_SKIN);
mpBar = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("mp_bar"));
mpBarBorder = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("bar"));

xpLabel = new Label("27  / 50", Utils.UI_SKIN);
xpBar = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("xp_bar"));
xpBarBorder = new Image(Utils.UI_TEXTURE_ATLAS.findRegion("bar"));

inventoryButton = new ImageButton(Utils.UI_SKIN, "inventory-button");
lvlLabel = new Label("Level: 1", Utils.UI_SKIN);
goldLabel = new Label(GOLD_LABEL, Utils.UI_SKIN);

WidgetGroup hpGroup = new WidgetGroup();
WidgetGroup mpGroup = new WidgetGroup();
WidgetGroup xpGroup = new WidgetGroup();

hpLabel.setPosition(43, 7);
hpBar.setPosition(33, 10);
hpBar.scaleBy(-0.49f);
hpBarBorder.scaleBy(-0.5f);
hpGroup.addActor(hpBar);
hpGroup.addActor(hpBarBorder);
hpGroup.addActor(hpLabel);

mpLabel.setPosition(43, 7);
mpBar.setPosition(33, 10);
mpBar.scaleBy(-0.49f);
mpBarBorder.scaleBy(-0.5f);
mpGroup.addActor(mpBar);
mpGroup.addActor(mpBarBorder);
mpGroup.addActor(mpLabel);

xpLabel.setPosition(43, 7);
xpBar.setPosition(33, 10);
xpBar.scaleBy(-0.49f);
xpBar.scaleBy(-0.25f, 0);
xpBarBorder.scaleBy(-0.5f);
xpGroup.addActor(xpBar);
xpGroup.addActor(xpBarBorder);
xpGroup.addActor(xpLabel);

inventoryButton.getImageCell().size(32, 32);

this.defaults().expand().fill().pad(5);
this.add(hpGroup).width(323);
this.add(xpGroup).width(323);
this.add(inventoryButton);
this.row();
this.add(mpGroup).width(323);
this.add(lvlLabel).padLeft(50);
this.add(goldLabel).padRight(50);

pack();
setPosition(stage.getWidth() / 2 - getWidth() / 2, 0);
stage.addActor(this);
   }
 
开发者ID:Quillraven,项目名称:Quilly-s-Castle,代码行数:65,代码来源:StatusUI.java

示例9: TestFlowGroup

import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入方法依赖的package包/类
public TestFlowGroup () {
		super("flow groups");

		TableUtils.setSpacingDefaults(this);
		columnDefaults(0).left();

		setResizable(true);
		addCloseButton();
		closeOnEscape();

		WidgetGroup group = new VerticalFlowGroup(2);

		String lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi luctus magna sit amet tellus egestas tincidunt. " +
				"Morbi tempus eleifend dictum. Nunc ex nisl, dignissim eget gravida vel, rutrum a nibh. Fusce congue odio ac elit " +
				"rhoncus rutrum. Donec nec lectus leo. Phasellus et consectetur ante. Cras vel consectetur mauris, sed semper lectus. ";
		String[] parts = lorem.split(" ");
		for (String part : parts) {
			group.addActor(new VisLabel(part));
		}

//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));
//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));
//		group.addActor(new VisLabel("Lorem ipsum"));
//		group.addActor(new VisLabel("dolor sit"));
//		group.addActor(new VisLabel("amet"));
//		group.addActor(new VisLabel("a\nb\nc"));

		VisScrollPane scrollPane = new VisScrollPane(group);
		scrollPane.setFadeScrollBars(false);
		scrollPane.setFlickScroll(false);
		scrollPane.setOverscroll(false, false);
		scrollPane.setScrollingDisabled(group instanceof HorizontalFlowGroup, group instanceof VerticalFlowGroup);
		add(scrollPane).grow();

		setSize(300, 150);
		centerWindow();
	}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:44,代码来源:TestFlowGroup.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.addActor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。