mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 13:36:40 +00:00
Merge branch 'fix_image_button_scale' into 'master'
Use float based scale factor for ImageButton texture (#6849) Closes #6849 See merge request OpenMW/openmw!2076
This commit is contained in:
commit
f6a07ab603
2 changed files with 11 additions and 4 deletions
|
@ -131,6 +131,7 @@
|
||||||
Bug #6753: Info records without a DATA subrecords are loaded incorrectly
|
Bug #6753: Info records without a DATA subrecords are loaded incorrectly
|
||||||
Bug #6794: Light sources are attached to mesh bounds centers instead of mesh origins when AttachLight NiNode is missing
|
Bug #6794: Light sources are attached to mesh bounds centers instead of mesh origins when AttachLight NiNode is missing
|
||||||
Bug #6799: Game crashes if an NPC has no Class attached
|
Bug #6799: Game crashes if an NPC has no Class attached
|
||||||
|
Bug #6849: ImageButton texture is not scaled properly
|
||||||
Feature #890: OpenMW-CS: Column filtering
|
Feature #890: OpenMW-CS: Column filtering
|
||||||
Feature #1465: "Reset" argument for AI functions
|
Feature #1465: "Reset" argument for AI functions
|
||||||
Feature #2491: Ability to make OpenMW "portable"
|
Feature #2491: Ability to make OpenMW "portable"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "imagebutton.hpp"
|
#include "imagebutton.hpp"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
@ -88,13 +90,17 @@ namespace Gui
|
||||||
|
|
||||||
if (!mUseWholeTexture)
|
if (!mUseWholeTexture)
|
||||||
{
|
{
|
||||||
int scale = 1.f;
|
float scale = 1.f;
|
||||||
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(textureName);
|
MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture(textureName);
|
||||||
if (texture && getHeight() != 0)
|
if (texture && getHeight() != 0)
|
||||||
scale = texture->getHeight() / getHeight();
|
scale = static_cast<float>(texture->getHeight()) / getHeight();
|
||||||
|
|
||||||
setImageTile(MyGUI::IntSize(mTextureRect.width * scale, mTextureRect.height * scale));
|
const int width = static_cast<int>(std::round(mTextureRect.width * scale));
|
||||||
MyGUI::IntCoord scaledSize(mTextureRect.left * scale, mTextureRect.top * scale, mTextureRect.width * scale, mTextureRect.height * scale);
|
const int height = static_cast<int>(std::round(mTextureRect.height * scale));
|
||||||
|
setImageTile(MyGUI::IntSize(width, height));
|
||||||
|
MyGUI::IntCoord scaledSize(static_cast<int>(std::round(mTextureRect.left * scale)),
|
||||||
|
static_cast<int>(std::round(mTextureRect.top * scale)),
|
||||||
|
width, height);
|
||||||
setImageCoord(scaledSize);
|
setImageCoord(scaledSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue