daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void  DrawSprite(sprite_ptr spr, uint8_t *fb)
  2. {
  3.       const uint16_t* data = (spr->num_frames > 1 ) ? spr->frames[spr->curr_frame] : spr->imgData  ;
  4.        
  5.        
  6.       uint32_t spriteHeight = spr->height;
  7.       uint32_t spriteWidth  = spr->width;
  8.       uint32_t x = spr->x;
  9.       uint32_t y = spr->y;
  10.     for (uint32_t i = 0; i < spriteHeight; i++)
  11.         {
  12.         for (uint32_t j = 0; j < spriteWidth; j++) {
  13.             uint16_t color = *data++;
  14.             if (color != 0)
  15.             {
  16.                                  *(__IO uint16_t*) (fb + (2*((i+y)*BSP_LCD_GetXSize() + j + x))) = color;
  17.  
  18.             }
  19.              }
  20.                
  21.         }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top