flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
294 stars 25 forks source link

Image - allow passing of quad and image and more #52

Closed flamendless closed 3 years ago

flamendless commented 4 years ago

Hi, it would be useful to allow something like:

Slab.Image("Animation", {
  Title = "Animation",
  Image = spritesheet,
  Quad = quad
})

As an alternative to Sub(x,y,w,h)


Also, for clarification, does the Sub variant in Image does the same as quad or it's for controlling how the image is drawn in the widget?

I've noticed that using the Scale with Sub variants makes the image overflow in the widget without the widget size and succeeding elements adjust properly.

coding-jackalope commented 4 years ago

Hi @flamendless, thanks for the suggestion. I'll add this to the upcoming patch release.

The Sub variant will actually create a quad with the given settings and will reference the texture coordinates supplied in the call. Slab should then add the widget based on the bounds of the quad. If not, I'll try to reproduce the issue and fix it for the upcoming release.

flamendless commented 4 years ago

Oh i mistyped the last part. I meant that using the Scale with the Sub variants makes the image overflow the window. It also overlaps behind other widgets.