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
#include <node.h> | |
#include <v8.h> | |
#include <windows.h> | |
#include <stdio.h> | |
#include <conio.h> | |
#include <tchar.h> | |
//#include <iostream> | |
using namespace v8; |
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
=== SYSTEM === | |
GetVersion System.version | |
GetVersionString System.versionString | |
Abort System.abort(msg) | |
Exit System.exit() | |
RestartGame System.restart() | |
System.sleep(double seconds) |
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
Game.init = function() { | |
Screen.drawRect(10,10,Screen.width-20,Screen.height-20,Color.RED); | |
Screen.flip() | |
} | |
Game.loop = function() { | |
// something with statemanager or so | |
} | |
Game.states["load"] = function() { |
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
===== | |
Lib | |
===== | |
function RenderNode() { | |
this.parent = null; | |
this.children = []; | |
this.vertices = []; |
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
Small explanation: first, watch this in a way you can see 1 line in full length, else it is unreadable. | |
* 'create client' is a message from pool.connect() in pool.js, after pool.acquire has been called. Here i set a variable to the client, called ___key,with a small text and the current date. This is to recognize the client. | |
* Then you see messages from the generic pool: they are from the ide remover, that is scheduled when a client is inside the pool (not used). At the end of the functon, if number of client in the pool > 0, it reschedules, otherwise, it does not reschedule. | |
* Then it figures the client has timed out (timeout here being the pool timeout, defined in the configuration. I put it very very fast in order to be able to test this reasonably. (reap 500ms, idle timeout 10s). | |
* 'ended' is in pool.destroy() (factory). It will then set _destroying to true and poolCount to undefined, and call client.end() (stream). | |
* generic pool tells us that all clients are removed (correctly so). | |
* Then the error come |
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 unwrapAsyncValue<T>(value: any, cb: (_err: any, _value: T) => void): void { | |
Promise.join(value, (unwrappedValue: any) => { | |
if (typeof unwrappedValue === "function") { | |
unwrappedValue(cb); | |
} else { | |
cb(null, unwrappedValue); | |
} | |
}).catch((err: Error) => cb(err, 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
function logClass(targetClass: any): () => void { | |
let originalClass = targetClass; | |
// Function to create new instances of a class. | |
function construct(constructor: Function, args: any[]): any { | |
let cls = function(): void { | |
return constructor.apply(this, args); | |
}; | |
cls.prototype = constructor.prototype; |
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
class Game { | |
constructor() { | |
assert(false && "Can't create another Game object"); | |
} | |
get name() { | |
return "MyGame"; | |
} |
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
All resources are accessed using SPhereFS protocol | |
Default root is ~sgm/ | |
If / is not prefixed, it is implied | |
/ equals to ~sgm/ | |
I want: | |
./ or ../ to start from current file |
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
return x() | |
.then(() => y()) | |
.catch(() => { | |
return a() | |
.then(() => b()); | |
}); | |
EQUALS | |
return x() |
OlderNewer