Last active
December 13, 2015 20:28
-
-
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.
This file contains hidden or 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
/// <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"); | |
}); | |
}; |
This file contains hidden or 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
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