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.h@0:56c7173428ac, 2022-11-22 (annotated)
- Committer:
- gboudreau6
- Date:
- Tue Nov 22 16:42:02 2022 +0000
- Revision:
- 0:56c7173428ac
For ECE 2036 Fall 2022 Lab 6;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gboudreau6 | 0:56c7173428ac | 1 | #ifndef GOBBLE_BUZZ_H |
gboudreau6 | 0:56c7173428ac | 2 | #define GOBBLE_BUZZ |
gboudreau6 | 0:56c7173428ac | 3 | |
gboudreau6 | 0:56c7173428ac | 4 | //I am okay with keeping these |
gboudreau6 | 0:56c7173428ac | 5 | //as define statements for the colors |
gboudreau6 | 0:56c7173428ac | 6 | #define WHITE 0xFFFFFF |
gboudreau6 | 0:56c7173428ac | 7 | #define BLACK 0x000000 |
gboudreau6 | 0:56c7173428ac | 8 | #define RED 0xFF0000 |
gboudreau6 | 0:56c7173428ac | 9 | #define GREEN 0x00FF00 |
gboudreau6 | 0:56c7173428ac | 10 | #define BLUE 0x0000FF |
gboudreau6 | 0:56c7173428ac | 11 | #define LGREY 0xBFBFBF |
gboudreau6 | 0:56c7173428ac | 12 | #define DGREY 0x5F5F5F |
gboudreau6 | 0:56c7173428ac | 13 | #define YELLOW 0xFFFF00 |
gboudreau6 | 0:56c7173428ac | 14 | #define BROWN 0x964B00 |
gboudreau6 | 0:56c7173428ac | 15 | |
gboudreau6 | 0:56c7173428ac | 16 | //Maybe these should be c++ constants |
gboudreau6 | 0:56c7173428ac | 17 | //defined in your GobbleBuzz class!! |
gboudreau6 | 0:56c7173428ac | 18 | #define X_DELTA 5 |
gboudreau6 | 0:56c7173428ac | 19 | #define Y_DELTA 5 |
gboudreau6 | 0:56c7173428ac | 20 | |
gboudreau6 | 0:56c7173428ac | 21 | class GobbleBuzz |
gboudreau6 | 0:56c7173428ac | 22 | { |
gboudreau6 | 0:56c7173428ac | 23 | public: |
gboudreau6 | 0:56c7173428ac | 24 | GobbleBuzz(): xpos(50), ypos(50) { copyX();copyY();} |
gboudreau6 | 0:56c7173428ac | 25 | inline void copyX(){ xOLDpos = xpos;} |
gboudreau6 | 0:56c7173428ac | 26 | inline void copyY() {yOLDpos = ypos;} |
gboudreau6 | 0:56c7173428ac | 27 | inline void increaseX() { xpos+=X_DELTA ;} |
gboudreau6 | 0:56c7173428ac | 28 | inline void increaseY() { ypos+=Y_DELTA;} |
gboudreau6 | 0:56c7173428ac | 29 | inline void decreaseX() { xpos-=X_DELTA; } |
gboudreau6 | 0:56c7173428ac | 30 | inline void decreaseY() { ypos-=Y_DELTA; } |
gboudreau6 | 0:56c7173428ac | 31 | |
gboudreau6 | 0:56c7173428ac | 32 | bool overlap(int,int,int,int); |
gboudreau6 | 0:56c7173428ac | 33 | |
gboudreau6 | 0:56c7173428ac | 34 | int getXPos() const { return xpos; } |
gboudreau6 | 0:56c7173428ac | 35 | int getYPos() const { return ypos; } |
gboudreau6 | 0:56c7173428ac | 36 | int getOLDXPos() const { return xOLDpos; } |
gboudreau6 | 0:56c7173428ac | 37 | int getOLDYPos() const {return yOLDpos; } |
gboudreau6 | 0:56c7173428ac | 38 | |
gboudreau6 | 0:56c7173428ac | 39 | private: |
gboudreau6 | 0:56c7173428ac | 40 | int xpos; |
gboudreau6 | 0:56c7173428ac | 41 | int ypos; |
gboudreau6 | 0:56c7173428ac | 42 | int xOLDpos; |
gboudreau6 | 0:56c7173428ac | 43 | int yOLDpos; |
gboudreau6 | 0:56c7173428ac | 44 | |
gboudreau6 | 0:56c7173428ac | 45 | }; |
gboudreau6 | 0:56c7173428ac | 46 | |
gboudreau6 | 0:56c7173428ac | 47 | #endif |