Sample webassembly game of PONG

Attached is a VERY basic game of Pong written in Oxygene/WASM.

Really just a proof of concept based on my Oxygene/Wasm adventure so far… don’t get excited

  • Main game is oxygene/wasm
  • This adds a Canvas and hooks in the DOM keypress event
  • Timer is in javascript and calls back to wasm.
  • Canvas drawing etc is done in wasm

Just playing and thought it may be useful to share…

Pong.zip (732.4 KB)

5 Likes

very nice, thank you… as i understand from your sample i can load picture in this way… but i think there is a better way?

in html: (put < before img)
img id=“scream” width=“220” height=“277” src=“https://clipart.info/images/ccovers/1496184262Emoji-Png-Icon-Cowboy-Emoji-Png-large.png” alt=“The Scream”>

in program:
var img : dynamic;

img := WebAssembly.GetElementById(‘scream’);
ctx.drawImage(img, 10, 10);

1 Like