C# Class Nez.PrimitiveBatch

batcher that draws vertex colored triangles
Inheritance: IDisposable
显示文件 Open project: prime31/Nez Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void
PrimitiveBatch ( int bufferSize = 500 ) : System
addVertex ( Vector2 vertex, Color color, PrimitiveType primitiveType ) : void
begin ( ) : void

draws directly in screen space at full viewport size

begin ( Matrix &projection, Matrix &view ) : void

Begin is called to tell the PrimitiveBatch what kind of primitives will be drawn, and to prepare the graphics card to render those primitives. Use camera.projectionMatrix and camera.transformMatrix if the batch should be in camera space.

drawArrow ( Vector2 start, Vector2 end, float length, float width, bool drawStartIndicator, Color color ) : void
drawCircle ( Vector2 center, float radius, Color color, int circleSegments = 32 ) : void
drawPolygon ( Vector2 position, Vector2 vertices, Color color ) : void
drawPolygon ( Vector2 vertices, int count, Color color ) : void
drawRectangle ( Rectangle &rect, Color color ) : void
drawRectangle ( float x, float y, float width, float height, Color color ) : void
end ( ) : void

End is called once all the primitives have been drawn using AddVertex. it will call Flush to actually submit the draw call to the graphics card, and then tell the basic effect to end.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
flushLines ( ) : void
flushTriangles ( ) : void

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

PrimitiveBatch() public method

public PrimitiveBatch ( int bufferSize = 500 ) : System
bufferSize int
return System

addVertex() public method

public addVertex ( Vector2 vertex, Color color, PrimitiveType primitiveType ) : void
vertex Vector2
color Color
primitiveType PrimitiveType
return void

begin() public method

draws directly in screen space at full viewport size
public begin ( ) : void
return void

begin() public method

Begin is called to tell the PrimitiveBatch what kind of primitives will be drawn, and to prepare the graphics card to render those primitives. Use camera.projectionMatrix and camera.transformMatrix if the batch should be in camera space.
public begin ( Matrix &projection, Matrix &view ) : void
projection Matrix The projection.
view Matrix The view.
return void

drawArrow() public method

public drawArrow ( Vector2 start, Vector2 end, float length, float width, bool drawStartIndicator, Color color ) : void
start Vector2
end Vector2
length float
width float
drawStartIndicator bool
color Color
return void

drawCircle() public method

public drawCircle ( Vector2 center, float radius, Color color, int circleSegments = 32 ) : void
center Vector2
radius float
color Color
circleSegments int
return void

drawPolygon() public method

public drawPolygon ( Vector2 position, Vector2 vertices, Color color ) : void
position Vector2
vertices Vector2
color Color
return void

drawPolygon() public method

public drawPolygon ( Vector2 vertices, int count, Color color ) : void
vertices Vector2
count int
color Color
return void

drawRectangle() public method

public drawRectangle ( Rectangle &rect, Color color ) : void
rect Microsoft.Xna.Framework.Rectangle
color Color
return void

drawRectangle() public method

public drawRectangle ( float x, float y, float width, float height, Color color ) : void
x float
y float
width float
height float
color Color
return void

end() public method

End is called once all the primitives have been drawn using AddVertex. it will call Flush to actually submit the draw call to the graphics card, and then tell the basic effect to end.
public end ( ) : void
return void