Page 1 of 1
Scaling sprite in GUI
Posted: Thu Oct 06, 2016 9:24 pm
by canidae
I'd like to add a sprite to my GUI, but I need to scale it. If I define my own button_style then the image is scaled just fine, but I don't need (nor want) a button with the sprite, just the image.
I tried this:
Code: Select all
data.raw["gui-style"].default["auto_research_sprite"] = {
type = "image_style",
width = 24,
height = 24,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0
}
This won't scale down a 32x32 sprite, it'll just crop it instead.
Re: Scaling sprite in GUI
Posted: Thu Oct 06, 2016 9:57 pm
by aubergine18
There is a special 'sprite' GUI element and also a special 'sprite' prototype. I've not fully investigated yet, but here's some notes I jotted down:
*
https://github.com/aubergine10/Style/issues/33
*
https://github.com/aubergine10/Style/issues/34
The Foreman mod uses these sprites, I've no idea if they are scalable or not.
EDIT: I don't think I've seen an `image_style` used before - does that actually work? If so, how did you get it displayed in your GUI (regardless of scaling issues)?
Re: Scaling sprite in GUI
Posted: Thu Oct 06, 2016 10:37 pm
by canidae
aubergine18 wrote:There is a special 'sprite' GUI element and also a special 'sprite' prototype. I've not fully investigated yet, but here's some notes I jotted down:
*
https://github.com/aubergine10/Style/issues/33
*
https://github.com/aubergine10/Style/issues/34
The Foreman mod uses these sprites, I've no idea if they are scalable or not.
EDIT: I don't think I've seen an `image_style` used before - does that actually work? If so, how did you get it displayed in your GUI (regardless of scaling issues)?
Quick response as I'm off for the night:
I've read some of your posts regarding this issue, but it seems like you didn't find a solution to the problem I wish to solve(?)
I don't know how I came across image_style, I tried a lot of stuff, maybe I just guessed. But it works (except the scaling issue). Take a look at
Auto Research code.
Re: Scaling sprite in GUI
Posted: Thu Oct 06, 2016 11:20 pm
by aubergine18
See if .scale or .scalable properties have any effect (either in the `image-style` or `sprite` protos).
From memory, .scalable is just something to do with game window resize, so probably not of any use.
However, .scale will sometimes work in image definitions (so hopefully in `sprite` definitions).
Failing that, you'd have to resize the image files themselves?