Skip to content

Instantly share code, notes, and snippets.

@arcanis
Created June 24, 2014 22:28
Show Gist options
  • Save arcanis/e508860ca3dbdce19e8b to your computer and use it in GitHub Desktop.
Save arcanis/e508860ca3dbdce19e8b to your computer and use it in GitHub Desktop.
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