• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IntCoord函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IntCoord函数的典型用法代码示例。如果您正苦于以下问题:C++ IntCoord函数的具体用法?C++ IntCoord怎么用?C++ IntCoord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: IntCoord

void ZombieDarkEntity::collideWithEnemy(EnemyEntity* entity)
{
  if (entity->getMovingStyle() == movWalking)
  {
    if (currentDirection == 6 && entity->getX() > x)
    {
      currentDirection = 4;
      targetTile = IntCoord(currentTile.x - 1, currentTile.y);
    }
    else if (currentDirection == 4 && entity->getX() < x)
    {
      currentDirection = 6;
      targetTile = IntCoord(currentTile.x + 1, currentTile.y);
    }
    else if (currentDirection == 8 && entity->getY() < y)
    {
      currentDirection = 2;
      targetTile = IntCoord(currentTile.x, currentTile.y + 1);
    }
    else if (currentDirection == 2 && entity->getY() > y)
    {
      currentDirection = 8;
      targetTile = IntCoord(currentTile.x, currentTile.y - 1);
    }
    switch (currentDirection)
    {
      case 4: velocity.x = - creatureSpeed; velocity.y = 0.0f; break;
      case 6: velocity.x = + creatureSpeed; velocity.y = 0.0f; break;
      case 2: velocity.y = + creatureSpeed; velocity.x = 0.0f; break;
      case 8: velocity.y = - creatureSpeed; velocity.x = 0.0f; break;
      default: break;
    }
    nextFacingDirection = currentDirection;
  }
}
开发者ID:Cirrus-Minor,项目名称:witchblast,代码行数:35,代码来源:ZombieDarkEntity.cpp


示例2: getViewSize

	IntCoord Gui::convertRelativeToInt(const FloatCoord& _coord, WidgetPtr _parent)
	{
		const FloatSize& size = getViewSize();
		if (null == _parent) {
			return IntCoord(_coord.left * size.width, _coord.top * size.height, _coord.width * size.width, _coord.height * size.height);
		}
		const IntCoord& coord = _parent->getClientCoord();
		return IntCoord(_coord.left * coord.width, _coord.top * coord.height, _coord.width * coord.width, _coord.height * coord.height);
	}
开发者ID:twktheainur,项目名称:vortex-ee,代码行数:9,代码来源:MyGUI_Gui.cpp


示例3: if

	IntCoord Window::_getActionScale(Widget* _widget)
	{
		if (_widget->isUserString("Scale"))
		{
			IntCoord result = IntCoord::parse(_widget->getUserString("Scale"));

			if (result == IntCoord(1, 1, 0, 0) && !mMovable)
				result.clear();

			return result;
		}
		else if (_widget->isUserString("Action"))
		{
			const std::string& action = _widget->getUserString("Action");
			if (action == "Move")
			{
				if (mMovable)
					return IntCoord(1, 1, 0, 0);
				else
					return IntCoord();
			}

			IntCoord coord;
			Align align = Align::parse(action);

			if (align.isLeft())
			{
				coord.left = 1;
				coord.width = -1;
			}
			else if (align.isRight())
			{
				coord.width = 1;
			}

			if (align.isTop())
			{
				coord.top = 1;
				coord.height = -1;
			}
			else if (align.isBottom())
			{
				coord.height = 1;
			}

			return coord;
		}

		return IntCoord();
	}
开发者ID:norak,项目名称:MMO-Framework,代码行数:50,代码来源:MyGUI_Window.cpp


