Jump to content

Transparent Background


Bodman
 Share

Recommended Posts

Edit: Never mind. Typescript Type Docs are just incorrect

This must be an easy solution, but I can't figure it out. 
I'm trying to make phaser render with a transparent background, but I'm getting a black background every time. 

Here is my initialization

new Phaser.Game({
            type: Phaser.AUTO,
            width: Config.width,
            height: Config.height,
            scene: Scenes,
            parent:document.getElementById('game'),
            "render.transparent": true
});


Anything I'm doing incorrectly? 

Thanks again, 

Link to comment
Share on other sites

On 6/29/2018 at 7:38 AM, Bodman said:

Edit: Never mind. Typescript Type Docs are just incorrect

This must be an easy solution, but I can't figure it out. 
I'm trying to make phaser render with a transparent background, but I'm getting a black background every time. 

Here is my initialization


new Phaser.Game({
            type: Phaser.AUTO,
            width: Config.width,
            height: Config.height,
            scene: Scenes,
            parent:document.getElementById('game'),
            "render.transparent": true
});


Anything I'm doing incorrectly? 

Thanks again, 

How can we get more accurate TS def from JSDoc?

There are always many mistakes in auto-generated TS def file.

Link to comment
Share on other sites

25 minutes ago, Majirefy said:

There are always many mistakes in auto-generated TS def file.

I would expect the hand-made ones to be much much worse.

25 minutes ago, Majirefy said:

How can we get more accurate TS def from JSDoc?

Best way? When you spot a mistake, fix the JSDoc! If the JSDoc fix doesn't suffice, make an issue on the generator git repo, or even better fix it and make a pull request.

Link to comment
Share on other sites

If you just need to get your TypeScript code working right away, copy the phaser.ts file, correct the errors, and use the corrected definitions instead.

But you should report or correct the errors in the Phaser repo to get them fixed for good.

Link to comment
Share on other sites

Can you please be more explicit. Where is the corrected phaser.ts file that you are talking about?

I have updated to the latest 3.11.0 phaser.d.ts and phaser.min.js and the background is still not transparent.

Phaser3-Doc Repository

new Phaser.Game({
	width                   : 1920,
	height                  : 1080,
	parent                  : document.getElementById("application"),
	scene                   : MainScene,
	type                    : Phaser.AUTO,
	fps                     : {target: 60, min: 30},
	"render.transparent"    : true,
	"render.autoResize"     : true,
	physics                 : {
		default: "arcade"
	}
});

Okay so apparently the problem I am facing is this:
https://github.com/photonstorm/phaser3-docs/issues/50

Changing "render.transparent" to "transparent" resolves this problem.

I assume all "xxxx.yyyy" keys are not working as intended as of now.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...