diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-02-08 20:03:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 20:03:38 -0800 |
commit | 8563edd058bb5e564b5e6c2bafde6636b3fce6ee (patch) | |
tree | d3232ac628eee1517e258d9b512b0f9a838e9f02 /src/modules/sparkler/simple.c | |
parent | 9d032314e9db794dc88889bc24bf50bbafc3ec8d (diff) | |
parent | b35ba71b6de341f7b87beb3bc078600f3d191612 (diff) |
Consolidate fb_fragment_t interactions
sparkler and stars both cleared fragments and drew individual pixels into fragments, add that functionality to fb.h and cleanup sparkler and stars accordingly.
Diffstat (limited to 'src/modules/sparkler/simple.c')
-rw-r--r-- | src/modules/sparkler/simple.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/sparkler/simple.c b/src/modules/sparkler/simple.c index e453e46..5524282 100644 --- a/src/modules/sparkler/simple.c +++ b/src/modules/sparkler/simple.c @@ -1,6 +1,7 @@ #include <stdlib.h> -#include "draw.h" +#include "fb.h" +#include "helpers.h" #include "particle.h" #include "particles.h" @@ -97,10 +98,11 @@ static void simple_draw(particles_t *particles, particle_t *p, int x, int y, fb_ { simple_ctxt_t *ctxt = p->ctxt; - if (!draw_pixel(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime)))) { + if (!should_draw_expire_if_oob(particles, p, x, y, f, &ctxt->longevity)) /* immediately kill off stars that wander off screen */ - ctxt->longevity = 0; - } + return; + + fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime))); } |