update Tetris example jpg to data

This commit is contained in:
0x1abin
2018-03-19 18:20:44 +08:00
parent e628cf2ef2
commit 704046cf15
4 changed files with 1717 additions and 2001 deletions
+3 -1
View File
@@ -36,6 +36,7 @@ Block blocks[7] = {
{{{{-1,0},{0,0},{1,0},{0,-1}},{{0,-1},{0,0},{0,1},{-1,0}},
{{-1,0},{0,0},{1,0},{0,1}},{{0,-1},{0,0},{0,1},{1,0}}},4,7}
};
extern uint8_t tetris_img[];
//========================================================================
void setup(void) {
Serial.begin(115200); // SERIAL
@@ -53,7 +54,8 @@ void setup(void) {
make_block( 6, 0xF00F); // _DD,DD_ LIGHT GREEN
make_block( 7, 0xF8FC); // _D_,DDD PINK
//----------------------------------------------------------------------
M5.Lcd.drawJpgFile(SD, "/tetris.jpg"); // Load background from SD
// M5.Lcd.drawJpgFile(SD, "/tetris.jpg"); // Load background from SD
M5.Lcd.drawJpg(tetris_img, 34215); // Load background from file data
PutStartPos(); // Start Position
for (int i = 0; i < 4; ++i) screen[pos.X +
block.square[rot][i].X][pos.Y + block.square[rot][i].Y] = block.color;
File diff suppressed because it is too large Load Diff
-1999
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -14,7 +14,7 @@ file_size = os.path.getsize(in_name)
with open(in_name, 'rb') as infile:
with open(out_name, 'wb+') as outfile:
arrary_name = 'unsigned char ' + out_name[0:out_name.find('.')] + '[' +str(file_size)+'] = {\n'
arrary_name = 'const unsigned char ' + out_name[0:out_name.find('.')] + '[' +str(file_size)+'] = {\n'
outfile.write(arrary_name.encode('utf-8'))
while True:
data = infile.read(20)