Skip to content

Instantly share code, notes, and snippets.

View AGoblinKing's full-sized avatar
🐢
INFRASTRUCTURE

a Goblin King AGoblinKing

🐢
INFRASTRUCTURE
View GitHub Profile
// A task runner that calls the Typescript compiler (tsc) and
// Compiles a HelloWorld.ts program
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "rustc",
// The command is a shell script
var x = require("xule");
x.scene(document.body, {
controller : function() {
var ctrl = this;
ctrl.player = { x : 5 };
},
step : function(ctrl) {
if(x.key("w")) {
ctrl.player.x++;
s(".content", {
color : "blue",
backgroundColor : "purple"
}, [
s(".sub-content", {
border : "2px solid black"
})
]);
@AGoblinKing
AGoblinKing / component.js
Last active August 29, 2015 14:14
Mithril Components using a Module Loader
var m = require("mithril");
module.exports = function Component(ctrl) {
var foo = ctrl.Component.foo = m.prop(5);
ctrl.Component.clicked = function() {
ctrl.Component.foo(++foo);
};
return function ComponentView() {
{
"c" : [ "components/test.js", "components/test2.js"],
"e" : [{
"i" : "test",
"c" : {
"test" : { "test" : true },
"test2" : {}
},
"e" : [{
"i" : "bar",
Component = {
entitiesAttached : [],
call : function(message) {
// first give the component a shot
if(typeof this[message.n] === "function") {
this[message.n](message);
}
// then its attached versions
if(typeof this.e[message.n] === "function") {
data.components.reduce(function(prev, componentPath) {
Vx.Loaders.script(componentPath, prev);
return prev;
}, function() {
if(++loaded >= toLoad) {
// Components ready
world.state = 1;
// Entities ready
this.readyListeners.forEach(function(fn) {
var anim = this.getComponent(Txl.c.Animation);
anim.add("bebop", new Txl.easing.InOut({properties}));
anim.play("bebop", 5000);
var anim = this.getComponent(Txl.c.Animation);
anim.add("bebop", new Txl.easing.InOut({properties}));
anim.play("bebop", 5000);
export import Game = require("game");
export import Scene = require("scene");
export import Utils = require("utils");
// these need broken up
import iEntity = require("entity");
import iTiles = require("components/tiles");
// setting up a nice wrapper
export var TileMap = iTiles.TileMap;