com.badlogic.gdx.scenes.scene2d.ui.Image.getY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(956)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.getY()方法的一些代码示例,展示了Image.getY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.getY()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Image
类名称:Image
方法名:getY

Image.getY介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

  1. public void draw (Batch batch, float parentAlpha) {
  2. validate();
  3. Color color = getColor();
  4. batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  5. float x = getX();
  6. float y = getY();
  7. float scaleX = getScaleX();
  8. float scaleY = getScaleY();
  9. if (drawable instanceof TransformDrawable) {
  10. float rotation = getRotation();
  11. if (scaleX != 1 || scaleY != 1 || rotation != 0) {
  12. ((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
  13. imageWidth, imageHeight, scaleX, scaleY, rotation);
  14. return;
  15. }
  16. }
  17. if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
  18. }

代码示例来源:origin: libgdx/libgdx

  1. public void draw (Batch batch, float parentAlpha) {
  2. validate();
  3. Color color = getColor();
  4. batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  5. float x = getX();
  6. float y = getY();
  7. float scaleX = getScaleX();
  8. float scaleY = getScaleY();
  9. if (drawable instanceof TransformDrawable) {
  10. float rotation = getRotation();
  11. if (scaleX != 1 || scaleY != 1 || rotation != 0) {
  12. ((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
  13. imageWidth, imageHeight, scaleX, scaleY, rotation);
  14. return;
  15. }
  16. }
  17. if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
  18. }

代码示例来源:origin: libgdx/libgdx

  1. rotate.setPosition(64, blend.getY());
  2. scale.setPosition(128, blend.getY());

代码示例来源:origin: stackoverflow.com

  1. Image myImage = ...;
  2. Vector2 coords = new Vector2(myImage.getX(), myImage.getY());
  3. myImage.localToStageCoordinates(/*in/out*/coords);
  4. myImage.getStage().stageToScreenCoordinates(/*in/out*/coords);
  5. System.out.println("Image X " +myImage.get()+ " maps to screen " +coords.x);

代码示例来源:origin: oakes/libgdx-examples

  1. boolean movePiece(Image piece, float xChange, float yChange) {
  2. int pixelCount = countPixels(0, 0, viewWidth, viewHeight);
  3. piece.setPosition(piece.getX() + xChange, piece.getY() + yChange);
  4. if (pixelCount != countPixels(0, 0, viewWidth, viewHeight)) {
  5. piece.setPosition(piece.getX() - xChange, piece.getY() - yChange);
  6. return false;
  7. }
  8. return true;
  9. }

代码示例来源:origin: com.badlogicgames.gdx/gdx

  1. public void draw (Batch batch, float parentAlpha) {
  2. validate();
  3. Color color = getColor();
  4. batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
  5. float x = getX();
  6. float y = getY();
  7. float scaleX = getScaleX();
  8. float scaleY = getScaleY();
  9. if (drawable instanceof TransformDrawable) {
  10. float rotation = getRotation();
  11. if (scaleX != 1 || scaleY != 1 || rotation != 0) {
  12. ((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
  13. imageWidth, imageHeight, scaleX, scaleY, rotation);
  14. return;
  15. }
  16. }
  17. if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
  18. }

代码示例来源:origin: Var3D/var3dframe

  1. private void inZone(){
  2. if(img_tank.getX()<getLeft()){
  3. img_tank.setX(getLeft());
  4. }else if(img_tank.getRight()>getRight()){
  5. img_tank.setX(getRight(),Align.right);
  6. }
  7. if(img_tank.getY()<getBottom()){
  8. img_tank.setY(getBottom());
  9. }else if(img_tank.getTop()>getTop()){
  10. img_tank.setY(getTop(),Align.top);
  11. }
  12. }

代码示例来源:origin: kotcrab/vis-ui

  1. public void draw (Batch batch, Image parent) {
  2. ShaderProgram originalShader = batch.getShader();
  3. batch.setShader(gridShader);
  4. gridShader.setUniformf("u_width", parent.getWidth());
  5. gridShader.setUniformf("u_height", parent.getHeight());
  6. gridShader.setUniformf("u_gridSize", gridSize);
  7. batch.draw(whiteTexture, parent.getX() + parent.getImageX(), parent.getY() + parent.getImageY(),
  8. parent.getImageWidth() * parent.getScaleX(), parent.getImageHeight() * parent.getScaleY());
  9. batch.setShader(originalShader);
  10. }
  11. }

代码示例来源:origin: Var3D/var3dframe

  1. .setColor(Color.DARK_GRAY).setAlpha(0.5f).show();
  2. Image img_close=game.getUI(new Image(texture)).setSize(img_close_bg).setPosition
  3. (img_close_bg.getX(),img_close_bg.getY()+2).setColor(Color.WHITE).addClicAction().show();
  4. float left=img_close.getX(Align.center)-r*0.24f;
  5. float right=img_close.getX(Align.center)+r*0.24f;
  6. float top=img_close.getY(Align.center)+r*0.24f;
  7. float down=img_close.getY(Align.center)-r*0.24f;
  8. ActorLine line1=game.getUI(new ActorLine(left,top,right,down)).touchOff().setColor(Color.BLACK).show();
  9. ActorLine line2=game.getUI(new ActorLine(left,down,right,top)).touchOff().setColor(Color.BLACK).show();
  10. .setScale(0.5f).setPosition(getRateX(0.75f),getRateY(0.25f),Align.center)
  11. .setColor(Color.valueOf("0172d1")).addClicAction().show();
  12. VLabel lab_down=game.getLabel("获取").setPosition(img_down.getX(Align.center),img_down.getY(Align.center)
  13. ,Align.center).touchOff().show();

代码示例来源:origin: dsaltares/libgdx-cookbook

  1. image.setPosition(middlepointX-image.getWidth()*0.5f, label.getY()-image.getHeight() - 10); // 10 for margin
  2. float firstRowY = image.getY() - 50;

相关文章