This project is an implementation of the classic Tetris game written in C, compiled to WebAssembly (Wasm) to run in a web browser. The goal of this project is to provide a Tetris game engine that can be easily integrated into a React application using the generated JavaScript module.
- Classic Tetris gameplay with falling blocks.
- Keyboard controls for movement and rotation.
- Game over detection.
To build the WebAssembly module from the C source code, follow these steps:
-
Clone this repository:
git clone https://github.com/yourusername/tetris-c-wasm.git
-
Navigate to the project directory:
cd tetris-game/src
-
Compile the C code to WebAssembly using Emscripten (ensure you have Emscripten installed):
emcc tetris.c -o tetris.js
This command will generate
tetris.js
andtetris.wasm
files.
Integrating into a React Application In the future, the project will be upgraded by enhancing the Tetris game's features, adding high scores, or implementing multiplayer functionality.