dsfml.graphics.shape



class Shape: dsfml.graphics.drawableimpl.Drawableimpl!(sfShape).Drawableimpl;
Shape defines a drawable convex shape ; it also defines helper functions to draw simple shapes like lines, rectangles, circles, etc.

void addPoint(float x, float y, Color col = WHITE, Color outlineCol = BLACK);
Add a point to the shape

Params:
float x X position of the point
float y Y position of the point
Color col Color of the point (white by default)
Color outlineCol Outline color of the point (black by default)

void addPoint(Vector2!(float) position, Color col = WHITE, Color outlineCol = BLACK);
Add a point to the shape

Params:
Vector2!(float) position position of the point
Color col Color of the point (white by default)
Color outlineCol Outline color of the point (black by default)

void enableFill(bool enable);
Enable or disable filling the shape. Fill is enabled by default.

Params:
bool enable True to enable, false to disable

void enableOutline(bool enable);
Enable or disable drawing a shape outline. Outline is enabled by default

Params:
bool enable True to enable, false to disable

void setOutlineWidth(float width);
Change the width of a shape outline

Params:
float width New width

uint getNbPoints();
Get the number of points composing a shape

Returns:
Total number of points

Vector2!(float) getPoint(uint index);
Get a point of the shape

Params:
uint index Index-th point

float getOutlineWidth();
Get the width of the shape outline

Returns:
Current outline width



static Shape line(float p1X, float p1Y, float p2X, float p2Y, float thickness, Color col, float outline = 0F, Color outlineCol = BLACK);
Create a shape made of a single line

Params:
float thickness Line thickness
Color col Color used to draw the line
float outline Outline width (0 by default)
Color outlineCol Color used to draw the outline (black by default)

Returns:
New line shape

static Shape rectangle(float p1X, float p1Y, float p2X, float p2Y, Color col, float outline = 0F, Color outlineCol = BLACK);
Create a shape made of a single rectangle

Params:
float p1X X position of the first point
float p1Y Y position of the first point
float p2X X position second point
float p2Y Y position second point
Color col Color used to fill the rectangle
float outline Outline width (0 by default)
Color outlineCol Color used to draw the outline (black by default)

Returns:
new rectangle shape

static Shape circle(float x, float y, float radius, Color col, float outline = 0F, Color outlineCol = BLACK);
Create a shape made of a single circle

Params:
float x X position of the center
float y Y position of the center
float radius Radius
Color col Color used to fill the circle
float outline Outline width (0 by default)
Color outlineCol Color used to draw the outline (black by default)

Returns:
new circle shape


Page generated by Ddoc.