Live wall paper
The source code of Nexus one live wallpaper(Galaxy)
void createParticle(struct Stars_s *star, struct Particles_s *part, float scale) {
float d = fabsf(randomGauss()) * State->galaxyRadius * 0.5f + randf(64.0f);
float id = d / State->galaxyRadius;
float z = randomGauss() * 0.4f * (1.0f - id);
float p = -d * ELLIPSE_TWIST;
* Initialize all the stars. Called from Java.
*/
void initParticles() {
if (State->isPreview == 1) {
angle = 0.0f;
}
struct Stars_s *star = Stars;
struct Particles_s *part = Particles;
int particlesCount = State->particlesCount;
float scale = State->galaxyRadius / (State->width * 0.5f);
int i;
for (i = 0; i < clear="none">createParticle(star, part, scale);
star++;
part++;
}
}
void drawSpace(float xOffset, int width, int height) {
bindTexture(NAMED_PFBackground, 0, NAMED_TSpace);
drawQuadTexCoords(
0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
width, 0.0f, 0.0f, 2.0f, 1.0f,
width, height, 0.0f, 2.0f, 0.0f,
0.0f, height, 0.0f, 0.0f, 0.0f);
}
沒有留言:
張貼留言