summaryrefslogtreecommitdiff
path: root/src/modules/sparkler/xplode.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-08 20:03:38 -0800
committerGitHub <noreply@github.com>2017-02-08 20:03:38 -0800
commit8563edd058bb5e564b5e6c2bafde6636b3fce6ee (patch)
treed3232ac628eee1517e258d9b512b0f9a838e9f02 /src/modules/sparkler/xplode.c
parent9d032314e9db794dc88889bc24bf50bbafc3ec8d (diff)
parentb35ba71b6de341f7b87beb3bc078600f3d191612 (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/xplode.c')
-rw-r--r--src/modules/sparkler/xplode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/modules/sparkler/xplode.c b/src/modules/sparkler/xplode.c
index 24a436e..3e3beb4 100644
--- a/src/modules/sparkler/xplode.c
+++ b/src/modules/sparkler/xplode.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
-#include "draw.h"
+#include "fb.h"
+#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -60,16 +61,16 @@ static void xplode_draw(particles_t *particles, particle_t *p, int x, int y, fb_
xplode_ctxt_t *ctxt = p->ctxt;
uint32_t color;
+ if (!should_draw_expire_if_oob(particles, p, x, y, f, &ctxt->longevity))
+ return;
+
if (ctxt->longevity == ctxt->lifetime) {
color = makergb(0xff, 0xff, 0xa0, 1.0);
} else {
color = makergb(0xff, 0xff, 0x00, ((float)ctxt->longevity / ctxt->lifetime));
}
- if (!draw_pixel(f, x, y, color)) {
- /* offscreen */
- ctxt->longevity = 0;
- }
+ fb_fragment_put_pixel_unchecked(f, x, y, color);
}
© All Rights Reserved