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


C++ Rectangle::Bottom方法代码示例

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


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

示例1: CanMoveTo

	bool Map::CanMoveTo(const GameObject* movingObject, const Rectangle& position, const std::list<GameObject*>& objects) const
	{
		if (IsInMapBounds(position) == false)
			return false;

		const MapCell* cell = GetCellFromRealPosition(position.Left(), position.Top());
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Right() - 1, position.Top());
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Left(), position.Bottom() - 1);
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Right() - 1, position.Bottom() - 1);
		if (cell->GetIsObstacle() == true)
			return false;

		for (std::list<GameObject*>::const_iterator it = objects.cbegin(); it != objects.cend(); ++it)
		{
			if ((*it != movingObject) && ((*it)->IsCollidable() == true) && (*it)->IsCollidingWith(position) == true)
				return false;
		}
		return true;
	}
开发者ID:BenjaminHamon,项目名称:ClassicBomberman,代码行数:25,代码来源:Map.cpp

示例2: TerminateParkedOperation

// --------------------------------------------------------------------------------------------
// eine evtl. geparkte EditOperation "vergessen"
void CGeoEditExtension::TerminateParkedOperation (void)
{
	DeleteRestrictLines();

	m_bOpParked = false;	// eine evt. geparkte IEditOperation ignorieren

// rudimentäre temporäre Objekte auf dem Bildschirm löschen
KoOrd lXmin, lXmax, lYmin, lYmax;

	if (S_FALSE == m_wTopObjs->GetTopicalObjectsRectangle (FALSE, &lXmin, &lXmax, &lYmin, &lYmax))
		return;		// es gibt keine temporären Objekte
	
Point PLU = BSKoordinaten (lXmin, lYmin);
Point PRO = BSKoordinaten (lXmax, lYmax);
int iMarkGr;

    m_wTopObjs->GetMarkerSizeBS (&iMarkGr);

Rectangle Rec;

	Rec.Left()   = PLU.X() - iMarkGr - iSicher;
	Rec.Right()  = PRO.X() + iMarkGr + iSicher;
	Rec.Top()    = PRO.Y() + iMarkGr + iSicher;
	Rec.Bottom() = PLU.Y() - iMarkGr - iSicher;
    DEX_RePaintRectWait (Rec);
    MWind()->Update();		// sofort löschen

// rudimentäre temporäre Objekte aus den Topical-Objekten löschen
    m_wTopObjs->DeleteTopicalObjects (FALSE);

} // TerminateParkedOperation
开发者ID:hkaiser,项目名称:TRiAS,代码行数:33,代码来源:GeoEdit.cpp

示例3: Intersect

	bool Rectangle::Intersect(const Rectangle& other) const
	{
		return (Left() < other.Right())
			&& (Right() > other.Left())
			&& (Top() < other.Bottom())
			&& (Bottom() > other.Top());
	}
开发者ID:BenjaminHamon,项目名称:ClassicBomberman,代码行数:7,代码来源:Rectangle.cpp

示例4: UnDraw

// --------------------------------------------------------------------------------------------
// Konstruktionshilfslinie auf dem Bildschirm löschen
HRESULT CRestrictLine::UnDraw (void)
{
HRESULT hrRet = S_OK;
Rectangle rcUnDraw;	// Rechteck der zu löschenden Konstruktionshilfslinie

	if (RESTRTYPE_GERADE == m_ResType || RESTRTYPE_STRECKE == m_ResType)
	{
		rcUnDraw.Left() = min (m_EPt1.X(), m_EPt2.X()) - iZug;
		rcUnDraw.Right() = max (m_EPt1.X(), m_EPt2.X()) + iZug;
		rcUnDraw.Top() = max (m_EPt1.Y(), m_EPt2.Y()) + iZug;
		rcUnDraw.Bottom() = min (m_EPt1.Y(), m_EPt2.Y()) - iZug;
	}
	else if (RESTRTYPE_KREIS == m_ResType)
	{
		rcUnDraw.Left() = m_RefPt.X() - iZug;
		rcUnDraw.Right() = m_RefPt.X() + 2*m_iRad + iZug;
		rcUnDraw.Top() = m_RefPt.Y() + 2*m_iRad + iZug;
		rcUnDraw.Bottom() = m_RefPt.Y() - iZug;
	}
	else
	{
		if (RESTRTYPE_UNKNOWN != m_ResType)
			_ASSERTE (m_ResType == RESTRTYPE_GERADE || m_ResType == RESTRTYPE_KREIS ||
					   m_ResType == RESTRTYPE_STRECKE || m_ResType == RESTRTYPE_UNKNOWN);

	Window MWnd(__hWndM);					// TRiAS-Hauptfenster
	Dimension dimMWin = MWnd.GetSize();		// Größe (im Point-Format) des Hauptfensters

		rcUnDraw.Left() = 0;
		rcUnDraw.Right() = dimMWin.Width();
		rcUnDraw.Top() = dimMWin.Height();
		rcUnDraw.Bottom() = 0;

		hrRet = E_UNEXPECTED;
	}
	
	m_bUnDraw = true;	// Konstruktionshilfslinie wird auf dem Bildschirm gelöscht
	DEX_RePaintRectWait (rcUnDraw);
	m_pVWnd->Update();

	return hrRet;

} // UnDraw
开发者ID:hkaiser,项目名称:TRiAS,代码行数:45,代码来源:RestrictLine.cpp

示例5: DoForce

	void GrowCanvas::DoForce(Point &ptStart, Point &ptEnd, 
								  PointArray2D *gridPoints, Rectangle &boundary)
	{
		float fCrossDistance = (float)std::min(
			std::min(ptEnd.X - boundary.X, boundary.Right() - ptEnd.X),
			std::min(ptEnd.Y - boundary.Y, boundary.Bottom() - ptEnd.Y));
		Point *ptTmp;
		float r;

		if (m_GrowFactor < 1)
			m_GrowFactor += GROWSTEP;

		if (m_bGrow)
		{
			// Calculating the new coordinate of the grid points.
			for (int i = gridPoints->GetWidth() - 1; i >= 0; --i)
			{
				for (int j = gridPoints->GetHeight() - 1; j >= 0; --j)
				{
					ptTmp = gridPoints->GetItem(i, j);
					r = Distance(*ptTmp, ptEnd.X, ptEnd.Y)/fCrossDistance;

					if (r < 1)
					{
						r = pow(r, m_GrowFactor);
						ptTmp->X = ptEnd.X + (int)((ptTmp->X - ptEnd.X)*r);
//						__android_log_print(ANDROID_LOG_FATAL, "LOG", "grow canvas: %d", (int)((ptTmp->X - ptEnd.X)*r));
//						ptTmp->X = ptStart.X + 15.005;
						ptTmp->Y = ptEnd.Y + (int)((ptTmp->Y - ptEnd.Y)*r);
//						ptTmp->Y = ptStart.Y + 15.005;
					}
				}
			}
		}
		else
		{
			// Calculating the new coordinate of the grid points.
			for (int i = gridPoints->GetWidth() - 1; i >= 0; --i)
			{
				for (int j = gridPoints->GetHeight() - 1; j >= 0; --j)
				{
					ptTmp = gridPoints->GetItem(i, j);
					r = Distance(*ptTmp, ptEnd.X, ptEnd.Y)/fCrossDistance;

					if (r < 1 && r > 0.01)
					{
						r = pow(r, m_GrowFactor);
						ptTmp->X = ptEnd.X + (int)((ptTmp->X - ptEnd.X)/r);
						ptTmp->Y = ptEnd.Y + (int)((ptTmp->Y - ptEnd.Y)/r);
					}
				}
			}
		}
	}
开发者ID:HVisionSensing,项目名称:FaceStretch,代码行数:54,代码来源:GrowCanvas.cpp

示例6: mTextureSize

 TextureRect::TextureRect(const Point2& textureSize, const Rectangle& sourceRectangle)
   : mTextureSize(textureSize)
   , mSourceRectangle(sourceRectangle)
 {
   assert( textureSize.X >= 0 );
   assert( textureSize.Y >= 0 );
   assert( sourceRectangle.Left() >= 0 );
   assert( sourceRectangle.Top() >= 0 );
   assert( sourceRectangle.Right() <= textureSize.X );
   assert( sourceRectangle.Bottom() <= textureSize.Y );
 }
