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@6:16c94d294309, 2017-05-04 (annotated)
- Committer:
- Nathanj94
- Date:
- Thu May 04 12:24:38 2017 +0000
- Revision:
- 6:16c94d294309
- Parent:
- 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 | 6:16c94d294309 | 8 | /** Fruit class |
Nathanj94 | 6:16c94d294309 | 9 | @brief Drawings of shapes that all fit in to a 6x6 grid (pixels) and are called |
Nathanj94 | 6:16c94d294309 | 10 | @brief at random by the Objects class whenever an object is initialised. |
Nathanj94 | 6:16c94d294309 | 11 | |
Nathanj94 | 6:16c94d294309 | 12 | @author Nathan Johnston |
Nathanj94 | 6:16c94d294309 | 13 | @date 27th March 2017 |
Nathanj94 | 6:16c94d294309 | 14 | */ |
Nathanj94 | 6:16c94d294309 | 15 | |
Nathanj94 | 0:1976fca8d66a | 16 | class Fruit |
Nathanj94 | 0:1976fca8d66a | 17 | { |
Nathanj94 | 0:1976fca8d66a | 18 | public: |
Nathanj94 | 0:1976fca8d66a | 19 | |
Nathanj94 | 0:1976fca8d66a | 20 | Fruit(); |
Nathanj94 | 0:1976fca8d66a | 21 | ~Fruit(); |
Nathanj94 | 0:1976fca8d66a | 22 | |
Nathanj94 | 2:15120c2cf507 | 23 | //STRAWBERRY DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 24 | |
Nathanj94 | 3:aecb8ec9c91d | 25 | /** Draw Strawberry |
Nathanj94 | 5:bb459bc1ad0b | 26 | * |
Nathanj94 | 5:bb459bc1ad0b | 27 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 5:bb459bc1ad0b | 28 | * strawberry shape on the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 29 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 30 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 31 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 32 | */ |
Nathanj94 | 0:1976fca8d66a | 33 | void draw_strawberry(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 34 | |
Nathanj94 | 3:aecb8ec9c91d | 35 | /** Undraw Strawberry |
Nathanj94 | 5:bb459bc1ad0b | 36 | * |
Nathanj94 | 5:bb459bc1ad0b | 37 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 5:bb459bc1ad0b | 38 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 5:bb459bc1ad0b | 39 | * the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 40 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 41 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 42 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 43 | */ |
Nathanj94 | 0:1976fca8d66a | 44 | void undraw_strawberry(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 45 | |
Nathanj94 | 3:aecb8ec9c91d | 46 | |
Nathanj94 | 2:15120c2cf507 | 47 | //PINEAPPLE DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 48 | |
Nathanj94 | 3:aecb8ec9c91d | 49 | /** Draw Pineapple |
Nathanj94 | 5:bb459bc1ad0b | 50 | * |
Nathanj94 | 5:bb459bc1ad0b | 51 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 5:bb459bc1ad0b | 52 | * pineapple shape on the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 53 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 54 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 55 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 56 | */ |
Nathanj94 | 3:aecb8ec9c91d | 57 | void draw_pineapple(int x, int y, N5110 &lcd) |
Nathanj94 | 3:aecb8ec9c91d | 58 | |
Nathanj94 | 3:aecb8ec9c91d | 59 | /** Undraw Pineapple |
Nathanj94 | 5:bb459bc1ad0b | 60 | * |
Nathanj94 | 5:bb459bc1ad0b | 61 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 5:bb459bc1ad0b | 62 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 5:bb459bc1ad0b | 63 | * the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 64 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 65 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 66 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 67 | */; |
Nathanj94 | 0:1976fca8d66a | 68 | void undraw_pineapple(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 69 | |
Nathanj94 | 3:aecb8ec9c91d | 70 | |
Nathanj94 | 2:15120c2cf507 | 71 | //PEAR DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 72 | |
Nathanj94 | 3:aecb8ec9c91d | 73 | /** Draw Pear |
Nathanj94 | 5:bb459bc1ad0b | 74 | * |
Nathanj94 | 5:bb459bc1ad0b | 75 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 5:bb459bc1ad0b | 76 | * pear shape on the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 77 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 78 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 79 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 80 | */ |
Nathanj94 | 0:1976fca8d66a | 81 | void draw_pear(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 82 | |
Nathanj94 | 3:aecb8ec9c91d | 83 | /** Undraw Pear |
Nathanj94 | 5:bb459bc1ad0b | 84 | * |
Nathanj94 | 5:bb459bc1ad0b | 85 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 5:bb459bc1ad0b | 86 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 5:bb459bc1ad0b | 87 | * the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 88 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 89 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 90 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 91 | */ |
Nathanj94 | 0:1976fca8d66a | 92 | void undraw_pear(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 93 | |
Nathanj94 | 3:aecb8ec9c91d | 94 | |
Nathanj94 | 2:15120c2cf507 | 95 | //MELON DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 96 | |
Nathanj94 | 3:aecb8ec9c91d | 97 | /** Draw Melon |
Nathanj94 | 5:bb459bc1ad0b | 98 | * |
Nathanj94 | 5:bb459bc1ad0b | 99 | * Use x and y co-ordinates of an initialised object to draw a |
Nathanj94 | 5:bb459bc1ad0b | 100 | * melon shape on the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 101 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 102 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 103 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 104 | */ |
Nathanj94 | 0:1976fca8d66a | 105 | void draw_melon(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 106 | |
Nathanj94 | 3:aecb8ec9c91d | 107 | /** Undraw Melon |
Nathanj94 | 5:bb459bc1ad0b | 108 | * |
Nathanj94 | 5:bb459bc1ad0b | 109 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 5:bb459bc1ad0b | 110 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 5:bb459bc1ad0b | 111 | * the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 112 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 113 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 114 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 115 | */ |
Nathanj94 | 0:1976fca8d66a | 116 | void undraw_melon(int x, int y, N5110 &lcd); |
Nathanj94 | 2:15120c2cf507 | 117 | |
Nathanj94 | 3:aecb8ec9c91d | 118 | |
Nathanj94 | 2:15120c2cf507 | 119 | //ANTIFRUIT DRAW/UNDRAW// |
Nathanj94 | 3:aecb8ec9c91d | 120 | |
Nathanj94 | 3:aecb8ec9c91d | 121 | /** Draw Antifruit |
Nathanj94 | 5:bb459bc1ad0b | 122 | * |
Nathanj94 | 5:bb459bc1ad0b | 123 | * Use x and y co-ordinates of an initialised object to draw an |
Nathanj94 | 5:bb459bc1ad0b | 124 | * antifruit shape on the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 125 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 126 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 127 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 128 | */ |
Nathanj94 | 1:d9e03c7482ad | 129 | void draw_antifruit(int x, int y, N5110 &lcd); |
Nathanj94 | 3:aecb8ec9c91d | 130 | |
Nathanj94 | 3:aecb8ec9c91d | 131 | /** Undraw Antifruit |
Nathanj94 | 5:bb459bc1ad0b | 132 | * |
Nathanj94 | 5:bb459bc1ad0b | 133 | * Use x and y co-ordinates to draw the same shape but with |
Nathanj94 | 5:bb459bc1ad0b | 134 | * FILL_WHITE rather than FILL_BLACK to effectively clear it from |
Nathanj94 | 5:bb459bc1ad0b | 135 | * the buffer. |
Nathanj94 | 5:bb459bc1ad0b | 136 | * @param x - x co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 137 | * @param y - y co-ordinate reference point |
Nathanj94 | 5:bb459bc1ad0b | 138 | * @param lcd - N5110 custom library |
Nathanj94 | 5:bb459bc1ad0b | 139 | */ |
Nathanj94 | 1:d9e03c7482ad | 140 | void undraw_antifruit(int x, int y, N5110 &lcd); |
Nathanj94 | 0:1976fca8d66a | 141 | |
Nathanj94 | 0:1976fca8d66a | 142 | private: |
Nathanj94 | 4:7310089c4a57 | 143 | //No private variables required in this class |
Nathanj94 | 0:1976fca8d66a | 144 | }; |
Nathanj94 | 0:1976fca8d66a | 145 | #endif |