glasshouse/src/Main.hx

48 lines
987 B
Haxe

import screens.TitleScreen;
class Main extends hxd.App {
var center:h2d.Flow;
var style = null;
override function init() {
center = new h2d.Flow(s2d);
center.horizontalAlign = center.verticalAlign = Middle;
onResize();
var root = new TitleScreen(Right, center);
root.btnNewGame.onClick = function() {
Game.inst = new Game();
}
root.btnContinueGame.onClick = function() {
root.btnContinueGame.dom.addClass("highlight");
}
// root.btnQuit.onClick = function() {
// Sys.exit(0);
// }
style = new h2d.domkit.Style();
style.load(hxd.Res.style);
style.allowInspect = true;
style.addObject(root);
}
override function onResize() {
center.minWidth = center.maxWidth = s2d.width;
center.minHeight = center.maxHeight = s2d.height;
}
override function update(dt:Float) {
style.sync();
}
static function main() {
#if hl
hxd.res.Resource.LIVE_UPDATE = true;
hxd.Res.initLocal();
#else
hxd.Res.initEmbed();
#end
new Main();
}
}