开发者ID:kuscsik,项目名称:libdfmc,代码行数:11,代码来源:TextureRect.cpp

示例7: ExpandingSreenSection

// --------------------------------------------------------------------------------------------
// Bildausschnitt vergrößern, so daß die BS-Punkte ExtPt1 und ExtPt2 mit enthalten sind
void CRestrictLine::ExpandingSreenSection (Point ExtPt1, Point ExtPt2)
{
Rectangle rcOldView = m_pVWnd->CanvasRect();	// derzeiteiges TRiAS-ViewFenster
Rectangle rcNewView;							// neues vergrößertes TRiAS-ViewFenster
CoOrd MinX = min (ExtPt1.X(), ExtPt2.X());
CoOrd MaxX = max (ExtPt1.X(), ExtPt2.X());
CoOrd MinY = min (ExtPt1.Y(), ExtPt2.Y());
CoOrd MaxY = max (ExtPt1.Y(), ExtPt2.Y());

	// Faktor 1.1 ist eine Zugabe, damit ExtPt1 bzw. ExtPt2 im neuen Bildausschnitt nicht genau
	// auf dem Rand sitzt
	if (MinY < rcOldView.Bottom()) rcNewView.Bottom() = 1.1 * MinY;
	else rcNewView.Bottom() = rcOldView.Bottom();

	if (MaxY > rcOldView.Top()) rcNewView.Top() = 1.1 * MaxY;
	else rcNewView.Top() = rcOldView.Top();

	if (MinX < rcOldView.Left()) rcNewView.Left() = 1.1 * MinX;
	else rcNewView.Left() = rcOldView.Left();

	if (MaxX > rcOldView.Right()) rcNewView.Right() = 1.1 * MaxX;
	else rcNewView.Right() = rcOldView.Right();

EPunkt PLU = DBKoordinaten (Point(rcNewView.Left(),rcNewView.Bottom()));
EPunkt PRO = DBKoordinaten (Point(rcNewView.Right(),rcNewView.Top()));
KoOrd lCO[4];	// Koordinaten des neuen Sichtausschnittes (lCO[0] = xmin, lCO[1] = xmax,
				// lCO[2] = ymin, lCO[3] = ymax)

	lCO[0] = PLU.X();
	lCO[1] = PRO.X();
	lCO[2] = PLU.Y();
	lCO[3] = PRO.Y();
	DEX_SetActiveSightContainer (lCO);
	DEX_RePaintRectWait (rcNewView);
	m_pVWnd->Update();

} // ExpandingSreenSection
开发者ID:hkaiser,项目名称:TRiAS,代码行数:39,代码来源:RestrictLine.cpp

示例8: ComputeLocationCode

static EClip ComputeLocationCode( const Point2I & pt, const Rectangle & rect )
{
    int code = ClipNone;

    if ( pt.X() < rect.Left() )
        code |= ClipLeft;
    if ( pt.Y() < rect.Top() )
        code |= ClipTop;
    if ( rect.Right() < pt.X() )
        code |= ClipRight;
    if ( rect.Bottom() < pt.Y() )
        code |= ClipBottom;

    return  EClip( code );
}
开发者ID:davidand36,项目名称:libEpsilonDelta,代码行数:15,代码来源:LineSegment2.cpp

示例9: Left

//
// Intersects
// Check if this rectangle intersects another.
//
bool Nixin::Rectangle::Intersects( const Rectangle& other ) const
{
	return ( Left() < other.Right() && Right() > other.Left() && Bottom() < other.Top() && Top() > other.Bottom() );
}
开发者ID:Bonnn,项目名称:Nixin,代码行数:8,代码来源:Nixin_Rectangle.cpp

示例10: IsInMapBounds

	bool Map::IsInMapBounds(const Rectangle& rectangle) const
	{
		return (rectangle.Left() >= 0) && (rectangle.Top() >= 0) && (rectangle.Right() <= (mapWidth_ * CellWidth)) && (rectangle.Bottom() <= (mapHeight_ * CellHeight));
	}
开发者ID:BenjaminHamon,项目名称:ClassicBomberman,代码行数:4,代码来源:Map.cpp

示例11: if

