|
1 | 1 | import wasmFile from 'wasmoon/dist/glue.wasm';
|
2 | 2 | import { LuaFactory, LuaMultiReturn } from 'wasmoon'
|
3 |
| -import { editor } from 'monaco-editor' |
| 3 | +import { editor, languages } from 'monaco-editor/esm/vs/editor/editor.api' |
| 4 | +import * as lualang from 'monaco-editor/esm/vs/basic-languages/lua/lua' |
4 | 5 | import gly from '@gamely/core-native-html5'
|
5 |
| -import gly_engine from '@gamely/gly-engine-lite/dist/main.lua' |
6 |
| -import defaultScript from './default.lua' |
| 6 | +import gly_engine from '@gamely/gly-engine-lite' assert {type: "text"} |
| 7 | +import defaultScript from './default.lua' assert {type: "text"} |
7 | 8 |
|
8 |
| -let monacoTimeout; |
| 9 | +let monacoTimeout: number; |
9 | 10 |
|
10 | 11 | document.addEventListener('DOMContentLoaded', async () => {
|
11 |
| - const elInpWidth = document.querySelector('#width') |
12 |
| - const elInpHeight = document.querySelector('#height') |
13 |
| - const elInpStroke = document.querySelector('#stroke') |
14 |
| - const elSelFormat = document.querySelector('#resolution') |
15 |
| - const elBtnDownload = document.querySelector('#download') |
16 |
| - const elChkAntiAliasing = document.querySelector('#antialiasing') |
17 |
| - const elSelResolution = document.querySelector('#resolution') |
18 |
| - const elMonacoEditor = document.querySelector('#editor') |
19 |
| - const elCanvas = document.querySelector('#gameCanvas') |
20 |
| - |
| 12 | + const elInpWidth = document.querySelector('#width') as HTMLInputElement |
| 13 | + const elInpHeight = document.querySelector('#height') as HTMLInputElement |
| 14 | + const elInpStroke = document.querySelector('#stroke') as HTMLInputElement |
| 15 | + const elSelFormat = document.querySelector('#resolution') as HTMLInputElement |
| 16 | + const elBtnDownload = document.querySelector('#download') as HTMLElement |
| 17 | + const elChkAntiAliasing = document.querySelector('#antialiasing') as HTMLInputElement |
| 18 | + const elSelResolution = document.querySelector('#resolution') as HTMLInputElement |
| 19 | + const elMonacoEditor = document.querySelector('#editor') as HTMLElement |
| 20 | + const elCanvas = document.querySelector('#gameCanvas') as HTMLCanvasElement |
| 21 | + |
| 22 | + languages.register({ id: 'lua' }) |
| 23 | + languages.setMonarchTokensProvider('lua', lualang.language) |
21 | 24 | const monacoEditor = editor.create(elMonacoEditor, {
|
22 | 25 | language: 'lua',
|
23 | 26 | theme: 'vs-dark',
|
|
0 commit comments