本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Sprite.setAlpha方法的典型用法代碼示例。如果您正苦於以下問題:Java Sprite.setAlpha方法的具體用法?Java Sprite.setAlpha怎麽用?Java Sprite.setAlpha使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Sprite
的用法示例。
在下文中一共展示了Sprite.setAlpha方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processEntity
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
@Override
protected void processEntity(Entity entity, float deltaTime) {
if (_tile != null) {
_batch.begin();
TextureRegion textureRegion = _tile.getCell().getTile().getTextureRegion();
Sprite sprite = new Sprite(textureRegion);
if (!isLegalPlacement()) {
sprite.setColor(Color.RED);
sprite.setAlpha(0.5f);
} else {
sprite.setColor(Color.GREEN);
sprite.setAlpha(0.5f);
}
sprite.setPosition(_tile.getCords().x, _tile.getCords().y);
sprite.draw(_batch);
_batch.end();
}
}
示例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);
}
示例3: draw
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
@Override
public void draw(Batch batch, float parentAlpha) {
// TODO Auto-generated method stub
super.draw(batch, parentAlpha);
if(is_me_get_focus == false){
if(Math.pow(this.page_no-book.current_page,2)<=book.pages_range_to_load){
page_textrue=new Texture(Gdx.files.internal("pagestray/p"+page_no+".png"));
page_textrue.setFilter(TextureFilter.Linear,TextureFilter.Linear);
page_sprite = new Sprite(page_textrue);
page_sprite.setSize(Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
is_me_get_focus = true;
//book.android.make_toast("page no : "+page_no+" loaded", false);
}
}else
{
b_a_s.setColor(255/255f,27/255f,177/255f,book.bookmark_a_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_b_s.setColor(27/255f,255/255f,215/255f,book.bookmark_b_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_c_s.setColor(255/255f,220/255f,27/255f,book.bookmark_c_page == page_no? (book.stage_detector==Stages.menu?.6f:(book.them_detector ==Thems.colord?.5f:.4f)):0);
b_a_s.setPosition(b_first_x,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+ b_y);
b_b_s.setPosition(b_first_x+b_pading_x+b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
b_c_s.setPosition(b_first_x+2*b_pading_x+2*b_width, book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight()+b_y);
back_ground.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
britness.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
page_sprite.setPosition(0,book.pages_scroll_pane.getScrollY()-(page_no-1)*Gdx.graphics.getHeight());
page_sprite.setAlpha(book.stage_detector==Stages.menu?.3f:1);
back_ground.setAlpha(book.them_detector ==Thems.colord?1:0);
britness.setAlpha(1f-(book.light_value*.01f));
back_ground.draw(batch);
page_sprite.draw(batch);
britness.draw(batch);
b_a_s.draw(batch);
b_b_s.draw(batch);
b_c_s.draw(batch);
}
if(Math.pow(this.page_no-book.current_page,2)>book.pages_range_to_load&&is_me_get_focus){
// book.android.make_toast("page no : "+page_no+" unloaded", false);
is_me_get_focus = false ;
page_sprite = null ;
page_textrue.dispose() ;
}
}
示例4: create
import com.badlogic.gdx.graphics.g2d.Sprite; //導入方法依賴的package包/類
/**
* Initialisierung
*
* @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
*/
@Override
public void create(SchoolGame game) {
this.game = game;
batch = new SpriteBatch();
Texture splashImg = new Texture(Gdx.files.internal("data/misc/splashscreen.png"));
screenSprite = new Sprite(splashImg);
screenSprite.setPosition(-screenSprite.getWidth() / 2, -screenSprite.getHeight() / 2);
screenSprite.setAlpha(0);
timer = SHOW_TIME + FADE_TIME * 2;
}