bool
LineSegment2I::Clip( const Rectangle & rect )
{   /*Clip*/
    PointPair endpoints = Endpoints();
    Point2I pt0 = endpoints.first;
    Point2I pt1 = endpoints.second;
    float left = static_cast< float >( rect.Left() );
    float top = static_cast< float >( rect.Top() );
    float right = static_cast< float >( rect.Right() );
    float bottom = static_cast< float >( rect.Bottom() );

    EClip code0 = ComputeLocationCode( pt0, rect );
    EClip code1 = ComputeLocationCode( pt1, rect );
    bool inside = ( (code0 | code1) == 0 );
    bool outside = ( (code0 & code1) != 0 );

    while ( ! inside && ! outside )
    {
        if ( code0 == ClipNone ) // Swap if necessary so pt0 needs clipping.
        {
            std::swap( pt0, pt1 );
            std::swap( code0, code1 );
        }

        float x, y;
        if ( code0 & ClipLeft )
        {
            y = pt0.Y()
                +  ((pt1.Y() - pt0.Y())
                    * (left - pt0.X()) / (pt1.X() - pt0.X()));
            x = left;
        }
        else if ( code0 & ClipTop )
        {
            x = pt0.X()
                +  ((pt1.X() - pt0.X())
                    * (top - pt0.Y()) / (pt1.Y() - pt0.Y()));
            y = top;
        }
        else if ( code0 & ClipRight )
        {
            y = pt0.Y()
                +  ((pt1.Y() - pt0.Y())
                    * (right - pt0.X()) / (pt1.X() - pt0.X()));
            x = right;
        }
        else    //ClipBottom
        {
            x = pt0.X()
                +  ((pt1.X() - pt0.X())
                    * (bottom - pt0.Y()) / (pt1.Y() - pt0.Y()));
            y = bottom;
        }
        pt0.Set( static_cast< int >( x + 0.5f ),
                 static_cast< int >( y + 0.5f ) );

        code0 = ComputeLocationCode( pt0, rect );
        inside = ( (code0 | code1) == 0 );
        outside = ( (code0 & code1) != 0 );
    }

    Set( pt0, pt1 );

    return inside;
}                                                                      /*Clip*/
开发者ID:davidand36,项目名称:libEpsilonDelta,代码行数:65,代码来源:LineSegment2.cpp

示例12: DrawCargo

void ShipInfoPanel::DrawCargo(const Rectangle &bounds)
{
	Color dim = *GameData::Colors().Get("medium");
	Color bright = *GameData::Colors().Get("bright");
	Color backColor = *GameData::Colors().Get("faint");
	const Ship &ship = **shipIt;

	// Cargo list.
	const CargoHold &cargo = (player.Cargo().Used() ? player.Cargo() : ship.Cargo());
	Table table;
	table.AddColumn(0, Table::LEFT);
	table.AddColumn(WIDTH - 20, Table::RIGHT);
	table.SetUnderline(-5, WIDTH - 15);
	table.DrawAt(bounds.TopLeft() + Point(10., 8.));
	
	double endY = bounds.Bottom() - 30. * (cargo.Passengers() != 0);
	bool hasSpace = (table.GetRowBounds().Bottom() < endY);
	if((cargo.CommoditiesSize() || cargo.HasOutfits() || cargo.MissionCargoSize()) && hasSpace)
	{
		table.Draw("Cargo", bright);
		table.Advance();
		hasSpace = (table.GetRowBounds().Bottom() < endY);
	}
	if(cargo.CommoditiesSize() && hasSpace)
	{
		for(const auto &it : cargo.Commodities())
		{
			if(!it.second)
				continue;
			
			commodityZones.emplace_back(table.GetCenterPoint(), table.GetRowSize(), it.first);
			if(it.first == selectedCommodity)
				table.DrawHighlight(backColor);
			
			table.Draw(it.first, dim);
			table.Draw(to_string(it.second), bright);
			
			// Truncate the list if there is not enough space.
			if(table.GetRowBounds().Bottom() >= endY)
			{
				hasSpace = false;
				break;
			}
		}
		table.DrawGap(10.);
	}
	if(cargo.HasOutfits() && hasSpace)
	{
		for(const auto &it : cargo.Outfits())
		{
			if(!it.second)
				continue;
			
			plunderZones.emplace_back(table.GetCenterPoint(), table.GetRowSize(), it.first);
			if(it.first == selectedPlunder)
				table.DrawHighlight(backColor);
			
			// For outfits, show how many of them you have and their total mass.
			bool isSingular = (it.second == 1 || it.first->Get("installable") < 0.);
			string name = (isSingular ? it.first->Name() : it.first->PluralName());
			if(!isSingular)
				name += " (" + to_string(it.second) + "x)";
			table.Draw(name, dim);
			
			double mass = it.first->Mass() * it.second;
			table.Draw(Format::Number(mass), bright);
			
			// Truncate the list if there is not enough space.
			if(table.GetRowBounds().Bottom() >= endY)
			{
				hasSpace = false;
				break;
			}
		}
		table.DrawGap(10.);
	}
	if(cargo.HasMissionCargo() && hasSpace)
	{
		for(const auto &it : cargo.MissionCargo())
		{
			// Capitalize the name of the cargo.
			table.Draw(Format::Capitalize(it.first->Cargo()), dim);
			table.Draw(to_string(it.second), bright);
			
			// Truncate the list if there is not enough space.
			if(table.GetRowBounds().Bottom() >= endY)
				break;
		}
		table.DrawGap(10.);
	}
	if(cargo.Passengers() && endY >= bounds.Top())
	{
		table.DrawAt(Point(bounds.Left(), endY) + Point(10., 8.));
		table.Draw("passengers:", dim);
		table.Draw(to_string(cargo.Passengers()), bright);
	}
}
开发者ID:Amazinite,项目名称:endless-sky,代码行数:97,代码来源:ShipInfoPanel.cpp

