本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setX()
方法的一些代码示例,展示了Image.setX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.setX()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Image
类名称:Image
方法名:setX
暂无
代码示例来源:origin: libgdx/libgdx
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
stage = new Stage();
for (int i = 0; i < 100; i++) {
Image img = new Image(new TextureRegion(texture));
img.setX((float)Math.random() * 480);
img.setY((float)Math.random() * 320);
img.getColor().a = (float)Math.random() * 0.5f + 0.5f;
stage.addActor(img);
}
stage.getRoot().addAction(forever(sequence(fadeOut(3), fadeIn(3))));
}
代码示例来源:origin: dingjibang/GDX-RPG
public void setX(float x) {
super.setX((int)x);
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public void touchDragged (InputEvent event, float x, float y, int pointer) {
super.touchDragged(event, x, y, pointer);
if(pressed){
float newToggleButtonX = downButtonX+x-downX;
newToggleButtonX = Math.max(minButtonX, newToggleButtonX);
newToggleButtonX = Math.min(maxButtonX, newToggleButtonX);
toggleButton.setX(newToggleButtonX);
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public void toggleToRight(){
if(isLeft){
isLeft = false;
toggleButton.setX(maxButtonX);
if(toggleListener != null){
toggleListener.widgetToggled(isLeft);
}
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public void toggleToLeft(){
if(!isLeft){
isLeft = true;
toggleButton.setX(minButtonX);
if(toggleListener != null){
toggleListener.widgetToggled(isLeft);
}
}
}
public void toggleToRight(){
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public void act(float delta) {
super.act(delta);
if(animating){
if(isLeft){
toggleButton.setX(toggleButton.getX()-ANIMATE_SPEED*delta);
if(toggleButton.getX()<=minButtonX){
toggleButton.setX(minButtonX);
animating = false;
}
}else{
toggleButton.setX(toggleButton.getX()+ANIMATE_SPEED*delta);
if(toggleButton.getX()>=maxButtonX){
toggleButton.setX(maxButtonX);
animating = false;
}
}
}
}
代码示例来源:origin: Var3D/var3dframe
private void inZone(){
if(img_tank.getX()<getLeft()){
img_tank.setX(getLeft());
}else if(img_tank.getRight()>getRight()){
img_tank.setX(getRight(),Align.right);
}
if(img_tank.getY()<getBottom()){
img_tank.setY(getBottom());
}else if(img_tank.getTop()>getTop()){
img_tank.setY(getTop(),Align.top);
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public ToggleWidget(ToggleWidgetStyle style) {
this.style = style;
background = new Image(style.backgroundDrawable);
addActor(background);
toggleButton = new Image(style.toggleButtonDrawable);
addActor(toggleButton);
float width = background.getWidth();
float height = Math.max(toggleButton.getHeight(), background.getHeight());
setWidth(width);
setHeight(height);
background.setY((getHeight()-background.getHeight())/2);
toggleButton.setY((getHeight()-toggleButton.getHeight())/2);
addListener(new ToggleWidgetClickListener());
maxButtonX = getWidth() - toggleButton.getWidth();
minButtonX = 0;
minButtonX += style.toggleButtonPadding/2;
maxButtonX -= style.toggleButtonPadding/2;
isLeft = true;
toggleButton.setX(minButtonX);
}
代码示例来源:origin: kbz/SIFTrain
splashImage.setX(stage.getWidth() / 2 - (scale * splashImage.getWidth()) / 2);
代码示例来源:origin: xietansheng/Game2048ForGDX
helpContentImage.setX(getWidth() / 2 - helpContentImage.getWidth() / 2);
代码示例来源:origin: xietansheng/Game2048ForGDX
private void init() {
/*
* 2048 LOGO
*/
logoImage = new Image(getMainGame().getAtlas().findRegion(Res.AtlasNames.GAME_LOGO));
logoImage.setX(20);
addActor(logoImage);
// 设置组的宽高(以世界的宽度, LOGO 的高度 作为组的宽高)
setSize(getMainGame().getWorldWidth(), logoImage.getHeight());
/*
* 当前分数
*/
currScoreGroup = new ScoreGroup(getMainGame(), getMainGame().getAtlas().findRegion(Res.AtlasNames.GAME_SCORE_BG_NOW));
currScoreGroup.setX(186);
currScoreGroup.setY(getHeight() - currScoreGroup.getHeight()); // 设置到组的顶部
addActor(currScoreGroup);
/*
* 最佳分数
*/
bestScoreGroup = new ScoreGroup(getMainGame(), getMainGame().getAtlas().findRegion(Res.AtlasNames.GAME_SCORE_BG_BEST));
bestScoreGroup.setX(334);
bestScoreGroup.setY(getHeight() - bestScoreGroup.getHeight());
addActor(bestScoreGroup);
}
内容来源于网络,如有侵权,请联系作者删除!