mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Remove software cursor option, hw cursors seem to be working well enough
This commit is contained in:
parent
fa63924884
commit
5a4bd9b202
4 changed files with 5 additions and 92 deletions
|
@ -73,57 +73,4 @@ namespace MWGui
|
||||||
return mSize;
|
return mSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Cursor::Cursor()
|
|
||||||
{
|
|
||||||
// hide mygui's pointer since we're rendering it ourselves (because mygui's pointer doesn't support rotation)
|
|
||||||
MyGUI::PointerManager::getInstance().setVisible(false);
|
|
||||||
|
|
||||||
MyGUI::PointerManager::getInstance().eventChangeMousePointer += MyGUI::newDelegate(this, &Cursor::onCursorChange);
|
|
||||||
|
|
||||||
mWidget = MyGUI::Gui::getInstance().createWidget<MyGUI::ImageBox>("RotatingSkin",0,0,0,0,MyGUI::Align::Default,"Pointer","");
|
|
||||||
|
|
||||||
onCursorChange(MyGUI::PointerManager::getInstance().getDefaultPointer());
|
|
||||||
}
|
|
||||||
|
|
||||||
Cursor::~Cursor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cursor::onCursorChange(const std::string &name)
|
|
||||||
{
|
|
||||||
ResourceImageSetPointerFix* imgSetPtr = dynamic_cast<ResourceImageSetPointerFix*>(
|
|
||||||
MyGUI::PointerManager::getInstance().getByName(name));
|
|
||||||
assert(imgSetPtr != NULL);
|
|
||||||
|
|
||||||
MyGUI::ResourceImageSet* imgSet = imgSetPtr->getImageSet();
|
|
||||||
|
|
||||||
std::string texture = imgSet->getIndexInfo(0,0).texture;
|
|
||||||
|
|
||||||
mSize = imgSetPtr->getSize();
|
|
||||||
mHotSpot = imgSetPtr->getHotSpot();
|
|
||||||
|
|
||||||
int rotation = imgSetPtr->getRotation();
|
|
||||||
|
|
||||||
mWidget->setImageTexture(texture);
|
|
||||||
MyGUI::ISubWidget* main = mWidget->getSubWidgetMain();
|
|
||||||
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
|
|
||||||
rotatingSubskin->setCenter(MyGUI::IntPoint(mSize.width/2,mSize.height/2));
|
|
||||||
rotatingSubskin->setAngle(Ogre::Degree(rotation).valueRadians());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cursor::update()
|
|
||||||
{
|
|
||||||
MyGUI::IntPoint position = MyGUI::InputManager::getInstance().getMousePosition();
|
|
||||||
|
|
||||||
mWidget->setPosition(position - mHotSpot);
|
|
||||||
mWidget->setSize(mSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cursor::setVisible(bool visible)
|
|
||||||
{
|
|
||||||
mWidget->setVisible(visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,23 +39,6 @@ namespace MWGui
|
||||||
int mRotation; // rotation in degrees
|
int mRotation; // rotation in degrees
|
||||||
};
|
};
|
||||||
|
|
||||||
class Cursor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Cursor();
|
|
||||||
~Cursor();
|
|
||||||
void update ();
|
|
||||||
|
|
||||||
void setVisible (bool visible);
|
|
||||||
|
|
||||||
void onCursorChange (const std::string& name);
|
|
||||||
|
|
||||||
private:
|
|
||||||
MyGUI::ImageBox* mWidget;
|
|
||||||
|
|
||||||
MyGUI::IntSize mSize;
|
|
||||||
MyGUI::IntPoint mHotSpot;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -100,7 +100,6 @@ namespace MWGui
|
||||||
, mRepair(NULL)
|
, mRepair(NULL)
|
||||||
, mCompanionWindow(NULL)
|
, mCompanionWindow(NULL)
|
||||||
, mTranslationDataStorage (translationDataStorage)
|
, mTranslationDataStorage (translationDataStorage)
|
||||||
, mSoftwareCursor(NULL)
|
|
||||||
, mCharGen(NULL)
|
, mCharGen(NULL)
|
||||||
, mInputBlocker(NULL)
|
, mInputBlocker(NULL)
|
||||||
, mCrosshairEnabled(Settings::Manager::getBool ("crosshair", "HUD"))
|
, mCrosshairEnabled(Settings::Manager::getBool ("crosshair", "HUD"))
|
||||||
|
@ -128,7 +127,6 @@ namespace MWGui
|
||||||
, mFPS(0.0f)
|
, mFPS(0.0f)
|
||||||
, mTriangleCount(0)
|
, mTriangleCount(0)
|
||||||
, mBatchCount(0)
|
, mBatchCount(0)
|
||||||
, mUseHardwareCursors(Settings::Manager::getBool("hardware cursors", "GUI"))
|
|
||||||
{
|
{
|
||||||
// Set up the GUI system
|
// Set up the GUI system
|
||||||
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
|
mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
|
||||||
|
@ -173,16 +171,19 @@ namespace MWGui
|
||||||
mLoadingScreen->onResChange (w,h);
|
mLoadingScreen->onResChange (w,h);
|
||||||
|
|
||||||
//set up the hardware cursor manager
|
//set up the hardware cursor manager
|
||||||
mSoftwareCursor = new Cursor();
|
|
||||||
mCursorManager = new SFO::SDLCursorManager();
|
mCursorManager = new SFO::SDLCursorManager();
|
||||||
|
|
||||||
MyGUI::PointerManager::getInstance().eventChangeMousePointer += MyGUI::newDelegate(this, &WindowManager::onCursorChange);
|
MyGUI::PointerManager::getInstance().eventChangeMousePointer += MyGUI::newDelegate(this, &WindowManager::onCursorChange);
|
||||||
|
|
||||||
MyGUI::InputManager::getInstance().eventChangeKeyFocus += MyGUI::newDelegate(this, &WindowManager::onKeyFocusChanged);
|
MyGUI::InputManager::getInstance().eventChangeKeyFocus += MyGUI::newDelegate(this, &WindowManager::onKeyFocusChanged);
|
||||||
|
|
||||||
setUseHardwareCursors(mUseHardwareCursors);
|
mCursorManager->setEnabled(true);
|
||||||
|
|
||||||
onCursorChange(MyGUI::PointerManager::getInstance().getDefaultPointer());
|
onCursorChange(MyGUI::PointerManager::getInstance().getDefaultPointer());
|
||||||
mCursorManager->cursorVisibilityChange(false);
|
mCursorManager->cursorVisibilityChange(false);
|
||||||
|
|
||||||
|
// hide mygui's pointer
|
||||||
|
MyGUI::PointerManager::getInstance().setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::initUI()
|
void WindowManager::initUI()
|
||||||
|
@ -313,7 +314,6 @@ namespace MWGui
|
||||||
delete mMerchantRepair;
|
delete mMerchantRepair;
|
||||||
delete mRepair;
|
delete mRepair;
|
||||||
delete mSoulgemDialog;
|
delete mSoulgemDialog;
|
||||||
delete mSoftwareCursor;
|
|
||||||
delete mCursorManager;
|
delete mCursorManager;
|
||||||
delete mRecharge;
|
delete mRecharge;
|
||||||
|
|
||||||
|
@ -344,8 +344,6 @@ namespace MWGui
|
||||||
mHud->setBatchCount(mBatchCount);
|
mHud->setBatchCount(mBatchCount);
|
||||||
|
|
||||||
mHud->update();
|
mHud->update();
|
||||||
|
|
||||||
mSoftwareCursor->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::updateVisible()
|
void WindowManager::updateVisible()
|
||||||
|
@ -879,12 +877,6 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getInputManager()->setDragDrop(dragDrop);
|
MWBase::Environment::get().getInputManager()->setDragDrop(dragDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setUseHardwareCursors(bool use)
|
|
||||||
{
|
|
||||||
mCursorManager->setEnabled(use);
|
|
||||||
mSoftwareCursor->setVisible(!use && mCursorVisible);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManager::setCursorVisible(bool visible)
|
void WindowManager::setCursorVisible(bool visible)
|
||||||
{
|
{
|
||||||
if(mCursorVisible == visible)
|
if(mCursorVisible == visible)
|
||||||
|
@ -892,8 +884,6 @@ namespace MWGui
|
||||||
|
|
||||||
mCursorVisible = visible;
|
mCursorVisible = visible;
|
||||||
mCursorManager->cursorVisibilityChange(visible);
|
mCursorManager->cursorVisibilityChange(visible);
|
||||||
|
|
||||||
mSoftwareCursor->setVisible(!mUseHardwareCursors && visible);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
|
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
|
||||||
|
@ -924,8 +914,6 @@ namespace MWGui
|
||||||
mHud->setFpsLevel(Settings::Manager::getInt("fps", "HUD"));
|
mHud->setFpsLevel(Settings::Manager::getInt("fps", "HUD"));
|
||||||
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
|
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
|
||||||
|
|
||||||
setUseHardwareCursors(Settings::Manager::getBool("hardware cursors", "GUI"));
|
|
||||||
|
|
||||||
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
||||||
it != changed.end(); ++it)
|
it != changed.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -977,8 +965,6 @@ namespace MWGui
|
||||||
|
|
||||||
void WindowManager::onCursorChange(const std::string &name)
|
void WindowManager::onCursorChange(const std::string &name)
|
||||||
{
|
{
|
||||||
mSoftwareCursor->onCursorChange(name);
|
|
||||||
|
|
||||||
if(!mCursorManager->cursorChanged(name))
|
if(!mCursorManager->cursorChanged(name))
|
||||||
return; //the cursor manager doesn't want any more info about this cursor
|
return; //the cursor manager doesn't want any more info about this cursor
|
||||||
//See if we can get the information we need out of the cursor resource
|
//See if we can get the information we need out of the cursor resource
|
||||||
|
|
|
@ -369,9 +369,6 @@ namespace MWGui
|
||||||
unsigned int mTriangleCount;
|
unsigned int mTriangleCount;
|
||||||
unsigned int mBatchCount;
|
unsigned int mBatchCount;
|
||||||
|
|
||||||
bool mUseHardwareCursors;
|
|
||||||
void setUseHardwareCursors(bool use);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
|
||||||
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
|
||||||
|
|
Loading…
Reference in a new issue