mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 21:53:52 +00:00
Use mousewheel to turn book pages.
This commit is contained in:
parent
df1f1bd5c8
commit
aac3ada14b
3 changed files with 37 additions and 17 deletions
|
@ -130,26 +130,12 @@ namespace MWGui
|
|||
|
||||
void BookWindow::onNextPageButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
if ((mCurrentPage+1)*2 < mPages.size())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book page2", 1.0, 1.0);
|
||||
|
||||
++mCurrentPage;
|
||||
|
||||
updatePages();
|
||||
}
|
||||
nextPage();
|
||||
}
|
||||
|
||||
void BookWindow::onPrevPageButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
if (mCurrentPage > 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book page", 1.0, 1.0);
|
||||
|
||||
--mCurrentPage;
|
||||
|
||||
updatePages();
|
||||
}
|
||||
prevPage();
|
||||
}
|
||||
|
||||
void BookWindow::updatePages()
|
||||
|
@ -194,5 +180,28 @@ namespace MWGui
|
|||
if (button->getAlign().isRight())
|
||||
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
|
||||
}
|
||||
|
||||
void BookWindow::nextPage()
|
||||
{
|
||||
if ((mCurrentPage+1)*2 < mPages.size())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book page2", 1.0, 1.0);
|
||||
|
||||
++mCurrentPage;
|
||||
|
||||
updatePages();
|
||||
}
|
||||
}
|
||||
void BookWindow::prevPage()
|
||||
{
|
||||
if (mCurrentPage > 0)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book page", 1.0, 1.0);
|
||||
|
||||
--mCurrentPage;
|
||||
|
||||
updatePages();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ namespace MWGui
|
|||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
||||
void nextPage();
|
||||
void prevPage();
|
||||
void setInventoryAllowed(bool allowed);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwgui/bookwindow.hpp"
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
|
@ -552,6 +553,15 @@ namespace MWInput
|
|||
if (arg.state.Z.rel)
|
||||
MWBase::Environment::get().getWorld()->changeVanityModeScale(arg.state.Z.rel);
|
||||
}
|
||||
|
||||
//if the player is reading a book and flicking the mouse wheel
|
||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Book && arg.state.Z.rel)
|
||||
{
|
||||
if (arg.state.Z.rel < 0)
|
||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->nextPage();
|
||||
else
|
||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->prevPage();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue