-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Egret #38
Comments
简单安装最简单的引入方案,引入核心 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player" data-entry-class="Main">
</div>
<script src="https://yun.duiba.com.cn/db_games/egret_5.2.9/egret.min.js"></script>
<script src="https://yun.duiba.com.cn/db_games/egret_5.2.9/egret.web.min.js"></script>
<script src="main.js"></script>
</body>
</html> 逻辑文件 class Main extends egret.DisplayObjectContainer {
constructor() {
super();
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
onAddToStage(event) {
let textfield = new egret.TextField();
this.addChild(textfield);
textfield.textColor = 0xff0000;
textfield.text = 'hello world';
}
}
window['Main'] = Main;
egret.runEgret(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
入口文件
Main.ts,清空createGameScene里面的方法,里面是所有场景的起点
添加背景
添加文字
添加事件
除了运用匿名函数,还可以这样添加事件
The text was updated successfully, but these errors were encountered: