Skip to content

Instantly share code, notes, and snippets.

@SageStarCodes
Last active December 19, 2016 19:02
Show Gist options
  • Save SageStarCodes/700ac859f41e902888bcc04f459e804c to your computer and use it in GitHub Desktop.
Save SageStarCodes/700ac859f41e902888bcc04f459e804c to your computer and use it in GitHub Desktop.
//THE BITMAP **7 wide and 6 high** (hint: It's a pixel heart, hand-written by me :D)
bool bmap[] = {false, true, true,false, true, true,false,
true, true, true, true, true, true, true,
true, true, true, true, true, true, true,
false, true, true, true, true, true,false,
false,false, true, true, true,false,false,
false,false,false, true,false,false,false};
//DRAW A HALF OF A HEART
drawBitmap(i,j,7,6,4,6,bmap);
//RENDERING CODE
void drawBitmap(int startx, int starty,int width, int height, bool bm[]) {
for(int i = 0; i < height; i++) {
for(int j = 0; j < width; j++) {
lcd.setPixel(startx+j, starty+i, (int)bm[j + width * i]);
}
}
}
void drawBitmap(int startx, int starty, int width, int height, int cutoffw, int cutoffh, bool bm[]) {
for(int i = 0; i < cutoffh; i++) {
for(int j = 0; j < cutoffw; j++) {
lcd.setPixel(startx+j, starty+i, (int)bm[j + width * i]);
}
}
}
void drawBitmap(int startx, int starty, int width, int height,int cutonw, int cutonh, int cutoffw, int cutoffh, bool bm[]) {
for(int i = cutonh; i < cutoffh; i++) {
for(int j = cutonw; j < cutoffw; j++) {
lcd.setPixel(startx+j, starty+i, (int)bm[j + width * i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment