Accompanying library for Objects. Library contains five shapes that are selected at random by the Objects library and drawn on to the objects on a Nokia N5110 LCD display.
Dependents: Game_Controller_Project
Fruit.h@4:7310089c4a57, 2017-04-28 (annotated)
- Committer:
- Nathanj94
- Date:
- Fri Apr 28 17:15:23 2017 +0000
- Revision:
- 4:7310089c4a57
- Parent:
- 3:aecb8ec9c91d
- Child:
- 5:bb459bc1ad0b
.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nathanj94 | 0:1976fca8d66a | 1 | #ifndef FRUIT_H |
Nathanj94 | 0:1976fca8d66a | 2 | #define FRUIT_H |
Nathanj94 | 0:1976fca8d66a | 3 | |
Nathanj94 | 0:1976fca8d66a | 4 | #include "mbed.h" |
Nathanj94 | 0:1976fca8d66a | 5 | #include "N5110.h" |
Nathanj94 | 0:1976fca8d66a | 6 | #include "Gamepad.h" |
Nathanj94 | 0:1976fca8d66a | 7 | |
Nathanj94 | 0:1976fca8d66a | 8 | class Fruit |
Nathanj94 | 0:1976fca8d66a | 9 | { |
Nathanj94 | 0:1976fca8d66a | 10 | public: |
Nathanj94 | 0:1976fca8d66a | 11 | |
Nathanj94 | 0:1976fca8d66a | 12 | Fruit(); |
Nathanj94 | 0:1976fca8d66a | 13 | ~Fruit(); |
Nathanj94 | 0:1976fca8d66a | 14 | |
Nathanj94 | 2:15120c2cf507 | 15 | //STRAWBERRY DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 16 | |
Nathanj94 | 3:aecb8ec9c91d | 17 | /** Draw Strawberry |
Nathanj94 | 3:aecb8ec9c91d | 18 | * |
Nathanj94 | 3:aecb8ec9c91d | 19 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 3:aecb8ec9c91d | 20 | * strawberry shape on the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 21 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 22 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 23 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 24 | */ |
Nathanj94 | 0:1976fca8d66a | 25 | void draw_strawberry(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 26 | |
Nathanj94 | 3:aecb8ec9c91d | 27 | /** Undraw Strawberry |
Nathanj94 | 3:aecb8ec9c91d | 28 | * |
Nathanj94 | 3:aecb8ec9c91d | 29 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 3:aecb8ec9c91d | 30 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 3:aecb8ec9c91d | 31 | * the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 32 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 33 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 34 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 35 | */ |
Nathanj94 | 0:1976fca8d66a | 36 | void undraw_strawberry(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 37 | |
Nathanj94 | 3:aecb8ec9c91d | 38 | |
Nathanj94 | 2:15120c2cf507 | 39 | //PINEAPPLE DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 40 | |
Nathanj94 | 3:aecb8ec9c91d | 41 | /** Draw Pineapple |
Nathanj94 | 3:aecb8ec9c91d | 42 | * |
Nathanj94 | 3:aecb8ec9c91d | 43 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 3:aecb8ec9c91d | 44 | * pineapple shape on the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 45 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 46 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 47 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 48 | */ |
Nathanj94 | 3:aecb8ec9c91d | 49 | void draw_pineapple(int x, int y, N5110 &lcd) |
Nathanj94 | 3:aecb8ec9c91d | 50 | |
Nathanj94 | 3:aecb8ec9c91d | 51 | /** Undraw Pineapple |
Nathanj94 | 3:aecb8ec9c91d | 52 | * |
Nathanj94 | 3:aecb8ec9c91d | 53 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 3:aecb8ec9c91d | 54 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 3:aecb8ec9c91d | 55 | * the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 56 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 57 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 58 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 59 | */; |
Nathanj94 | 0:1976fca8d66a | 60 | void undraw_pineapple(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 61 | |
Nathanj94 | 3:aecb8ec9c91d | 62 | |
Nathanj94 | 2:15120c2cf507 | 63 | //PEAR DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 64 | |
Nathanj94 | 3:aecb8ec9c91d | 65 | /** Draw Pear |
Nathanj94 | 3:aecb8ec9c91d | 66 | * |
Nathanj94 | 3:aecb8ec9c91d | 67 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 3:aecb8ec9c91d | 68 | * pear shape on the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 69 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 70 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 71 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 72 | */ |
Nathanj94 | 0:1976fca8d66a | 73 | void draw_pear(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 74 | |
Nathanj94 | 3:aecb8ec9c91d | 75 | /** Undraw Pear |
Nathanj94 | 3:aecb8ec9c91d | 76 | * |
Nathanj94 | 3:aecb8ec9c91d | 77 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 3:aecb8ec9c91d | 78 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 3:aecb8ec9c91d | 79 | * the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 80 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 81 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 82 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 83 | */ |
Nathanj94 | 0:1976fca8d66a | 84 | void undraw_pear(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 85 | |
Nathanj94 | 3:aecb8ec9c91d | 86 | |
Nathanj94 | 2:15120c2cf507 | 87 | //MELON DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 88 | |
Nathanj94 | 3:aecb8ec9c91d | 89 | /** Draw Melon |
Nathanj94 | 3:aecb8ec9c91d | 90 | * |
Nathanj94 | 3:aecb8ec9c91d | 91 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 3:aecb8ec9c91d | 92 | * melon shape on the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 93 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 94 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 95 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 96 | */ |
Nathanj94 | 0:1976fca8d66a | 97 | void draw_melon(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 98 | |
Nathanj94 | 3:aecb8ec9c91d | 99 | /** Undraw Melon |
Nathanj94 | 3:aecb8ec9c91d | 100 | * |
Nathanj94 | 3:aecb8ec9c91d | 101 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 3:aecb8ec9c91d | 102 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 3:aecb8ec9c91d | 103 | * the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 104 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 105 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 106 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 107 | */ |
Nathanj94 | 0:1976fca8d66a | 108 | void undraw_melon(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 109 | |
Nathanj94 | 3:aecb8ec9c91d | 110 | |
Nathanj94 | 2:15120c2cf507 | 111 | //ANTIFRUIT DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 112 | |
Nathanj94 | 3:aecb8ec9c91d | 113 | /** Draw Antifruit |
Nathanj94 | 3:aecb8ec9c91d | 114 | * |
Nathanj94 | 3:aecb8ec9c91d | 115 | * Use x and y co-ordinates of an initialised object to draw an |
Nathanj94 | 3:aecb8ec9c91d | 116 | * antifruit shape on the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 117 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 118 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 119 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 120 | */ |
Nathanj94 | 1:d9e03c7482ad | 121 | void draw_antifruit(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 122 | |
Nathanj94 | 3:aecb8ec9c91d | 123 | /** Undraw Antifruit |
Nathanj94 | 3:aecb8ec9c91d | 124 | * |
Nathanj94 | 3:aecb8ec9c91d | 125 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 3:aecb8ec9c91d | 126 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 3:aecb8ec9c91d | 127 | * the buffer. |
Nathanj94 | 3:aecb8ec9c91d | 128 | * @param x - x co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 129 | * @param y - y co-ordinate reference point |
Nathanj94 | 3:aecb8ec9c91d | 130 | * @param lcd - N5110 custom library |
Nathanj94 | 3:aecb8ec9c91d | 131 | */ |
Nathanj94 | 1:d9e03c7482ad | 132 | void undraw_antifruit(int x, int y, N5110 &lcd); |
Nathanj94 | 0:1976fca8d66a | 133 | |
Nathanj94 | 0:1976fca8d66a | 134 | private: |
Nathanj94 | 4:7310089c4a57 | 135 | //No private variables required in this class |
Nathanj94 | 0:1976fca8d66a | 136 | }; |
Nathanj94 | 0:1976fca8d66a | 137 | #endif |