https://github.com/ymzuiku/layaair-extra
layaair的一些扩展
https://github.com/ymzuiku/layaair-extra
Last synced: about 2 months ago
JSON representation
layaair的一些扩展
- Host: GitHub
- URL: https://github.com/ymzuiku/layaair-extra
- Owner: ymzuiku
- License: mit
- Created: 2018-08-12T14:03:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-02T14:46:54.000Z (over 6 years ago)
- Last Synced: 2025-02-23T15:48:14.088Z (2 months ago)
- Language: JavaScript
- Size: 1.74 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Use WebGL create cross-platform UI
lib is fork laya-air: [http://ldc.layabox.com/](http://ldc.layabox.com/)
## 安装
```sh
$ yarn add layaair-extra
```## 编写简单的项目
```sh
$ cp -rf node_modules/layaair-extra/public public #拷贝通用public
$ touch src/index.ts
```在 `src/index.ts` 编写以下代码:
```js
import { air, Laya, plus } from 'layaair-extra';// 如果要用Laya开发游戏、使用Laya的Debug工具
import 'layaair-extra/src/LayaGame';
import 'layaair-extra/src/LayaDebugTool';class App extends Laya.Sprite {
constructor() {
super();
// do something
const label = new Laya.Text();
label.text = 'Hello LayaAir Extra';
label.fontSize = 40;
this.addChild(label);
}
}air.initGame({
RootComponent: App,
type: 'vertical',
statPosition: [30, 30],
completed: startGame,
});
function startGame() {
// do something
}
```## 启动项目
```sh
$ npm install -g pillar-pack
$ pillar-pack
```浏览器预览 `http://127.0.0.1:3100/index.dev.html`
## licensed
layaair-extra is [MIT licensed](./LICENSE).