mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Fix wrong use of guiScalingImageButton in formspecs buttons (#10094)
This commit is contained in:
parent
646af2ef5f
commit
ee6c499ff8
@ -789,13 +789,12 @@ void GUIButton::setFromStyle(const StyleSpec& style)
|
|||||||
setDrawBorder(style.getBool(StyleSpec::BORDER, true));
|
setDrawBorder(style.getBool(StyleSpec::BORDER, true));
|
||||||
setUseAlphaChannel(style.getBool(StyleSpec::ALPHA, true));
|
setUseAlphaChannel(style.getBool(StyleSpec::ALPHA, true));
|
||||||
|
|
||||||
const core::position2di buttonCenter(AbsoluteRect.getCenter());
|
|
||||||
core::position2d<s32> geom(buttonCenter);
|
|
||||||
if (style.isNotDefault(StyleSpec::BGIMG)) {
|
if (style.isNotDefault(StyleSpec::BGIMG)) {
|
||||||
video::ITexture *texture = style.getTexture(StyleSpec::BGIMG,
|
video::ITexture *texture = style.getTexture(StyleSpec::BGIMG,
|
||||||
getTextureSource());
|
getTextureSource());
|
||||||
setImage(guiScalingImageButton(
|
setImage(guiScalingImageButton(
|
||||||
Environment->getVideoDriver(), texture, geom.X, geom.Y));
|
Environment->getVideoDriver(), texture,
|
||||||
|
AbsoluteRect.getWidth(), AbsoluteRect.getHeight()));
|
||||||
setScaleImage(true);
|
setScaleImage(true);
|
||||||
} else {
|
} else {
|
||||||
setImage(nullptr);
|
setImage(nullptr);
|
||||||
|
@ -62,13 +62,12 @@ void GUIButtonImage::setFromStyle(const StyleSpec& style)
|
|||||||
|
|
||||||
video::IVideoDriver *driver = Environment->getVideoDriver();
|
video::IVideoDriver *driver = Environment->getVideoDriver();
|
||||||
|
|
||||||
const core::position2di buttonCenter(AbsoluteRect.getCenter());
|
|
||||||
core::position2d<s32> geom(buttonCenter);
|
|
||||||
if (style.isNotDefault(StyleSpec::FGIMG)) {
|
if (style.isNotDefault(StyleSpec::FGIMG)) {
|
||||||
video::ITexture *texture = style.getTexture(StyleSpec::FGIMG,
|
video::ITexture *texture = style.getTexture(StyleSpec::FGIMG,
|
||||||
getTextureSource());
|
getTextureSource());
|
||||||
|
|
||||||
setForegroundImage(guiScalingImageButton(driver, texture, geom.X, geom.Y));
|
setForegroundImage(guiScalingImageButton(driver, texture,
|
||||||
|
AbsoluteRect.getWidth(), AbsoluteRect.getHeight()));
|
||||||
setScaleImage(true);
|
setScaleImage(true);
|
||||||
} else {
|
} else {
|
||||||
setForegroundImage(nullptr);
|
setForegroundImage(nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user