mirror of
https://github.com/rjanicek/vice.js.git
synced 2025-06-18 16:45:35 -04:00
* added keyboard example
This commit is contained in:
parent
be32fb8472
commit
29196186dc
27
c64-keyboard.html
Normal file
27
c64-keyboard.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<body>
|
||||
<!-- the canvas *must not* have any border or padding, or mouse coords will be wrong -->
|
||||
<canvas id="canvas" style="border: 0px none;"></canvas>
|
||||
<p><button onmousedown="sendSpaceKeyPressedCode()" onmouseup="sendSpaceKeyReleasedCode()">space bar</button></p>
|
||||
<script type="text/javascript" >
|
||||
|
||||
var C64_SPACE_KEY_CODE = 32;
|
||||
|
||||
function sendSpaceKeyPressedCode() {
|
||||
Module.ccall('keyboard_key_pressed', 'undefined', ['number'], [C64_SPACE_KEY_CODE]);
|
||||
}
|
||||
|
||||
function sendSpaceKeyReleasedCode() {
|
||||
Module.ccall('keyboard_key_released', 'undefined', ['number'], [C64_SPACE_KEY_CODE]);
|
||||
}
|
||||
|
||||
var Module = {
|
||||
arguments: ['+sound'],
|
||||
canvas: document.getElementById('canvas'),
|
||||
};
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="js/x64.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user