Created
June 24, 2014 22:28
-
-
Save arcanis/e508860ca3dbdce19e8b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startEmulator = function (rom) { | |
var engine = Virtjs.create(Virtjs.engine.GameBoy, { | |
devices : { | |
screen : new Virtjs.screen.WebGL(), | |
input : new Virtjs.input.Keyboard({ map : map }), | |
timer : new Virtjs.timer.RAFrame(), | |
data : new Virtjs.data.LocalStorage() | |
}, | |
skipBios : true | |
}).load(rom); | |
document.body.appendChild(engine.devices.screen.canvas); | |
}; | |
( function ( ) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', 'http://example.org/tetris.gb', true); | |
xhr.responseType = 'arraybuffer'; | |
xhr.addEventListener('load', function () { | |
startEmulator(xhr.response); }); | |
xhr.send(null); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment