diff --git a/src/gui/GuiSlider.hx b/src/gui/GuiSlider.hx index b656f0e5..89c140ab 100644 --- a/src/gui/GuiSlider.hx +++ b/src/gui/GuiSlider.hx @@ -1,5 +1,6 @@ package gui; +import h2d.Scene; import hxd.snd.Channel; import hxd.res.Sound; import hxd.Key; @@ -33,4 +34,13 @@ class GuiSlider extends GuiImage { this.bmp.width = this.bmp.tile.width * Settings.uiScale; super.update(dt, mouseState); } + + public override function render(scene2d:Scene) { + super.render(scene2d); + var renderRect = getRenderRectangle(); + this.bmp.width = this.bmp.tile.width * Settings.uiScale; + this.bmp.x = renderRect.position.x + renderRect.extent.x * sliderValue; + this.bmp.x = Util.clamp(this.bmp.x, renderRect.position.x, renderRect.position.x + renderRect.extent.x - bmp.width / 2); + this.bmp.width = this.bmp.tile.width * Settings.uiScale; + } }