Skip to content

Commit

Permalink
DisPlayImage事例临时修改-lzy
Browse files Browse the repository at this point in the history
  • Loading branch information
l1628146905 committed Jun 25, 2021
1 parent 1878f8c commit 57df3cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion h5/2d/as/Sprite_DisplayImage.as
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ package
{
public function Sprite_DisplayImage()
{
Laya.Config.isAntialias = true;
// 2D场景不显示时打开
Laya.Config.isAntialias = true;
// 2D场景显示错乱时打开
Laya.Config.useWebGL2 = false;
// 不支持WebGL时自动切换至Canvas
Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL);

Expand Down
5 changes: 4 additions & 1 deletion h5/2d/js/Sprite_DisplayImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ class Sprite_DisplayImage {
Browser = Laya.Browser,
WebGL = Laya.WebGL,
Stage = Laya.Stage;
Config.isAntialias = true;
// 2D场景不显示时打开
Laya.Config.isAntialias = true;
// 2D场景显示错乱时打开
Laya.Config.useWebGL2 = false;
// 不支持WebGL时自动切换至Canvas
Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL);
Laya.stage.alignV = Stage.ALIGN_MIDDLE;
Expand Down
7 changes: 5 additions & 2 deletions h5/2d/ts/Sprite_DisplayImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ module laya {

export class Sprite_DisplayImage {
constructor() {
Config.isAntialias = true;
// 2D场景不显示时打开
Laya.Config.isAntialias = true;
// 2D场景显示错乱时打开
Laya.Config.useWebGL2 = false;
// 不支持WebGL时自动切换至Canvas
Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL);
Laya.stage.alignV = Stage.ALIGN_MIDDLE;
Expand All @@ -26,7 +29,7 @@ module laya {
ape.loadImage("res/apes/monkey3.png");

// 方法2:使用drawTexture
Laya.loader.load("res/apes/monkey2.png", Handler.create(this, function(): void {
Laya.loader.load("res/apes/monkey2.png", Handler.create(this, function (): void {
var t: Texture = Laya.loader.getRes("res/apes/monkey2.png");
var ape: Sprite = new Sprite();
ape.graphics.drawTexture(t, 0, 0);
Expand Down

0 comments on commit 57df3cd

Please sign in to comment.