GraphicsAPI reference
Class ParallaxLayer
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics
A background image that scrolls slower (or faster) than the camera and repeats horizontally. Draw it in screen space (no camera pushed). Factor 0 is fixed to the screen, 1 moves with the world. Y is the screen row of the image’s top edge; the optional VerticalFactor lets tall worlds shift it as the camera rises or falls.
public sealed class ParallaxLayerInheritance
Constructors
ParallaxLayer(Texture)
A background image that scrolls slower (or faster) than the camera and repeats horizontally. Draw it in screen space (no camera pushed). Factor 0 is fixed to the screen, 1 moves with the world. Y is the screen row of the image’s top edge; the optional VerticalFactor lets tall worlds shift it as the camera rises or falls.
public ParallaxLayer(Texture texture)Parameters
texture Texture
Properties
Drift
Extra horizontal offset in screen pixels per second (drifting clouds, traffic).
public float Drift { get; init; }Property Value
Factor
Horizontal scroll relative to the camera: 0 stays fixed, 1 moves with the world (0.5 by default).
public float Factor { get; init; }Property Value
RepeatX
Whether the image repeats to cover the screen width (true by default).
public bool RepeatX { get; init; }Property Value
Texture
The image; the layer does not dispose it.
public Texture Texture { get; }Property Value
Tint
Colour multiplier (white by default).
public Color Tint { get; init; }Property Value
VerticalFactor
Vertical scroll relative to the camera (0 by default: the layer stays at Y).
public float VerticalFactor { get; init; }Property Value
Y
Screen row of the image’s top edge when the camera is at Y = 0.
public float Y { get; init; }Property Value
Methods
Draw(IRenderer, Vector2, float)
Draws the layer in screen space.
public void Draw(IRenderer r, Vector2 cameraPosition, float time = 0)Parameters
The renderer, with no camera pushed.
cameraPosition Vector2
The camera’s Position.
time float
Seconds used by Drift, for example the game’s Time.