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
texturize = (url, callback) -> | |
image = new Image() | |
image.src = url | |
image.onload = -> | |
canvas = document.createElement 'canvas' | |
context = canvas.getContext '2d' | |
canvas.width = image.width | |
canvas.height = image.height |
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
// Yeah, what is null? Let's make it nil | |
var nil = null; | |
var objc_call = function(magic) { | |
if (magic === nil) { | |
return nil; | |
} | |
var args = Array.prototype.slice.call(arguments, 1); | |
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
### | |
This a small 1h experiment on creating a game environment which should look similar to a templating engine or QML. | |
This is just a mockup and may be developed into a game engine in the near future. | |
### | |
# Create a new game instance (It would be cool if you wouldn't need an instance and could just write "Game") | |
new Game -> | |
# Create a scene within the game | |
@scene -> |
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
(function() { | |
'use strict'; | |
var exportObject, hasModule, isObject, | |
__hasProp = {}.hasOwnProperty; | |
(function() { | |
var _ref; | |
return (_ref = Array.isArray) != null ? _ref : Array.isArray = function(a) { | |
return a.push === Array.prototype.push && (a.length != null); |
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
traverseObject = (o, key) -> | |
keyArray = if key.indexOf('.') > 0 then key.split('.') else [key] | |
for k in keyArray | |
return unless Object.hasOwnProperty.call o, k | |
o = o[k] | |
o |
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
do (root = @) -> | |
root.mixinList = {} | |
root.mixin = (target, name, params...) -> | |
root.mixin(target, n, params) for n in name if Array.isArray name | |
if typeof mixinList[name] is 'function' | |
mixinList[name].apply(target, params) | |
else | |
target[key] = value for key, value of mixinList[name] when not Object.hasOwnProperty.call target, key |
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
var performance = window.performance; | |
performance.now = performance.now || (function() { | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
var functionName = ''; | |
for (var i = 0, j = vendors.length; i < j; i++) { | |
functionName = vendors[i] + 'Now'; | |
if (performance[functionName]) { | |
return performance[functionName]; |
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
var nextTick = function(fn) { | |
var id = window.requestAnimationFrame(function() { | |
fn && fn(); | |
window.cancelAnimationFrame(id); | |
}); | |
}; |
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
package ; | |
/** | |
* ... | |
* @author Johannes Stein | |
*/ | |
class EventMap | |
{ | |
private var map: Map<String, Array<Dynamic -> Void>>; | |
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
do (root = if exports? then exports else @) -> | |
defined = [] | |
modules = {} | |
evaluateModules = (ids, callback, after) -> | |
ids = [ids] if typeof deps is 'string' | |
depList = [] | |
depLength = ids.length |