Su 200943147
Dependencies: Gamepad N5110 mbed
Shape/Shape.cpp@1:4f00a4d5073c, 2017-04-17 (annotated)
- Committer:
- GS00
- Date:
- Mon Apr 17 15:37:35 2017 +0000
- Revision:
- 1:4f00a4d5073c
- Parent:
- 0:444b4d0a113d
version 2
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 | 0:444b4d0a113d | 4 | Shape::shape() |
GS00 | 0:444b4d0a113d | 5 | { |
GS00 | 0:444b4d0a113d | 6 | } |
GS00 | 0:444b4d0a113d | 7 | |
GS00 | 0:444b4d0a113d | 8 | void Shape::L_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 9 | { |
GS00 | 1:4f00a4d5073c | 10 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 11 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 12 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 13 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 14 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 15 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 16 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 17 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 18 | } |
GS00 | 0:444b4d0a113d | 19 | } |
GS00 | 0:444b4d0a113d | 20 | |
GS00 | 0:444b4d0a113d | 21 | void Shape::O_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 22 | { |
GS00 | 1:4f00a4d5073c | 23 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 24 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 25 | 0,1,1,1,1,0, |
GS00 | 1:4f00a4d5073c | 26 | 0,1,1,1,1,0, |
GS00 | 1:4f00a4d5073c | 27 | 0,1,1,1,1,0, |
GS00 | 1:4f00a4d5073c | 28 | 0,1,1,1,1,0, |
GS00 | 1:4f00a4d5073c | 29 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 30 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 31 | } |
GS00 | 0:444b4d0a113d | 32 | } |
GS00 | 0:444b4d0a113d | 33 | |
GS00 | 0:444b4d0a113d | 34 | void Shape::S_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 35 | { |
GS00 | 1:4f00a4d5073c | 36 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 37 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 38 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 39 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 40 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 41 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 42 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 43 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 44 | } |
GS00 | 0:444b4d0a113d | 45 | } |
GS00 | 0:444b4d0a113d | 46 | |
GS00 | 0:444b4d0a113d | 47 | void Shape::Z_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 48 | { |
GS00 | 1:4f00a4d5073c | 49 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 50 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 51 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 52 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 53 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 54 | 0,0,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 55 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 56 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 57 | } |
GS00 | 0:444b4d0a113d | 58 | } |
GS00 | 0:444b4d0a113d | 59 | void Shape::I_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 60 | { |
GS00 | 1:4f00a4d5073c | 61 | Array= {0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 62 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 63 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 64 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 65 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 66 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 67 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 68 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 69 | } |
GS00 | 0:444b4d0a113d | 70 | } |
GS00 | 0:444b4d0a113d | 71 | void Shape::J_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 72 | { |
GS00 | 1:4f00a4d5073c | 73 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 74 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 75 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 76 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 77 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 78 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 79 | 1,1,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 80 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 81 | } |
GS00 | 0:444b4d0a113d | 82 | } |
GS00 | 1:4f00a4d5073c | 83 | void Shape::T_Shape(N5110 &lcd) |
GS00 | 0:444b4d0a113d | 84 | { |
GS00 | 1:4f00a4d5073c | 85 | Array= {0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 86 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 87 | 1,1,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 88 | 1,1,1,1,1,1, |
GS00 | 1:4f00a4d5073c | 89 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 90 | 0,0,1,1,0,0, |
GS00 | 1:4f00a4d5073c | 91 | 0,0,0,0,0,0, |
GS00 | 1:4f00a4d5073c | 92 | 0,0,0,0,0,0 |
GS00 | 1:4f00a4d5073c | 93 | } |
GS00 | 0:444b4d0a113d | 94 | } |
GS00 | 0:444b4d0a113d | 95 | |
GS00 | 0:444b4d0a113d | 96 | |
GS00 | 0:444b4d0a113d | 97 | void Shape::Movement(Direction d,float mag) |
GS00 | 0:444b4d0a113d | 98 | { |
GS00 | 0:444b4d0a113d | 99 | float mag = joystick.get_mag(); |
GS00 | 0:444b4d0a113d | 100 | Direction d = joystick.get_direction(); |
GS00 | 1:4f00a4d5073c | 101 | |
GS00 | 0:444b4d0a113d | 102 | if(d == W) { |
GS00 | 0:444b4d0a113d | 103 | x-=mag*10; |
GS00 | 0:444b4d0a113d | 104 | } else if(d == E) { |
GS00 | 0:444b4d0a113d | 105 | x+=mag*10; |
GS00 | 0:444b4d0a113d | 106 | } |
GS00 | 0:444b4d0a113d | 107 | } |
GS00 | 0:444b4d0a113d | 108 | |
GS00 | 0:444b4d0a113d | 109 | void Shape::Drop() |
GS00 | 0:444b4d0a113d | 110 | { |
GS00 | 0:444b4d0a113d | 111 | y=y+1; |
GS00 | 0:444b4d0a113d | 112 | } |