In this chapter, we're taking a Tetris clone written in C++ and updating the code to integrate Emscripten and compile to Wasm/JS. The code base in its original form compiled to an executable utilizes SDL2 and can be loaded from the command line. In this section, we're going to briefly review what Tetris is, how to get the code (without having to write it from scratch), and how to get it running.
Overview of the game
What is Tetris?
In Tetris, the main objective of the game is to rotate and move pieces (Tetriminos) of various shapes within a playing field (well or matrix) to create a row of blocks without gaps. When a full row is created, it is deleted from the playing field and your score is increased by one. In...