[SOLVED] Pass KeyEventArgs with MouseEventArgs
Posted: Tue Nov 03, 2009 07:03
CEGUI 0.7.1 SVN Branch
This doesn't seem to be present or we haven't figured out how to do it. We want to be able to scan for a pressed key (like shift) when the user is scrolling the mouse wheel. So far, it doesn't seem to work. We use OIS and we are receiving the SHIFT key modifier and injecting it into the CEGUI system.
This doesn't seem to be present or we haven't figured out how to do it. We want to be able to scan for a pressed key (like shift) when the user is scrolling the mouse wheel. So far, it doesn't seem to work. We use OIS and we are receiving the SHIFT key modifier and injecting it into the CEGUI system.
Code: Select all
bool clsGUIInvList::event_SpinnerUnits_MouseWheel(const CEGUI::EventArgs& e)
{
const CEGUI::KeyEventArgs& mKEA = static_cast<const CEGUI::KeyEventArgs&>( e );
const CEGUI::MouseEventArgs& mMEA = static_cast<const CEGUI::MouseEventArgs&>( e );
// If the user is also pressing the SHIFT key then change the spinner multiplier.
float mMultiplier = 1.0f, mNewUnits = 0.0f;
if ( mKEA.sysKeys == CEGUI::SystemKey::Shift ) mMultiplier = 10.0f;
// Only process mouse wheel changes
if ( mMEA.wheelChange != 0.0f )
{
if ( mMEA.wheelChange > 0.0f )
mNewUnits = mSpinnerUnits->getCurrentValue() + ( mSpinnerUnits->getStepSize() * mMultiplier );
else
mNewUnits = mSpinnerUnits->getCurrentValue() - ( mSpinnerUnits->getStepSize() * mMultiplier );
mSpinnerUnits->setCurrentValue( mNewUnits );
} // wheelChange?
return true;
} // event_SpinnerUnits_MouseWheel