本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Group.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setPosition方法的具体用法?Java Group.setPosition怎么用?Java Group.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.Group
的用法示例。
在下文中一共展示了Group.setPosition方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visualize
import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override public IFuture<Void> visualize(DroppedItem drop) {
final Future<Void> future = new Future<Void>();
Group group = new Group();
Tile image = new Tile("item/" + drop.item.name);
Label counter = new Label(String.valueOf(drop.count), Config.skin);
counter.setSize(image.getWidth(), image.getHeight());
counter.setAlignment(Align.right | Align.bottom);
group.addActor(image);
group.addActor(counter);
group.setTransform(false);
visualizer.viewController.notificationLayer.addActor(group);
group.setPosition(drop.target.getX() * ViewController.CELL_SIZE, drop.target.getY() * ViewController.CELL_SIZE);
group.addAction(Actions.parallel(
Actions.moveBy(0, 30, 1f, Interpolation.fade),
Actions.alpha(0, 1f, Interpolation.fade),
Actions.delay(0.4f, Actions.run(new Runnable() {
@Override public void run() {
future.happen();
}
}))
));
return future;
}
示例2: setValues
import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
public void setValues(Group target, int tweenType, float[] newValues) {
switch (tweenType) {
case POSITION:
target.setPosition(newValues[0], newValues[1]);
break;
case ROTATION:
target.setRotation(newValues[0]);
break;
case SCALE:
target.setScale(newValues[0], newValues[1]);
break;
case X:
target.setX(newValues[0]);
break;
case Y:
target.setY(newValues[0]);
break;
case SCALE_X:
target.setScaleX(newValues[0]);
break;
case SCALE_Y:
target.setScaleY(newValues[0]);
break;
}
}
示例3: readModelEntity
import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
private void readModelEntity() {
Group group = getGroup();
if (group != null && modelEntity != null) {
group.setName(modelEntity.getName());
group.setPosition(modelEntity.getX(), modelEntity.getY());
group.setOrigin(modelEntity.getOriginX(), modelEntity.getOriginY());
group.setRotation(modelEntity.getRotation());
group.setScale(modelEntity.getScaleX(), modelEntity.getScaleY());
Color color = modelEntity.getColor();
if (color != null) {
group.setColor(color.getR(), color.getG(), color.getB(),
color.getA());
}
}
}
示例4: layout
import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
public void layout() {
Group group = getLayer(Layer.SCENE_CONTENT).getGroup();
float scaleX = getWidth() / (float) worldWidth;
float scaleY = getHeight() / (float) worldHeight;
float scale = Math.min(scaleX, scaleY);
float diffX = (getWidth() - worldWidth * scale) / 2.0f;
float diffY = (getHeight() - worldHeight * scale) / 2.0f;
group.setPosition(diffX, diffY);
group.setScale(scale);
gameViewport.set(diffX, diffY, worldWidth * scale, worldHeight * scale);
}
示例5: HUD
import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
public HUD() {
super();
weaponPillTextures = new Texture[WP_OVERHEAT + 1][2];
weaponPillTextures[WP_SELECTED][0] = new Texture("hud/hud-pill-yellow-empty.png");
weaponPillTextures[WP_SELECTED][1] = new Texture("hud/hud-pill-yellow.png");
weaponPillTextures[WP_UNSELECTED][0] = new Texture("hud/hud-pill-green-empty.png");
weaponPillTextures[WP_UNSELECTED][1] = new Texture("hud/hud-pill-green.png");
weaponPillTextures[WP_OVERHEAT][0] = new Texture("hud/hud-pill-red-empty.png");
weaponPillTextures[WP_OVERHEAT][1] = new Texture("hud/hud-pill-red.png");
lowerRight = new Group();
lowerLeft = new Group();
addActor(lowerRight);
addActor(lowerLeft);
// RIGHT PANEL
Image lrPanel = new Image(new Texture("hud/hud-panel-lowerright.png"));
lowerRight.addActor(lrPanel);
lowerRight.setPosition(Gdx.graphics.getWidth() - lrPanel.getWidth(), 0);
hullIcon = new Image(new Texture("hud/hud-icon-hull.png"));
lowerRight.addActor(hullIcon);
hullIcon.setPosition(42, 53);
hullPills = new PillGroup(new Texture("hud/hud-pill-green-empty.png"), new Texture("hud/hud-pill-green.png"), 10, 300, (int)hullIcon.getHeight());
lowerRight.addActor(hullPills);
hullPills.setPosition(144, 53);
shieldIcon = new Image(new Texture("hud/hud-icon-shield.png"));
lowerRight.addActor(shieldIcon);
shieldIcon.setPosition(42, 4);
shieldPills = new PillGroup(new Texture("hud/hud-pill-blue-empty.png"), new Texture("hud/hud-pill-blue.png"), 10, 300, (int)hullIcon.getHeight());
lowerRight.addActor(shieldPills);
shieldPills.setPosition(144, 4);
// LEFT PANEL
Image llPanel = new Image(new Texture("hud/hud-panel-lowerleft.png"));
lowerLeft.addActor(llPanel);
laserIcon = new Image(new Texture("hud/hud-icon-laserred.png"));
lowerLeft.addActor(laserIcon);
laserIcon.setPosition(12, 53);
laserPills = new PillGroup(new Texture("hud/hud-pill-green-empty.png"), new Texture("hud/hud-pill-green.png"), 10, 300, (int)hullIcon.getHeight());
lowerLeft.addActor(laserPills);
laserPills.setPosition(114, 53);
missileIcon = new Image(new Texture("hud/hud-icon-missile1.png"));
lowerLeft.addActor(missileIcon);
missileIcon.setPosition(12, 4);
missilePills = new PillGroup(new Texture("hud/hud-pill-green-empty.png"), new Texture("hud/hud-pill-green.png"), 10, 300, (int)hullIcon.getHeight());
lowerLeft.addActor(missilePills);
missilePills.setPosition(114, 4);
selectedIcon = new Image(new Texture("hud/hud-selector-yellow.png"));
selectedIcon.setPosition(12, 53);
orientator = new Image(new Texture("orientator.png"));
orientator.setPosition((Gdx.graphics.getWidth() - orientator.getWidth()) / 2, (Gdx.graphics.getHeight() - orientator.getHeight()) / 2);
addActor(orientator);
orientator.setColor(new Color(1, 1, 1, 0.5f));
orient = new Image(new Texture("orientation.png"));
orient.setPosition((Gdx.graphics.getWidth() - orient.getWidth()) / 2, (Gdx.graphics.getHeight() - orient.getHeight()) / 2);
addActor(orient);
orient.setColor(new Color(1, 1, 1, 0.5f));
}