-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
51 lines (44 loc) · 1.37 KB
/
index.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
48
49
50
51
export default {}
import Draw from '../boot/draw.js'
import Game from '../boot/game.js'
import Room from './room.js'
import Shader from './shader.js'
import Scenes from './scenes.js'
import Dev from './dev.js'
import Liv from './living.js'
import Tool from './tool.js'
import Node from '../boot/node.js'
import Sound from './sound.js'
import Tbl from './init-tbl.js'
const matrix = Node.load('boot/gl-matrix.js');
const {vec3, mat4} = matrix;
const window = Draw.createWindow();
window.setClearColor([0.2, 0.3, 0.3, 1]);
window.center();
window.onKey(gl.GLFW_KEY_ESCAPE, gl.GLFW_PRESS, 0, function() {
window.shouldClose();
});
window.prepareDraw();
const sp = Shader.init(window);
const camera = Game.createCamera(sp);
const order = Tool.createDrawOrder(Shader);
window.add(camera);
window.add(order);
camera.lookAt(0, 0, -1);
vec3.set(camera.up(), 0, -1, 0);
Tbl.init();
Sound.init(window);
Room.init(window, order, camera);
Scenes.init(window, camera, sp, order);
Scenes.start_game();
// 开发测试用, 启用后需要把39行注释, 同时只能启用一个.
// Dev.bgm(); //!!!
// Dev.roomBrowse(Room, window, camera);
// Dev.smallMapBrowse(Room, window);
// Dev.dataDirBrowse(Room, window);
Dev.enemyBrowse(Liv, window, Room, camera);
// 备用游戏循环, 有戏主循环在别处
// window.add(Draw.showRate());
while (window.nextFrame()) {
}
window.destroy();