X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=shape.c;h=5aa7fb763b5a1600e6ce87313ea9c4ada83e27d0;hp=f45715866b11a44473c9a788f4a61fe591286e7d;hb=1f33a47c0e3b72d6050b72926643812237dc3f49;hpb=d918241a08d6e8b1cc10b3c682edde8876a492ef diff --git a/shape.c b/shape.c index f457158..5aa7fb7 100644 --- a/shape.c +++ b/shape.c @@ -108,3 +108,14 @@ collide(int xdiff, int ydiff, struct shape *r, struct shape *s) if(xov == 0 || yov == 0) return 0; // bboxes hit? else return mask_collide(xov, yov, r, s); } + +int +pixel_collide(unsigned int xoff, unsigned int yoff, struct shape *r) +{ + uint32_t pmask; + + if(xoff >= r->w || yoff >= r->h) return 0; + + pmask = 1 << (xoff & 31); xoff >>= 5; + return r->mask[yoff*r->mw + xoff] & pmask; +}