Class: SFML::RenderState
- Inherits:
-
Object
- Object
- SFML::RenderState
- Defined in:
- ext/graphics/render_state.c,
ext/graphics/render_state.c
Overview
The set of render states (transform, blend mode, stencil mode, coordinate type, texture, shader) applied when drawing a Drawable to a render target.
Instance Attribute Summary collapse
-
#blend_mode ⇒ BlendMode
Returns the state's blend mode.
-
#coordinate_type ⇒ Symbol
Returns the state's texture coordinate type.
-
#shader ⇒ Shader?
Returns the state's shader, or
nilif it has none. -
#stencil_mode ⇒ StencilMode
Returns the state's stencil mode.
-
#texture ⇒ Texture?
Returns the object's texture, or
nilif it has none. -
#transform ⇒ Array
Also available as #matrix.
Instance Method Summary collapse
-
#initialize(*args) ⇒ RenderState
constructor
Creates a render state with SFML's default blend mode, stencil mode and coordinate type, and identity transform unless
matrix(a 3x3 row-major Array, see Transform) is given. -
#transform ⇒ Array
Also available as #matrix.
-
#matrix=(rb_matrix) ⇒ self
matrixis a 3x3 row-major Array, see Transform.
Constructor Details
#new ⇒ RenderState #new(matrix) ⇒ RenderState
Creates a render state with SFML's default blend mode, stencil mode and
coordinate type, and identity transform unless matrix (a 3x3
row-major Array, see Transform) is given.
74 75 76 77 78 79 80 81 82 83 84 |
# File 'ext/graphics/render_state.c', line 74
static VALUE RenderStates_initialize(int argc, VALUE* argv, VALUE self) {
if (argc > 1) {
raise_invalid_arguments_excepted(1, argc);
}
if (argc == 1) {
Get_RenderState_Struct(self)->transform = Transform_ArrayToTransform(argv[0]);
}
return self;
}
|
Instance Attribute Details
#blend_mode ⇒ BlendMode
Returns the state's blend mode.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_blend_mode(VALUE self) {
return blend_mode_to_rb(Get_RenderState_Struct(self)->blendMode);
}
|
#coordinate_type ⇒ Symbol
Returns the state's texture coordinate type.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_coordinate_type(VALUE self) {
return ID2SYM(rb_intern(coordinate_type_name(Get_RenderState_Struct(self)->coordinateType)));
}
|
#shader ⇒ Shader?
Returns the state's shader, or nil if it has none.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_shader(VALUE self) {
return Get_RenderStates_Wrapper(self)->rb_shader;
}
|
#stencil_mode ⇒ StencilMode
Returns the state's stencil mode.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_stencil_mode(VALUE self) {
return stencil_mode_to_rb(Get_RenderState_Struct(self)->stencilMode);
}
|
#texture ⇒ Texture?
Returns the object's texture, or nil if it has none.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_texture(VALUE self) {
return Get_RenderStates_Wrapper(self)->rb_texture;
}
|
#transform ⇒ Array
Also available as #matrix.
255 256 257 |
# File 'ext/graphics/render_state.c', line 255
static VALUE RenderStates_get_transform(VALUE self) {
return Transform_MatrixToArray(Get_RenderState_Struct(self)->transform.matrix);
}
|
Instance Method Details
#transform ⇒ Array
Also available as #matrix.
108 109 110 |
# File 'ext/graphics/render_state.c', line 108
static VALUE RenderStates_get_transform(VALUE self) {
return Transform_MatrixToArray(Get_RenderState_Struct(self)->transform.matrix);
}
|
#transform=(matrix) ⇒ self #matrix=(matrix) ⇒ self
matrix is a 3x3 row-major Array, see Transform.
94 95 96 97 98 99 100 |
# File 'ext/graphics/render_state.c', line 94
static VALUE RenderStates_set_transform(VALUE self, VALUE rb_matrix) {
sfRenderStates* states = Get_RenderState_Struct(self);
states->transform = Transform_ArrayToTransform(rb_matrix);
return self;
}
|