当前位置: 首页>>代码示例>>C++>>正文


C++ MouseEvent::getX方法代码示例

本文整理汇总了C++中gcn::MouseEvent::getX方法的典型用法代码示例。如果您正苦于以下问题:C++ MouseEvent::getX方法的具体用法?C++ MouseEvent::getX怎么用?C++ MouseEvent::getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gcn::MouseEvent的用法示例。


在下文中一共展示了MouseEvent::getX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mouseDragged

void EmoteShortcutContainer::mouseDragged(gcn::MouseEvent &event)
{
    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        if (!mEmoteMoved && mEmoteClicked)
        {
            const int index = getIndexFromGrid(event.getX(), event.getY());

            if (index == -1)
                return;

            const int emoteId = emoteShortcut->getEmote(index);

            if (emoteId)
            {
                mEmoteMoved = emoteId;
                emoteShortcut->removeEmote(index);
            }
        }
        if (mEmoteMoved)
        {
            mCursorPosX = event.getX();
            mCursorPosY = event.getY();
        }
    }
}
开发者ID:TonyRice,项目名称:mana,代码行数:26,代码来源:emoteshortcutcontainer.cpp

示例2: mouseReleased

void PlayControllerZone::mouseReleased( gcn::MouseEvent& mouseEvent )
{

  model().setMouse( "ZoneO",
                    mouseEvent.getX(),
                    mouseEvent.getY() );

  //
  // Tenemos un area para seleccionar.
  adjustSelectedArea( mouseEvent.getX(),
                      mouseEvent.getY() );

  switch ( mouseEvent.getButton() )
  {
    case gcn::MouseEvent::LEFT:
      view().setSelectedArea( m_selectarea );
      break;
    case gcn::MouseEvent::RIGHT:
      view().setDestination( m_selectarea );
      break;
    default:
      break;
  }

  mouseEvent.consume();
}
开发者ID:jorgejcabrera,项目名称:gamemvc,代码行数:26,代码来源:playcontrollerzone.cpp

示例3: mouseDragged

void OutfitWindow::mouseDragged(gcn::MouseEvent &event)
{
    Window::mouseDragged(event);
    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        if (!mItemMoved && mItemClicked)
        {
            const int index = getIndexFromGrid(event.getX(), event.getY());
            if (index == -1)
                return;
            const int itemId = mItems[mCurrentOutfit][index];
            if (itemId < 0)
                return;
            Item *item = PlayerInfo::getInventory()->findItem(itemId);
            if (item)
            {
                mItemMoved = item;
                mItems[mCurrentOutfit][index] = -1;
            }
        }
        if (mItemMoved)
        {
            mCursorPosX = event.getX();
            mCursorPosY = event.getY();
        }
    }
}
开发者ID:mobilehub,项目名称:mana,代码行数:27,代码来源:outfitwindow.cpp

示例4: mouseDragged

void ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
{
    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        if (!mItemMoved && mItemClicked)
        {
            const int index = getIndexFromGrid(event.getX(), event.getY());
            const int itemId = itemShortcut->getItem(index);

            if (index == -1 || itemId < 0)
                return;

            Item *item = player_node->getInventory()->findItem(itemId);

            if (item)
            {
                mItemMoved = item;
                itemShortcut->removeItem(index);
            }
        }
        if (mItemMoved)
        {
            mCursorPosX = event.getX();
            mCursorPosY = event.getY();
        }
    }
}
开发者ID:weimingtom,项目名称:guichan-input,代码行数:27,代码来源:itemshortcutcontainer.cpp

示例5: getTitleBarHeight

