Open hajimehoshi opened 1 year ago
Probably I'll add github.com/hajimehoshi/ebitengine/v2/exp/clipboard
as an expeirmental package:
package clipboard
func Set([]byte)
func Get() []byte
What about other mime type like images?
EDIT: https://w3c.github.io/clipboard-apis/#mandatory-data-types-x
I'm currently using the library mentioned in the issue (namely golang.design/x/clipboard
) mainly because of it's Watch()
feature.
In my game I need to be notified and do action whenever the text stored in the clipboard changes, if we implement the clipboard functionalities to the Ebitengine, can we also move this feature?
In my game I need to be notified and do action whenever the text stored in the clipboard changes,
Interesting. I'll take a look at the implementation later.
Unfortunately it would not be possible to implement the 'watch' feature in a portable way if we want to include browsers https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
then what about throwing error on browsers?
I don't think this is a good solution. What about looking at the content of the clipboard every tick?
Operating System
What feature would you like to be added?
I want a new API to read and write a clipboard content. I have not determined the API yet, but the API should match with Ebitengine's semantics. For example, we might have to restrict reading and writing the content only in Update (https://github.com/hajimehoshi/ebiten/issues/2658).
Why is this needed?
This is useful especially for GUI applications.
There are some existing libraries like https://github.com/golang-design/clipboard, but I'm worried that this uses its own threads and might cause impedance mismatch with Ebitengine's threads. The new API would have to use Ebitengine's internal UI (main) thread.