當前位置: 首頁>>代碼示例>>Java>>正文


Java Sprite.setOrigin方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setOrigin方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setOrigin方法的具體用法?Java Sprite.setOrigin怎麽用?Java Sprite.setOrigin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.graphics.g2d.Sprite的用法示例。


在下文中一共展示了Sprite.setOrigin方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GameActor

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public GameActor(TextureRegion actor_region,float x_pos,float y_pos,Color color,float width,float height) {
actor_texture = actor_region;
xpos = x_pos ;
ypos = y_pos ;
width_ =width ;
height_ = height;
actor_Sprite = new Sprite(actor_texture);
actor_Sprite.setX(xpos);
actor_Sprite.setY(ypos);
if(color != null){   
actor_Sprite.setColor(color);}
actor_Sprite.setSize(width_, height_);
actor_Sprite.setOrigin(width_/2, height_/2);
setBounds(xpos, ypos, width_, height_);
this.setTouchable(Touchable.enabled);
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:17,代碼來源:GameActor.java

示例2: draw

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float parentAlpha) {
	if (sprite != null && !sprite.isEmpty() && !sprite.equals(NO_SPRITE)) {
		Sprite render = layer.getGameSprite(sprite);
		render.setPosition(MathUtils.round(getX()), MathUtils.round(getY()));
		render.setRotation(getRotation());
		render.setAlpha(getColor().a * parentAlpha);
		render.setOrigin(getOriginX(), getOriginY());
		render.setColor(getColor());
		render.setSize(getWidth(), getHeight());
		render.setScale(getScaleX(), getScaleY());
		render.setFlip(flip_x, flip_y);
		render.draw(batch);
	}
	super.draw(batch, parentAlpha);
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:17,代碼來源:GameObject.java

示例3: create

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
@Override
public void create() {		
	float w = Gdx.graphics.getWidth();
	float h = Gdx.graphics.getHeight();
	
	camera = new OrthographicCamera(1, h/w);
	batch = new SpriteBatch();
	
	texture = new Texture(Gdx.files.internal("data/libgdx.png"));
	texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
	
	TextureRegion region = new TextureRegion(texture, 0, 0, 200, 200);
	
	sprite = new Sprite(region);
	sprite.setSize(1f,  sprite.getHeight() / sprite.getWidth());
	sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
	sprite.setPosition(-.5f, -.5f);

}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:20,代碼來源:MyGdxGame.java

示例4: initializeSprite

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
private void initializeSprite() {
    SCALE = 2.5f;
    SPEED = 25f;
    CURRENT_STATE = STATE.STATIONARY;
    SPRITE = new Sprite(AssetDoctor.getSprite("fry_02"));
    resizeSprite(SPRITE);
    SPRITE.setOrigin(SPRITE.getWidth()/2.0f, 0f);
    SPRITE.rotate(ROTATION);
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:10,代碼來源:Fry.java

示例5: initBars

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
private void initBars() {
    bars = new ArrayList<Sprite>();
    for(int i = 0; i < NUM_BARS; i++) {
        Sprite bar = new Sprite(AssetDoctor.getSprite("color_white"));
        bar.setOrigin(0f, 0f);
        bar.setColor(Color.BLACK);
        height = DS.T_HEIGHT/(float)NUM_BARS;
        bar.setSize(DS.T_WIDTH, height);
        bar.setPosition(0, i*height);
        bars.add(bar);
    }
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:13,代碼來源:IntroWipeAnimation.java

示例6: resizeSprite

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
protected void resizeSprite(Sprite sprite) {
    sprite.setOrigin(0f, 0f);
    sprite.setSize(sprite.getWidth()*SCALE, sprite.getHeight()*SCALE);
    sprite.setOrigin(sprite.getWidth()/2.0f, sprite.getHeight()/2.0f);
    sprite.setPosition(x - sprite.getWidth()/2.0f, y - sprite.getHeight()/2.0f);
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:7,代碼來源:BurgerExplosion.java

示例7: resizeSprite

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
private void resizeSprite(Sprite sprite) {
    sprite.setOrigin(0f, 0f);
    sprite.setSize(sprite.getWidth()*SCALE, sprite.getHeight()*SCALE);
    sprite.setOrigin(sprite.getWidth()/2.0f, sprite.getHeight()/2.0f);
    sprite.setPosition(x, y);
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:7,代碼來源:Pony.java

示例8: loadSprite

import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
public static Sprite loadSprite(String id, String file, float scaleX, float scaleY) {
    Sprite sprite = loadSprite(id, file);
    sprite.setScale(scaleX, scaleY);
    sprite.setOrigin(0, 0);
    return sprite;
}
 
開發者ID:dsaves,項目名稱:Ponytron,代碼行數:7,代碼來源:AssetDoctor.java


注:本文中的com.badlogic.gdx.graphics.g2d.Sprite.setOrigin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。