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


Java Sprite.setAlpha方法代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:21,代碼來源:TowerPlacementSystem.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: 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() ;
		
		
	}
	
}
 
開發者ID:omar6597,項目名稱:alquran-alkarem,代碼行數:52,代碼來源:PageSeen.java

示例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;
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:18,代碼來源:Splashscreen.java


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