Sign in to follow this  
Bodman

Transparent Background

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, 

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.