RenderStates

Define the states used for drawing to a RenderTarget.

There are four global states that can be applied to the drawn objects: - the blend mode: how pixels of the object are blended with the background - the transform: how the object is positioned/rotated/scaled - the texture: what image is mapped to the object - the shader: what custom effect is applied to the object

High-level objects such as sprites or text force some of these states when they are drawn. For example, a sprite will set its own texture, so that you don't have to care about it when drawing the sprite.

The transform is a special case: sprites, texts and shapes (and it's a good idea to do it with your own drawable classes too) combine their transform with the one that is passed in the RenderStates structure. So that you can use a "global" transform on top of each object's transform.

Most objects, especially high-level drawables, can be drawn directly without defining render states explicitely – the default set of states is ok in most cases.

If you want to use a single specific render state, for example a shader, you can pass it directly to the Draw function: RenderStates has an implicit one-argument constructor for each state.

When you're inside the Draw function of a drawable object (inherited from sf::Drawable), you can either pass the render states unmodified, or change some of them. For example, a transformable object will combine the current transform with its own transform. A sprite will set its texture. Etc.

Constructors

this
this(BlendMode theBlendMode)
Undocumented in source.
this
this(Transform theTransform)
Undocumented in source.
this
this(const(Texture) theTexture)
Undocumented in source.
this
this(const(Shader) theShader)
Undocumented in source.
this
this(BlendMode theBlendMode, Transform theTransform, const(Texture) theTexture, const(Shader) theShader)
Undocumented in source.

Members

Properties

Default
RenderStates Default [@property getter]

A default, empty render state.

shader
const(Shader) shader [@property setter]

The shader to apply while rendering.

shader
const(Shader) shader [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
texture
const(Texture) texture [@property setter]

The texture to apply while rendering.

texture
const(Texture) texture [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

emptyShader
Shader emptyShader;
Undocumented in source.
emptyTexture
Texture emptyTexture;
Undocumented in source.

Variables

blendMode
BlendMode blendMode;
Undocumented in source.
transform
Transform transform;
Undocumented in source.

See Also

Meta

Authors

Laurent Gomila, Jeremy DeHaan