Skip to content

This repository features a fun and engaging Tetris game built for the LilyGO T-Display S3, utilizing the ESP32-S3 microcontroller and the TFT_eSPI library for colorful, retro-style graphics rendering on embedded devices. If you like it, leave a star. Have fun!

License

Notifications You must be signed in to change notification settings

zamweis/t-display-s3-tetris

Repository files navigation

T-Display S3 Tetris

A Tetris game implementation for the T-Display S3 device using the PlatformIO environment and the ESP32-S3 microcontroller. This project utilizes the TFT_eSPI library to handle display rendering and features an interactive Tetris experience.

Table of Contents

Description

This project implements a classic Tetris game on the LilyGO T-Display S3 device. It leverages the ESP32-S3's processing capabilities and the TFT_eSPI library for graphics display. This is a hobby project aimed at demonstrating game development and graphics rendering capabilities for embedded devices, with the main goal being to have fun and spark interest in creating engaging projects on microcontrollers.

Screenshot

Screenshot of the Project

Features

  • Tetris game logic and block handling
  • Interactive graphical interface using the TFT_eSPI library
  • Multiple Tetris shapes and their rotation mechanisms
  • Collision detection and line clearing logic
  • User input handling (buttons or touch interactions)
  • Highscores
  • Navigationbar

Prerequisites

Note on ESP Compatibility

This project is compatible with any ESP device that supports the TFT_eSPI library, making it flexible for other displays and ESP boards. Simply adjust the display's dimensions.

Installation

  1. Clone the repository:

    git clone https://github.com/zamweis/t-display-s3-tetris.git
    cd t-display-s3-tetris
  2. Install the necessary dependencies using PlatformIO:

    pio lib install
  3. Ensure that your board is correctly configured in platformio.ini.

Configuring the TFT_eSPI Library

To use the TFT display correctly, you need to configure the User_Setup.h file in the TFT_eSPI library:

  • Uncomment the appropriate lines that correspond to your display model and connection setup in User_Setup.h.
  • For example, if using a parallel connection or a specific display model, make sure that the configuration matches your hardware setup.

Refer to the TFT_eSPI documentation for more details on configuring the display settings.

Building and Uploading

  1. Open the project folder in PlatformIO or VS Code with the PlatformIO extension installed.

  2. Connect your T-Display S3 device via USB.

  3. To build and upload the firmware to your device:

    pio run --target upload

Folder Structure

.
├── src/
│   ├── Config.cpp              # Configuration source file.
│   ├── Config.h                # Configuration constants and macros.
│   ├── main.cpp                # Entry point for the application.
│   ├── Display/
│   │   ├── DisplayManager.cpp  # Implementation of display management.
│   │   └── DisplayManager.h    # Header for display-related functionalities.
│   ├── Game/
│   │   ├── BlockMap.cpp        # Game grid management implementation.
│   │   ├── BlockMap.h          # Game grid management header.
│   │   ├── Game.cpp            # Main game logic implementation.
│   │   ├── Game.h              # Header for core game logic.
│   │   ├── ShapeFactory.cpp    # Shape creation implementation.
│   │   └── ShapeFactory.h      # Header for shape creation.
│   ├── HighScore/
│   │   ├── HighScoreManager.cpp # High score management implementation.
│   │   └── HighScoreManager.h   # Header for high score management.
│   ├── Input/
│   │   ├── InputHandler.cpp    # Implementation of input handling.
│   │   └── InputHandler.h      # Header for input handling.
│   └── Model/
│       ├── Block.cpp           # Block model implementation.
│       ├── Block.h             # Header for block model.
│       ├── Point.cpp           # Point model implementation.
│       ├── Point.h             # Header for point model.
│       └── Shapes/
│           ├── Shape.cpp       # Base shape implementation.
│           ├── Shape.h         # Header for base shape.
│           ├── ShapeI.cpp      # Specific shape implementation (I).
│           ├── ShapeI.h        # Header for shape (I).
│           ├── ShapeJ.cpp      # Specific shape implementation (J).
│           ├── ShapeJ.h        # Header for shape (J).
│           ├── ShapeL.cpp      # Specific shape implementation (L).
│           ├── ShapeL.h        # Header for shape (L).
│           ├── ShapeO.cpp      # Specific shape implementation (O).
│           ├── ShapeO.h        # Header for shape (O).
│           ├── ShapeS.cpp      # Specific shape implementation (S).
│           ├── ShapeS.h        # Header for shape (S).
│           ├── ShapeT.cpp      # Specific shape implementation (T).
│           ├── ShapeT.h        # Header for shape (T).
│           ├── ShapeZ.cpp      # Specific shape implementation (Z).
│           └── ShapeZ.h        # Header for shape (Z).

Contributing

Contributions are welcome! Please see the CONTRIBUTING file for guidelines on how to get started.

Security

For information on reporting security vulnerabilities, please see the SECURITY file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This repository features a fun and engaging Tetris game built for the LilyGO T-Display S3, utilizing the ESP32-S3 microcontroller and the TFT_eSPI library for colorful, retro-style graphics rendering on embedded devices. If you like it, leave a star. Have fun!

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages