![]()  | 
  
    Gamedev Framework (gf)
    0.14.0
    
   A C++14 framework for 2D games 
   | 
 
Define the states used for drawing to a RenderTarget. More...
#include <gf/RenderStates.h>
Public Attributes | |
| BlendMode | mode = BlendAlpha | 
| The blending mode.  More... | |
| Matrix3f | transform = identityTransform() | 
| The transform matrix.  More... | |
| const BareTexture * | texture = nullptr | 
| The texture.  More... | |
| Shader * | shader = nullptr | 
| The shader.  More... | |
| float | lineWidth = 0.0f | 
| The line width.  More... | |
Related Functions | |
(Note that these are not member functions.)  | |
| bool | operator== (const RenderStates &lhs, const RenderStates &rhs) | 
| Check render states equality.  More... | |
Define the states used for drawing to a RenderTarget.
There are four global states that can be applied to the drawn objects:
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 gf::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 explicitly – the default set of states is ok in most cases.
When you're inside the draw() function of a drawable object (inherited from gf::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.
| float gf::RenderStates::lineWidth = 0.0f | 
The line width.
| BlendMode gf::RenderStates::mode = BlendAlpha | 
The blending mode.
| Shader* gf::RenderStates::shader = nullptr | 
The shader.
| const BareTexture* gf::RenderStates::texture = nullptr | 
The texture.
| Matrix3f gf::RenderStates::transform = identityTransform() | 
The transform matrix.
 1.8.13