Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE PinDetect mbed
gobbleBuzz.cpp
00001 #include "gobbleBuzz.h" 00002 #include "uLCD_4DGL.h" 00003 00004 00005 #define TURKEY_HEIGHT 8 00006 #define TURKEY_WIDTH 11 00007 00008 extern uLCD_4DGL uLCD; 00009 00010 bool GobbleBuzz::overlap(int upperLX, int upperLY, int lowerRX, int lowerRY) 00011 { 00012 00013 int lrxpos = xpos+TURKEY_WIDTH; 00014 int lrypos = ypos+TURKEY_HEIGHT; 00015 00016 //first check to see if in the upper left corner of turkey is in rectangle 00017 if (((xpos >= upperLX) && (xpos <= lowerRX)) //then x pos satisfied 00018 && ((ypos >= upperLY) && (ypos <=lowerRY))) 00019 return true; 00020 //now check to see if the lower right corner of the turkey is in the rectangle 00021 else if ( ((lrxpos >= upperLX) && (lrxpos <= lowerRX)) //then x pos satisfied 00022 && ((lrypos >= upperLY) && (lrypos <= lowerRY)) ) 00023 return true; 00024 //now check to see if the upper right corner of turkey is in rectangle 00025 else if ( ((lrxpos >= upperLX) && (lrxpos <= lowerRX)) //then x pos satisfied 00026 && ((ypos >= upperLY) && (ypos <= lowerRY)) ) 00027 return true; 00028 //now check to see if the lower left corner of the turkey is in rectangle 00029 else if ( ((xpos >= upperLX) && (xpos <= lowerRX)) //then x pos satisfied 00030 && ((lrypos >= upperLY) && (lrypos <= lowerRY)) ) 00031 return true; 00032 else //no overlap 00033 return false; 00034 }
Generated on Tue Nov 22 2022 16:42:34 by
1.7.2