BackgroundLayer
Declaration
public class Strawberry.Graphics.Layers.BackgroundLayer
Background layer. Renders a single sprite as a tiled or scrolling background.
Inherits: Strawberry.Graphics.Layers.Layer
Constructors
BackgroundLayer
void BackgroundLayer()
BackgroundLayer
void BackgroundLayer(int maxBatchCount)
Parameters:
| Name | Type | Description |
|---|---|---|
maxBatchCount |
System.Int32 |
Properties
ActiveShader
Gets the currently active shader used for rendering.
BasicShader ActiveShader { get }
GraphicsContext
IGraphicsContext GraphicsContext { get }
Sprite
The sprite to render as background.
Sprite Sprite { get set }
ImageIndex
Current frame of the sprite.
int ImageIndex { get set }
ImageSpeed
The speed of the animation in frames (1 = a cycle of animation per second).
int ImageSpeed { get set }
DrawCalls
Gets or sets the number of draw calls performed during the most recent render pass.
int DrawCalls { get set }
Position
The top left position of the background layer.
Vector2 Position { get set }
Scale
The scale of the sprite rendered by background layer.
Vector2 Scale { get set }
TileH
The number of repeats in the x direction. Set to -1 for infinite scrolling based on viewport.
int TileH { get set }
TileV
The number of repeats in the y direction. Set to -1 for infinite scrolling based on viewport.
int TileV { get set }
Size
The size of the background layer.
Vector2 Size { get set }
Color
The color used to render the background layer.
Color Color { get set }
ParallaxFactor
The parallax scrolling factor. Vector2.One scrolls normally with the camera, Vector2.Zero stays fixed relative to the camera.
Vector2 ParallaxFactor { get set }
AutoScrollSpeed
Gets or sets the speed at which the background layer scrolls automatically.
Vector2 AutoScrollSpeed { get set }
Methods
Initialize override
void Initialize(Scene scene)
Parameters:
| Name | Type | Description |
|---|---|---|
scene |
Strawberry.Core.Scene |
Update override
void Update()
Render override
void Render()