Skip to content

Instantly share code, notes, and snippets.

@dallonf
Last active December 13, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dallonf/4969628 to your computer and use it in GitHub Desktop.
Save dallonf/4969628 to your computer and use it in GitHub Desktop.
Using the Quintus Engine with TypeScript. This is just a proof-of-concept, it's WAY too early to actually use.
/// <reference path="quintus.d.ts" />
var Q = Quintus()
.include("Sprites, Scenes, Input");
// No need to call Q.Sprite.extend
class Player extends Q.Sprite {
init(p) {
super.init(p, {
asset: "somegraphic.png",
x: 320/2,
y: 420/2
});
}
}
Q.scene("level1", (stage) => {
stage.insert(new Player());
});
window.onload = () => {
Q.setup();
Q.load(["somegraphic.png"], () => {
Q.stageScene("level1");
});
};
module Q {
function include(plugins: string): Q;
function setup(): Q;
function scene(levelName: string, stageFunc: (stage: Stage) => void );
function stageScene(sceneName: string);
function load(fileNames: string[], callback: Function);
class Sprite {
init(p: any, options: SpriteOptions) : void;
}
interface SpriteOptions {
asset?: string;
x?: number;
y?: number;
}
interface Stage {
insert(object:Sprite): void;
}
}
var Quintus: (options?: Object) => Q;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment