mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
This commit is contained in:
parent
e582d5ecaa
commit
b1fa0e9560
7 changed files with 36 additions and 19 deletions
|
@ -29,6 +29,7 @@ Programmers
|
|||
Alex S (docwest)
|
||||
Alexey Yaryshev (skeevert)
|
||||
Allofich
|
||||
Andreas Stöckel
|
||||
Andrei Kortunov (akortunov)
|
||||
AnyOldName3
|
||||
Ardekantur
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
Bug #6066: addtopic "return" does not work from within script. No errors thrown
|
||||
Bug #6101: Disarming trapped unlocked owned objects isn't considered a crime
|
||||
Bug #6115: Showmap overzealous matching
|
||||
Bug #6129: Player avatar not displayed correctly for large window sizes when GUI scaling active
|
||||
Bug #6131: Item selection in the avatar window not working correctly for large window sizes
|
||||
Bug #6133: Cannot reliably sneak or steal in the sight of the NPCs siding with player
|
||||
|
||||
0.47.0
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace MWBase
|
|||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
virtual bool getWorldMouseOver() = 0;
|
||||
|
||||
virtual float getScalingFactor() = 0;
|
||||
virtual float getScalingFactor() const = 0;
|
||||
|
||||
virtual bool toggleFogOfWar() = 0;
|
||||
|
||||
|
|
|
@ -461,14 +461,10 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::updatePreviewSize()
|
||||
{
|
||||
MyGUI::IntSize size = mAvatarImage->getSize();
|
||||
int width = std::min(mPreview->getTextureWidth(), size.width);
|
||||
int height = std::min(mPreview->getTextureHeight(), size.height);
|
||||
float scalingFactor = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
||||
mPreview->setViewport(int(width*scalingFactor), int(height*scalingFactor));
|
||||
|
||||
const MyGUI::IntSize viewport = getPreviewViewportSize();
|
||||
mPreview->setViewport(viewport.width, viewport.height);
|
||||
mAvatarImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f,
|
||||
width*scalingFactor/float(mPreview->getTextureWidth()), height*scalingFactor/float(mPreview->getTextureHeight())));
|
||||
viewport.width / float(mPreview->getTextureWidth()), viewport.height / float(mPreview->getTextureHeight())));
|
||||
}
|
||||
|
||||
void InventoryWindow::onNameFilterChanged(MyGUI::EditBox* _sender)
|
||||
|
@ -629,15 +625,8 @@ namespace MWGui
|
|||
|
||||
MWWorld::Ptr InventoryWindow::getAvatarSelectedItem(int x, int y)
|
||||
{
|
||||
// convert to OpenGL lower-left origin
|
||||
y = (mAvatarImage->getHeight()-1) - y;
|
||||
|
||||
// Scale coordinates
|
||||
float scalingFactor = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
||||
x = static_cast<int>(x*scalingFactor);
|
||||
y = static_cast<int>(y*scalingFactor);
|
||||
|
||||
int slot = mPreview->getSlotSelected (x, y);
|
||||
const osg::Vec2f viewport_coords = mapPreviewWindowToViewport(x, y);
|
||||
int slot = mPreview->getSlotSelected(viewport_coords.x(), viewport_coords.y());
|
||||
|
||||
if (slot == -1)
|
||||
return MWWorld::Ptr();
|
||||
|
@ -832,4 +821,26 @@ namespace MWGui
|
|||
{
|
||||
mPreview->rebuild();
|
||||
}
|
||||
|
||||
MyGUI::IntSize InventoryWindow::getPreviewViewportSize() const
|
||||
{
|
||||
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
||||
const float scale = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
||||
|
||||
return MyGUI::IntSize(std::min<int>(mPreview->getTextureWidth(), previewWindowSize.width * scale),
|
||||
std::min<int>(mPreview->getTextureHeight(), previewWindowSize.height * scale));
|
||||
}
|
||||
|
||||
osg::Vec2f InventoryWindow::mapPreviewWindowToViewport(int x, int y) const
|
||||
{
|
||||
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
||||
const float normalisedX = x / std::max<float>(1.0f, previewWindowSize.width);
|
||||
const float normalisedY = y / std::max<float>(1.0f, previewWindowSize.height);
|
||||
|
||||
const MyGUI::IntSize viewport = getPreviewViewportSize();
|
||||
return osg::Vec2f(
|
||||
normalisedX * float(viewport.width - 1),
|
||||
(1.0 - normalisedY) * float(viewport.height - 1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,9 @@ namespace MWGui
|
|||
void updatePreviewSize();
|
||||
void updateArmorRating();
|
||||
|
||||
MyGUI::IntSize getPreviewViewportSize() const;
|
||||
osg::Vec2f mapPreviewWindowToViewport(int x, int y) const;
|
||||
|
||||
void adjustPanes();
|
||||
|
||||
/// Unequips count items from mSelectedItem, if it is equipped, and then updates mSelectedItem in case the items were re-stacked
|
||||
|
|
|
@ -1326,7 +1326,7 @@ namespace MWGui
|
|||
return mHud->getWorldMouseOver();
|
||||
}
|
||||
|
||||
float WindowManager::getScalingFactor()
|
||||
float WindowManager::getScalingFactor() const
|
||||
{
|
||||
return mScalingFactor;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace MWGui
|
|||
void setDragDrop(bool dragDrop) override;
|
||||
bool getWorldMouseOver() override;
|
||||
|
||||
float getScalingFactor() override;
|
||||
float getScalingFactor() const override;
|
||||
|
||||
bool toggleFogOfWar() override;
|
||||
bool toggleFullHelp() override; ///< show extra info in item tooltips (owner, script)
|
||||
|
|
Loading…
Reference in a new issue