var press = jQuery.Event("keydown");
press.which = 32; // # The 'SPACE BAR' key code value
press.keyCode = 32;
$('#btn').click( function() {
$('#testInput').focus();
$(document).trigger(press);
console.info(press);
});In addition, to insure that the keypress event was occuring, I added the following:
$(document).on('keydown', function(event) {
alert(event.keyCode);
});
I get an alert with the correct keypress code but no reaction from melonJS. Is there a better way to pass this keypress event to Melon? Would it be better to give melonJS focus somehow?did you somewhere (initialization code) do something like this :// initialize keyboard eventsme.input.bindKey(me.input.KEY.SPACE, "some actio name");// map the touch event on the X keyme.input.bindTouch(me.input.SPACE);
Things work much much better with CocoonJS. I recommend trying that. Don't bother with a pure HTML game on mobile. Not yet, anyway.
Side note: web audio API may be better on iOS 6. I haven't tried it.