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

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

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

Image.setOrigin介绍

暂无

代码示例

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

private void fillGroup (Group group, Texture texture) {
  float advance = 32 + SPACING;
  for (int y = 0; y < NUM_SPRITES * advance; y += advance)
    for (int x = 0; x < NUM_SPRITES * advance; x += advance) {
      Image img = new Image(new TextureRegion(texture));
      img.setAlign(Align.center);
      img.setScaling(Scaling.none);
      img.setBounds(x, y, 32, 32);
      img.setOrigin(16, 16);
      group.addActor(img);
      sprites.add(img);
    }
}

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

public void create () {
  stage = new Stage();
  Gdx.input.setInputProcessor(stage);
  texture = new Texture("data/group-debug.png");
  Image image = new Image(texture);
  image.setScaling(Scaling.fit);
  image.setBounds(100, 100, 400, 200);
  stage.addActor(image);
  Image image2 = new Image(texture);
  image2.setScaling(Scaling.fit);
  image.setBounds(100, 100, 400, 200);
  image2.setOrigin(200, 100);
  image2.setScale(0.5f);
  stage.addActor(image2);
}

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

@Override
public void create () {
  stage = new Stage();
  texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
  texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  img = new Image(new TextureRegion(texture));
  img.setSize(100, 100);
  img.setOrigin(50, 50);
  img.setPosition(100, 100);
  img2 = new Image(new TextureRegion(texture));
  img2.setSize(100, 100);
  img2.setOrigin(50, 50);
  img2.setPosition(100, 100);
  img3 = new Image(new TextureRegion(texture));
  img3.setSize(100, 100);
  img3.setOrigin(50, 50);
  img3.setPosition(100, 100);
  stage.addActor(img);
  stage.addActor(img2);
  stage.addActor(img3);
  img.addAction(sequence());
  img2.addAction(parallel(sequence(), moveBy(100, 0, 1)));
  img3.addAction(sequence(parallel(moveBy(100, 200, 2)), Actions.run(this)));
}

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

@Override
public void create () {
  stage = new Stage();
  Action complexAction = forever(sequence(parallel(rotateBy(180, 2), scaleTo(1.4f, 1.4f, 2), alpha(0.7f, 2)),
    parallel(rotateBy(180, 2), scaleTo(1.0f, 1.0f, 2), alpha(1.0f, 2))));
  texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
  texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  final Image img1 = new Image(new TextureRegion(texture));
  img1.setSize(100, 100);
  img1.setOrigin(50, 50);
  img1.setPosition(50, 50);
  final Image img2 = new Image(new TextureRegion(texture));
  img2.setSize(50, 50);
  img2.setOrigin(50, 50);
  img2.setPosition(150, 150);
  stage.addActor(img1);
  stage.addActor(img2);
  img1.addAction(complexAction);
  // img2.action(complexAction.copy());
}

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

@Override
public void create () {
  stage = new Stage();
  texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false);
  texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
  final Image img = new Image(new TextureRegion(texture));
  img.setSize(100, 100);
  img.setOrigin(50, 50);
  img.setPosition(100, 100);
  // img.addAction(forever(sequence(delay(1.0f), new Action() {
  // public boolean act (float delta) {
  // System.out.println(1);
  // img.clearActions();
  // return true;
  // }
  // })));
  img.addAction(Actions.moveBy(100, 0, 2));
  img.addAction(Actions.after(Actions.scaleTo(2, 2, 2)));
  stage.addActor(img);
}

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

Image myImage = new Image(myTexture);
myImage.addAction(Actions.parallel(Actions.moveTo(endX, endY, duration), Actions.rotateBy(degrees, duration)));
myImage.setPosition(startX, startY);
myImage.setOrigin(sizeX/2, sizeY/2);
stage.add(myImage);

代码示例来源:origin: SquidPony/SquidLib

/**
 * Creates a Image Actor that should look like the glyph '^' in this font, but will be rotate-able.
 * @param color a Color to tint the '^' with
 * @return the Actor, with no position set.
 */
public Image makeDirectionMarker(Color color) {
  if (!initialized) {
    throw new IllegalStateException("This factory has not yet been initialized!");
  }
  Image im = new Image(dirMarker);
  im.setColor(scc.filter(color));
  im.setSize(actualCellWidth, actualCellHeight + (distanceField ? 1 : 0)); //  - lineHeight / actualCellHeight //+ lineTweak * 1f
  im.setOrigin(1); //center
  return im;
}

代码示例来源:origin: lycying/c2d-engine

Image image = new Image(new TextureRegion(Engine.resource("Circle", Texture.class)));
image.setSize(tmp.radius * 2, tmp.radius * 2);
image.setOrigin(tmp.radius, tmp.radius);
image.setPosition(b2Body.drawableOffsetX - tmp.radius, b2Body.drawableOffsetY - tmp.radius);
image.setColor(generateColor());
Image image = new Image(new TextureRegion(Engine.resource("Box", Texture.class)));
image.setSize(tmp.width, tmp.height);
image.setOrigin(tmp.width / 2, tmp.height / 2);
image.setPosition(b2Body.drawableOffsetX - tmp.width / 2, b2Body.drawableOffsetY - tmp.height / 2);
image.setColor(generateColor());

代码示例来源:origin: lycying/c2d-engine

Image image = new Image(atlas.findRegion("circle"));
image.setSize(tmp.radius * 2, tmp.radius * 2);
image.setOrigin(tmp.radius, tmp.radius);
image.setPosition(b2Body.drawableOffsetX - tmp.radius, b2Body.drawableOffsetY - tmp.radius);
image.setColor(generateColor());
Image image = new Image(atlas.findRegion("box"));
image.setSize(tmp.width, tmp.height);
image.setOrigin(tmp.width / 2, tmp.height / 2);
image.setPosition(b2Body.drawableOffsetX - tmp.width / 2, b2Body.drawableOffsetY - tmp.height / 2);
image.setColor(generateColor());

代码示例来源:origin: peakgames/libgdx-stagebuilder

foregroundImage.setOrigin(foregroundImage.getWidth() / 2, foregroundImage.getHeight() / 2);
backgroundImage.setOrigin(backgroundImage.getWidth() / 2, backgroundImage.getHeight() / 2);

代码示例来源:origin: xietansheng/Game2048ForGDX

bgImage.setOrigin(0, 0);

代码示例来源:origin: xietansheng/Game2048ForGDX

bgImage.setOrigin(0, 0);

代码示例来源:origin: langurmonkey/gaiasky

float scl = GlobalConf.SCALE_FACTOR / 2.5f;
logoimg.setScale(scl);
logoimg.setOrigin(Align.center);

代码示例来源:origin: xietansheng/Game2048ForGDX

bgImage.setOrigin(0, 0);

代码示例来源:origin: xietansheng/Game2048ForGDX

bgImage.setOrigin(0, 0);

代码示例来源:origin: langurmonkey/gaiasky

logotex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
Image gaiasky = new Image(logotex);
gaiasky.setOrigin(Align.center);

相关文章