Flip tile pattern game
Dependencies: 4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player
cursor.cpp@1:4e25bf8e016e, 2015-10-22 (annotated)
- Committer:
- jsmith352
- Date:
- Thu Oct 22 15:28:45 2015 +0000
- Revision:
- 1:4e25bf8e016e
- Parent:
- 0:96656a61e4e3
flip tile
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jsmith352 | 0:96656a61e4e3 | 1 | #include "cursor.h" |
jsmith352 | 0:96656a61e4e3 | 2 | |
jsmith352 | 0:96656a61e4e3 | 3 | // constructors |
jsmith352 | 0:96656a61e4e3 | 4 | |
jsmith352 | 0:96656a61e4e3 | 5 | Cursor::Cursor(PinName pin1, PinName pin2, PinName pin3){ |
jsmith352 | 0:96656a61e4e3 | 6 | LCD_ptr = new uLCD_4DGL(pin1, pin2, pin3); |
jsmith352 | 0:96656a61e4e3 | 7 | } |
jsmith352 | 0:96656a61e4e3 | 8 | |
jsmith352 | 0:96656a61e4e3 | 9 | void Cursor::drawCircle(int position, int Color){ |
jsmith352 | 0:96656a61e4e3 | 10 | switch(position){ |
jsmith352 | 0:96656a61e4e3 | 11 | case 0: |
jsmith352 | 0:96656a61e4e3 | 12 | circle0(Color); |
jsmith352 | 0:96656a61e4e3 | 13 | break; |
jsmith352 | 0:96656a61e4e3 | 14 | case 1: |
jsmith352 | 0:96656a61e4e3 | 15 | circle1(Color); |
jsmith352 | 0:96656a61e4e3 | 16 | break; |
jsmith352 | 0:96656a61e4e3 | 17 | case 2: |
jsmith352 | 0:96656a61e4e3 | 18 | circle2(Color); |
jsmith352 | 0:96656a61e4e3 | 19 | break; |
jsmith352 | 0:96656a61e4e3 | 20 | case 3: |
jsmith352 | 0:96656a61e4e3 | 21 | circle3(Color); |
jsmith352 | 0:96656a61e4e3 | 22 | break; |
jsmith352 | 0:96656a61e4e3 | 23 | case 4: |
jsmith352 | 0:96656a61e4e3 | 24 | circle4(Color); |
jsmith352 | 0:96656a61e4e3 | 25 | break; |
jsmith352 | 0:96656a61e4e3 | 26 | case 5: |
jsmith352 | 0:96656a61e4e3 | 27 | circle5(Color); |
jsmith352 | 0:96656a61e4e3 | 28 | break; |
jsmith352 | 0:96656a61e4e3 | 29 | case 6: |
jsmith352 | 0:96656a61e4e3 | 30 | circle6(Color); |
jsmith352 | 0:96656a61e4e3 | 31 | break; |
jsmith352 | 0:96656a61e4e3 | 32 | case 7: |
jsmith352 | 0:96656a61e4e3 | 33 | circle7(Color); |
jsmith352 | 0:96656a61e4e3 | 34 | break; |
jsmith352 | 0:96656a61e4e3 | 35 | case 8: |
jsmith352 | 0:96656a61e4e3 | 36 | circle8(Color); |
jsmith352 | 0:96656a61e4e3 | 37 | break; |
jsmith352 | 0:96656a61e4e3 | 38 | case 9: |
jsmith352 | 0:96656a61e4e3 | 39 | circle9(Color); |
jsmith352 | 0:96656a61e4e3 | 40 | break; |
jsmith352 | 0:96656a61e4e3 | 41 | case 10: |
jsmith352 | 0:96656a61e4e3 | 42 | circle10(Color); |
jsmith352 | 0:96656a61e4e3 | 43 | break; |
jsmith352 | 0:96656a61e4e3 | 44 | case 11: |
jsmith352 | 0:96656a61e4e3 | 45 | circle11(Color); |
jsmith352 | 0:96656a61e4e3 | 46 | break; |
jsmith352 | 0:96656a61e4e3 | 47 | case 12: |
jsmith352 | 0:96656a61e4e3 | 48 | circle12(Color); |
jsmith352 | 0:96656a61e4e3 | 49 | break; |
jsmith352 | 0:96656a61e4e3 | 50 | case 13: |
jsmith352 | 0:96656a61e4e3 | 51 | circle13(Color); |
jsmith352 | 0:96656a61e4e3 | 52 | break; |
jsmith352 | 0:96656a61e4e3 | 53 | case 14: |
jsmith352 | 0:96656a61e4e3 | 54 | circle14(Color); |
jsmith352 | 0:96656a61e4e3 | 55 | break; |
jsmith352 | 0:96656a61e4e3 | 56 | case 15: |
jsmith352 | 0:96656a61e4e3 | 57 | circle15(Color); |
jsmith352 | 0:96656a61e4e3 | 58 | break; |
jsmith352 | 0:96656a61e4e3 | 59 | default: |
jsmith352 | 0:96656a61e4e3 | 60 | break; |
jsmith352 | 0:96656a61e4e3 | 61 | } |
jsmith352 | 0:96656a61e4e3 | 62 | } |
jsmith352 | 0:96656a61e4e3 | 63 | |
jsmith352 | 0:96656a61e4e3 | 64 | // *************************************** // |
jsmith352 | 0:96656a61e4e3 | 65 | // Circles // |
jsmith352 | 0:96656a61e4e3 | 66 | // *************************************** // |
jsmith352 | 0:96656a61e4e3 | 67 | void Cursor::circle0(int color){ |
jsmith352 | 0:96656a61e4e3 | 68 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 69 | LCD_ptr->filled_circle(106, 20, 8, color); |
jsmith352 | 0:96656a61e4e3 | 70 | else |
jsmith352 | 0:96656a61e4e3 | 71 | LCD_ptr->filled_circle(111, 15, 8, color); |
jsmith352 | 0:96656a61e4e3 | 72 | } |
jsmith352 | 0:96656a61e4e3 | 73 | void Cursor::circle1(int color){ |
jsmith352 | 0:96656a61e4e3 | 74 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 75 | LCD_ptr->filled_circle(106, 63, 8, color); |
jsmith352 | 0:96656a61e4e3 | 76 | else |
jsmith352 | 0:96656a61e4e3 | 77 | LCD_ptr->filled_circle(111, 47, 8, color); |
jsmith352 | 0:96656a61e4e3 | 78 | } |
jsmith352 | 0:96656a61e4e3 | 79 | void Cursor::circle2(int color){ |
jsmith352 | 0:96656a61e4e3 | 80 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 81 | LCD_ptr->filled_circle(106, 106, 8, color); |
jsmith352 | 0:96656a61e4e3 | 82 | else |
jsmith352 | 0:96656a61e4e3 | 83 | LCD_ptr->filled_circle(111, 79, 8, color); |
jsmith352 | 0:96656a61e4e3 | 84 | } |
jsmith352 | 0:96656a61e4e3 | 85 | void Cursor::circle3(int color){ |
jsmith352 | 0:96656a61e4e3 | 86 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 87 | LCD_ptr->filled_circle(63, 20, 8, color); |
jsmith352 | 0:96656a61e4e3 | 88 | else |
jsmith352 | 0:96656a61e4e3 | 89 | LCD_ptr->filled_circle(111, 111, 8, color); |
jsmith352 | 0:96656a61e4e3 | 90 | } |
jsmith352 | 0:96656a61e4e3 | 91 | void Cursor::circle4(int color){ |
jsmith352 | 0:96656a61e4e3 | 92 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 93 | LCD_ptr->filled_circle(63, 63, 8, color); |
jsmith352 | 0:96656a61e4e3 | 94 | else |
jsmith352 | 0:96656a61e4e3 | 95 | LCD_ptr->filled_circle(79, 15, 8, color); |
jsmith352 | 0:96656a61e4e3 | 96 | } |
jsmith352 | 0:96656a61e4e3 | 97 | void Cursor::circle5(int color){ |
jsmith352 | 0:96656a61e4e3 | 98 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 99 | LCD_ptr->filled_circle(63, 106, 8, color); |
jsmith352 | 0:96656a61e4e3 | 100 | else |
jsmith352 | 0:96656a61e4e3 | 101 | LCD_ptr->filled_circle(79, 47, 8, color); |
jsmith352 | 0:96656a61e4e3 | 102 | } |
jsmith352 | 0:96656a61e4e3 | 103 | void Cursor::circle6(int color){ |
jsmith352 | 0:96656a61e4e3 | 104 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 105 | LCD_ptr->filled_circle(20, 20, 8, color); |
jsmith352 | 0:96656a61e4e3 | 106 | else |
jsmith352 | 0:96656a61e4e3 | 107 | LCD_ptr->filled_circle(79, 79, 8, color); |
jsmith352 | 0:96656a61e4e3 | 108 | } |
jsmith352 | 0:96656a61e4e3 | 109 | void Cursor::circle7(int color){ |
jsmith352 | 0:96656a61e4e3 | 110 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 111 | LCD_ptr->filled_circle(20, 63, 8, color); |
jsmith352 | 0:96656a61e4e3 | 112 | else |
jsmith352 | 0:96656a61e4e3 | 113 | LCD_ptr->filled_circle(79, 111, 8, color); |
jsmith352 | 0:96656a61e4e3 | 114 | } |
jsmith352 | 0:96656a61e4e3 | 115 | void Cursor::circle8(int color){ |
jsmith352 | 0:96656a61e4e3 | 116 | if(number_of_circles == true) |
jsmith352 | 0:96656a61e4e3 | 117 | LCD_ptr->filled_circle(20, 106, 8, color); |
jsmith352 | 0:96656a61e4e3 | 118 | else |
jsmith352 | 0:96656a61e4e3 | 119 | LCD_ptr->filled_circle(47, 15, 8, color); |
jsmith352 | 0:96656a61e4e3 | 120 | } |
jsmith352 | 0:96656a61e4e3 | 121 | void Cursor::circle9(int color){ |
jsmith352 | 0:96656a61e4e3 | 122 | LCD_ptr->filled_circle(47, 47, 8, color); |
jsmith352 | 0:96656a61e4e3 | 123 | } |
jsmith352 | 0:96656a61e4e3 | 124 | void Cursor::circle10(int color){ |
jsmith352 | 0:96656a61e4e3 | 125 | LCD_ptr->filled_circle(47, 79, 8, color); |
jsmith352 | 0:96656a61e4e3 | 126 | } |
jsmith352 | 0:96656a61e4e3 | 127 | void Cursor::circle11(int color){ |
jsmith352 | 0:96656a61e4e3 | 128 | LCD_ptr->filled_circle(47, 111, 8, color); |
jsmith352 | 0:96656a61e4e3 | 129 | } |
jsmith352 | 0:96656a61e4e3 | 130 | void Cursor::circle12(int color){ |
jsmith352 | 0:96656a61e4e3 | 131 | LCD_ptr->filled_circle(15, 15, 8, color); |
jsmith352 | 0:96656a61e4e3 | 132 | } |
jsmith352 | 0:96656a61e4e3 | 133 | void Cursor::circle13(int color){ |
jsmith352 | 0:96656a61e4e3 | 134 | LCD_ptr->filled_circle(15, 47, 8, color); |
jsmith352 | 0:96656a61e4e3 | 135 | } |
jsmith352 | 0:96656a61e4e3 | 136 | void Cursor::circle14(int color){ |
jsmith352 | 0:96656a61e4e3 | 137 | LCD_ptr->filled_circle(15, 79, 8, color); |
jsmith352 | 0:96656a61e4e3 | 138 | } |
jsmith352 | 0:96656a61e4e3 | 139 | void Cursor::circle15(int color){ |
jsmith352 | 0:96656a61e4e3 | 140 | LCD_ptr->filled_circle(15, 111, 8, color); |
jsmith352 | 0:96656a61e4e3 | 141 | } |