本文整理汇总了C++中ci::app::MouseEvent类的典型用法代码示例。如果您正苦于以下问题:C++ MouseEvent类的具体用法?C++ MouseEvent怎么用?C++ MouseEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MouseEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mouseDownInternal
bool XRect::mouseDownInternal( ci::app::MouseEvent event )
{
bool hit = hitTest( event.getPos() );
if (hit && mScript)
mScript->call("mouseDown", event.getPos().x, event.getPos().y);
return hit;
}
开发者ID:stimulant,项目名称:Cinder-XUI,代码行数:7,代码来源:XRect.cpp
示例2: mouseDown
void GraphNodeHandler::mouseDown(ci::app::MouseEvent &event)
{
if (glm::length(*position - ci::vec2(event.getPos())) < size)
{
if (event.isAltDown())
{
if (selection == Selection::addEdge)
{
selection = Selection::none;
}
else
{
selection = Selection::addEdge;
selectedInFrame = ci::app::getElapsedFrames();
}
}
else
{
selection = Selection::move;
}
event.setHandled(true);
}
else
{
if (selection == Selection::move)
selection = Selection::none;
}
}
开发者ID:mitro42,项目名称:GraphStudio,代码行数:29,代码来源:GraphNodeHandler.cpp
示例3: mouseWheel
void ColorPicker::mouseWheel( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) && !mHit ) {
mColor.a -= event.getWheelIncrement() * mFormat.mSensitivity;
mColor.a = std::max( std::min( mColor.a, mFormat.mAlphaLimits.y ), mFormat.mAlphaLimits.x );
updateColorRef();
updateLabel();
setNeedsDisplay();
if( (int)mTrigger & (int)Trigger::CHANGE ) {
trigger();
}
}
else if( mHit ) {
vec3 color = mColor.get( mFormat.mColorModel );
color.z -= event.getWheelIncrement() * mFormat.mSensitivity;
color.z = std::max( std::min( color.z, 1.0f ), 0.0f );
mColor.set( mFormat.mColorModel, vec4( color.x, color.y, color.z, mColor.a ) );
updateColorRef();
updateLabel();
setNeedsDisplay();
if( (int)mTrigger & (int)Trigger::CHANGE ) {
trigger();
}
}
}
开发者ID:rezaali,项目名称:Cinder-UI,代码行数:25,代码来源:ColorPicker.cpp
示例4: mouseUp
void MultiSlider::mouseUp( ci::app::MouseEvent &event )
{
if( mHit ) {
#ifdef CINDER_COCOA_TOUCH
setState( State::NORMAL );
#else
if( isHit( event.getPos() ) ) {
setState( State::OVER );
std::string newKey = getKey( event.getPos() );
if( newKey != mHoverKey ) {
mHoverKey = newKey;
changeState();
setNeedsDisplay();
}
}
else {
setState( State::NORMAL );
}
#endif
if( (int)mTrigger & (int)Trigger::END ) {
trigger();
}
}
mHitKey = "";
mHit = false;
}
开发者ID:rezaali,项目名称:Cinder-UI,代码行数:26,代码来源:MultiSlider.cpp
示例5: mouseDrag
bool Monitor::mouseDrag( ci::app::MouseEvent event )
{
switch( mMouseState )
{
case MS_NOTHING :
break;
case MS_MOVE :
{
Vec2i diff = event.getPos() - mPosMouseDrag;
mArea += diff;
mPosMouseDrag = event.getPos();
}
break;
case MS_RESIZE :
{
Vec2i diff = event.getPos() - mPosMouseDrag;
int width = math<int>::max( mArea.getWidth() + diff.x, mMinWidth );
int height = math<int>::max( mArea.getHeight() + diff.y, mMinHeight );
mArea.x2 = mArea.x1 + width;
mArea.y2 = mArea.y1 + height;
mPosMouseDrag = event.getPos();
}
break;
}
return mMouseState != MS_NOTHING;
}
开发者ID:bgbotond,项目名称:PulseSensor,代码行数:27,代码来源:Monitor.cpp
示例6: mouseDrag
void RibbonPaint::mouseDrag( ci::app::MouseEvent event )
{
if(_state != kStateNormal) return;
// Not drawing lines, clear the frame
if(_drawLines == false)
ci::gl::clear( _clearColor );
// invisible if shift is helpd down
if( event.isShiftDown() )
{
// Store it the first time
if(_alphaWhenDrawing > 0) {
_oldAlphaWhenDrawing = _alphaWhenDrawing;
}
// make zero until they let go, or mouse up
_alphaWhenDrawing = 0;
} else {
_alphaWhenDrawing = _oldAlphaWhenDrawing;
}
// start drawing lines
_mousePosition = event.getPos();
_drawLines = true;
}
开发者ID:onedayitwillmake,项目名称:RibbonPaint-2.0,代码行数:27,代码来源:RibbonPaint.cpp
示例7: onMouseDown
void PretzelRoot::onMouseDown(ci::app::MouseEvent &event)
{
PretzelGui *pg;
// only click the top-most gui
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){
pg = *it;
if( pg->getGlobalBounds().contains( event.getPos() ) ){
pg->mouseDown( event.getPos() );
break;
}
}
// If this gui isn't on top, do z sorting to bring it up
if( pg != mGuiList[0] ){
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ){
if( *it == pg ){
it = mGuiList.erase(it);
}else{
++it;
}
}
mGuiList.push_front(pg);
}
}
开发者ID:RallyTronics,项目名称:PretzelGui,代码行数:27,代码来源:PretzelRoot.cpp
示例8: mouseDrag
void GraphNodeHandler::mouseDrag(ci::app::MouseEvent &event)
{
if (selection == Selection::move)
{
*position = event.getPos();
changed = true;
}
event.setHandled(selection == Selection::move);
}
开发者ID:mitro42,项目名称:GraphStudio,代码行数:9,代码来源:GraphNodeHandler.cpp
示例9: mouseUp
void GraphNodeHandler::mouseUp(ci::app::MouseEvent &event)
{
if (selection == Selection::move)
{
selection = Selection::none;
event.setHandled(true);
return;
}
event.setHandled(false);
}
开发者ID:mitro42,项目名称:GraphStudio,代码行数:10,代码来源:GraphNodeHandler.cpp
示例10: mouseDrag
bool Camera::mouseDrag(ci::app::MouseEvent m_event) {
/*
if (draw_interface_)
return false;
*/
cam_->mouseDrag(m_event.getPos(), m_event.isLeftDown(), m_event.isMiddleDown(),
m_event.isRightDown());
return false;
}
开发者ID:ptierney,项目名称:cinder_sketches,代码行数:10,代码来源:Camera.cpp
示例11: ImGui_ImplCinder_MouseButtonCallback
void ImGui_ImplCinder_MouseButtonCallback(ci::app::MouseEvent e, bool isDown)
{
ImGui_ImplCinder_MouseState state = isDown ? MouseState_Pressed : MouseState_Released;
if (e.isLeft())
g_MousePressed[0] = state;
else if (e.isRight())
g_MousePressed[1] = state;
else if (e.isMiddle())
g_MousePressed[2] = state;
}
开发者ID:jrcurtis,项目名称:subsequencely,代码行数:10,代码来源:imgui_impl_cinder_gl3.cpp
示例12: signbit
void DialerT<T>::mouseWheel( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) )
{
T value = *mValueRef + mZoneMultiplier*( signbit( event.getWheelIncrement() ) > 0 ? 1.0 : -1.0 );
setValue( max( min( value, mMax ), mMin ) );
if( (int)mTrigger & (int)Trigger::CHANGE )
{
trigger();
}
}
}
开发者ID:eriser,项目名称:Cinder-UI,代码行数:12,代码来源:Dialer.cpp
示例13: 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 );
}
开发者ID:rezaali,项目名称:Cinder-UI,代码行数:52,代码来源:ColorPicker.cpp
示例14: getHitPercent
void SliderT<T>::input( ci::app::MouseEvent &event )
{
vec2 hp = getHitPercent( event.getPos() );
hp.x = min( max( hp.x, 0.0f ), 1.0f );
float value = lmap<double>( hp.x, 0.0, 1.0, mMin, mMax );
if( mFormat.mSticky || event.isMetaDown() )
{
value = ceil( value / mFormat.mStickyValue ) * mFormat.mStickyValue;
}
setValue( value );
}
开发者ID:eriser,项目名称:Cinder-UI,代码行数:13,代码来源:Slider.cpp
示例15: mouseUp
void Game::mouseUp(ci::app::MouseEvent e)
{
int button;
if (e.isLeft())
button = Button::LEFT;
else if (e.isRight())
button = Button::RIGHT;
else if (e.isMiddle())
button = Button::MIDDLE;
else
return;
mEngine.mouseEvent(false, button);
}
开发者ID:jettca,项目名称:Aton,代码行数:14,代码来源:Game.cpp
示例16: setState
void DialerT<T>::mouseMove( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) )
{
setState( State::OVER );
mHitPoint = event.getPos();
calculatePrecisionZone();
setNeedsDisplay();
}
else
{
setState( State::NORMAL );
}
}
开发者ID:eriser,项目名称:Cinder-UI,代码行数:14,代码来源:Dialer.cpp
示例17: onMouseMoved
void PretzelRoot::onMouseMoved(ci::app::MouseEvent &event)
{
// for( auto it=mGuiList.begin(); it!=mGuiList.end(); ++it){
// (*it)->mouseMoved( event.getPos() );
// }
for( auto it = mGuiList.begin(); it!=mGuiList.end(); ++it){
PretzelGui *pg = *it;
if( pg->getGlobalBounds().contains( event.getPos() ) ){
(*it)->mouseMoved( event.getPos() );
break;
}
}
}
开发者ID:RallyTronics,项目名称:PretzelGui,代码行数:15,代码来源:PretzelRoot.cpp
示例18: 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;
}
开发者ID:kourtin,项目名称:Atelier,代码行数:15,代码来源:cinder2DInteractItem.cpp
示例19: setState
void RangeT<T>::mouseDown( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) ) {
mHit = true;
setState( State::DOWN );
mHitValueHigh = mValueHigh;
mHitValueLow = mValueLow;
input( event.getPos() );
if( (int)mTrigger & (int)Trigger::BEGIN ) {
trigger();
}
} else {
setState( State::NORMAL );
}
}
开发者ID:SethGibson,项目名称:Cinder-UI,代码行数:15,代码来源:Range.cpp
示例20: mouseDown
void TextInput::mouseDown( ci::app::MouseEvent &event )
{
if( isHit( event.getPos() ) ) {
mHit = true;
mClicked = true;
setState( State::DOWN );
calculateCursorPosition( event.getPos() );
if( (int)mTrigger & (int)Trigger::BEGIN ) {
trigger();
}
}
else {
setState( State::NORMAL );
}
}
开发者ID:rezaali,项目名称:Cinder-UI,代码行数:15,代码来源:TextInput.cpp
注:本文中的ci::app::MouseEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论