本文整理汇总了C++中ci::app::MouseEvent::getY方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseEvent::getY方法的具体用法?C++ MouseEvent::getY怎么用?C++ MouseEvent::getY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci::app::MouseEvent
的用法示例。
在下文中一共展示了MouseEvent::getY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDrag
void ColorPicker::mouseDrag( ci::app::MouseEvent &event )
{
if( mHit ) {
vec2 pt = event.getPos();
vec3 color = mColor.get( mFormat.mColorModel );
if( mFormat.mRelative ) {
//COMMON
vec2 delta = pt - mHitPoint;
delta *= mFormat.mSensitivity;
color.x += delta.x;
//SPECIFIC
if( mFormat.mColorModel == ColorModel::CM_HSV ) {
color.x = color.x > 1.0 ? 0.0 : color.x < 0.0 ? 1.0 : color.x;
color.y -= delta.y;
}
else {
color.x = std::max( std::min( color.x, 1.0f ), 0.0f );
color.y += delta.y;
}
}
else {
//COMMON
color.x = (float)event.getX() / (float)app::getWindow()->getWidth();
//SPECIFIC
if( mFormat.mColorModel == ColorModel::CM_HSV ) {
color.x = color.x > 1.0 ? 0.0 : color.x < 0.0 ? 1.0 : color.x;
color.y = 1.0 - ( (float)event.getY() / (float)app::getWindow()->getHeight() );
}
else {
color.x = std::max( std::min( color.x, 1.0f ), 0.0f );
color.y = (float)event.getY() / (float)app::getWindow()->getHeight();
}
}
color.y = std::max( std::min( color.y, 1.0f ), 0.0f );
mColor.set( mFormat.mColorModel, vec4( color.x, color.y, color.z, mColor.a ) );
mHitPoint = pt;
updateColorRef();
updateLabel();
setNeedsDisplay();
setState( State::DOWN );
if( (int)mTrigger & (int)Trigger::CHANGE ) {
trigger();
}
}
else {
setState( State::NORMAL );
}
View::mouseDrag( event );
}
示例2: scale
bool Cinder2DInteractItem::detect_click_selection(ci::app::MouseEvent mouse_event) {
if (!detect_selection_)
return false;
Rect bounds = bounding_rect();
bounds *= scale().x;
bounds += ci::Vec2f(position().x, position().y);
if (bounds.isInside(ci::Vec2f(mouse_event.getX(), mouse_event.getY()))) {
activate(Client::user_identity());
return true;
}
return false;
}
示例3: ImGui_ImplCinder_MouseMoveCallback
void ImGui_ImplCinder_MouseMoveCallback(ci::app::MouseEvent e)
{
g_MousePos.x = e.getX();
g_MousePos.y = e.getY();
}