diff --git a/dust-sample/src/main/AndroidManifest.xml b/dust-sample/src/main/AndroidManifest.xml index aafba60..abe3ec8 100644 --- a/dust-sample/src/main/AndroidManifest.xml +++ b/dust-sample/src/main/AndroidManifest.xml @@ -6,10 +6,12 @@ android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" - android:theme="@style/AppTheme" > + android:theme="@style/AppTheme" + > + android:label="@string/app_name" + android:windowSoftInputMode="adjustResize"> diff --git a/dust-sample/src/main/res/layout/activity_dust.xml b/dust-sample/src/main/res/layout/activity_dust.xml index 890acba..94a0f6a 100644 --- a/dust-sample/src/main/res/layout/activity_dust.xml +++ b/dust-sample/src/main/res/layout/activity_dust.xml @@ -21,5 +21,8 @@ android:text="start" /> + diff --git a/dust-sample/src/main/res/raw/starexplosion.pex b/dust-sample/src/main/res/raw/starexplosion.pex index 8963adc..d753489 100644 --- a/dust-sample/src/main/res/raw/starexplosion.pex +++ b/dust-sample/src/main/res/raw/starexplosion.pex @@ -1,28 +1,28 @@ - + - - - - + + + + - - - - + + + + - + - - + + - + diff --git a/dust-sample/src/main/res/raw/staroutlineexplosion.pex b/dust-sample/src/main/res/raw/staroutlineexplosion.pex index 8d73503..ff9bd22 100644 --- a/dust-sample/src/main/res/raw/staroutlineexplosion.pex +++ b/dust-sample/src/main/res/raw/staroutlineexplosion.pex @@ -1,29 +1,29 @@ - + - - - - + + + + - - - - + + + + - + - - - - - + + + + + diff --git a/dust/src/main/java/com/billylindeman/dust/layer/GLParticleLayer.java b/dust/src/main/java/com/billylindeman/dust/layer/GLParticleLayer.java index 02baff6..9867981 100644 --- a/dust/src/main/java/com/billylindeman/dust/layer/GLParticleLayer.java +++ b/dust/src/main/java/com/billylindeman/dust/layer/GLParticleLayer.java @@ -125,6 +125,8 @@ public void onSurfaceChanged(GL10 gl, int w, int h) { glSize.x = 320; glSize.y = ((float)h/(float)w)*320; + gl.glMatrixMode(GL10.GL_PROJECTION); + gl.glLoadIdentity(); gl.glOrthof(0,glSize.x,0,glSize.y,0,1); size.x=w; @@ -172,9 +174,8 @@ private void drawParticlesForEmitter(GL10 gl, Emitter e) { Particle p = particles[i]; gl.glPushMatrix(); gl.glTranslatef(p.position.x, p.position.y, 0); - gl.glScalef(.5f*p.particleSize, .5f*p.particleSize, 0); - gl.glRotatef((float)p.angle, 0,0,1); - tr.draw(gl, p.color); + gl.glRotatef(p.rotation, 0,0,1); + tr.draw(gl, p.particleSize, p.color); gl.glPopMatrix(); } } diff --git a/dust/src/main/java/com/billylindeman/dust/layer/TexturedRect.java b/dust/src/main/java/com/billylindeman/dust/layer/TexturedRect.java index d38e251..e4455af 100644 --- a/dust/src/main/java/com/billylindeman/dust/layer/TexturedRect.java +++ b/dust/src/main/java/com/billylindeman/dust/layer/TexturedRect.java @@ -64,8 +64,9 @@ public void registerTextureHandle(GL10 gl, final Bitmap bitmap) { /** Load bitmap into GL texture */ gl.glGenTextures(1, textureHandle, 0); gl.glBindTexture(GL10.GL_TEXTURE_2D, textureHandle[0]); - gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); - gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST); + gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR); + gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); + GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); textureIsRegistered = true; @@ -80,7 +81,7 @@ public boolean hasTexture() { return textureIsRegistered; } - public void draw(GL10 gl, Color c){ + public void draw(GL10 gl,float size, Color c){ float cb[] = { c.r,c.g,c.b,c.a, c.r,c.g,c.b,c.a, @@ -90,6 +91,16 @@ public void draw(GL10 gl, Color c){ colorBuffer.put(cb); colorBuffer.position(0); + size *= .5f; + float vertices[]={ + -size, size, 0.0f, //top left + -size,-size,0.0f, //bottom left + size,-size,0.0f, //bottom right + size,size,0.0f //top right + }; + + vertexBuffer.put(vertices); + vertexBuffer.position(0); gl.glFrontFace(GL10.GL_CCW); gl.glEnable(GL10.GL_CULL_FACE); diff --git a/dust/src/main/java/com/billylindeman/dust/particle/EmitterConfig.java b/dust/src/main/java/com/billylindeman/dust/particle/EmitterConfig.java index 13ff8b1..d5543c5 100644 --- a/dust/src/main/java/com/billylindeman/dust/particle/EmitterConfig.java +++ b/dust/src/main/java/com/billylindeman/dust/particle/EmitterConfig.java @@ -44,7 +44,7 @@ public class EmitterConfig { int maxParticles; - float duration; + public float duration; float rotationStart, rotationStartVariance; float rotationEnd, rotationEndVariance;