示例4: IntCoord

	IntCoord EditText::getCursorCoord(size_t _position)
	{
		if (nullptr == mFont)
			return IntCoord();

		if (mTextOutDate)
			updateRawData();

		IntPoint point = mTextView.getCursorPoint(_position);
		point += mCroppedParent->getAbsolutePosition();
		point -= mViewOffset;
		point += mCoord.point();

		return IntCoord(point.left, point.top, 2, mFontHeight);
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:15,代码来源:MyGUI_EditText.cpp


示例5: IntCoord

	void Message::setWindowFade(bool _fade)
	{
		return; //пока пропустим

		if (_fade)
		{
			if (nullptr == mWidgetFade)
			{
				Gui& gui = Gui::getInstance();
				mWidgetFade = gui.createWidgetT(Widget::getClassTypeName(), mFadeSkin, IntCoord(0, 0, gui.getViewSize().width, gui.getViewSize().height), Align::Stretch, mFadeLayer);
				if (mSmoothShow)
				{
					mWidgetFade->setVisible(false);

					ControllerFadeAlpha* controller = createControllerFadeAlpha(MESSAGE_ALPHA_MAX, MESSAGE_SPEED_COEF, false);
					ControllerManager::getInstance().addItem(mWidgetFade, controller);
				}
				else
				{
					mWidgetFade->setAlpha(MESSAGE_ALPHA_MAX);
				}
			}
		}
		else
		{
			if (nullptr != mWidgetFade)
			{
				WidgetManager::getInstance().destroyWidget(mWidgetFade);
				mWidgetFade = nullptr;
			}
		}
	}
开发者ID:OndraK,项目名称:openmw,代码行数:32,代码来源:MyGUI_Message.cpp


示例6: setNeedKeyFocus

	void ScrollView::initialiseOverride()
	{
		Base::initialiseOverride();

		// FIXME нам нужен фокус клавы
		setNeedKeyFocus(true);

		assignWidget(mClient, "Client");
		if (mClient != nullptr)
		{
			mClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel);

			// создаем холcт, реальный владелец детей
			mRealClient = mClient->createWidget<Widget>("Default", IntCoord(), Align::Default);
			mRealClient->eventMouseWheel += newDelegate(this, &ScrollView::notifyMouseWheel);
			setWidgetClient(mRealClient);
		}

		assignWidget(mVScroll, "VScroll");
		if (mVScroll != nullptr)
		{
			mVScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition);
		}

		assignWidget(mHScroll, "HScroll");
		if (mHScroll != nullptr)
		{
			mHScroll->eventScrollChangePosition += newDelegate(this, &ScrollView::notifyScrollChangePosition);
		}

		updateView();
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:32,代码来源:MyGUI_ScrollView.cpp


示例7: requestItemSize

	Widget* ItemBox::getItemWidget(size_t _index)
	{
		// еще нет такого виджета, нуно создать
		if (_index == mVectorItems.size())
		{
			requestItemSize();

			Widget* item = _getClientWidget()->createWidget<Widget>("Default", IntCoord(0, 0, mSizeItem.width, mSizeItem.height), Align::Default);

			// вызываем запрос на создание виджета
			requestCreateWidgetItem(this, item);

			item->eventMouseWheel += newDelegate(this, &ItemBox::notifyMouseWheel);
			item->eventRootMouseChangeFocus += newDelegate(this, &ItemBox::notifyRootMouseChangeFocus);
			item->eventMouseButtonPressed += newDelegate(this, &ItemBox::notifyMouseButtonPressed);
			item->eventMouseButtonReleased += newDelegate(this, &ItemBox::notifyMouseButtonReleased);
			item->eventMouseButtonDoubleClick += newDelegate(this, &ItemBox::notifyMouseButtonDoubleClick);
			item->eventMouseDrag += newDelegate(this, &ItemBox::notifyMouseDrag);
			item->_setContainer(this);
			item->eventKeyButtonPressed += newDelegate(this, &ItemBox::notifyKeyButtonPressed);
			item->eventKeyButtonReleased += newDelegate(this, &ItemBox::notifyKeyButtonReleased);

			item->_setInternalData((size_t)mVectorItems.size());

			mVectorItems.push_back(item);
		}

		// запрашивать только последовательно
		MYGUI_ASSERT_RANGE(_index, mVectorItems.size(), "ItemBox::getItemWidget");

		return mVectorItems[_index];
	}
