jjant / runty8

A Pico8 clone in Rust.
MIT License
225 stars 17 forks source link

What still needs to happen for clipboard to be supported? #48

Open lesleyrs opened 1 year ago

lesleyrs commented 1 year ago

I can see it correctly saves each pixel in sprite_sheet.txt and shows the copied/pasted message yet it does not work, so if you slap [gfx][/gfx] on a string with the data from current selected sprite we can copy and read it back minus [gfx][/gfx] for paste?

Then we need to be able to access to stat(4)/clipboard to read it in a game/tool.

Is that it?

Also I know Pico-8 has intentional limitations about reading/writing clipboard which is quite annoying for my usecase here: https://github.com/lesleyrs/pico-paint

This is to prevent a cartridge from accessing potentially-sensitive data on the host system's clipboard without the user's permission. - from https://pico-8.fandom.com/wiki/Clipboard

I couldn't find an answer why this would be bad on pico-8 as it doesn't have any built-in network capabilities so the worst that could happen is a game displaying your clipboard on screen, which could be annoying if somebody was livestreaming it and happens to copy his passwords. And even then they wouldn't know their username?

IMO that's not worth being a big inconvenience though, I would much rather have a notification on launch that shows if the application could try to access clipboard. Just like the devkit mode notification in pico-8 informing people.

Thx for coming to my TED talk.

jjant commented 1 year ago

Hey there, thank you for the help. This doesn't work like you expect because I didn't use the system clipboard when implementing Runty8's clipboard 😅:

"Copying" right now means writing to an in-memory vec of pixels, and similarly "pasting" is reading from it.

We should probably change this to be like Pico8, using the real clipboard and the [gfx]...[/gfx] formatted strings, I just didn't know that's how it worked at the time.