- 注册时间
- 2013-2-13
- 最后登录
- 2023-10-13
- 阅读权限
- 200
- 积分
- 9309
- 精华
- 1
- 帖子
- 2411
|
zb0819 发表于 2018-5-29 11:20
http://lufylegend.com/api/zh_CN/ ... perty_WINDOW_RESIZE
这个例子里在浏览器缩放的时候矩形的大小也 ... - LInit(1000/60, "legend", window.innerWidth,window.innerHeight, main);
- var layer;
- function main () {
- LGlobal.stageScale = LStageScaleMode.SHOW_ALL;
- LSystem.screen(LStage.FULL_SCREEN);
- layer = new LSprite();
- addChild(layer);
- update();
- LGlobal.stage.addEventListener(LEvent.WINDOW_RESIZE,update);
- }
- function update(){
- LGlobal.width = window.innerWidth;
- LGlobal.height = window.innerHeight;
- LGlobal.canvasObj.width = LGlobal.width;
- LGlobal.canvasObj.height = LGlobal.height;
- LSystem.screen(LStage.FULL_SCREEN);
- layer.graphics.clear();
- layer.graphics.drawRect(1, "#ff0000", [0, 0, 50, 50], true, "#880088");
- layer.graphics.drawRect(1, "#ff0000", [LGlobal.width - 50, 0, 50, 50], true, "#880088");
- layer.graphics.drawRect(1, "#ff0000", [0, LGlobal.height - 50, 50, 50], true, "#880088");
- layer.graphics.drawRect(1, "#ff0000", [LGlobal.width - 50, LGlobal.height - 50, 50, 50], true, "#880088");
- }
复制代码 |
|