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.
- Description
- Screenshot
- Features
- Prerequisites
- Installation
- Building and Uploading
- Folder Structure
- Contributing
- Security
- License
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.
- 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
- PlatformIO IDE (recommended for building and uploading)
- ESP32 Board Support
- TFT_eSPI Library
- LilyGO T-Display S3
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.
-
Clone the repository:
git clone https://github.com/zamweis/t-display-s3-tetris.git cd t-display-s3-tetris
-
Install the necessary dependencies using PlatformIO:
pio lib install
-
Ensure that your board is correctly configured in
platformio.ini
.
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.
-
Open the project folder in PlatformIO or VS Code with the PlatformIO extension installed.
-
Connect your T-Display S3 device via USB.
-
To build and upload the firmware to your device:
pio run --target upload
.
├── 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).
Contributions are welcome! Please see the CONTRIBUTING file for guidelines on how to get started.
For information on reporting security vulnerabilities, please see the SECURITY file.
This project is licensed under the MIT License. See the LICENSE file for details.