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

Can't set Sprite's color via makeGraphic #23

Closed
jessefreeman opened this issue May 14, 2013 · 1 comment
Closed

Can't set Sprite's color via makeGraphic #23

jessefreeman opened this issue May 14, 2013 · 1 comment

Comments

@jessefreeman
Copy link

Color param supplied to sprite.makeGraphic does not correctly set a color on a sprite without an image. You can pass in a number but it is not saved in the makeGraphic method:

line 93:

public makeGraphic(width: number, height: number, color: number = 0xffffffff): Sprite {

            this._texture = null;
            this.width = width;
            this.height = height;

            this._dynamicTexture = false;

            return this;
}

And since the color param is not being saved it appears to be hard coded to the render code on line 288:

this._game.stage.context.fillStyle = 'rgb(255,000,255)';

Suggested solution: supply a rgb string in makeGraphic or accept a color and convert it to rbg before storing it to a variable on the sprite instance to be used in the render logic.

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