Skip to content

Pong - 2D Game Example

Similar to the balls example, this example uses twr-wasm's 2D Draw API and a C++ canvas class to run a simple game of singleplayer Pong.

The Pong example demonstrates

  • C++
  • Using twr-wasm draw 2D APIs that match Javascript Canvas APIs.
  • Using the twr-wasm canvas.cpp class.
  • Taking in Javascript events as user input

This example does not use libc++, which results in smaller code size. For an example that uses libc++ see tests-libcxx.

Screen Grab of Pong Example