Comparing version 0.6.5 to 0.6.6
@@ -172,31 +172,27 @@ /* | ||
var rel = Object.defineProperties({}, { | ||
'clone' : { | ||
value : function(obj) { | ||
obj = obj || {}, obj.x = this.x, obj.y = this.y; | ||
return obj; | ||
} | ||
}, | ||
'toString' : { | ||
value : function() { | ||
return (this.x | 0) + 'x' + (this.y | 0) + ' (' + this.abs + ')'; | ||
} | ||
}, | ||
'abs' : { | ||
value : Object.defineProperties({}, { | ||
'clone' : { | ||
value : function(obj) { | ||
obj = obj || {}, obj.x = this.x, obj.y = this.y; | ||
return obj; | ||
} | ||
}, | ||
'toString' : { | ||
value : function() { | ||
return (this.x | 0) + 'x' + (this.y | 0); | ||
} | ||
} | ||
}) | ||
} | ||
// TODO: define per mouse object with get-only x and y | ||
var rel = {}, abs = {}; | ||
defineValue(rel, 'clone', function(obj) { | ||
obj = obj || {}, obj.x = this.x, obj.y = this.y; | ||
return obj; | ||
}); | ||
defineValue(rel, 'toString', function() { | ||
return (this.x | 0) + 'x' + (this.y | 0) + ' (' + this.abs + ')'; | ||
}); | ||
defineValue(rel, 'abs', abs); | ||
defineValue(abs, 'clone', function(obj) { | ||
obj = obj || {}, obj.x = this.x, obj.y = this.y; | ||
return obj; | ||
}); | ||
defineValue(abs, 'toString', function() { | ||
return (this.x | 0) + 'x' + (this.y | 0); | ||
}); | ||
function defineValue(obj, name, value) { | ||
Object.defineProperty(obj, name, { | ||
value : value | ||
}); | ||
} | ||
function locateElevent(el, ev, loc) { | ||
@@ -203,0 +199,0 @@ // pageX/Y if available? |
@@ -225,2 +225,6 @@ /* | ||
if (!result && (atlas = _atlases_map[query])) { | ||
result = atlas.select(); | ||
} | ||
for (i = 0; !result && i < _atlases_arr.length; i++) { | ||
@@ -230,6 +234,2 @@ result = _atlases_arr[i].select(query); | ||
if (!result && (atlas = _atlases_map[query])) { | ||
result = atlas.select(); | ||
} | ||
if (!result) { | ||
@@ -236,0 +236,0 @@ console.error('Texture not found: ' + query); |
@@ -15,2 +15,3 @@ /* | ||
var is = require('./util/is'); | ||
var await = require('./util/await'); | ||
@@ -66,7 +67,7 @@ stats.create = 0; | ||
var _stages = []; | ||
var _started = false; | ||
var _loaded = false; | ||
var _paused = false; | ||
Class.app = function(app, opts) { | ||
if (!_started) { | ||
if (!_loaded) { | ||
_app_queue.push(arguments); | ||
@@ -89,6 +90,11 @@ return; | ||
var loading = await(); | ||
Class.preload = function(load) { | ||
if (typeof load === 'string') { | ||
if (/\.js($|\?|\#)/.test(load)) { | ||
return Class.preloadScript(load); | ||
var url = load; | ||
if (/\.js($|\?|\#)/.test(url)) { | ||
load = function(callback) { | ||
loadScript(url, callback); | ||
}; | ||
} | ||
@@ -99,9 +105,7 @@ } | ||
} | ||
if (!_started) { | ||
_preload_queue.push(load); | ||
return; | ||
} | ||
load(function(err) { | ||
console.log(err); | ||
}); | ||
// if (!_started) { | ||
// _preload_queue.push(load); | ||
// return; | ||
// } | ||
load(loading()); | ||
}; | ||
@@ -114,16 +118,17 @@ | ||
DEBUG && console.log('Preloading...'); | ||
(function next() { | ||
if (_preload_queue.length) { | ||
var load = _preload_queue.shift(); | ||
load(next); | ||
} else { | ||
DEBUG && console.log('Loading apps...'); | ||
_started = true; | ||
while (_app_queue.length) { | ||
var args = _app_queue.shift(); | ||
Class.app.apply(Class, args); | ||
} | ||
// DEBUG && console.log('Preloading...'); | ||
// _started = true; | ||
// while (_preload_queue.length) { | ||
// var load = _preload_queue.shift(); | ||
// load(loading()); | ||
// } | ||
loading.then(function() { | ||
DEBUG && console.log('Loading apps...'); | ||
_loaded = true; | ||
while (_app_queue.length) { | ||
var args = _app_queue.shift(); | ||
Class.app.apply(Class, args); | ||
} | ||
})(); | ||
}); | ||
}; | ||
@@ -155,8 +160,2 @@ | ||
Class.preloadScript = function(src) { | ||
return Class.preload(function(callback) { | ||
loadScript(src, callback); | ||
}); | ||
}; | ||
function loadScript(src, callback) { | ||
@@ -163,0 +162,0 @@ var el = document.createElement('script'); |
@@ -24,3 +24,3 @@ /* | ||
'app-loader' : AppLoader, | ||
'image-loader' : ImageLoader, | ||
'image-loader' : ImageLoader | ||
}); | ||
@@ -27,0 +27,0 @@ |
@@ -562,2 +562,5 @@ /* | ||
Class.prototype.width = function(w) { | ||
if (typeof w === 'undefined') { | ||
return this.pin('width'); | ||
} | ||
this.pin('width', w); | ||
@@ -568,2 +571,5 @@ return this; | ||
Class.prototype.height = function(h) { | ||
if (typeof h === 'undefined') { | ||
return this.pin('height'); | ||
} | ||
this.pin('height', h); | ||
@@ -570,0 +576,0 @@ return this; |
{ | ||
"name": "stage-js", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"description": "2D HTML5 JavaScript library for cross-platform game development", | ||
@@ -5,0 +5,0 @@ "homepage": "http://piqnt.com/stage.js/", |
@@ -147,4 +147,4 @@ var expect = require('./util/expect'); | ||
name : "main", | ||
imagePath : "main.png", | ||
imageRatio : 4, | ||
// imagePath : "main.png", | ||
// imageRatio : 4, | ||
trim : 0.1, | ||
@@ -151,0 +151,0 @@ cutouts : [ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144120
52
4668