Closed SelfDevTV closed 4 months ago
How about clearRect
method name, similar as clearRect
in canvas api
Yes that could work too. Infact i was searching for this method at first, but then found it's called erase. @rexrainbow do you know how that normally works? Should I just create a fork go ahead and send a PR or do we talk about it first / have to get assigned first. etc? Sorry would be my first contribution kinda
clear
already exists - it would be easier to just allow you to pass 4 optional parameters to it, rather than increase the API size.
erase
is not the same thing, that uses a special blend mode and the pixels from the textures to remove it, and then you have to factor in alpha blending on non-opaque pixels too. It's meant more as a way to punch a 'shape' into a dynamic texture, than to clear an area.
clear
already exists - it would be easier to just allow you to pass 4 optional parameters to it, rather than increase the API size.
Yes that would be the best way I think. It should take 4 optional parameters ala x: number, y: number, width: number, height: number = width
or something like that.
erase
is not the same thing, that uses a special blend mode and the pixels from the textures to remove it, and then you have to factor in alpha blending on non-opaque pixels too. It's meant more as a way to punch a 'shape' into a dynamic texture, than to clear an area.
Ok understood now :) thx for clarifying
The problem
I have a dynamic texture I draw 1000s of numbers on it (via
Phaser.Gameobjects.Text
orBitmapText
) and viatex.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: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: ....)
Are you running full screen on a mobile device? The font is so blurry
Just zoomed in by a lot with the main cam. Maybe that's why
Hi @SelfDevTV, thanks for submitting this feature request.
We have implemented the feature that will allow you to clear a specified area of a dynamic texture like so:
dynamicTexture.clear(x, y, width, height)
This update has been pushed to the master
branch and will be part of the next release. Do test it out and feel free to reach out if you need further assistance.
Hi @SelfDevTV, thanks for submitting this feature request.
We have implemented the feature that will allow you to clear a specified area of a dynamic texture like so:
dynamicTexture.clear(x, y, width, height)
This update has been pushed to the
master
branch and will be part of the next release. Do test it out and feel free to reach out if you need further assistance.
OMG you guys are awesome. Keep it up :) Thank you very much!
The problem
I have a dynamic texture I draw 1000s of numbers on it (via
Phaser.Gameobjects.Text
orBitmapText
) and viatex.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:A fellow discord mate helped me out with a workaround:
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: ....)