0
我完成了JavaScript + html5畫布的基本引擎。非常簡陋。它適用於瀏覽器,但它不適用於iOS。HTML5的畫布+ Javascript代碼無法在iOS上工作
我是否使用過尚未在Safari Mobile上實現的功能? :(
http://bluecodestudio.com/kipos/gametest.html
我完成了JavaScript + html5畫布的基本引擎。非常簡陋。它適用於瀏覽器,但它不適用於iOS。HTML5的畫布+ Javascript代碼無法在iOS上工作
我是否使用過尚未在Safari Mobile上實現的功能? :(
http://bluecodestudio.com/kipos/gametest.html
在keyboardJS.init(),您使用的是你的事件回調的bind()方法。
document.addEventListener("keydown", this.keyIsDown.bind(this));
document.addEventListener("keyup", this.keyIsUp.bind(this));
Safari瀏覽器(包括移動Safari瀏覽器)不支持綁定( )方法,你需要提供一個polyfill:
/**
* Bind.js
* Copyright 2010, WebReflection
* License: http://www.opensource.org/licenses/mit-license.php
*/
if (Function.prototype.bind === null || Function.prototype.bind === undefined) {
Function.prototype.bind = (function (slice) {
// (C) WebReflection - Mit Style License
function bind(context) {
var self = this; // "trapped" function reference
// only if there is more than an argument
// we are interested into more complex operations
// this will speed up common bind creation
// avoiding useless slices over arguments
if (1 < arguments.length) {
// extra arguments to send by default
var $arguments = slice.call(arguments, 1);
return function() {
return self.apply(
context,
// thanks @kangax for this suggestion
arguments.length ?
// concat arguments with those received
$arguments.concat(slice.call(arguments)) :
// send just arguments, no concat, no slice
$arguments
);
};
}
// optimized callback
return function() {
// speed up when function is called without arguments
return arguments.length ? self.apply(context, arguments) : self.call(context);
};
}
// the named function
return bind;
} (Array.prototype.slice));
}
哦,先生!很多這個讚美!它完美的工作!:) –