# Sample webassembly game of PONG

**URL:** https://talk.remobjects.com/t/sample-webassembly-game-of-pong/19346
**Category:** Oxygene
**Tags:** webassembly
**Created:** [May 5, 2019, 8:34am UTC](https://talk.remobjects.com/t/sample-webassembly-game-of-pong/19346 "2019-05-05T08:34:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![paul](https://talk.remobjects.com/user_avatar/talk.remobjects.com/paul/32/10125_2.png) [@paul](https://talk.remobjects.com/u/paul)
#### Post date: [May 5, 2019, 8:34am UTC](https://talk.remobjects.com/t/sample-webassembly-game-of-pong/19346/1 "2019-05-05T08:34:50Z")

</div>

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](https://talk.remobjects.com/uploads/default/original/2X/0/097d3544d23d057c732851e5c17bbbf334bce66f.zip) (732.4 KB)

---

<div class="post-metadata">

### Author: ![kostantinoson](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/k/cc9497/32.png) [@kostantinoson](https://talk.remobjects.com/u/kostantinoson)
#### Post date: [May 8, 2019, 7:06pm UTC](https://talk.remobjects.com/t/sample-webassembly-game-of-pong/19346/2 "2019-05-08T19:06:59Z")

</div>

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](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);
