#include <SPI.h>
#include <Grafx.h>
/*
Teensy3.x and Arduino's
You are using 4 wire SPI here, so:
MOSI: 11//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
MISO: 12//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
SCK: 13//Teensy3.x/Arduino UNO (for MEGA/DUE refere to arduino site)
ESP8266-----------------------------------
Use:
#define __CS 16 //(D0)
#define __DC 5 //(D1)
#define __RST 4 //(D2)
SCLK:D5
MOSI:D7
*/
#define __CS1 10
#define __DC 9
/*
Teensy 3.x can use: 2,6,10,15,20,21,22,23
Arduino's 8 bit: any
DUE: check arduino site
If you do not use reset, tie it to +3V3
*/
uint8_t errorCode = 0;
Grafx tft = Grafx(__CS1, __DC);
//////Paul Atreides
const byte paul_front_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x62,0x46,0x40,0x02,0x30,0x0c,0x39,0x9c,0x40,0x02,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x11,0x88,0x0e,0x70};
const byte paul_front_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x00,0x00,0x0c,0x30,0x00,0x00,0x06,0x00,0x09,0x90,0x0e,0x70,0x00,0x00};
const byte paul_front_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x08,0x10,0x10,0x08,0x20,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x2f,0xf4,0x39,0x9c,0x0d,0xb0,0x07,0xe0,0x36,0x6c,0x31,0x8c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x00,0x00,0x10,0x08,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00};
//front walk
const byte paul_front_walk_1_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x62,0x46,0x40,0x02,0x30,0x0c,0x39,0x9c,0x40,0x02,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x11,0xf8,0x0e,0x00};
const byte paul_front_walk_1_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x00,0x00,0x0c,0x30,0x00,0x00,0x06,0x00,0x09,0x90,0x0e,0x00,0x00,0x00};
const byte paul_front_walk_1_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x0b,0xd0,0x1e,0x78,0x2d,0xb4,0x1b,0xd8,0x05,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_walk_1_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x07,0xe0,0x0d,0xb0,0x0d,0xb0,0x0f,0xf0,0x06,0x60,0x33,0xcc,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_walk_1_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x00,0x00,0x10,0x08,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//front walk 2
const byte paul_front_walk_2_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x62,0x46,0x40,0x02,0x30,0x0c,0x39,0x9c,0x40,0x02,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x1f,0x88,0x00,0x70};
const byte paul_front_walk_2_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x00,0x00,0x0c,0x30,0x00,0x00,0x00,0x60,0x09,0x90,0x00,0x70,0x00,0x00};
const byte paul_front_walk_2_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x08,0x10,0x10,0x08,0x20,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_walk_2_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x07,0xe0,0x0d,0xb0,0x0d,0xb0,0x0f,0xf0,0x06,0x60,0x33,0xcc,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_front_walk_2_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x00,0x00,0x10,0x08,0x00,0x00,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//left
const byte paul_left_black[] PROGMEM = {16,16,
0x00,0x00,0x03,0xe0,0x04,0x10,0x08,0x08,0x10,0x04,0x10,0x04,0x14,0x04,0x10,0x08,0x10,0x10,0x08,0x60,0x07,0xe0,0x02,0x20,0x03,0x20,0x04,0xe0,0x04,0x20,0x03,0xc0};
const byte paul_left_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x03,0xc0,0x00,0x00};
const byte paul_left_brown[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x01,0xa0,0x06,0xd0,0x01,0x68,0x00,0xb0,0x00,0x58,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_left_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x0f,0x00,0x0b,0x00,0x0b,0x60,0x0f,0xe0,0x07,0x80,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_left_yellow[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x02,0x40,0x01,0x20,0x08,0x90,0x00,0x48,0x00,0xa0,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//rear
const byte paul_rear_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x60,0x06,0x40,0x02,0x20,0x04,0x3a,0x5c,0x49,0x92,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x11,0x88,0x0e,0x70};
const byte paul_rear_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x00,0x00,0x06,0x60,0x09,0x90,0x0e,0x70,0x00,0x00};
const byte paul_rear_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x0b,0xd0,0x1e,0x78,0x2d,0xb4,0x1b,0xd8,0x05,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0c,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x02,0x40,0x14,0x28,0x01,0x80,0x12,0x48,0x04,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//rear walk 1
const byte paul_rear_walk_1_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x60,0x06,0x40,0x02,0x20,0x04,0x3a,0x5c,0x49,0x92,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x11,0xf8,0x0e,0x00};
const byte paul_rear_walk_1_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x60,0x00,0x00,0x06,0x60,0x09,0x90,0x0e,0x00,0x00,0x00};
const byte paul_rear_walk_1_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x0b,0xd0,0x1e,0x78,0x2d,0xb4,0x1b,0xd8,0x05,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_walk_1_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x07,0xe0,0x0d,0xb0,0x0d,0xb0,0x0f,0xf0,0x06,0x60,0x33,0xcc,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_walk_1_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x02,0x40,0x14,0x28,0x01,0x80,0x12,0x48,0x04,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//rear walk 2
const byte paul_rear_walk_2_black[] PROGMEM = {16,16,
0x07,0xe0,0x08,0x10,0x10,0x08,0x20,0x04,0x20,0x04,0x20,0x04,0x60,0x06,0x40,0x02,0x20,0x04,0x3a,0x5c,0x49,0x92,0x4f,0xf2,0x39,0x9c,0x16,0x68,0x1f,0x88,0x00,0x70};
const byte paul_rear_walk_2_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x00,0x00,0x0c,0x30,0x00,0x00,0x00,0x60,0x09,0x90,0x00,0x70,0x00,0x00};
const byte paul_rear_walk_2_brown[] PROGMEM = {16,16,
0x00,0x00,0x06,0x60,0x0d,0xb0,0x17,0xe8,0x1d,0xb8,0x0b,0xd0,0x1e,0x78,0x2d,0xb4,0x1b,0xd8,0x05,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_walk_2_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0c,0x30,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_rear_walk_2_yellow[] PROGMEM = {16,16,
0x00,0x00,0x01,0x80,0x02,0x40,0x08,0x10,0x02,0x40,0x14,0x28,0x01,0x80,0x12,0x48,0x04,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//right
const byte paul_right_black[] PROGMEM = {16,16,
0x00,0x00,0x07,0xc0,0x08,0x20,0x10,0x10,0x20,0x08,0x20,0x08,0x20,0x28,0x10,0x08,0x08,0x08,0x06,0x10,0x07,0xe0,0x04,0x40,0x04,0xc0,0x07,0x20,0x04,0x20,0x03,0xc0};
const byte paul_right_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x03,0xc0,0x00,0x00};
const byte paul_right_brown[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x05,0x80,0x0b,0x60,0x16,0x80,0x0d,0x00,0x1a,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_right_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0xf0,0x00,0xd0,0x06,0xd0,0x07,0xf0,0x01,0xe0,0x00,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_right_yellow[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x02,0x40,0x04,0x80,0x09,0x10,0x12,0x00,0x05,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//walk left
const byte paul_walk_left_black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x03,0x80,0x0c,0x40,0x10,0x20,0x20,0x20,0x20,0x30,0x20,0x10,0x20,0x10,0x20,0x20,0x10,0xc0,0x0f,0xc0,0x3f,0x30,0x49,0x28,0x27,0xc8,0x1c,0x30};
const byte paul_walk_left_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x10,0x18,0x30,0x00,0x00};
const byte paul_walk_left_brown[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0a,0x80,0x01,0x40,0x0c,0x80,0x01,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_walk_left_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x12,0x00,0x16,0x00,0x1e,0xc0,0x1f,0xc0,0x0f,0x00,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,0x00};
const byte paul_walk_left_yellow[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x80,0x05,0x40,0x10,0x80,0x01,0x40,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//walk right
const byte paul_walk_right_black[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x01,0xc0,0x02,0x30,0x04,0x08,0x04,0x04,0x0c,0x04,0x08,0x04,0x08,0x04,0x04,0x04,0x03,0x08,0x03,0xf0,0x0c,0xfc,0x14,0x92,0x13,0xe4,0x0c,0x38};
const byte paul_walk_right_blue[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x6c,0x0c,0x18,0x00,0x00};
const byte paul_walk_right_brown[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x50,0x02,0x80,0x01,0x30,0x02,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte paul_walk_right_pink[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x48,0x00,0x68,0x03,0x78,0x03,0xf8,0x00,0xf0,0x00,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00};
const byte paul_walk_right_yellow[] PROGMEM = {16,16,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x02,0xa0,0x01,0x08,0x02,0x80,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const byte blank_square[] PROGMEM ={16,16,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,
B00000000,B00000000,};
const byte red_square[] PROGMEM ={16,16,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,};
const byte green_square[] PROGMEM ={16,16,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,};
const byte blue_square[] PROGMEM ={16,16,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,};
const byte yellow_square[] PROGMEM ={16,16,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,
B11111111,B11111111,};
const byte tilemap1[] PROGMEM = {22,17,
16,16,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,};
const byte tilemap2[] PROGMEM = {22,17,
16,16,
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,
0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,};
const byte *spritesheet1[] = {blank_square,green_square};
const byte *spritesheet2[] = {blank_square,blue_square};
const byte *spritesheet3[] = {blank_square,red_square};
const byte *spritesheet4[] = {blank_square,yellow_square};
int player_x = 160;
int player_y = 110;
int player_direction = 2;
int x=0,y=0;
void setup() {
Serial.begin(38400);
long unsigned debug_start = millis();
while (!Serial && ((millis() - debug_start) <= 5000));
Serial.println("serial ok, testing lib...");
tft.begin();
// tft.buttons.begin();
// tft.buttons.update();
tft.setFrameRate(62);
tft.persistence = false;
//the following it's mainly for Teensy
//it will help you to understand if you have choosed the
//wrong combination of pins!
errorCode = tft.getErrorCode();
if (errorCode != 0) {
Serial.print("Init error! ");
if (bitRead(errorCode, 0)) Serial.print("MOSI or SCLK pin mismach!\n");
if (bitRead(errorCode, 1)) Serial.print("CS or DC pin mismach!\n");
}
else {
Serial.println("Inited");
}
}
void loop(void) {
if(tft.updateAll()){
if (tft.buttons.repeat(BTN_RIGHT,2));//{x--;}
if (tft.buttons.repeat(BTN_LEFT,0));//{x++;}
if (tft.buttons.repeat(BTN_DOWN,3));//{y--;}
if (tft.buttons.repeat(BTN_UP,1));//{y++;}
if (tft.buttons.repeat(BTN_A,4));//{x--;}
if (tft.buttons.repeat(BTN_Y,7));//{x++;}
if (tft.buttons.repeat(BTN_B,5));//{y--;}
if (tft.buttons.repeat(BTN_X,6));//{y++;}
if (tft.buttons.repeat(BTN_L,8));//{x--;}
if (tft.buttons.repeat(BTN_R,9));//{x++;}
// tft.drawTilemap(22,17,tilemap1,spritesheet1, GREEN);
// tft.drawTilemap(22,17,tilemap2,spritesheet2, BLUE);
if(tft.buttons.repeat(BTN_L,8)){
tft.drawBitmap1(player_x, player_y,green_square,16,16,GREEN);}
if(tft.buttons.repeat(BTN_R,9)){
tft.drawBitmap1(player_x, player_y,blue_square,16,16,BLUE);}
if(tft.buttons.repeat(BTN_UP,1)){
tft.drawBitmap1(player_x, player_y,paul_rear_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_rear_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_rear_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_rear_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_rear_yellow,16,16,YELLOW);
player_direction = 1;}
// player_y = player_y - 1;}
// if(player_y <= 0){
// player_y = 0;}
if(tft.buttons.repeat(BTN_X,6)){
tft.drawBitmap1(player_x, player_y,paul_rear_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_rear_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_rear_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_rear_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_rear_yellow,16,16,YELLOW);
player_direction = 1;}
// player_y = player_y - 1;}
// if(player_y <= 0){
// player_y = 0;}
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
if(tft.buttons.repeat(BTN_DOWN,3)){
tft.drawBitmap1(player_x, player_y,paul_front_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_front_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_front_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_front_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_front_yellow,16,16,YELLOW);
player_direction = 2;}
// player_y = player_y + 1;}
// if(player_y >= 40){
// player_y = 40;}
if(tft.buttons.repeat(BTN_B,5)){
tft.drawBitmap1(player_x, player_y,paul_front_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_front_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_front_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_front_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_front_yellow,16,16,YELLOW);
player_direction = 2;}
// player_y = player_y + 1;}
// if(player_y >= 40){
// player_y = 40;}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
if(tft.buttons.repeat(BTN_LEFT,0)){
tft.drawBitmap1(player_x, player_y,paul_left_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_left_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_left_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_left_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_left_yellow,16,16,YELLOW);
player_direction = 3;}
// player_x = player_x + 1;}
// if(player_x >= 77){
// player_x = 77;}
if(tft.buttons.repeat(BTN_Y,7)){
tft.drawBitmap1(player_x, player_y,paul_left_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_left_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_left_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_left_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_left_yellow,16,16,YELLOW);
player_direction = 3;}
// player_x = player_x + 1;}
// if(player_x >= 77){
// player_x = 77;}
//////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
if(tft.buttons.repeat(BTN_RIGHT,2)){
tft.drawBitmap1(player_x, player_y,paul_right_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_right_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_right_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_right_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_right_yellow,16,16,YELLOW);
player_direction = 4;}
// player_x = player_x + 1;}
// if(player_x >= 77){
// player_x = 77;}
if(tft.buttons.repeat(BTN_A,4)){
tft.drawBitmap1(player_x, player_y,paul_right_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_right_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_right_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_right_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_right_yellow,16,16,YELLOW);
player_direction = 4;}
// player_x = player_x + 1;}
// if(player_x >= 77){
// player_x = 77;}
/////////////////////////////////////////////////////
////////////PLAYER DIRECTION/////////////
/////////////////////////////////////////////////////
if (player_direction == 1){
tft.drawBitmap1(player_x, player_y,paul_rear_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_rear_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_rear_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_rear_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_rear_yellow,16,16,YELLOW);
}
else if (player_direction == 2){
tft.drawBitmap1(player_x, player_y,paul_front_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_front_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_front_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_front_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_front_yellow,16,16,YELLOW);
}
else if (player_direction == 3){
tft.drawBitmap1(player_x, player_y,paul_left_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_left_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_left_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_left_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_left_yellow,16,16,YELLOW);
}
else if (player_direction == 4){
tft.drawBitmap1(player_x, player_y,paul_right_black,16,16,BLACK);
tft.drawBitmap1(player_x, player_y,paul_right_blue,16,16,BLUE);
tft.drawBitmap1(player_x, player_y,paul_right_brown,16,16,BROWN);
tft.drawBitmap1(player_x, player_y,paul_right_pink,16,16,PINK);
tft.drawBitmap1(player_x, player_y,paul_right_yellow,16,16,YELLOW);
}
}
}