示例13: DrawOutfits

void ShipInfoPanel::DrawOutfits(const Rectangle &bounds, Rectangle &cargoBounds)
{
	// Check that the specified area is big enough.
	if(bounds.Width() < WIDTH)
		return;
	
	// Colors to draw with.
	Color dim = *GameData::Colors().Get("medium");
	Color bright = *GameData::Colors().Get("bright");
	const Ship &ship = **shipIt;
	
	// Table attributes.
	Table table;
	table.AddColumn(0, Table::LEFT);
	table.AddColumn(WIDTH - 20, Table::RIGHT);
	table.SetUnderline(0, WIDTH - 20);
	Point start = bounds.TopLeft() + Point(10., 8.);
	table.DrawAt(start);
	
	// Draw the outfits in the same order used in the outfitter.
	for(const string &category : Outfit::CATEGORIES)
	{
		auto it = outfits.find(category);
		if(it == outfits.end())
			continue;
		
		// Skip to the next column if there is not space for this category label
		// plus at least one outfit.
		if(table.GetRowBounds().Bottom() + 40. > bounds.Bottom())
		{
			start += Point(WIDTH, 0.);
			if(start.X() + WIDTH - 20 > bounds.Right())
				break;
			table.DrawAt(start);
		}
		
		// Draw the category label.
		table.Draw(category, bright);
		table.Advance();
		for(const Outfit *outfit : it->second)
		{
			// Check if we've gone below the bottom of the bounds.
			if(table.GetRowBounds().Bottom() > bounds.Bottom())
			{
				start += Point(WIDTH, 0.);
				if(start.X() + WIDTH - 20 > bounds.Right())
					break;
				table.DrawAt(start);
				table.Draw(category, bright);
				table.Advance();
			}
			
			// Draw the outfit name and count.
			table.Draw(outfit->Name(), dim);
			string number = to_string(ship.OutfitCount(outfit));
			table.Draw(number, bright);
		}
		// Add an extra gap in between categories.
		table.DrawGap(10.);
	}
	
	// Check if this information spilled over into the cargo column.
	if(table.GetPoint().X() >= cargoBounds.Left())
	{
		double startY = table.GetRowBounds().Top() - 8.;
		cargoBounds = Rectangle::WithCorners(
			Point(cargoBounds.Left(), startY),
			Point(cargoBounds.Right(), max(startY, cargoBounds.Bottom())));
	}
}
开发者ID:Amazinite,项目名称:endless-sky,代码行数:70,代码来源:ShipInfoPanel.cpp


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