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
ebiten: add a new image API to 'deallocate' its internal state and deprecate Dispose
#2808
Comments
For 3., what about |
What about removing the
The re-creation of the atlas in such cases sounds a bit complicated, no? Considering this is understandable for 2 |
This issue is to simplified the model of an image by removing the disposed state. I'm afraid I don't think your proposal aligns with this.
An image just after NewImage is in the same situation, so there is nothing completed. |
I'm adding comments from Discord:
|
Dispose
Another name candidate is |
Dispose
Dispose
I think Image.Dispose() is not really a problem, not more than the standard library File.Close(), or close(channel) is. We can't use closed files or closed channels either. By the way, I fee Close() is a good name in stead of Dispose(). |
This is not a name issue. Please read #2808 (comment) |
Dispose
Dispose
Operating System
What feature would you like to be added?
If an image is disposed, the image is no longer available. While explicit dispoing is necessary for actual games, I don't like the exisistence of this additional state in an image. Actually, this prevents us from introducing some optimization (#825 (comment)). (EDIT: Now
Dispose
does nothing for a subimage, we might be able to introduce this optimization.)There are some possible solutions:
(*Image).Dispose
. The newDispose
disposes the internal state of an image, but an image is still available as a cleared image.internal/atlas
state is recreated when the image is used again. This is a breaking change, so this would be introduced in v3.(*Image).Clear
. If the image is not used for a while afterClear
, Ebitengine can dispose its internal state. If the image is used again,internal/atlas
state is recreated like 1. This is not a breaking change so we can introduce in v2, but we have to be careful the performance impact. Also, the newClear
might be confusing to users.Dispose
is deprecated in v2 and removed in v3.(*Image).Clear2
or a better name, and deprecating(*Image).Dispose
.Clear2
is the same as the newDeprecate
in 1.Why is this needed?
In order to simplify the model of an image.
The text was updated successfully, but these errors were encountered: