-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
54 lines (36 loc) · 1.52 KB
/
app.ts
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
48
49
50
51
52
53
54
//declare var wx: any;
import { tt_impl } from "./ttapi_impl_web/ttimpl_web.js"
import { tt } from "./ttapi_interface/ttapi.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中的不太好
async Start(): Promise<void> {
console.warn("==初始化扩展==");
//本地扩展是为了做编辑器用的,非编辑器不用管
let b = await 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>(userdata, deffonturl, debug);
await app.Start();
app.ChangeState(new State_game.State_Game());
}
}
export class UserData {
}