This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 188e3a319e7a0f9eb12cfd5d06a0ac7aa996d771 (commit) from b3b9438ff87b573ce38bde2602edb0b07086560d (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/188e3a319e7a0f9eb12cfd5d06a0ac7aa996d...
commit 188e3a319e7a0f9eb12cfd5d06a0ac7aa996d771 Author: Cyril Hrubis metan@ucw.cz Date: Sun Feb 12 23:49:28 2012 +0100
demos: Particle demo, fix rounding error.
diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c index 3be671a..b8af396 100644 --- a/demos/particle/particle_demo.c +++ b/demos/particle/particle_demo.c @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) GP_BackendFlip(backend);
struct space *space; - space = space_create(200, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8); + space = space_create(300, 10<<8, 10<<8, (context->w - 10)<<8, (context->h - 10)<<8);
for (;;) { if (backend->Poll) @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) } if (!pause_flag) { - space_time_tick(space, 2); + space_time_tick(space, 3); space_draw_particles(context, space); GP_BackendFlip(backend); } diff --git a/demos/particle/space.c b/demos/particle/space.c index a243f97..c029b0b 100644 --- a/demos/particle/space.c +++ b/demos/particle/space.c @@ -45,6 +45,8 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h,
unsigned int i;
+ srandom(time(NULL)); + for (i = 0; i < particle_count; i++) { new->particles[i].x = random() % (max_w - min_w) + min_w; new->particles[i].y = random() % (max_h - min_h) + min_h; @@ -100,7 +102,7 @@ static void gravity_forces(struct space *space, int time) int dist_x = DIST_X(space, i, j); int dist_y = DIST_Y(space, i, j);
- int dist_squared = (SQUARE(dist_x>>8) + SQUARE(dist_y>>8)) + (1<<8); + int dist_squared = (SQUARE((dist_x + (1<<7))>>8) + SQUARE((dist_y + (1<<7))>>8)) + (1<<8); int dist = ((int)sqrt(dist_squared))<<4;
if (dist < (1<<9))
-----------------------------------------------------------------------
Summary of changes: demos/particle/particle_demo.c | 4 ++-- demos/particle/space.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.