jbkim / T-Rex_TFT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Chrome Dinosaur game

This code was made on ESP-WROVER-KIT and using WROVER-KIT-LCD library. The DinoGame folder needs to be in Arduino's libraries folder. Aditional information about the project is here.

(some legal stuff) I do not own the rights to this game I just did this out of fun (/some legal stuff)

Porting to M5Stack

  • Change LCD pin definition in WROVER_KIT_LCD.cpp
#define WROVER_CS               14
#define WROVER_DC               27
#define WROVER_RST              33
#define WROVER_SCLK             18
#define WROVER_MOSI             23
#define WROVER_MISO             19
#define WROVER_BL               32
  • Change LCD width & height in WROVER_KIT_LCD.h
#define WROVER_WIDTH       320
#define WROVER_HEIGHT      240
  • Change button pin in T0Rex_TFT.ino
  pinMode(37, INPUT_PULLUP);  // Jump - Button C
  pinMode(39, INPUT_PULLUP);  // duck - Button A 
  • Commnent the Back light pin control at the end of WROVER_KIT_LCD::begin() function
void WROVER_KIT_LCD::begin(){
    _width  = WROVER_WIDTH;
    _height = WROVER_HEIGHT;

    pinMode(WROVER_DC, OUTPUT);
    digitalWrite(WROVER_DC, LOW);
    pinMode(WROVER_CS, OUTPUT);
    digitalWrite(WROVER_CS, HIGH);
    pinMode(WROVER_BL, OUTPUT);
    digitalWrite(WROVER_BL, WROVER_BL_OFF);

    SPI.begin(WROVER_SCLK, WROVER_MISO, WROVER_MOSI, -1);

    pinMode(WROVER_RST, OUTPUT);
    digitalWrite(WROVER_RST, HIGH);
    delay(100);
    digitalWrite(WROVER_RST, LOW);
    delay(100);
    digitalWrite(WROVER_RST, HIGH);
    delay(200);

    _id = readId();
    log_d("Display ID: 0x%06X", _id);

    startWrite();

    if(_id){
        writeInitData(st7789v_init_data);
    } else {
        writeInitData(ili9341_init_data);
    }

    writeCommand(WROVER_SLPOUT);
    delay(120);
    writeCommand(WROVER_DISPON);
    delay(120);

    endWrite();
    // Need to disable below for M5Stack
    // digitalWrite(WROVER_BL, WROVER_BL_ON);
}

https://twitter.com/i/status/1150028285474041856

About

License:MIT License


Languages

Language:C 98.5%Language:C++ 1.5%