本文整理汇总了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);
}