开发者ID:DotWolff,项目名称:mygui,代码行数:32,代码来源:MyGUI_ItemBox.cpp


示例8: MYGUI_LOG

	void ImageBox::recalcIndexes()
	{
		mItems.clear();

		if ((mRectImage.right <= mRectImage.left) || (mRectImage.bottom <= mRectImage.top))
			return;
		if ((mSizeTile.width <= 0) || (mSizeTile.height <= 0))
			return;

		size_t count_h = (size_t)(mRectImage.width() / mSizeTile.width);
		size_t count_v = (size_t)(mRectImage.height() / mSizeTile.height);

		if ((count_h * count_v) > IMAGE_MAX_INDEX)
		{
			MYGUI_LOG(Warning, "Tile count very mach, rect : " << mRectImage.print() << " tile : " << mSizeTile.print() << " texture : " << _getTextureName() << " indexes : " << (count_h * count_v) << " max : " << IMAGE_MAX_INDEX);
			return;
		}

		int pos_h = mRectImage.left;
		int pos_v = mRectImage.top;

		for (size_t v = 0; v < count_v; ++v)
		{
			for (size_t h = 0; h < count_h; ++h)
			{
				addItem(IntCoord(pos_h, pos_v, mSizeTile.width, mSizeTile.height));
				pos_h += mSizeTile.width;
			}
			pos_v += mSizeTile.height;
			pos_h = mRectImage.left;
		}
	}
开发者ID:blunted2night,项目名称:MyGUI,代码行数:32,代码来源:MyGUI_ImageBox.cpp


