Class OcsfmlGraphics.convex_shape

class convex_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 -> ?points:(float * float) list -> unit -> object .. end
Specialized shape representing a convex polygon.

This class inherits all the functions of sf::Transformable (position, rotation, scale, bounds, ...) as well as the functions of sf::Shape (outline, color, texture, ...).

It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly. Moreover, the points must be defined in order; using a random order would result in an incorrect shape.

Usage example:

    let polygon = new convex_shape 
    ~points:[(0.,0.) ; (0.,10.) ; (25., 5.)]
    ~position:(10.,20.) ()) in
    window#draw polygon

method destroy : unit
method set_point : int -> float * float -> unit
Set the position of a point.

Don't forget that the polygon must remain convex, and the points need to stay ordered! SetPointCount must be called first in order to set the total number of points. The result is undefined if index is out of the valid range.

method set_point_count : int -> unit
Set the number of points of the polygon.

count must be greater than 2 to define a valid shape.