public class ConvexShape extends Shape
points, pointsNeedUpdate
Constructor and Description |
---|
ConvexShape()
Constructs a new empty polygon.
|
ConvexShape(int points)
Constructs a new empty polygon and allocates a certain amount of points.
|
ConvexShape(Vector2f... points)
Constructs a new polygon from a given set of points.
|
Modifier and Type | Method and Description |
---|---|
Transform |
getInverseTransform()
Gets the inverse of the current transformation matrix.
|
Vector2f |
getOrigin()
Gets the origin of this object.
|
Vector2f[] |
getPoints()
Gets all the points of the shape.
|
Vector2f |
getPosition()
Gets the position of this object.
|
float |
getRotation()
Gets the rotation angle of this object.
|
Vector2f |
getScale()
Gets the scaling of this object.
|
Transform |
getTransform()
Gets the current transformation matrix.
|
void |
move(float x,
float y)
Moves this object.
|
void |
move(Vector2f v)
Moves the object.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
rotate(float angle)
Rotates this object around its origin.
|
void |
scale(float x,
float y)
Scales the object, using its origin as the scaling center.
|
void |
scale(Vector2f factors)
Scales the object, using its origin as the scaling center.
|
void |
setOrigin(float x,
float y)
Sets the rotation, scaling and drawing origin of this object.
|
void |
setPoint(int i,
Vector2f v)
Sets a point of the polygon.
|
void |
setPointCount(int pointCount)
Sets the amount of points that belong to the polygon.
|
void |
setPoints(Vector2f... points)
Sets the points of the polygon.
|
void |
setPosition(float x,
float y)
Sets the position of this object in the scene so that its origin will be exactly on it.
|
void |
setScale(float x,
float y)
Sets the scaling of this object, using its origin as the scaling center.
|
draw, getFillColor, getGlobalBounds, getLocalBounds, getOutlineColor, getOutlineThickness, getPoint, getPointCount, getTexture, getTextureRect, setFillColor, setOrigin, setOutlineColor, setOutlineThickness, setPosition, setRotation, setScale, setTexture, setTexture, setTextureRect
finalize
public ConvexShape()
public ConvexShape(int points)
setPointCount(int)
directly after
construction of the polygon.points
- the amount of points of the polygon.public ConvexShape(Vector2f... points)
setPoints(org.jsfml.system.Vector2f...)
directly after construction of the polygon.points
- the points of the polygon.@Deprecated protected long nativeCreate()
SFMLNativeObject
nativeCreate
in class SFMLNativeObject
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class SFMLNativeObject
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SFMLNativeObject
public void setPointCount(int pointCount)
pointCount
- the amount of points of the polygon.public void setPoint(int i, Vector2f v)
i
- the index of the point to set. Note that this index must be within the bounds
of the polygon's point count, ie the point count needs to be set properly
using setPointCount(int)
first.v
- the point to set at the given index.public void setPoints(Vector2f... points)
setPointCount(int)
and setPoint(int, org.jsfml.system.Vector2f)
for each point
in the given array.points
- the points of the polygon.public Vector2f[] getPoints()
Shape
public final void setPosition(float x, float y)
Transformable
setPosition
in interface Transformable
x
- the new X coordinate.y
- the new Y coordinate.public final void setScale(float x, float y)
Transformable
setScale
in interface Transformable
x
- the new X scaling factor.y
- the new Y scaling factor.public final void setOrigin(float x, float y)
Transformable
setOrigin
in interface Transformable
x
- the new X coordinate of the origin.y
- the new Y coordinate of the origin.public Vector2f getPosition()
Transformable
getPosition
in interface Transformable
public float getRotation()
Transformable
getRotation
in interface Transformable
public Vector2f getScale()
Transformable
getScale
in interface Transformable
public Vector2f getOrigin()
Transformable
getOrigin
in interface Transformable
public final void move(float x, float y)
Transformable
move
in interface Transformable
x
- the X offset added to the current position.y
- the Y offset added to the current position.public final void move(Vector2f v)
Transformable
move
in interface Transformable
v
- the offset vector added to the current position.public final void rotate(float angle)
Transformable
rotate
in interface Transformable
angle
- the rotation angle in degrees.public final void scale(float x, float y)
Transformable
scale
in interface Transformable
x
- the X scaling factor.y
- the Y scaling factor.public final void scale(Vector2f factors)
Transformable
scale
in interface Transformable
factors
- the scaling factors.public Transform getTransform()
Transformable
getTransform
in interface Transformable
public Transform getInverseTransform()
Transformable
getInverseTransform
in interface Transformable