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


C++ IntCoord函数代码示例

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


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


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