Ctrl+K

SpriteLayer

Declaration

public class Strawberry.Graphics.Layers.SpriteLayer

A layer responsible for batching and rendering sprites within a scene.

Inherits: Strawberry.Graphics.Layers.Layer

Constructors

SpriteLayer

void SpriteLayer()

SpriteLayer

void SpriteLayer(int maxBatchCount)

Parameters:

Name Type Description
maxBatchCount System.Int32

Properties

ActiveShader

Gets the currently active shader used for sprite rendering.

BasicShader ActiveShader { get }

GraphicsContext

Gets the graphics context for the current scene.

IGraphicsContext GraphicsContext { get }

DrawCalls

Gets or sets the number of draw calls performed during the most recent render pass.

int DrawCalls { get set }

Methods

Initialize override

Initializes the sprite layer and allocates rendering resources.

void Initialize(Scene scene)

Parameters:

Name Type Description
scene Strawberry.Core.Scene

SetShader

void SetShader(BasicShader shader)

Parameters:

Name Type Description
shader Strawberry.Graphics.BasicShader

ResetShader

void ResetShader()

SetBlendMode

void SetBlendMode(string name)

Parameters:

Name Type Description
name System.String

GetQuad

SpriteQuad GetQuad(Sprite sprite, Vector2 position, Vector2 origin, Vector2 scale, Color color, int imageIndex, float angle)

Parameters:

Name Type Description
sprite Strawberry.Graphics.Sprite
position Strawberry.Math.Vector2
origin Strawberry.Math.Vector2
scale Strawberry.Math.Vector2
color Strawberry.Graphics.Color
imageIndex System.Int32
angle System.Single

Push

void Push(Sprite sprite, Vector2 position, Vector2 origin, Vector2 scale, Color color, int imageIndex, float angle)

Parameters:

Name Type Description
sprite Strawberry.Graphics.Sprite
position Strawberry.Math.Vector2
origin Strawberry.Math.Vector2
scale Strawberry.Math.Vector2
color Strawberry.Graphics.Color
imageIndex System.Int32
angle System.Single

Push

void Push(Texture texture, Vector2 position, Vector2 texSize, Vector2 size, Vector2 topLeft, Color color)

Parameters:

Name Type Description
texture Strawberry.Graphics.Texture
position Strawberry.Math.Vector2
texSize Strawberry.Math.Vector2
size Strawberry.Math.Vector2
topLeft Strawberry.Math.Vector2
color Strawberry.Graphics.Color

Render override

void Render()

DrawOutlineRectangle

void DrawOutlineRectangle(RotatedRectangle rect, Color color)

Parameters:

Name Type Description
rect Strawberry.Common.RotatedRectangle
color Strawberry.Graphics.Color

DrawRectangle

void DrawRectangle(RotatedRectangle rect, Color color)

Parameters:

Name Type Description
rect Strawberry.Common.RotatedRectangle
color Strawberry.Graphics.Color

DrawHorizontalLine

void DrawHorizontalLine(Vector2 start, float length, Color color)

Parameters:

Name Type Description
start Strawberry.Math.Vector2
length System.Single
color Strawberry.Graphics.Color

DrawVerticalLine

void DrawVerticalLine(Vector2 start, float length, Color color)

Parameters:

Name Type Description
start Strawberry.Math.Vector2
length System.Single
color Strawberry.Graphics.Color

PushString

Vector2 PushString(string text, Font font, Vector2 position, Color color, TextDirection direction)

Parameters:

Name Type Description
text System.String
font Strawberry.Graphics.Text.Font
position Strawberry.Math.Vector2
color Strawberry.Graphics.Color
direction Strawberry.Graphics.Text.TextDirection

PushString

Vector2 PushString(string text, Font font, Vector2 position, Color color, TextDirection direction, float size)

Parameters:

Name Type Description
text System.String
font Strawberry.Graphics.Text.Font
position Strawberry.Math.Vector2
color Strawberry.Graphics.Color
direction Strawberry.Graphics.Text.TextDirection
size System.Single