Keyboard Controls
Movea, s, d
Rotateq, e

Technologies Used and Rationale

  • Rust
    • Similar reasoning as my other tic tac toe project
  • canvas2D [Switched to webgl]
    • Built-in way to draw in 2D in the browser
  • webgl
    • WebGL can also be used to draw in 2D and it allows you create programs that run on the GPU

What I learned

  • The gist of using canvas2D
  • Importing and using libraries in Rust, as well as reading Rust-y API docs

Implementation Notes

  • Built the same way as the tic tac toe project
  • I used nalgebra crate to represent the points of a tetromino as a matrix. Matrix multiplication has concepts that represent the translation and rotation of points. This was useful because I didn’t want to hard-code the tetrominos for all possible rotations.
  • I used webgl's GL_POINTS primitive and adjusted its gl_PointSize to draw individual blocks, instead of a loop of fillRect in canvas2D