| 29 |
var canvas = document.createElement("canvas"); |
var canvas = document.createElement("canvas"); |
| 30 |
canvas.width = width; |
canvas.width = width; |
| 31 |
canvas.height = height; |
canvas.height = height; |
| 32 |
|
if("imageSmoothingEnabled" in window) { |
| 33 |
|
var browser = JGUtil.getBrowser(); |
| 34 |
|
if(browser.opera) { |
| 35 |
|
canvas.style["imageRendering"] = "-o-crisp-edges"; |
| 36 |
|
} else { |
| 37 |
|
if(browser.msie) { |
| 38 |
|
canvas.style["msInterpolationMode"] = "nearest-neighbor"; |
| 39 |
|
} else { |
| 40 |
|
if(browser.safari) { |
| 41 |
|
canvas.style["imageRendering"] = "-webkit-optimize-contrast"; |
| 42 |
|
} |
| 43 |
|
} |
| 44 |
|
} |
| 45 |
|
var context = canvas.getContext("2d"); |
| 46 |
|
if(context["imageSmoothingEnabled"]) { |
| 47 |
|
context["imageSmoothingEnabled"] = false; |
| 48 |
|
} |
| 49 |
|
if(context["webkitImageSmoothingEnabled"]) { |
| 50 |
|
context["webkitImageSmoothingEnabled"] = false; |
| 51 |
|
} |
| 52 |
|
if(context["mozImageSmoothingEnabled"]) { |
| 53 |
|
context["mozImageSmoothingEnabled"] = false; |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
return canvas; |
return canvas; |
| 57 |
}; |
}; |
| 58 |
var Angle; |
var Angle; |
| 1058 |
this.width = width; |
this.width = width; |
| 1059 |
this.height = height; |
this.height = height; |
| 1060 |
this.image = image; |
this.image = image; |
| 1061 |
|
this.image.style["image-rendering"] = "-o-crisp-edges"; |
| 1062 |
this.sep = Math.floor(this.image.width / this.width); |
this.sep = Math.floor(this.image.width / this.width); |
| 1063 |
this.frame = [ |
this.frame = [ |
| 1064 |
0 |
0 |
| 2139 |
this.preload(param); |
this.preload(param); |
| 2140 |
}; |
}; |
| 2141 |
Game.prototype.preload = function (ary, loadingScene) { |
Game.prototype.preload = function (ary, loadingScene) { |
| 2142 |
for(var i in ary) { |
if(ary instanceof Array) { |
| 2143 |
this.resource.load(i, ary[i]); |
for(var i = 0; i < ary.length; i++) { |
| 2144 |
|
this.resource.load(ary[i], ary[i]); |
| 2145 |
|
} |
| 2146 |
|
} else { |
| 2147 |
|
if(typeof ary == "string") { |
| 2148 |
|
var hasLoadingScene = false; |
| 2149 |
|
for(var i = 0; i < arguments.length; i++) { |
| 2150 |
|
if(typeof arguments[i] != "string") { |
| 2151 |
|
loadingScene = arguments[i]; |
| 2152 |
|
hasLoadingScene = true; |
| 2153 |
|
} else { |
| 2154 |
|
this.resource.load(arguments[i], arguments[i]); |
| 2155 |
|
} |
| 2156 |
|
} |
| 2157 |
|
if(!hasLoadingScene) { |
| 2158 |
|
loadingScene = new LoadingScene(this, this.resource); |
| 2159 |
|
} |
| 2160 |
|
} else { |
| 2161 |
|
for(var i in ary) { |
| 2162 |
|
this.resource.load(i, ary[i]); |
| 2163 |
|
} |
| 2164 |
|
} |
| 2165 |
} |
} |
| 2166 |
if(!loadingScene) { |
if(!loadingScene) { |
| 2167 |
loadingScene = new LoadingScene(this, this.resource); |
loadingScene = new LoadingScene(this, this.resource); |
| 3196 |
var context = canvas.getContext("2d"); |
var context = canvas.getContext("2d"); |
| 3197 |
return context.createPattern(image, repeat == undefined ? "repeat" : repeat); |
return context.createPattern(image, repeat == undefined ? "repeat" : repeat); |
| 3198 |
} |
} |
| 3199 |
|
JGUtil.browser = null; |
| 3200 |
|
JGUtil.getBrowser = function getBrowser() { |
| 3201 |
|
if(JGUtil.browser) { |
| 3202 |
|
return JGUtil.browser; |
| 3203 |
|
} |
| 3204 |
|
var ua = navigator.userAgent.toLowerCase(); |
| 3205 |
|
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || []; |
| 3206 |
|
var ret = { |
| 3207 |
|
}; |
| 3208 |
|
if(match[1]) { |
| 3209 |
|
ret[match[1]] = true; |
| 3210 |
|
ret["version"] = match[2]; |
| 3211 |
|
} |
| 3212 |
|
if(ret.chrome) { |
| 3213 |
|
ret.webkit = true; |
| 3214 |
|
} else { |
| 3215 |
|
if(ret.webkit) { |
| 3216 |
|
ret.safari = true; |
| 3217 |
|
} |
| 3218 |
|
} |
| 3219 |
|
JGUtil.browser = ret; |
| 3220 |
|
return ret; |
| 3221 |
|
} |
| 3222 |
|
JGUtil.setCrispEdges = function setCrispEdges(game, crispEdges) { |
| 3223 |
|
if(crispEdges) { |
| 3224 |
|
window["imageSmoothingEnabled"] = crispEdges; |
| 3225 |
|
} else { |
| 3226 |
|
delete window["imageSmoothingEnabled"]; |
| 3227 |
|
} |
| 3228 |
|
game.refresh(); |
| 3229 |
|
} |
| 3230 |
return JGUtil; |
return JGUtil; |
| 3231 |
})(); |
})(); |
| 3232 |
var Line = (function (_super) { |
var Line = (function (_super) { |