aboutsummaryrefslogtreecommitdiff
path: root/tetromino.h
diff options
context:
space:
mode:
Diffstat (limited to 'tetromino.h')
-rw-r--r--tetromino.h207
1 files changed, 207 insertions, 0 deletions
diff --git a/tetromino.h b/tetromino.h
new file mode 100644
index 0000000..c0a33f0
--- /dev/null
+++ b/tetromino.h
@@ -0,0 +1,207 @@
+#define TETROMINO_WIDTH 4
+#define TETROMINO_HEIGHT 4
+#define TETROMINO_AREA (TETROMINO_HEIGHT*TETROMINO_WIDTH)
+/*
+struct tetromino {
+ char name;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+ unsigned int width;
+ unsigned int height;
+ char data[4][16];
+};*/
+
+struct piece
+{
+ struct colour *colour;
+ char (*bitmap)[4][4];
+ int type;
+ int rotation;
+};
+
+char tetromino_I[4][4][4] = {
+ {
+ {0,0,0,0},
+ {1,1,1,1},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,0,1,0},
+ {0,0,1,0},
+ {0,0,1,0},
+ {0,0,1,0}
+ },{
+ {0,0,0,0},
+ {0,0,0,0},
+ {1,1,1,1},
+ {0,0,0,0}
+ },{
+ {0,1,0,0},
+ {0,1,0,0},
+ {0,1,0,0},
+ {0,1,0,0}
+ }
+};
+
+
+char tetromino_J[4][4][4] = {
+ {
+ {1,0,0,0},
+ {1,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,1,0},
+ {0,1,0,0},
+ {0,1,0,0},
+ {0,0,0,0}
+ },{
+ {0,0,0,0},
+ {1,1,1,0},
+ {0,0,1,0},
+ {0,0,0,0}
+ },{
+ {0,1,0,0},
+ {0,1,0,0},
+ {1,1,0,0},
+ {0,0,0,0}
+ }
+};
+
+
+char tetromino_L[4][4][4] = {
+ {
+ {0,0,1,0},
+ {1,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,0,0},
+ {0,1,0,0},
+ {0,1,1,0},
+ {0,0,0,0}
+ },{
+ {0,0,0,0},
+ {1,1,1,0},
+ {1,0,0,0},
+ {0,0,0,0}
+ },{
+ {1,1,0,0},
+ {0,1,0,0},
+ {0,1,0,0},
+ {0,0,0,0}
+ }
+};
+
+
+char tetromino_O[4][4][4]= {
+ {
+ {0,1,1,0},
+ {0,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,1,0},
+ {0,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,1,0},
+ {0,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,1,0},
+ {0,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ }
+};
+
+
+char tetromino_S[4][4][4] = {
+ {
+ {0,1,1,0},
+ {1,1,0,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,1,0,0},
+ {0,1,1,0},
+ {0,0,1,0},
+ {0,0,0,0}
+ },{
+ {0,0,0,0},
+ {0,1,1,0},
+ {1,1,0,0},
+ {0,0,0,0}
+ },{
+ {1,0,0,0},
+ {1,1,0,0},
+ {0,1,0,0},
+ {0,0,0,0}
+ }
+};
+
+
+char tetromino_T[4][4][4] = {
+ {
+ {1,1,1,0},
+ {0,1,0,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,0,1,0},
+ {0,1,1,0},
+ {0,0,1,0},
+ {0,0,0,0}
+ },{
+ {0,0,0,0},
+ {0,1,0,0},
+ {1,1,1,0},
+ {0,0,0,0}
+ },{
+ {1,0,0,0},
+ {1,1,0,0},
+ {1,0,0,0},
+ {0,0,0,0}
+ }
+};
+
+char tetromino_Z[4][4][4] = {
+ {
+ {1,1,0,0},
+ {0,1,1,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ },{
+ {0,0,1,0},
+ {0,1,1,0},
+ {0,1,0,0},
+ {0,0,0,0}
+ },{
+ {0,0,0,0},
+ {1,1,0,0},
+ {0,1,1,0},
+ {0,0,0,0}
+ },{
+ {0,1,0,0},
+ {1,1,0,0},
+ {1,0,0,0},
+ {0,0,0,0}
+ }
+};
+
+
+
+
+char (*tetrominoes[])[4][4][4] = {
+ &tetromino_I,
+ &tetromino_J,
+ &tetromino_L,
+ &tetromino_O,
+ &tetromino_S,
+ &tetromino_T,
+ &tetromino_Z
+};