From 0baa7ebefb4b504da4d125aab55e96e7f2c5a87e Mon Sep 17 00:00:00 2001 From: Julian Date: Fri, 9 Nov 2018 18:30:47 +0100 Subject: Testris works very well --- sprites.h | 186 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 111 insertions(+), 75 deletions(-) (limited to 'sprites.h') diff --git a/sprites.h b/sprites.h index 3b53d47..41dd785 100644 --- a/sprites.h +++ b/sprites.h @@ -1,156 +1,192 @@ #ifndef sprites #define sprites +#include +#include + struct Sprite { - uint8_t buff[8]; + uint8_t buff[4]; uint8_t width; uint8_t height; + struct Sprite *rotateNext; }; -const Sprite smiley = { - { - 0b11001100, - 0b11001100, - 0b00000000, - 0b00110000, - 0b10000000, - 0b11111100, - 0b00000000, - 0b00000000 - }, 6, 6 -}; -const Sprite checker = { - { - 0b10101010, - 0b01010101, - 0b10101010, - 0b01010101, - 0b10101010, - 0b01010101, - 0b10101010, - 0b01010101 - }, 8, 8 -}; -const Sprite ball = { +struct Sprite ball = { { 0b11100000, 0b10100000, 0b11100000, 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000 - }, 3, 3 + }, 3, 3, NULL }; -const Sprite miniSmiley = { + +struct Sprite iBlock = { { - 0b01010000, - 0b10000000, 0b11110000, 0b00000000, 0b00000000, 0b00000000, - 0b00000000, - 0b00000000 - }, 4, 3 + }, 4, 1, NULL }; - - -const Sprite iBlock = { +struct Sprite iBlockR = { { - 0b11110000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000 - }, 4, 1 + 0b10000000, + 0b10000000, + 0b10000000, + 0b10000000, + }, 1, 4, NULL }; -const Sprite oBlock = { + +struct Sprite oBlock = { { 0b11000000, 0b11000000, 0b00000000, 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000 - }, 2, 2 + }, 2, 2, NULL }; -const Sprite tBlock = { +struct Sprite tBlock = { { 0b01000000, 0b11100000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite tBlockR = { + { + 0b10000000, + 0b11000000, + 0b10000000, 0b00000000, + }, 2, 3, NULL +}; +struct Sprite tBlockD = { + { + 0b11100000, + 0b01000000, 0b00000000, 0b00000000, - 0b00000000 - }, 3, 2 + }, 3, 2, NULL }; +struct Sprite tBlockL = { + { + 0b01000000, + 0b11000000, + 0b01000000, + 0b00000000, + }, 2, 3, NULL +}; + -const Sprite sBlock = { +struct Sprite sBlock = { { 0b01100000, 0b11000000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite sBlockR = { + { + 0b10000000, + 0b11000000, + 0b01000000, 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000 - }, 3, 2 + }, 2, 3, NULL }; -const Sprite zBlock = { +struct Sprite zBlock = { { 0b11000000, 0b01100000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite zBlockR = { + { + 0b01000000, + 0b11000000, + 0b10000000, 0b00000000, - 0b00000000, - 0b00000000, - 0b00000000 - }, 3, 2 + }, 2, 3, NULL }; -const Sprite jBlock = { + +// JBLOCk +struct Sprite jBlock = { { 0b10000000, 0b11100000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite jBlockR = { + { + 0b11000000, + 0b10000000, + 0b10000000, 0b00000000, + }, 2, 3, NULL +}; +struct Sprite jBlockD = { + { + 0b11100000, + 0b00100000, 0b00000000, 0b00000000, - 0b00000000 - }, 3, 2 + }, 3, 2, NULL +}; +struct Sprite jBlockL = { + { + 0b01000000, + 0b01000000, + 0b11000000, + 0b00000000, + }, 2, 3, NULL }; -const Sprite lBlock = { +//Lblock +struct Sprite lBlock = { { 0b00100000, 0b11100000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite lBlockR = { + { + 0b10000000, + 0b10000000, + 0b11000000, + 0b00000000, + }, 2, 3, NULL +}; +struct Sprite lBlockD = { + { + 0b11100000, + 0b10000000, 0b00000000, 0b00000000, + }, 3, 2, NULL +}; +struct Sprite lBlockL = { + { + 0b11000000, + 0b01000000, + 0b01000000, 0b00000000, - 0b00000000 - }, 3, 2 + }, 3, 2, NULL }; -const Sprite *blocks[] = { &iBlock, &oBlock, &tBlock, &sBlock, &zBlock, &jBlock, &lBlock }; +struct Sprite *blocks[] = { &iBlock, &oBlock, &tBlock, &sBlock, &zBlock, &jBlock, &lBlock }; #endif -- cgit v1.2.3