本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.getX()
方法的一些代码示例,展示了Image.getX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.getX()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Image
类名称:Image
方法名:getX
暂无
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX();
float y = getY();
float scaleX = getScaleX();
float scaleY = getScaleY();
if (drawable instanceof TransformDrawable) {
float rotation = getRotation();
if (scaleX != 1 || scaleY != 1 || rotation != 0) {
((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
imageWidth, imageHeight, scaleX, scaleY, rotation);
return;
}
}
if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX();
float y = getY();
float scaleX = getScaleX();
float scaleY = getScaleY();
if (drawable instanceof TransformDrawable) {
float rotation = getRotation();
if (scaleX != 1 || scaleY != 1 || rotation != 0) {
((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
imageWidth, imageHeight, scaleX, scaleY, rotation);
return;
}
}
if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
代码示例来源: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: stackoverflow.com
Image myImage = ...;
Vector2 coords = new Vector2(myImage.getX(), myImage.getY());
myImage.localToStageCoordinates(/*in/out*/coords);
myImage.getStage().stageToScreenCoordinates(/*in/out*/coords);
System.out.println("Image X " +myImage.get()+ " maps to screen " +coords.x);
代码示例来源:origin: oakes/libgdx-examples
boolean movePiece(Image piece, float xChange, float yChange) {
int pixelCount = countPixels(0, 0, viewWidth, viewHeight);
piece.setPosition(piece.getX() + xChange, piece.getY() + yChange);
if (pixelCount != countPixels(0, 0, viewWidth, viewHeight)) {
piece.setPosition(piece.getX() - xChange, piece.getY() - yChange);
return false;
}
return true;
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (!super.touchDown(event, x, y, pointer, button)){
return false;
}
if (pointer == 0 && button != 0){
return false;
}
if(toggleButton.hit(x-toggleButton.getX(), y, true) != null){
pressed = true;
downX = x;
downButtonX = toggleButton.getX();
toggleButton.setDrawable(style.toggleButtonDownDrawable);
}else{
if(isLeft){
toggleToRightAnimated();
}else{
toggleToLeftAnimated();
}
}
return true;
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
if(pressed){
boolean newIsLeft = toggleButton.getX() + toggleButton.getWidth()/2 < background.getWidth()/2;
if(toggleListener != null && isLeft != newIsLeft){
toggleListener.widgetToggled(newIsLeft);
}
isLeft = newIsLeft;
animating = true;
pressed = false;
toggleButton.setDrawable(style.toggleButtonDrawable);
}
super.touchUp(event, x, y, pointer, button);
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
private void prepareLabel(AssetsInterface assets) {
Label.LabelStyle labelStyle = new Label.LabelStyle(assets.getFont(this.fontName), Color.WHITE);
if (this.text != null) {
this.progressText = new Label(this.text, labelStyle);
} else {
this.progressText = new Label("", labelStyle);
}
this.progressText.setWidth(this.backgroundImage.getWidth());
this.progressText.setAlignment(Align.center);
this.progressText.setPosition(this.backgroundImage.getX(), (this.backgroundImage.getHeight() - this.progressText.getHeight()) * 0.5f);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = getColor();
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float x = getX();
float y = getY();
float scaleX = getScaleX();
float scaleY = getScaleY();
if (drawable instanceof TransformDrawable) {
float rotation = getRotation();
if (scaleX != 1 || scaleY != 1 || rotation != 0) {
((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
imageWidth, imageHeight, scaleX, scaleY, rotation);
return;
}
}
if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
代码示例来源:origin: kotcrab/vis-ui
public void draw (Batch batch, Image parent) {
ShaderProgram originalShader = batch.getShader();
batch.setShader(gridShader);
gridShader.setUniformf("u_width", parent.getWidth());
gridShader.setUniformf("u_height", parent.getHeight());
gridShader.setUniformf("u_gridSize", gridSize);
batch.draw(whiteTexture, parent.getX() + parent.getImageX(), parent.getY() + parent.getImageY(),
parent.getImageWidth() * parent.getScaleX(), parent.getImageHeight() * parent.getScaleY());
batch.setShader(originalShader);
}
}
代码示例来源: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: Var3D/var3dframe
.setColor(Color.DARK_GRAY).setAlpha(0.5f).show();
Image img_close=game.getUI(new Image(texture)).setSize(img_close_bg).setPosition
(img_close_bg.getX(),img_close_bg.getY()+2).setColor(Color.WHITE).addClicAction().show();
float left=img_close.getX(Align.center)-r*0.24f;
float right=img_close.getX(Align.center)+r*0.24f;
float top=img_close.getY(Align.center)+r*0.24f;
float down=img_close.getY(Align.center)-r*0.24f;
.setScale(0.5f).setPosition(getRateX(0.75f),getRateY(0.25f),Align.center)
.setColor(Color.valueOf("0172d1")).addClicAction().show();
VLabel lab_down=game.getLabel("获取").setPosition(img_down.getX(Align.center),img_down.getY(Align.center)
,Align.center).touchOff().show();
代码示例来源:origin: kbz/SIFTrain
loadingProgress.setX(splashImage.getX() + scale * splashImage.getWidth() * 0.15f);
loadingProgress.setY(stage.getHeight()*0.2f);
loadingProgress.setAnimateDuration(0.01f);
内容来源于网络,如有侵权,请联系作者删除!