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


C++ Rect::FromWorldRect方法代码示例

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


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

示例1: Draw

void MinerGob::Draw(DibBitmap *pbm, int xViewOrigin, int yViewOrigin, int nLayer)
{
#ifdef DRAW_OCCUPIED_TILE_INDICATOR
		{
			WRect wrcT;
			GetTilePaddedWRect(&wrcT);
			Rect rcT;
			rcT.FromWorldRect(&wrcT);
			rcT.Offset(-xViewOrigin, -yViewOrigin);
			DrawBorder(pbm, &rcT, 1, GetColor(kiclrWhite));
		}
#endif

	if (m_fHidden)
		return;

	MobileUnitGob::Draw(pbm, xViewOrigin, yViewOrigin, nLayer);

	if (m_st == kstMinerSuck && nLayer == knLayerDepthSorted) {
		SetAnimationStrip(&m_aniVacuum, m_ani.GetStrip());
		m_aniVacuum.Draw(pbm, PcFromUwc(m_wx) - xViewOrigin, PcFromUwc(m_wy) - yViewOrigin);
	} else if (nLayer == knLayerSelection && (m_ff & kfGobSelected)) {
		Rect rcT;
		rcT.FromWorldRect(&m_pmuntc->wrcUIBounds);
		rcT.Offset(PcFromUwc(m_wx) - xViewOrigin, PcFromUwc(m_wy) - yViewOrigin);
		DrawFullnessIndicator(pbm, &rcT, m_nGalaxiteAmount / knGalaxiteValue / 2, knMinerGalaxiteMax / knGalaxiteValue / 2);
	}
}
开发者ID:spiffcode,项目名称:hostile-takeover,代码行数:28,代码来源:Miner.cpp

示例2: Draw

void TankGob::Draw(DibBitmap *pbm, int xViewOrigin, int yViewOrigin, int nLayer)
{
	if (nLayer == knLayerDepthSorted) {

#ifdef DRAW_OCCUPIED_TILE_INDICATOR
		{
			WRect wrcT;
			GetTilePaddedWRect(&wrcT);
			Rect rcT;
			rcT.FromWorldRect(&wrcT);
			rcT.Offset(-xViewOrigin, -yViewOrigin);
			DrawBorder(pbm, &rcT, 1, GetColor(kiclrWhite));
		}
#endif
		Side side = m_pplr->GetSide();
		if (m_ff & kfGobDrawFlashed)
			side = (Side)-1;

		// Draw base

		int x = PcFromUwc(m_wx) - xViewOrigin;
		int y = PcFromUwc(m_wy) - yViewOrigin;
		m_ani.Draw(pbm, x, y, side);

		// Draw turret
		// The turret is aligned with the base's special point

		Point ptBaseSpecial;
		m_ani.GetSpecialPoint(&ptBaseSpecial);
		m_aniTurret.Draw(pbm, x + ptBaseSpecial.x, y + ptBaseSpecial.y, side);
	} else {
		MobileUnitGob::Draw(pbm, xViewOrigin, yViewOrigin, nLayer);
	}
}
开发者ID:Ahmar,项目名称:hostile-takeover,代码行数:34,代码来源:Tank.cpp

示例3: Draw

void ReplicatorGob::Draw(DibBitmap *pbm, int xViewOrigin, int yViewOrigin, int nLayer)
{
	if (nLayer == knLayerDepthSorted) {
		int x = PcFromUwc(m_wx) - xViewOrigin;
		int y = PcFromUwc(m_wy) - yViewOrigin;

		Side side = m_pplr->GetSide();
		if (m_ff & kfGobDrawFlashed)
			side = (Side)-1;

		m_ani.SetFrame(0);
		m_ani.SetStrip(m_fEnabled ? 2 : 0);
		m_ani.Draw(pbm, x, y, side);
		m_ani.SetStrip(m_fEnabled ? 3 : 1);
#if defined(IPHONE) || defined(SDL)
        // When this is scaled up by 1 1/3 (scaling 24 art to 32),
        // the upper right quadrant piece is 55 high, which translates after
        // rounding to 73, yet the lower right quad piece wants to go at
        // location 56 (effectively) which scales to 75, so there is a gap.

		m_ani.Draw(pbm, x, y - 1, side); // ugly hack
#else
		m_ani.Draw(pbm, x, y, side);
#endif

		if (m_fReplicating) {
			m_ani.SetStrip(m_pmuntc->panid->GetStripIndex("l 0"));
			m_ani.SetFrame(m_ifrmLights / 2);
			m_ani.Draw(pbm, x, y, side);
		}

	} else if (nLayer == knLayerSelection) {
		if (m_ff & kfGobSelected) {
			Rect rcT;
			rcT.FromWorldRect(&m_puntc->wrcUIBounds);
			rcT.Offset(-xViewOrigin + PcFromWc(m_wx), -yViewOrigin + PcFromWc(m_wy));
			DrawSelectionIndicator(pbm, &rcT, m_fxHealth, m_puntc->GetArmorStrength());
		}

	} else {
		StructGob::Draw(pbm, xViewOrigin, yViewOrigin, nLayer);
	}
}
开发者ID:spiffcode,项目名称:hostile-takeover,代码行数:43,代码来源:Replicator.cpp

示例4: GetClippingBounds

void ReplicatorGob::GetClippingBounds(Rect *prc)
{
	// Union of the two strips that combine to form the Replicator image

	m_pstruc->panid->GetBounds(0, 0, prc);
	Rect rcT;
	m_pstruc->panid->GetBounds(1, 0, &rcT);
	prc->Union(&rcT);

	// If selected, union with that rect

	if (gwfPerfOptions & kfPerfSelectionBrackets) {
		if (m_ff & kfGobSelected) {
			Rect rcSel;
			rcSel.FromWorldRect(&m_pstruc->wrcUIBounds);
//			rcSel.top -= kcyHealthBar;
			prc->Union(&rcSel);
		}
	}

	prc->Offset(PcFromUwc(m_wx), PcFromUwc(m_wy));
}
开发者ID:spiffcode,项目名称:hostile-takeover,代码行数:22,代码来源:Replicator.cpp


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