Libraries, utilities, bootloaders...
by rodot » Mon Aug 18, 2014 3:58 pm
yodasvideoarcade wrote:It would be useful to have an additional collission-detection function for detecting pixel-perfect collission between bitmaps.
That would be useful and pretty quick to implement, I'll give it a try asap. Thanks for the suggestion
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by Matrix828 » Mon Aug 18, 2014 5:06 pm
rodot wrote:yodasvideoarcade wrote:It would be useful to have an additional collission-detection function for detecting pixel-perfect collission between bitmaps.
That would be useful and pretty quick to implement, I'll give it a try asap. Thanks for the suggestion
Does what I posted work? (saves you a few minutes atleast
)
- Code: Select all
boolean collideBitmap(const uint8_t *bitmap1, int8_t x1, int8_t y1, const uint8_t *bitmap2, int8_t x2, int8_t y2) {
int8_t w1 = pgm_read_byte(bitmap1);
int8_t h1 = pgm_read_byte(bitmap1 + 1);
int8_t w2 = pgm_read_byte(bitmap2);
int8_t h2 = pgm_read_byte(bitmap2 + 1);
return gb.collideRectRect(x1, y1, w1, h1, x2, y2, w2, h2);
}
-
Matrix828
-
- Posts: 43
- Joined: Tue Jul 22, 2014 7:44 pm
-
by rodot » Mon Aug 18, 2014 5:20 pm
Yoda was talking about a pixel-wise collision, what you suggest here is the collisions between the rectangles containing the bitmap, do you get the difference?
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by DFX2KX » Sat Sep 06, 2014 11:15 pm
! YAYYY! It appears you don't have to draw said bitmaps either, this will be quite useful for all sorts of things! Thanks Rodot!
-
DFX2KX
-
- Posts: 250
- Joined: Mon Apr 14, 2014 3:48 am
Return to Software Development
Who is online
Users browsing this forum: No registered users and 40 guests