示例9: MYGUI_ASSERT_RANGE_INSERT

    void MultiListBox::insertColumnAt(size_t _column, const UString& _name, int _width, Any _data)
    {
        MYGUI_ASSERT_RANGE_INSERT(_column, mVectorColumnInfo.size(), "MultiListBox::insertColumnAt");
        if (_column == ITEM_NONE)
            _column = mVectorColumnInfo.size();

        createWidget<MultiListItem>("", IntCoord(), Align::Default);

        mVectorColumnInfo.back().width = _width;
        mVectorColumnInfo.back().sizeType = ResizingPolicy::Fixed;
        mVectorColumnInfo.back().name = _name;
        mVectorColumnInfo.back().data = _data;
        mVectorColumnInfo.back().button->setCaption(_name);

        if (_column == (mVectorColumnInfo.size() - 1))
        {
            updateColumns();

            mVectorColumnInfo.back().list->setScrollVisible(true);
        }
        else
        {
            _swapColumnsAt(_column, mVectorColumnInfo.size() - 1);
        }
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:25,代码来源:MyGUI_MultiListBox.cpp


示例10: MYGUI_ASSERT

	void MenuBar::insertItem(size_t _index, const Ogre::UTFString & _item)
	{
		MYGUI_ASSERT(_index < mVectorMenuItemInfo.size() || _index == ITEM_NONE, "index '" << _index << "' out of range");
		if (_index == ITEM_NONE) _index = mVectorMenuItemInfo.size();

		ButtonPtr button = mWidgetClient->createWidget<Button>(mButtonSkinName, IntCoord(), ALIGN_DEFAULT);
		button->eventMouseButtonPressed = newDelegate(this, &MenuBar::eventMouseButtonPressed);
		button->setCaption(_item);

		PopupMenuPtr menu = Gui::getInstance().createWidget<PopupMenu>("PopupMenu", IntCoord(), ALIGN_DEFAULT, "Popup");
		menu->eventPopupMenuClose = newDelegate(this, &MenuBar::notifyPopupMenuClose);
		menu->eventPopupMenuAccept = newDelegate(this, &MenuBar::notifyPopupMenuAccept);
		menu->_setOwner(this);

		mVectorMenuItemInfo.insert(mVectorMenuItemInfo.begin() + _index, MenuItemInfo(button, menu));
		update();
	}
开发者ID:twktheainur,项目名称:vortex-ee,代码行数:17,代码来源:MyGUI_MenuBar.cpp


示例11: if

	Button* TabControl::createButton()
	{
		Widget* parent = this;
		if (mWidgetBar != nullptr)
			parent = mWidgetBar;
		else if (mHeaderPlace != nullptr)
			parent = mHeaderPlace;

		return parent->createWidget<Button>(mButtonSkinName, IntCoord(), Align::Left | Align::Top);
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:10,代码来源:MyGUI_TabControl.cpp


示例12: MYGUI_ASSERT_RANGE_INSERT

	MenuItem* MenuControl::insertItemAt(size_t _index, const UString& _name, MenuItemType _type, const std::string& _id, Any _data)
	{
		MYGUI_ASSERT_RANGE_INSERT(_index, mItemsInfo.size(), "MenuControl::insertItemAt");
		if (_index == ITEM_NONE) _index = mItemsInfo.size();

		MenuItem* item = _getClientWidget()->createWidget<MenuItem>(getSkinByType(_type), IntCoord(), Align::Default);
		_wrapItem(item, _index, _name, _type, _id, _data);

		return item;
	}
开发者ID:Bewolf2,项目名称:Genesis-3D,代码行数:10,代码来源:MyGUI_MenuControl.cpp


示例13: IntCoord

	void MultiListBox::_wrapItem(MultiListItem* _item)
	{
		// скрываем у крайнего скролл
		if (!mVectorColumnInfo.empty())
			mVectorColumnInfo.back().list->setScrollVisible(false);
		else
			mSortColumnIndex = ITEM_NONE;

		ColumnInfo column;
		column.width = 0;
		column.sizeType = ResizingPolicy::Auto;

		column.item = _item;
		column.list = _item->createWidget<ListBox>(mSkinList, IntCoord(0, 0, _item->getWidth(), _item->getHeight()), Align::Stretch);
		column.list->eventListChangePosition += newDelegate(this, &MultiListBox::notifyListChangePosition);
		column.list->eventListMouseItemActivate += newDelegate(this, &MultiListBox::notifyListMouseItemActivate);
		column.list->eventListMouseItemFocus += newDelegate(this, &MultiListBox::notifyListChangeFocus);
		column.list->eventListChangeScroll += newDelegate(this, &MultiListBox::notifyListChangeScrollPosition);
		column.list->eventListSelectAccept += newDelegate(this, &MultiListBox::notifyListSelectAccept);

		if (mHeaderPlace != nullptr)
			column.button = mHeaderPlace->createWidget<Button>(mSkinButton, IntCoord(), Align::Default);
		else
			column.button = mClient->createWidget<Button>(mSkinButton, IntCoord(), Align::Default);

		//column.button->eventMouseButtonClick += newDelegate(this, &MultiListBox::notifyButtonClick);

		// если уже были столбики, то делаем то же колличество полей
		if (!mVectorColumnInfo.empty())
		{
			size_t count = mVectorColumnInfo.front().list->getItemCount();
			for (size_t pos = 0; pos < count; ++pos)
				column.list->addItem("");
		}

		mVectorColumnInfo.push_back(column);

		updateColumns();

		// показываем скролл нового крайнего
		mVectorColumnInfo.back().list->setScrollVisible(true);
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:42,代码来源:MyGUI_MultiListBox.cpp


示例14: IntCoord

	WidgetPtr ItemBox::getItemWidget(size_t _index)
	{
		// еще нет такого виджета, нуно создать
		if (_index >= mVectorItems.size()) {
			int pos = mTopIndex + (int)mVectorItems.size();
			WidgetPtr widget = mWidgetClient->createWidgetT("Widget", "Edit", IntCoord((pos % mCountItemInLine) * mSizeItem.width, ((pos / mCountItemInLine) * mSizeItem.height)  + mOffsetTop, mSizeItem.width, mSizeItem.height), ALIGN_DEFAULT);
			widget->eventMouseWheel = newDelegate(this, &ItemBox::notifyMouseWheel);
			mVectorItems.push_back(widget);
			return mVectorItems.back();
		}
		return mVectorItems[_index];
	}
开发者ID:MyGUI,项目名称:mygui-historical,代码行数:12,代码来源:MyGUI_ItemBox.cpp


示例15: coordAvailable

	void WrapPanel::simpleArrange()
	{
		IntCoord coordAvailable(0, 0, getWidth(), getHeight());
		IntPoint currentPosition = coordAvailable.point();

		int maxLineHeight = 0;
		bool hasAnyWidget = false;
		size_t startLineIndex = 0;

		size_t count = getChildCount();
		for (size_t index = 0; index < count; ++ index)
		{
			Widget* child = getChildAt(index);
			IntSize size = Panel::getDesiredSize(child);

			if (((currentPosition.left + size.width) > coordAvailable.width))
			{
				if (hasAnyWidget)
				{
					alignChildLine(startLineIndex, index, IntCoord(coordAvailable.left, currentPosition.top, coordAvailable.width, maxLineHeight), currentPosition.left - mSpacer.width);

					currentPosition.left = 0;
					currentPosition.top += maxLineHeight + mSpacer.height;
					maxLineHeight = 0;

					startLineIndex = index;
				}
			}

			currentPosition.left += size.width + mSpacer.width;
			maxLineHeight = (std::max)(size.height, maxLineHeight);

			hasAnyWidget = true;
		}

		if (startLineIndex < count)
			alignChildLine(startLineIndex, count, IntCoord(coordAvailable.left, currentPosition.top, coordAvailable.width, maxLineHeight), currentPosition.left - mSpacer.width);
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:38,代码来源:WrapPanel.cpp


示例16: getUserString

	void MultiListBox::initialiseOverride()
	{
		Base::initialiseOverride();

		std::string skinButtonEmpty;

		if (isUserString("SkinButton"))
			mSkinButton = getUserString("SkinButton");

		if (isUserString("SkinList"))
			mSkinList = getUserString("SkinList");

		if (isUserString("SkinSeparator"))
			mSkinSeparator = getUserString("SkinSeparator");

		if (isUserString("WidthSeparator"))
			mWidthSeparator = utility::parseValue<int>(getUserString("WidthSeparator"));

		// OBSOLETE
		if (isUserString("HeightButton"))
			mHeightButton = utility::parseValue<int>(getUserString("HeightButton"));
		if (mHeightButton < 0)
			mHeightButton = 0;

		///@wskin_child{MultiListBox, Widget, HeaderPlace} Место для заголовков колонок.
		assignWidget(mHeaderPlace, "HeaderPlace");

		///@wskin_child{MultiListBox, Widget, Client} Клиентская зона.
		assignWidget(mClient, "Client");
		if (mClient != nullptr)
			setWidgetClient(mClient);

		if (nullptr == mClient)
			mClient = this;

		///@wskin_child{MultiListBox, Widget, Empty} Виджет для заголовка в месте где нет списков.
		assignWidget(mWidgetEmpty, "Empty");

		if (mWidgetEmpty == nullptr)
		{
			if (isUserString("SkinButtonEmpty"))
				skinButtonEmpty = getUserString("SkinButtonEmpty");

			if (!skinButtonEmpty.empty())
				mWidgetEmpty = mClient->createWidget<Widget>(skinButtonEmpty, IntCoord(0, 0, mClient->getWidth(), getButtonHeight()), Align::Default);
		}

		if (getUpdateByResize())
			updateColumns();
	}
开发者ID:dayongxie,项目名称:MyGUI,代码行数:50,代码来源:MyGUI_MultiListBox.cpp


示例17: _createItemButton

	int TabControl::_getTextWidth(const UString& _text)
	{
		if (mItemButton.empty())
			_createItemButton();

		UString save = mItemButton[0]->getCaption();
		mItemButton[0]->setCaption(_text);

		ISubWidgetText* text = mItemButton[0]->getSubWidgetText();
		const IntSize& size = text ? text->getTextSize() : IntSize();
		const IntCoord& coord = text ? text->getCoord() : IntCoord();

		mItemButton[0]->setCaption(save);

		return size.width + mItemButton[0]->getWidth() - coord.width;
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:16,代码来源:MyGUI_TabControl.cpp


示例18: while

    Widget* MultiListBox::getSeparator(size_t _index)
    {
        if (!mWidthSeparator || mSkinSeparator.empty())
            return nullptr;
        // последний столбик
        if (_index == mVectorColumnInfo.size() - 1)
            return nullptr;

        while (_index >= mSeparators.size())
        {
            Widget* separator = mClient->createWidget<Widget>(mSkinSeparator, IntCoord(), Align::Default);
            mSeparators.push_back(separator);
        }

        return mSeparators[_index];
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:16,代码来源:MyGUI_MultiListBox.cpp


示例19: getUserString

    void MultiListBox::initialiseOverride()
    {
        Base::initialiseOverride();

        std::string skinButtonEmpty;

        if (isUserString("SkinButton"))
            mSkinButton = getUserString("SkinButton");
        if (isUserString("SkinList"))
            mSkinList = getUserString("SkinList");
        if (isUserString("SkinSeparator"))
            mSkinSeparator = getUserString("SkinSeparator");
        if (isUserString("WidthSeparator"))
            mWidthSeparator = utility::parseValue<int>(getUserString("WidthSeparator"));

        // OBSOLETE
        if (isUserString("HeightButton"))
            mHeightButton = utility::parseValue<int>(getUserString("HeightButton"));
        if (mHeightButton < 0)
            mHeightButton = 0;

        assignWidget(mHeaderPlace, "HeaderPlace");

        assignWidget(mClient, "Client");
        if (mClient != nullptr)
            setWidgetClient(mClient);

        if (nullptr == mClient)
            mClient = this;

        assignWidget(mWidgetEmpty, "Empty");

        if (mWidgetEmpty == nullptr)
        {
            if (isUserString("SkinButtonEmpty"))
                skinButtonEmpty = getUserString("SkinButtonEmpty");
            if (!skinButtonEmpty.empty())
                mWidgetEmpty = mClient->createWidget<Widget>(skinButtonEmpty, IntCoord(0, 0, mClient->getWidth(), getButtonHeight()), Align::Default);
        }

        if (getUpdateByResize())
            updateColumns();
    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:43,代码来源:MyGUI_MultiListBox.cpp


示例20: requestCoordItem

	void ItemBox::updateDropItems()
	{
		if (nullptr == mItemDrag)
		{
			// спрашиваем размер иконок
			IntCoord coord;

			requestCoordItem(this, coord, true);

			mPointDragOffset = coord.point();

			// создаем и запрашиваем детей
			mItemDrag = Gui::getInstance().createWidget<Widget>("Default", IntCoord(0, 0, coord.width, coord.height), Align::Default, mDragLayer);
			requestCreateWidgetItem(this, mItemDrag);
		}

		const IntPoint& point = InputManager::getInstance().getMousePosition();

		mItemDrag->setPosition(point.left - mClickInWidget.left + mPointDragOffset.left, point.top - mClickInWidget.top + mPointDragOffset.top);
		mItemDrag->setVisible(true);
	}
开发者ID:DotWolff,项目名称:mygui,代码行数:21,代码来源:MyGUI_ItemBox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IntDisable函数代码示例发布时间:2022-05-30
下一篇:
C++ Int64_val函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap