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


Java Image.startUse方法代碼示例

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


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

示例1: render

import org.newdawn.slick.Image; //導入方法依賴的package包/類
/**
 * Render the particles in the system
 * 
 * @param x The x coordinate to render the particle system at (in the current coordinate space)
 * @param y The y coordinate to render the particle system at (in the current coordiante space)
 */
public void render(float x, float y) {
	if ((sprite == null) && (defaultImageName != null)) {
		loadSystemParticleImage();
	}
	
	if (!visible) {
		return;
	}
	
	GL.glTranslatef(x,y,0);
	
	if (blendingMode == BLEND_ADDITIVE) {
		GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE);
	}
	if (usePoints()) {
		GL.glEnable( SGL.GL_POINT_SMOOTH ); 
		TextureImpl.bindNone();
	}
	
	// iterate over all emitters
	for( int emitterIdx=0; emitterIdx<emitters.size(); emitterIdx++ )
	{
		// get emitter
		ParticleEmitter emitter = (ParticleEmitter) emitters.get(emitterIdx);
		
		if (!emitter.isEnabled()) {
			continue;
		}
		
		// check for additive override and enable when set
		if (emitter.useAdditive()) {
			GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE);
		}
		
		// now get the particle pool for this emitter and render all particles that are in use
		ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter);
		Image image = emitter.getImage();
		if (image == null) {
			image = this.sprite;
		}
		
		if (!emitter.isOriented() && !emitter.usePoints(this)) {
			image.startUse();
		}
		
		for (int i = 0; i < pool.particles.length; i++)
		{
			if (pool.particles[i].inUse())
				pool.particles[i].render();
		} 
		
		if (!emitter.isOriented() && !emitter.usePoints(this)) {
			image.endUse();
		}

		// reset additive blend mode
		if (emitter.useAdditive()) {
			GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE_MINUS_SRC_ALPHA);
		}
	}

	if (usePoints()) {
		GL.glDisable( SGL.GL_POINT_SMOOTH ); 
	}
	if (blendingMode == BLEND_ADDITIVE) {
		GL.glBlendFunc(SGL.GL_SRC_ALPHA, SGL.GL_ONE_MINUS_SRC_ALPHA);
	}
	
	Color.white.bind();
	GL.glTranslatef(-x,-y,0);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:78,代碼來源:ParticleSystem.java


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