mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 07:36:44 +00:00
Improved responsiveness of the inventory window when resizing.
This commit is contained in:
parent
df0ee82a3c
commit
05a5cb3ae4
6 changed files with 29 additions and 5 deletions
|
@ -66,6 +66,7 @@ bool OMW::Engine::frameStarted (const Ogre::FrameEvent& evt)
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
MWBase::Environment::get().getWorld()->frameStarted(evt.timeSinceLastFrame);
|
MWBase::Environment::get().getWorld()->frameStarted(evt.timeSinceLastFrame);
|
||||||
|
MWBase::Environment::get().getWindowManager ()->frameStarted(evt.timeSinceLastFrame);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,8 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
||||||
|
|
||||||
|
virtual void frameStarted(float dt) = 0;
|
||||||
|
|
||||||
virtual void changePointer (const std::string& name) = 0;
|
virtual void changePointer (const std::string& name) = 0;
|
||||||
|
|
||||||
virtual const Translation::Storage& getTranslationDataStorage() const = 0;
|
virtual const Translation::Storage& getTranslationDataStorage() const = 0;
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace MWGui
|
||||||
, mLastXSize(0)
|
, mLastXSize(0)
|
||||||
, mLastYSize(0)
|
, mLastYSize(0)
|
||||||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||||
|
, mPreviewDirty(true)
|
||||||
{
|
{
|
||||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
|
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
|
||||||
|
|
||||||
|
@ -268,6 +269,19 @@ namespace MWGui
|
||||||
mTrading = true;
|
mTrading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::doRenderUpdate ()
|
||||||
|
{
|
||||||
|
if (mPreviewDirty)
|
||||||
|
{
|
||||||
|
mPreviewDirty = false;
|
||||||
|
MyGUI::IntSize size = mAvatar->getSize();
|
||||||
|
|
||||||
|
mPreview.update (size.width, size.height);
|
||||||
|
mAvatarImage->setSize(MyGUI::IntSize(std::max(mAvatar->getSize().width, 512), std::max(mAvatar->getSize().height, 1024)));
|
||||||
|
mAvatarImage->setImageTexture("CharacterPreview");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InventoryWindow::notifyContentChanged()
|
void InventoryWindow::notifyContentChanged()
|
||||||
{
|
{
|
||||||
// update the spell window just in case new enchanted items were added to inventory
|
// update the spell window just in case new enchanted items were added to inventory
|
||||||
|
@ -282,11 +296,7 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
mWindowManager.setSelectedWeapon(*weaponSlot, 100); /// \todo track weapon durability
|
mWindowManager.setSelectedWeapon(*weaponSlot, 100); /// \todo track weapon durability
|
||||||
|
|
||||||
MyGUI::IntSize size = mAvatar->getSize();
|
mPreviewDirty = true;
|
||||||
|
|
||||||
mPreview.update (size.width, size.height);
|
|
||||||
mAvatarImage->setSize(MyGUI::IntSize(std::max(mAvatar->getSize().width, 512), std::max(mAvatar->getSize().height, 1024)));
|
|
||||||
mAvatarImage->setImageTexture("CharacterPreview");
|
|
||||||
|
|
||||||
mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
|
mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
|
||||||
+ boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
|
+ boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void open();
|
virtual void open();
|
||||||
|
|
||||||
|
void doRenderUpdate();
|
||||||
|
|
||||||
/// start trading, disables item drag&drop
|
/// start trading, disables item drag&drop
|
||||||
void startTrade();
|
void startTrade();
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool mPreviewDirty;
|
||||||
|
|
||||||
MyGUI::Widget* mAvatar;
|
MyGUI::Widget* mAvatar;
|
||||||
MyGUI::ImageBox* mAvatarImage;
|
MyGUI::ImageBox* mAvatarImage;
|
||||||
MyGUI::TextBox* mArmorRating;
|
MyGUI::TextBox* mArmorRating;
|
||||||
|
|
|
@ -1190,3 +1190,8 @@ void WindowManager::showSoulgemDialog(MWWorld::Ptr item)
|
||||||
{
|
{
|
||||||
mSoulgemDialog->show(item);
|
mSoulgemDialog->show(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::frameStarted (float dt)
|
||||||
|
{
|
||||||
|
mInventoryWindow->doRenderUpdate ();
|
||||||
|
}
|
||||||
|
|
|
@ -238,6 +238,8 @@ namespace MWGui
|
||||||
virtual void startRepair(MWWorld::Ptr actor);
|
virtual void startRepair(MWWorld::Ptr actor);
|
||||||
virtual void startRepairItem(MWWorld::Ptr item);
|
virtual void startRepairItem(MWWorld::Ptr item);
|
||||||
|
|
||||||
|
virtual void frameStarted(float dt);
|
||||||
|
|
||||||
virtual void showSoulgemDialog (MWWorld::Ptr item);
|
virtual void showSoulgemDialog (MWWorld::Ptr item);
|
||||||
|
|
||||||
virtual void changePointer (const std::string& name);
|
virtual void changePointer (const std::string& name);
|
||||||
|
|
Loading…
Reference in a new issue