class shape :
?position:float * float -> ?scale:float * float -> ?rotation:float -> ?origin:float * float -> ?texture:#const_texture -> ?texture_rect:IntRect.t -> ?fill_color:Color.t -> ?outline_color:Color.t -> ?outline_thickness:float -> Shape.t ->
Ocsfml.Shape is a drawable class that allows to define and display a custom convex shape on a render target.
It's only an abstract base, it needs to be specialized for concrete types of shapes (circle, rectangle, convex polygon, star, ...).
In addition to the attributes provided by the specialized shape classes, a shape always has the following attributes:
method destroy :
method get_fill_color :
method get_global_bounds :
The returned rectangle is in global coordinates, which means
that it takes in account the transformations (translation,
rotation, scale, ...) that are applied to the entity. In other
words, this function returns the bounds of the sprite in the
global 2D world's coordinate system.
Returns Global bounding rectangle of the entity
method get_local_bounds :
The returned rectangle is in local coordinates, which means that
it ignores the transformations (translation, rotation, scale,
...) that are applied to the entity. In other words, this
function returns the bounds of the entity in the entity's
Returns Local bounding rectangle of the entity
method get_outline_color :
method get_outline_thickness :
method get_point :
int -> float * float
The result is undefined if the index is out of the valid range.
Returns Index-th point of the shape.
method get_point_count :
method get_texture :
const_texture reference option
If the shape has no source texture, none is returned. The
returned value is const, which means that you can't modify the
texture when you retrieve it with this function.
Returns Shape's texture.
method get_texture_rect :
method set_fill_color :
Color.t -> unit
This color is modulated (multiplied) with the shape's texture if
any. It can be used to colorize the shape, or change its global
opacity. You can use OcsfmlGraphics.Color.Transparent to make
the inside of the shape transparent, and have the outline
alone. By default, the shape's fill color is opaque white.
method set_outline_color :
Color.t -> unit
You can use OcsfmlGraphics.Color.Transparent to disable the
outline. By default, the shape's outline color is opaque
method set_outline_thickness :
float -> unit
This number cannot be negative. Using zero disables the
outline. By default, the outline thickness is 0.
method set_texture :
?texture:(#const_texture as 'a) ->
?reset_rect:bool -> unit -> unit
The texture argument refers to a texture that must exist as long
as the shape uses it. Indeed, the shape doesn't store its own
copy of the texture, but rather keeps a pointer to the one that
you passed to this function. If the source texture is destroyed
and the shape tries to use it, the behaviour is undefined. If
reset_rect is true, the TextureRect property of the shape is
automatically adjusted to the size of the new texture. If it is
false (the default), the texture rect is left unchanged.
texture: The new texture. Default disables texturing
reset_rect: Should the texture rect be reset to the size of the new texture?
method set_texture_rect :
IntRect.t -> unit
The texture rect is useful when you don't want to display the
whole texture, but rather a part of it. By default, the texture
rect covers the entire texture.