Skip to content
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

Text box still shows up white after changing properties #71

Open
ThePandaJam opened this issue Jul 20, 2018 · 4 comments
Open

Text box still shows up white after changing properties #71

ThePandaJam opened this issue Jul 20, 2018 · 4 comments

Comments

@ThePandaJam
Copy link

ThePandaJam commented Jul 20, 2018

Hi! I'm trying to make a transparent text input box (or one with the same colour as the background image) in my game and I've been changing the properties to suit my needs, but the box still shows up white. Can't really find much help elsewhere online...

Here's my code:

var nameInput = game.add.inputField(600, 510, {
			font: "32px 'Press Start 2P'",
			fill: "#ffffff",
			align: "center",
    	                borderWidth: 0,
    	                borderColor: '#ffffff',
//changing border in the text configuration worked, so trying to change bgColour here
			background: "#0BE783",
		});
                //changing colour to blend in with background
		nameInput.backgroundColor = "#0BE783";
		nameInput.fillAlpha = 0;
		nameInput.width = 300;
		nameInput.height = 34;
		nameInput.cursorColor = '#ffffff';

I'm using Phaser v2.3.0
@AleBles

@ThePandaJam
Copy link
Author

image

@MajorKuprich
Copy link

I have a similar problem regarding the change in the width of the input.
Whether the width is changed correctly in ur project?
I mean this line: nameInput.width = 300;

@ThePandaJam
Copy link
Author

ThePandaJam commented Jul 26, 2018

I found a fix for this issue. Just needed to add more attributes

var nameInput = game.add.inputField(500, 498, {
    font: "30px 'Press Start 2P'",
    fill: '#ffffff',
    fillAlpha: 0,
    fontWeight: 'bold',
    width: 400,
    max: 20,
    padding: 2,
    borderWidth: 1,
    borderColor: '#000',
    borderRadius: 6,
    placeHolder: 'Anonymous',
    textAlign: 'left',
    zoom: true,
    cursorColor : '#ffffff'
    });
nameInput.startFocus();

The last line is pretty important by the way.

@ThePandaJam
Copy link
Author

@MajorKuprich
That width change worked fine, the text there would go outside the white box, as per the width I set. It's just the white box that wouldn't go away no matter what i did to the attributes regarding background colour. I fixed it now, take a look at the code above. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants