Skip to content

Textures should have a way to erase a portion of the texture via a size / width / height #6853

@SelfDevTV

Description

@SelfDevTV

The problem

I have a dynamic texture I draw 1000s of numbers on it (via Phaser.Gameobjects.Text or BitmapText) and via tex.draw(). Sometimes I want to remove the text from a specific location on the texture. The only way I found this was via .erase.
Problem is it only takes in a Gameobject but not the size itself. When i give it my text gameobject it will remove it but in a very weird way. Here is a screenshot:

image

A fellow discord mate helped me out with a workaround:

const rect = this.add.rectangle(0, 0, 10, 10, 0);
dynTexture.erase(rect, 0, 0);

But still I thought why not implement another way of this function, that will also take in a size or width + height parameter. I would also like to try to implement it.

API for example for a DynamicTexture might look like this: dynTexture.erase(width: number, height: number = width, x: ....)

[Optional] Do you want to help provide this feature?
Yes. API for example for a DynamicTexture might look like this: dynTexture.erase(width: number, height: number = width, x: ....)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions