Skip to content
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

Mutable Image Widget #35

Open
Aidan-McNay opened this issue Apr 18, 2024 · 1 comment
Open

Mutable Image Widget #35

Aidan-McNay opened this issue Apr 18, 2024 · 1 comment

Comments

@Aidan-McNay
Copy link

(Feature Request, not critical)

An issue I've come upon several times is trying to update an Image Widget, similar to how you can change the styles/text of other widgets. The current workaround is to have it as a Resident layout and change the room to a new Resident with a new widget, but it's kinda clunky. I'm wondering whether there's a way to update the SDL texture associated with the image instead? Something like

val update_image : Bogue.Image.t -> Bogue.Image.t -> unit

where update source target would mutate target to have the same texture (and therefore image) as source

Happy to take a stab at it (although currently in uni, may be a while), but wanted to get a rough sense of "is this feasible" from someone who might know more :)

@sanette
Copy link
Owner

sanette commented Apr 18, 2024

It's a reasonable request. Two behaviors can be considered:

  1. the target image links to the source, so when the latter is modified, the former too
  2. the target image is a hard copy of the source made at creation time only.

Then:

1: is natural for instance when you have many sprites with the same image
2: is maybe a better choice because if we want to have the behavior of 1). we could first create the target image with Image.copy and then only update the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants