This is an implementation of Tetris following the official Tetris Design Guideline as closely as possible. It is written with modern C++ and OpenGL.
I was hesitating between using a deque
and a vector
of arrays for the mino grid. Even
if a lot of push and pop operations are needed, I thought maybe iterating through the
grid every frame could make vector
faster because of memory being contiguous. I ended
up making a benchmark to compare, and it turned out
deque
is better.
At first, I was refering to time using std::milliseconds
. However, the engine ended up being too fast for this, so
I had to go with std::nanoseconds