void
Wellcome::mousePressed(gcn::MouseEvent &event)
{
    gcn::Rectangle d1, d2, d3, d4;
    d1.setAll(mNext->getDimension().x,
              mNext->getDimension().y + getTitleBarHeight(),
              mNext->getDimension().x + mNext->getDimension().width,
              mNext->getDimension().y + mNext->getDimension().height + getTitleBarHeight());
    d2.setAll(mPrev->getDimension().x,
              mPrev->getDimension().y + getTitleBarHeight(),
              mPrev->getDimension().x + mPrev->getDimension().width,
              mPrev->getDimension().y + mPrev->getDimension().height + getTitleBarHeight());
    d3.setAll(mFinish->getDimension().x,
              mFinish->getDimension().y + getTitleBarHeight(),
              mFinish->getDimension().x + mFinish->getDimension().width,
              mFinish->getDimension().y + mFinish->getDimension().height + getTitleBarHeight());
    d4.setAll(mAgain->getDimension().x,
              mAgain->getDimension().y + getTitleBarHeight(),
              mAgain->getDimension().x + mAgain->getDimension().width,
              mAgain->getDimension().y + mAgain->getDimension().height + getTitleBarHeight());

    if(d1.isPointInRect(event.getX(), event.getY()) ||
       d2.isPointInRect(event.getX(), event.getY()) ||
       d3.isPointInRect(event.getX(), event.getY()) ||
       d4.isPointInRect(event.getX(), event.getY()) ||
       event.getY()<getTitleBarHeight())
    {
        Window::mousePressed(event);
        return;
    }
    setActionEventId("next");
    distributeActionEvent();

}
开发者ID:mekolat,项目名称:elektrogamesvn,代码行数:34,代码来源:wellcome.cpp

示例6: mousePressed

 void TileSelector::mousePressed(gcn::MouseEvent& mouseEvent)
 {
    if (mouseEvent.getX() <= mTileSetBitmap->w
         && mouseEvent.getY() <= mTileSetBitmap->h)
     {
         mSelectedTile = mouseEvent.getX() / 16
                       + (mouseEvent.getY() / 16) * mTileSetBitmap->w / 16;
         generateAction();
     }
 }
开发者ID:olofn,项目名称:db_public,代码行数:10,代码来源:tileselector.cpp

示例7: mouseDragged

void GlassViewer::mouseDragged(gcn::MouseEvent &e) {
	if(!mEnabled)
		return;
	
	//Console_Printf("dragged: %d, %d\n", e.getX(), e.getY());
	
	angle = origAngle + ((e.getX() - mLastMouse[0])/(float)mDimension.width) * 360;
	if(e.getX() < mLastMouse[0])
		dAngle = -1;
	else dAngle = 1;
}
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:11,代码来源:GlassViewer.cpp

示例8: mouseEntered

void PlayControllerZone::mouseEntered( gcn::MouseEvent& mouseEvent )
{

  model().setMouse( "Zone",
                    mouseEvent.getX(),
                    mouseEvent.getY() );
  view().updateMoveView( mouseEvent.getX(),
                         mouseEvent.getY() );
  mouseEvent.consume();

}
开发者ID:jorgejcabrera,项目名称:gamemvc,代码行数:11,代码来源:playcontrollerzone.cpp

示例9: mouseDragged

void PlayControllerZone::mouseDragged( gcn::MouseEvent& mouseEvent )
{

  model().setMouse( "ZoneE",
                    mouseEvent.getX(),
                    mouseEvent.getY() );

  adjustSelectedArea( mouseEvent.getX(),
                      mouseEvent.getY() );

  view().paintSelectedArea( m_selectarea );
  mouseEvent.consume();
}
开发者ID:jorgejcabrera,项目名称:gamemvc,代码行数:13,代码来源:playcontrollerzone.cpp

示例10: mousePressed

void Windowiki::mousePressed(gcn::MouseEvent &event)
{
    // Let Guichan move window to top and figure out title bar drag
    gcn::Window::mousePressed(event);

    const int x = event.getX();
    const int y = event.getY();
    mMouseResize = 0;

    // Activate resizing handles as appropriate
    if (event.getSource() == this && isResizable() &&
            event.getButton() == gcn::MouseEvent::LEFT &&
            !getChildrenArea().isPointInRect(x, y))
    {
        mMouseResize |= (x > getWidth() - resizeBorderWidthiki) ? RIGHT :
                        (x < resizeBorderWidthiki) ? LEFT : 0;
        mMouseResize |= (y > getHeight() - resizeBorderWidthiki) ? BOTTOM :
                        (y < resizeBorderWidthiki) ? TOP : 0;
    }
    else if (event.getSource() == mGrip)
    {
        mDragOffsetX = x + mGrip->getX();
        mDragOffsetY = y + mGrip->getY();
        mMouseResize |= BOTTOM | RIGHT;
        mIsMoving = false;
    }

    if (event.getButton() == gcn::MouseEvent::LEFT)
    {
        const int x = event.getX();
        const int y = event.getY();

        // Handle close button
        if (mCloseButton)
        {
            gcn::Rectangle closeButtonRect(
                getWidth() - closeImage->getWidth() - getPadding(),
                getPadding(),
                closeImage->getWidth(),
                closeImage->getHeight());

            if (closeButtonRect.isPointInRect(x, y))
            {
                setVisible(false);
            }
        }

        // Handle window resizing
    }
}
开发者ID:mekolat,项目名称:elektrogamesvn,代码行数:50,代码来源:window_iki.cpp

