Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tobias Schneider
committed
Jan 13, 2010
0 parents
commit 4613e29
Showing
12 changed files
with
2,795 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2010 Tobias Schneider | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Gordon: An open source Flash™ runtime written in pure JavaScript | ||
|
||
Copyright (c) 2010 Tobias Schneider | ||
Gordon is freely distributable under the terms of the MIT license. | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Gordon: An open source Flash™ runtime written in pure JavaScript | ||
* | ||
* Copyright (c) 2010 Tobias Schneider | ||
* Gordon is freely distributable under the terms of the MIT license. | ||
*/ | ||
|
||
(function(){ | ||
var _g = Gordon = {}; | ||
var _loadedUrls = {}; | ||
|
||
var scripts = document.getElementsByTagName("script"); | ||
var i = scripts.length; | ||
while(i--){ | ||
var match = scripts[i].src.match(/(^|.*\/)gordon\.js$/); | ||
if(match){ _g.ROOT = match[1]; } | ||
} | ||
|
||
_g.xhr = function(){ | ||
var request = new XMLHttpRequest(); | ||
request.open.apply(request, arguments); | ||
return request; | ||
} | ||
|
||
_g.require = function(url){ | ||
if(!url.match(/\.([^\/]*)$/)){ url += ".js"; } | ||
if(!_loadedUrls[url]){ | ||
with(_g.xhr("GET", _g.ROOT + url, false)){ | ||
send(null); | ||
if(status == 200){ | ||
eval(responseText); | ||
_loadedUrls[url] = true; | ||
} | ||
else{ throw new Error("Unable to load " + url + " status: " + status); } | ||
} | ||
} | ||
} | ||
})(); | ||
|
||
Gordon.require("src/_base"); | ||
Gordon.require("src/Movie"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Gordon: An open source Flash™ runtime written in pure JavaScript | ||
* | ||
* Copyright (c) 2010 Tobias Schneider | ||
* Gordon is freely distributable under the terms of the MIT license. | ||
*/ | ||
|
||
(function(){ | ||
var _g = Gordon; | ||
var _properties = { | ||
r: 255, | ||
g: 255, | ||
b: 255, | ||
a: 1 | ||
}; | ||
|
||
_g.Color = function(color){ | ||
if(typeof color == "string"){ | ||
var match = color.match(/^#([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})/i); | ||
if(match){ color = { | ||
r: parseInt(match[1], 16), | ||
g: parseInt(match[2], 16), | ||
b: parseInt(match[3], 16) | ||
}; } | ||
} | ||
for(var p in _properties){ this[p] = isNaN(color[p]) ? _properties[p] : color[p]; } | ||
}; | ||
_g.Color.prototype = { | ||
toArray: function(withAlpha){ | ||
var t = this; | ||
var array = [t.r, t.g, t.b]; | ||
if(withAlpha){ array.push(t.a); } | ||
return array; | ||
}, | ||
|
||
toString: function(withAlpha){ | ||
return "rgb" + (withAlpha ? 'a' : '') + '(' + this.toArray(withAlpha).join(", ") + ')'; | ||
} | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Gordon: An open source Flash™ runtime written in pure JavaScript | ||
* | ||
* Copyright (c) 2010 Tobias Schneider | ||
* Gordon is freely distributable under the terms of the MIT license. | ||
*/ | ||
|
||
(function(){ | ||
var _g = Gordon; | ||
var _properties = { | ||
multR: 1.0, | ||
multG: 1.0, | ||
multB: 1.0, | ||
multA: 1.0, | ||
addR: 0.0, | ||
addG: 0.0, | ||
addB: 0.0, | ||
addA: 0.0 | ||
}; | ||
|
||
_g.Cxform = function(cxform){ | ||
for(var p in _properties){ this[p] = isNaN(cxform[p]) ? _properties[p] : cxform[p]; } | ||
}; | ||
_g.Cxform.prototype = { | ||
toArray: function(){ | ||
with(this){ | ||
return [multR, 0, 0, 0, addR, 0, multG, 0, 0, addG, 0, 0, multB, 0, addB, 0, 0, 0, multA, addA]; | ||
} | ||
}, | ||
|
||
toString: function(){ | ||
return this.toArray().join(' '); | ||
} | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Gordon: An open source Flash™ runtime written in pure JavaScript | ||
* | ||
* Copyright (c) 2010 Tobias Schneider | ||
* Gordon is freely distributable under the terms of the MIT license. | ||
*/ | ||
|
||
(function(){ | ||
var _g = Gordon; | ||
var _properties = { | ||
scaleX: 1.0, | ||
scaleY: 1.0, | ||
skewX: 0.0, | ||
skewY: 0.0, | ||
moveX: 0, | ||
moveY: 0 | ||
}; | ||
|
||
_g.Matrix = function(matrix){ | ||
for(var p in _properties){ this[p] = isNaN(matrix[p]) ? _properties[p] : matrix[p]; } | ||
}; | ||
_g.Matrix.prototype = { | ||
toArray: function(){ | ||
with(this){ | ||
return [scaleX, skewX, skewY, scaleY, moveX, moveY]; | ||
} | ||
}, | ||
|
||
toString: function(){ | ||
with(this){ | ||
return "matrix(" + this.toArray().join(' ') + ')'; | ||
} | ||
} | ||
}; | ||
})(); |
Oops, something went wrong.