-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (47 loc) · 6.36 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
//declare var wx: any;
import { tt_impl } from "./ttapi_impl_web/ttimpl_web.js";
import * as tt2 from "./ttapi_layer2/ttlayer2.js";
import * as tt2test from "./ttapi_layer2_test/layer2_test.js";
import * as State_game from "./game/state_game.js";
export class App {
//此处的CommonData是Test中的不太好
Start() {
return __awaiter(this, void 0, void 0, function* () {
console.warn("==初始化扩展==");
//本地扩展是为了做编辑器用的,非编辑器不用管
let b = yield tt2.QExt.Init();
if (b) {
tt2.QExt.SetDebug(true); //自己扩展的小界面,用处不大,主要给f5 f12 整俩个按钮
}
//首先 初始化 TTEngine ,TTEngine 是一套极简的渲染引擎
let impl = new tt_impl.ttimpl_browser();
let canvas = window.document.createElement("canvas");
window.document.body.append(canvas);
canvas.style.width = "100%";
canvas.style.height = "100%";
canvas.style.border = "0px";
canvas.style.margin = "0px";
impl.Init(canvas);
let userdata = new UserData();
//测试程序指定资源位置
tt2test.Test_UITool.InitResPath("ttapi_layer2_test/data/");
let deffonturl = tt2test.Test_UITool.getDefaultFontResPath();
let debug = true;
let app = new tt2.QFrame_App(userdata, deffonturl, debug);
yield app.Start();
app.ChangeState(new State_game.State_Game());
});
}
}
export class UserData {
}
//# sourceMappingURL=data:application/json;base64,eyJ2Z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