示例11: mouseMoved

 void TileSelector::mouseMoved(gcn::MouseEvent& mouseEvent)
 {
     if (mouseEvent.getX() <= mTileSetBitmap->w
         && mouseEvent.getY() <= mTileSetBitmap->h)
     {
         mCurrentMouseX = mouseEvent.getX();
         mCurrentMouseY = mouseEvent.getY();
         mDrawMouseHoverTile = true;
     }
     else
     {
         mDrawMouseHoverTile = false;
     }
 }
开发者ID:olofn,项目名称:db_public,代码行数:14,代码来源:tileselector.cpp

示例12: mouseReleased

void GlassWindow::mouseReleased(gcn::MouseEvent& mouseEvent) {
	
	if(titleVisible) {
		if(mouseEvent.getY() <= (int)mTitleBarHeight && mouseEvent.getX()>=titleBarContainer.getX()) {
			gcn::Button *w;
			if((w = (gcn::Button*)titleBarContainer.getWidgetAt(mouseEvent.getX()-titleBarContainer.getX(), mouseEvent.getY())) != NULL) {
				w->mouseReleased(mouseEvent);
			}
		}
	}
	
	gcn::Window::mouseReleased(mouseEvent);
	
	GlassWidget::mouseReleased(mouseEvent);
}
开发者ID:newerthcom,项目名称:savagerebirth,代码行数:15,代码来源:GlassWindow.cpp

示例13: mousePressed

void DropDown::mousePressed(gcn::MouseEvent& mouseEvent)
{
    gcn::DropDown::mousePressed(mouseEvent);

    if (0 <= mouseEvent.getY() && mouseEvent.getY() < getHeight() &&
        mouseEvent.getX() >= 0 && mouseEvent.getX() < getWidth() &&
        mouseEvent.getButton() == gcn::MouseEvent::LEFT && mDroppedDown &&
        mouseEvent.getSource() == mListBox)
    {
        mPushed = false;
        foldUp();
        releaseModalMouseInputFocus();
        distributeActionEvent();
    }
}
开发者ID:Ablu,项目名称:mana,代码行数:15,代码来源:dropdown.cpp

示例14: mouseMoved

void RichTextBox::mouseMoved(gcn::MouseEvent &event)
{
    LinkIterator i = find_if(mLinks.begin(), mLinks.end(),
                             MouseOverLink(event.getX(), event.getY()));

    mSelectedLink = (i != mLinks.end()) ? (i - mLinks.begin()) : -1;
}
开发者ID:Aethyra,项目名称:Client,代码行数:7,代码来源:richtextbox.cpp

示例15: mouseMoved

void EquipmentWindow::mouseMoved(gcn::MouseEvent &event)
{
    const int x = event.getX();
    const int y = event.getY();

    int mouseX, mouseY;
    SDL_GetMouseState(&mouseX, &mouseY);

    // Show ItemTooltip
    std::string slotName = getSlotName(x, y);
    if (!slotName.empty())
    {
        mItemPopup->setEquipmentText(slotName);

        Item *item = getItem(x, y);
        if (item)
        {
            mItemPopup->setItem(item->getInfo());
        }
        else
            mItemPopup->setNoItem();

        mItemPopup->position(x + getX(), y + getY());
    }
    else
    {
        mItemPopup->setVisible(false);
    }
}
开发者ID:TonyRice,项目名称:mana,代码行数:29,代码来源:equipmentwindow.cpp


注:本文中的gcn::MouseEvent::getX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。