本文整理汇总了C++中LLSliderCtrl::getMaxValue方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSliderCtrl::getMaxValue方法的具体用法?C++ LLSliderCtrl::getMaxValue怎么用?C++ LLSliderCtrl::getMaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSliderCtrl
的用法示例。
在下文中一共展示了LLSliderCtrl::getMaxValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSliderText
void LLPanelDisplay::updateSliderText(LLUICtrl* ctrl, void* user_data)
{
// get our UI widgets
LLTextBox* text_box = (LLTextBox*)user_data;
LLSliderCtrl* slider = (LLSliderCtrl*) ctrl;
if(text_box == NULL || slider == NULL)
{
return;
}
// get range and points when text should change
F32 range = slider->getMaxValue() - slider->getMinValue();
llassert(range > 0);
F32 midPoint = slider->getMinValue() + range / 3.0f;
F32 highPoint = slider->getMinValue() + (2.0f * range / 3.0f);
// choose the right text
if(slider->getValueF32() < midPoint)
{
text_box->setText(std::string("Low"));
}
else if (slider->getValueF32() < highPoint)
{
text_box->setText(std::string("Mid"));
}
else
{
text_box->setText(std::string("High"));
}
}
示例2: onHintMaxMouseUp
void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
{
LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;
F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
if (isAgentAvatarValid())
{
LLVisualParamHint* hint = self->mHintMax;
if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
{
// step in direction
F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f);
F32 new_percent = self->weightToPercent(new_weight);
LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
self->mWearable->writeToAvatar();
slider->setValue( self->weightToPercent( new_weight ) );
}
}
}
}
LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
示例3: onHintHeldDown
void LLScrollingPanelParam::onHintHeldDown( bool max )
{
LLVisualParamHint* hint = max ? mHintMax : mHintMin;
LLViewerVisualParam* param = hint->getVisualParam();
if(!mWearable || !param)
{
return;
}
F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
if (current_weight != hint->getVisualParamWeight() )
{
const F32 FULL_BLEND_TIME = 2.f;
F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32() - mLastHeldTime;
mLastHeldTime += elapsed_time;
F32 new_weight;
if (current_weight > hint->getVisualParamWeight() )
{
new_weight = current_weight - (elapsed_time / FULL_BLEND_TIME);
}
else
{
new_weight = current_weight + (elapsed_time / FULL_BLEND_TIME);
}
// Make sure we're not taking the slider out of bounds
// (this is where some simple UI limits are stored)
F32 new_percent = weightToPercent(new_weight);
LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
mWearable->writeToAvatar();
gAgentAvatarp->updateVisualParams();
slider->setValue( weightToPercent( new_weight ) );
}
}
}
}
示例4: onHintMouseUp
void LLScrollingPanelParam::onHintMouseUp( bool max )
{
F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32();
if (isAgentAvatarValid())
{
LLVisualParamHint* hint = max ? mHintMax : mHintMin;
if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
{
LLViewerVisualParam* param = hint->getVisualParam();
if(mWearable)
{
// step in direction
F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
F32 range = mHintMax->getVisualParamWeight() - mHintMin->getVisualParamWeight();
//if min, range should be negative.
if(!max)
range *= -1.f;
// step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f);
F32 new_percent = weightToPercent(new_weight);
LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
mWearable->writeToAvatar();
slider->setValue( weightToPercent( new_weight ) );
}
}
}
}
}
LLVisualParamHint::requestHintUpdates( mHintMin, mHintMax );
}