Su 200943147
Dependencies: Gamepad N5110 mbed
Shape/Shape.cpp@6:e919a1fd1eed, 2017-05-03 (annotated)
- Committer:
- GS00
- Date:
- Wed May 03 08:42:22 2017 +0000
- Revision:
- 6:e919a1fd1eed
- Parent:
- 5:afa6592a4ba5
- Child:
- 7:31dd8865cc44
Current Version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GS00 | 0:444b4d0a113d | 1 | #include "Shape.h" |
GS00 | 0:444b4d0a113d | 2 | |
GS00 | 0:444b4d0a113d | 3 | |
GS00 | 3:9dd35424cdfe | 4 | Shape::Shape() |
GS00 | 0:444b4d0a113d | 5 | { |
GS00 | 0:444b4d0a113d | 6 | } |
GS00 | 0:444b4d0a113d | 7 | |
GS00 | 3:9dd35424cdfe | 8 | void Shape::Init() |
GS00 | 0:444b4d0a113d | 9 | { |
GS00 | 6:e919a1fd1eed | 10 | New=0; |
GS00 | 6:e919a1fd1eed | 11 | ShapePicker(); |
GS00 | 0:444b4d0a113d | 12 | } |
GS00 | 0:444b4d0a113d | 13 | |
GS00 | 3:9dd35424cdfe | 14 | void Shape::L_Shape() |
GS00 | 0:444b4d0a113d | 15 | { |
GS00 | 3:9dd35424cdfe | 16 | ShapeInit[l+1][k+1]=0; |
GS00 | 3:9dd35424cdfe | 17 | ShapeInit[l+2][k+1]=1; |
GS00 | 3:9dd35424cdfe | 18 | ShapeInit[l+3][k+1]=0; |
GS00 | 3:9dd35424cdfe | 19 | ShapeInit[l+4][k+1]=0; |
GS00 | 2:84e6975dd4b2 | 20 | |
GS00 | 3:9dd35424cdfe | 21 | ShapeInit[l+1][k+2]=0; |
GS00 | 3:9dd35424cdfe | 22 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 23 | ShapeInit[l+3][k+2]=0; |
GS00 | 3:9dd35424cdfe | 24 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 25 | |
GS00 | 3:9dd35424cdfe | 26 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 27 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 28 | ShapeInit[l+3][k+3]=1; |
GS00 | 3:9dd35424cdfe | 29 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 30 | |
GS00 | 3:9dd35424cdfe | 31 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 32 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 33 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 34 | ShapeInit[l+4][k+4]=0; |
GS00 | 0:444b4d0a113d | 35 | } |
GS00 | 0:444b4d0a113d | 36 | |
GS00 | 3:9dd35424cdfe | 37 | void Shape::O_Shape() |
GS00 | 3:9dd35424cdfe | 38 | { |
GS00 | 6:e919a1fd1eed | 39 | ShapeInit[l+1][k+1]=0; |
GS00 | 6:e919a1fd1eed | 40 | ShapeInit[l+2][k+1]=0; |
GS00 | 6:e919a1fd1eed | 41 | ShapeInit[l+3][k+1]=0; |
GS00 | 6:e919a1fd1eed | 42 | ShapeInit[l+4][k+1]=0; |
GS00 | 6:e919a1fd1eed | 43 | |
GS00 | 3:9dd35424cdfe | 44 | ShapeInit[l+1][k+2]=0; |
GS00 | 3:9dd35424cdfe | 45 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 46 | ShapeInit[l+3][k+2]=1; |
GS00 | 3:9dd35424cdfe | 47 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 48 | |
GS00 | 3:9dd35424cdfe | 49 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 50 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 51 | ShapeInit[l+3][k+3]=1; |
GS00 | 3:9dd35424cdfe | 52 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 53 | |
GS00 | 3:9dd35424cdfe | 54 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 55 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 56 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 57 | ShapeInit[l+4][k+4]=0; |
GS00 | 3:9dd35424cdfe | 58 | } |
GS00 | 3:9dd35424cdfe | 59 | |
GS00 | 3:9dd35424cdfe | 60 | void Shape::S_Shape() |
GS00 | 0:444b4d0a113d | 61 | { |
GS00 | 3:9dd35424cdfe | 62 | ShapeInit[l+1][k+1]=0; |
GS00 | 3:9dd35424cdfe | 63 | ShapeInit[l+2][k+1]=0; |
GS00 | 3:9dd35424cdfe | 64 | ShapeInit[l+3][k+1]=0; |
GS00 | 3:9dd35424cdfe | 65 | ShapeInit[l+4][k+1]=0; |
GS00 | 3:9dd35424cdfe | 66 | |
GS00 | 3:9dd35424cdfe | 67 | ShapeInit[l+1][k+2]=0; |
GS00 | 3:9dd35424cdfe | 68 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 69 | ShapeInit[l+3][k+2]=1; |
GS00 | 3:9dd35424cdfe | 70 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 71 | |
GS00 | 3:9dd35424cdfe | 72 | ShapeInit[l+1][k+3]=1; |
GS00 | 3:9dd35424cdfe | 73 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 74 | ShapeInit[l+3][k+3]=0; |
GS00 | 3:9dd35424cdfe | 75 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 76 | |
GS00 | 3:9dd35424cdfe | 77 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 78 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 79 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 80 | ShapeInit[l+4][k+4]=0; |
GS00 | 0:444b4d0a113d | 81 | } |
GS00 | 0:444b4d0a113d | 82 | |
GS00 | 3:9dd35424cdfe | 83 | void Shape::Z_Shape() |
GS00 | 0:444b4d0a113d | 84 | { |
GS00 | 6:e919a1fd1eed | 85 | ShapeInit[l+1][k+1]=0; |
GS00 | 6:e919a1fd1eed | 86 | ShapeInit[l+2][k+1]=0; |
GS00 | 6:e919a1fd1eed | 87 | ShapeInit[l+3][k+1]=0; |
GS00 | 6:e919a1fd1eed | 88 | ShapeInit[l+4][k+1]=0; |
GS00 | 6:e919a1fd1eed | 89 | |
GS00 | 3:9dd35424cdfe | 90 | ShapeInit[l+1][k+2]=1; |
GS00 | 3:9dd35424cdfe | 91 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 92 | ShapeInit[l+3][k+2]=0; |
GS00 | 3:9dd35424cdfe | 93 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 94 | |
GS00 | 3:9dd35424cdfe | 95 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 96 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 97 | ShapeInit[l+3][k+3]=1; |
GS00 | 3:9dd35424cdfe | 98 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 99 | |
GS00 | 3:9dd35424cdfe | 100 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 101 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 102 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 103 | ShapeInit[l+4][k+4]=0; |
GS00 | 0:444b4d0a113d | 104 | } |
GS00 | 3:9dd35424cdfe | 105 | void Shape::I_Shape() |
GS00 | 0:444b4d0a113d | 106 | { |
GS00 | 3:9dd35424cdfe | 107 | ShapeInit[l+1][k+1]=0; |
GS00 | 3:9dd35424cdfe | 108 | ShapeInit[l+2][k+1]=1; |
GS00 | 3:9dd35424cdfe | 109 | ShapeInit[l+3][k+1]=0; |
GS00 | 3:9dd35424cdfe | 110 | ShapeInit[l+4][k+1]=0; |
GS00 | 3:9dd35424cdfe | 111 | |
GS00 | 3:9dd35424cdfe | 112 | ShapeInit[l+1][k+2]=0; |
GS00 | 3:9dd35424cdfe | 113 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 114 | ShapeInit[l+3][k+2]=0; |
GS00 | 3:9dd35424cdfe | 115 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 116 | |
GS00 | 3:9dd35424cdfe | 117 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 118 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 119 | ShapeInit[l+3][k+3]=0; |
GS00 | 3:9dd35424cdfe | 120 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 121 | |
GS00 | 3:9dd35424cdfe | 122 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 123 | ShapeInit[l+2][k+4]=1; |
GS00 | 3:9dd35424cdfe | 124 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 125 | ShapeInit[l+4][k+4]=0; |
GS00 | 0:444b4d0a113d | 126 | } |
GS00 | 3:9dd35424cdfe | 127 | void Shape::J_Shape() |
GS00 | 0:444b4d0a113d | 128 | { |
GS00 | 3:9dd35424cdfe | 129 | ShapeInit[l+1][k+1]=0; |
GS00 | 3:9dd35424cdfe | 130 | ShapeInit[l+2][k+1]=0; |
GS00 | 3:9dd35424cdfe | 131 | ShapeInit[l+3][k+1]=1; |
GS00 | 3:9dd35424cdfe | 132 | ShapeInit[l+4][k+1]=0; |
GS00 | 3:9dd35424cdfe | 133 | |
GS00 | 3:9dd35424cdfe | 134 | ShapeInit[l+1][k+2]=0; |
GS00 | 3:9dd35424cdfe | 135 | ShapeInit[l+2][k+2]=0; |
GS00 | 3:9dd35424cdfe | 136 | ShapeInit[l+3][k+2]=1; |
GS00 | 3:9dd35424cdfe | 137 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 138 | |
GS00 | 3:9dd35424cdfe | 139 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 140 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 141 | ShapeInit[l+3][k+3]=1; |
GS00 | 3:9dd35424cdfe | 142 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 143 | |
GS00 | 3:9dd35424cdfe | 144 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 145 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 146 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 147 | ShapeInit[l+4][k+4]=0; |
GS00 | 3:9dd35424cdfe | 148 | } |
GS00 | 3:9dd35424cdfe | 149 | void Shape::T_Shape() |
GS00 | 3:9dd35424cdfe | 150 | { |
GS00 | 6:e919a1fd1eed | 151 | ShapeInit[l+1][k+1]=0; |
GS00 | 6:e919a1fd1eed | 152 | ShapeInit[l+2][k+1]=0; |
GS00 | 6:e919a1fd1eed | 153 | ShapeInit[l+3][k+1]=0; |
GS00 | 6:e919a1fd1eed | 154 | ShapeInit[l+4][k+1]=0; |
GS00 | 6:e919a1fd1eed | 155 | |
GS00 | 3:9dd35424cdfe | 156 | ShapeInit[l+1][k+2]=1; |
GS00 | 3:9dd35424cdfe | 157 | ShapeInit[l+2][k+2]=1; |
GS00 | 3:9dd35424cdfe | 158 | ShapeInit[l+3][k+2]=1; |
GS00 | 3:9dd35424cdfe | 159 | ShapeInit[l+4][k+2]=0; |
GS00 | 3:9dd35424cdfe | 160 | |
GS00 | 3:9dd35424cdfe | 161 | ShapeInit[l+1][k+3]=0; |
GS00 | 3:9dd35424cdfe | 162 | ShapeInit[l+2][k+3]=1; |
GS00 | 3:9dd35424cdfe | 163 | ShapeInit[l+3][k+3]=0; |
GS00 | 3:9dd35424cdfe | 164 | ShapeInit[l+4][k+3]=0; |
GS00 | 3:9dd35424cdfe | 165 | |
GS00 | 3:9dd35424cdfe | 166 | ShapeInit[l+1][k+4]=0; |
GS00 | 3:9dd35424cdfe | 167 | ShapeInit[l+2][k+4]=0; |
GS00 | 3:9dd35424cdfe | 168 | ShapeInit[l+3][k+4]=0; |
GS00 | 3:9dd35424cdfe | 169 | ShapeInit[l+4][k+4]=0; |
GS00 | 0:444b4d0a113d | 170 | } |
GS00 | 6:e919a1fd1eed | 171 | void Shape::RotateInit() |
GS00 | 6:e919a1fd1eed | 172 | { |
GS00 | 6:e919a1fd1eed | 173 | for(int i=1; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 174 | for(int j=1; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 175 | ArrayRotate[i-1][j-1]=ShapeInit[i][j]; |
GS00 | 6:e919a1fd1eed | 176 | } |
GS00 | 6:e919a1fd1eed | 177 | } |
GS00 | 6:e919a1fd1eed | 178 | int Temp; |
GS00 | 6:e919a1fd1eed | 179 | for (int i=0; i<2; i++) { |
GS00 | 6:e919a1fd1eed | 180 | for (int j=i; j<3-i; j++) { |
GS00 | 6:e919a1fd1eed | 181 | Temp=ArrayRotate[i][j]; |
GS00 | 6:e919a1fd1eed | 182 | ArrayRotate[i][j]=ArrayRotate[j][3-i]; |
GS00 | 6:e919a1fd1eed | 183 | ArrayRotate[j][3-i]=ArrayRotate[3-i][3-j]; |
GS00 | 6:e919a1fd1eed | 184 | ArrayRotate[3-i][3-j]=ArrayRotate[3-j][i]; |
GS00 | 6:e919a1fd1eed | 185 | ArrayRotate[3-j][i]=Temp; |
GS00 | 6:e919a1fd1eed | 186 | } |
GS00 | 6:e919a1fd1eed | 187 | } |
GS00 | 6:e919a1fd1eed | 188 | for(int i=1; i<5; i++) { |
GS00 | 6:e919a1fd1eed | 189 | for(int j=1; j<5; j++) { |
GS00 | 6:e919a1fd1eed | 190 | printf("%d\n",ArrayRotate[i][j]); |
GS00 | 6:e919a1fd1eed | 191 | } |
GS00 | 6:e919a1fd1eed | 192 | } |
GS00 | 6:e919a1fd1eed | 193 | } |
GS00 | 6:e919a1fd1eed | 194 | void Shape::Rotate(Gamepad &pad) |
GS00 | 6:e919a1fd1eed | 195 | { |
GS00 | 6:e919a1fd1eed | 196 | for(int i=1; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 197 | for(int j=1; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 198 | ArrayRotate[i-1][j-1]=ShapeInit[i][j]; |
GS00 | 6:e919a1fd1eed | 199 | } |
GS00 | 6:e919a1fd1eed | 200 | } |
GS00 | 6:e919a1fd1eed | 201 | int Temp; |
GS00 | 6:e919a1fd1eed | 202 | for (int i=0; i<2; i++) { |
GS00 | 6:e919a1fd1eed | 203 | for (int j=i; j<3-i; j++) { |
GS00 | 6:e919a1fd1eed | 204 | Temp=ArrayRotate[i][j]; |
GS00 | 6:e919a1fd1eed | 205 | ArrayRotate[i][j]=ArrayRotate[j][3-i]; |
GS00 | 6:e919a1fd1eed | 206 | ArrayRotate[j][3-i]=ArrayRotate[3-i][3-j]; |
GS00 | 6:e919a1fd1eed | 207 | ArrayRotate[3-i][3-j]=ArrayRotate[3-j][i]; |
GS00 | 6:e919a1fd1eed | 208 | ArrayRotate[3-j][i]=Temp; |
GS00 | 6:e919a1fd1eed | 209 | } |
GS00 | 6:e919a1fd1eed | 210 | } |
GS00 | 6:e919a1fd1eed | 211 | for(int i=1; i<5; i++) { |
GS00 | 6:e919a1fd1eed | 212 | for(int j=1; j<5; j++) { |
GS00 | 6:e919a1fd1eed | 213 | printf("%d\n",ArrayRotate[i][j]); |
GS00 | 6:e919a1fd1eed | 214 | } |
GS00 | 6:e919a1fd1eed | 215 | } |
GS00 | 6:e919a1fd1eed | 216 | if(pad.check_event(Gamepad::A_PRESSED) == true) { |
GS00 | 6:e919a1fd1eed | 217 | for(int i=0; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 218 | for(int j=0; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 219 | ShapeInit[i][j]=0; |
GS00 | 6:e919a1fd1eed | 220 | } |
GS00 | 6:e919a1fd1eed | 221 | } |
GS00 | 6:e919a1fd1eed | 222 | for(int i=0; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 223 | for(int j=0; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 224 | ShapeInit[i+1][j+1]=ArrayRotate[i][j]; |
GS00 | 6:e919a1fd1eed | 225 | } |
GS00 | 6:e919a1fd1eed | 226 | } |
GS00 | 6:e919a1fd1eed | 227 | } |
GS00 | 6:e919a1fd1eed | 228 | } |
GS00 | 3:9dd35424cdfe | 229 | |
GS00 | 6:e919a1fd1eed | 230 | void Shape::Update(Gamepad &pad) |
GS00 | 0:444b4d0a113d | 231 | { |
GS00 | 3:9dd35424cdfe | 232 | int n=14; |
GS00 | 6:e919a1fd1eed | 233 | for(int i=1; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 234 | for(int j=1; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 235 | ArrayRotate[i-1][j-1]=ShapeInit[i][j]; |
GS00 | 6:e919a1fd1eed | 236 | } |
GS00 | 6:e919a1fd1eed | 237 | } |
GS00 | 6:e919a1fd1eed | 238 | int Temp; |
GS00 | 6:e919a1fd1eed | 239 | for (int i=0; i<2; i++) { |
GS00 | 6:e919a1fd1eed | 240 | for (int j=i; j<3-i; j++) { |
GS00 | 6:e919a1fd1eed | 241 | Temp=ArrayRotate[i][j]; |
GS00 | 6:e919a1fd1eed | 242 | ArrayRotate[i][j]=ArrayRotate[j][3-i]; |
GS00 | 6:e919a1fd1eed | 243 | ArrayRotate[j][3-i]=ArrayRotate[3-i][3-j]; |
GS00 | 6:e919a1fd1eed | 244 | ArrayRotate[3-i][3-j]=ArrayRotate[3-j][i]; |
GS00 | 6:e919a1fd1eed | 245 | ArrayRotate[3-j][i]=Temp; |
GS00 | 6:e919a1fd1eed | 246 | } |
GS00 | 6:e919a1fd1eed | 247 | } |
GS00 | 6:e919a1fd1eed | 248 | for(int i=1; i<5; i++) { |
GS00 | 6:e919a1fd1eed | 249 | for(int j=1; j<5; j++) { |
GS00 | 6:e919a1fd1eed | 250 | printf("%d\n",ArrayRotate[i][j]); |
GS00 | 6:e919a1fd1eed | 251 | } |
GS00 | 6:e919a1fd1eed | 252 | } |
GS00 | 6:e919a1fd1eed | 253 | if(pad.check_event(Gamepad::A_PRESSED) == true) { |
GS00 | 6:e919a1fd1eed | 254 | for(int i=0; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 255 | for(int j=0; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 256 | ShapeInit[i][j]=0; |
GS00 | 6:e919a1fd1eed | 257 | } |
GS00 | 6:e919a1fd1eed | 258 | } |
GS00 | 6:e919a1fd1eed | 259 | for(int i=0; i<84; i++) { |
GS00 | 6:e919a1fd1eed | 260 | for(int j=0; j<48; j++) { |
GS00 | 6:e919a1fd1eed | 261 | ShapeInit[i+1][j+1]=ArrayRotate[i][j]; |
GS00 | 6:e919a1fd1eed | 262 | } |
GS00 | 6:e919a1fd1eed | 263 | } |
GS00 | 6:e919a1fd1eed | 264 | } |
GS00 | 5:afa6592a4ba5 | 265 | |
GS00 | 3:9dd35424cdfe | 266 | ShapeArray[x+n][y]=0; |
GS00 | 3:9dd35424cdfe | 267 | ShapeArray[x+1+n][y]=0; |
GS00 | 3:9dd35424cdfe | 268 | ShapeArray[x+2+n][y]=0; |
GS00 | 3:9dd35424cdfe | 269 | ShapeArray[x+3+n][y]=0; |
GS00 | 3:9dd35424cdfe | 270 | ShapeArray[x+4+n][y]=0; |
GS00 | 3:9dd35424cdfe | 271 | ShapeArray[x+5+n][y]=0; |
GS00 | 3:9dd35424cdfe | 272 | |
GS00 | 3:9dd35424cdfe | 273 | ShapeArray[x+n][y+1]=0; |
GS00 | 5:afa6592a4ba5 | 274 | ShapeArray[x+5+n][y+1]=0; |
GS00 | 5:afa6592a4ba5 | 275 | |
GS00 | 5:afa6592a4ba5 | 276 | ShapeArray[x+n][y+2]=0; |
GS00 | 5:afa6592a4ba5 | 277 | ShapeArray[x+5+n][y+2]=0; |
GS00 | 5:afa6592a4ba5 | 278 | |
GS00 | 5:afa6592a4ba5 | 279 | ShapeArray[x+n][y+3]=0; |
GS00 | 5:afa6592a4ba5 | 280 | ShapeArray[x+5+n][y+3]=0; |
GS00 | 5:afa6592a4ba5 | 281 | |
GS00 | 5:afa6592a4ba5 | 282 | ShapeArray[x+n][y+4]=0; |
GS00 | 5:afa6592a4ba5 | 283 | ShapeArray[x+5+n][y+4]=0; |
GS00 | 5:afa6592a4ba5 | 284 | |
GS00 | 3:9dd35424cdfe | 285 | ShapeArray[x+1+n][y+1]=ShapeInit[l+1][k+1]; |
GS00 | 3:9dd35424cdfe | 286 | ShapeArray[x+2+n][y+1]=ShapeInit[l+2][k+1]; |
GS00 | 3:9dd35424cdfe | 287 | ShapeArray[x+3+n][y+1]=ShapeInit[l+3][k+1]; |
GS00 | 6:e919a1fd1eed | 288 | ShapeArray[x+4+n][y+1]=ShapeInit[l+4][k+1]; |
GS00 | 3:9dd35424cdfe | 289 | |
GS00 | 3:9dd35424cdfe | 290 | ShapeArray[x+1+n][y+2]=ShapeInit[l+1][k+2]; |
GS00 | 3:9dd35424cdfe | 291 | ShapeArray[x+2+n][y+2]=ShapeInit[l+2][k+2]; |
GS00 | 3:9dd35424cdfe | 292 | ShapeArray[x+3+n][y+2]=ShapeInit[l+3][k+2]; |
GS00 | 3:9dd35424cdfe | 293 | ShapeArray[x+4+n][y+2]=ShapeInit[l+4][k+2]; |
GS00 | 3:9dd35424cdfe | 294 | |
GS00 | 3:9dd35424cdfe | 295 | ShapeArray[x+1+n][y+3]=ShapeInit[l+1][k+3]; |
GS00 | 3:9dd35424cdfe | 296 | ShapeArray[x+2+n][y+3]=ShapeInit[l+2][k+3]; |
GS00 | 3:9dd35424cdfe | 297 | ShapeArray[x+3+n][y+3]=ShapeInit[l+3][k+3]; |
GS00 | 3:9dd35424cdfe | 298 | ShapeArray[x+4+n][y+3]=ShapeInit[l+4][k+3]; |
GS00 | 3:9dd35424cdfe | 299 | |
GS00 | 3:9dd35424cdfe | 300 | ShapeArray[x+1+n][y+4]=ShapeInit[l+1][k+4]; |
GS00 | 3:9dd35424cdfe | 301 | ShapeArray[x+2+n][y+4]=ShapeInit[l+2][k+4]; |
GS00 | 3:9dd35424cdfe | 302 | ShapeArray[x+3+n][y+4]=ShapeInit[l+3][k+4]; |
GS00 | 3:9dd35424cdfe | 303 | ShapeArray[x+4+n][y+4]=ShapeInit[l+4][k+4]; |
GS00 | 5:afa6592a4ba5 | 304 | |
GS00 | 0:444b4d0a113d | 305 | } |
GS00 | 0:444b4d0a113d | 306 | |
GS00 | 6:e919a1fd1eed | 307 | void Shape::ShapePicker() |
GS00 | 6:e919a1fd1eed | 308 | { |
GS00 | 6:e919a1fd1eed | 309 | t=time(NULL); |
GS00 | 6:e919a1fd1eed | 310 | srand(t); |
GS00 | 6:e919a1fd1eed | 311 | |
GS00 | 6:e919a1fd1eed | 312 | if(New==0) { |
GS00 | 6:e919a1fd1eed | 313 | New=1; |
GS00 | 6:e919a1fd1eed | 314 | RandomNumber=rand()%7; |
GS00 | 6:e919a1fd1eed | 315 | } |
GS00 | 6:e919a1fd1eed | 316 | |
GS00 | 6:e919a1fd1eed | 317 | if(RandomNumber==0) { |
GS00 | 6:e919a1fd1eed | 318 | T_Shape(); |
GS00 | 6:e919a1fd1eed | 319 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 320 | } else if(RandomNumber==1) { |
GS00 | 6:e919a1fd1eed | 321 | J_Shape(); |
GS00 | 6:e919a1fd1eed | 322 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 323 | } else if(RandomNumber==2) { |
GS00 | 6:e919a1fd1eed | 324 | L_Shape(); |
GS00 | 6:e919a1fd1eed | 325 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 326 | } else if(RandomNumber==3) { |
GS00 | 6:e919a1fd1eed | 327 | O_Shape(); |
GS00 | 6:e919a1fd1eed | 328 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 329 | } else if(RandomNumber==4) { |
GS00 | 6:e919a1fd1eed | 330 | I_Shape(); |
GS00 | 6:e919a1fd1eed | 331 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 332 | } else if(RandomNumber==5) { |
GS00 | 6:e919a1fd1eed | 333 | S_Shape(); |
GS00 | 6:e919a1fd1eed | 334 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 335 | } else if(RandomNumber==6) { |
GS00 | 6:e919a1fd1eed | 336 | Z_Shape(); |
GS00 | 6:e919a1fd1eed | 337 | RandomNumber=10; |
GS00 | 6:e919a1fd1eed | 338 | } |
GS00 | 6:e919a1fd1eed | 339 | } |
GS00 | 0:444b4d0a113d | 340 | |
GS00 | 3:9dd35424cdfe | 341 | |
GS00 | 3:9dd35424cdfe | 342 | |
GS00 | 3:9dd35424cdfe | 343 | |
GS00 | 3:9dd35424cdfe | 344 | |
GS00 | 3:9dd35424cdfe | 345 | |
GS00 | 3:9dd35424cdfe | 346 | |
GS00 | 3:9dd35424cdfe | 347 | |
GS00 | 6:e919a1fd1eed | 348 | |
GS00 | 6:e919a1fd1eed | 349 |