Class Shape<T extends BlendableEntity<?>>
java.lang.Object
com.codingame.gameengine.module.entities.Entity<T>
com.codingame.gameengine.module.entities.BlendableEntity<T>
com.codingame.gameengine.module.entities.Shape<T>
- Type Parameters:
T
- a subclass inheriting Entity, used in order to return this as a T instead of a Shape.
- All Implemented Interfaces:
Mask
- Direct Known Subclasses:
Circle
,Line
,Polygon
,Rectangle
,RoundedRectangle
public abstract class Shape<T extends BlendableEntity<?>>
extends BlendableEntity<T>
implements Mask
A Shape represents a graphical entity with a fill and a line, both of which have an alpha and color. You may also set the line's
width in world units.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.codingame.gameengine.module.entities.BlendableEntity
BlendableEntity.BlendMode
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the alpha of the fill of thisShape
as a percentage.Returns the color of the fill of thisShape
as an RGB integer.double
Returns the alpha of the border of thisShape
as a percentage.int
Returns the color of the border of thisShape
as an RGB integer.double
Returns the width of the border of thisShape
in world units.setFillAlpha
(double alpha) Sets the alpha of the fill of thisShape
as a percentage.setFillAlpha
(double alpha, Curve curve) Sets the alpha of the fill of thisShape
as a percentage.setFillColor
(int color) Sets the color of the fill of thisShape
as an RGB integer.setFillColor
(int color, Curve curve) Sets the color of the fill of thisShape
as an RGB integer.setLineAlpha
(double alpha) Sets the alpha of the border of thisShape
as a percentage.setLineAlpha
(double alpha, Curve curve) Sets the alpha of the border of thisShape
as a percentage.setLineColor
(int lineColor) Sets the color of the border of thisShape
as an RGB integer.setLineColor
(int lineColor, Curve curve) Sets the color of the border of thisShape
as an RGB integer.setLineWidth
(double lineWidth) Sets the width of the border of thisShape
in world units.setLineWidth
(double lineWidth, Curve curve) Sets the width of the border of thisShape
in world units.Methods inherited from class com.codingame.gameengine.module.entities.BlendableEntity
getBlendMode, setBlendMode
Methods inherited from class com.codingame.gameengine.module.entities.Entity
getAlpha, getId, getMask, getParent, getRotation, getScaleX, getScaleY, getSkewX, getSkewY, getX, getY, getZIndex, isVisible, requireValidAlpha, requireValidColor, self, set, set, setAlpha, setAlpha, setMask, setMask, setRotation, setRotation, setScale, setScale, setScaleX, setScaleX, setScaleY, setScaleY, setSkewX, setSkewX, setSkewY, setSkewY, setVisible, setX, setX, setY, setY, setZIndex
-
Method Details
-
setFillColor
Sets the color of the fill of thisShape
as an RGB integer. If the fill should not be drawn, usesetFillAlpha(0)
.Default is 0xFFFFFF (white).
- Parameters:
color
- the color of the fill of thisShape
.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if color isn't a valid RGB integer
-
setFillColor
Sets the color of the fill of thisShape
as an RGB integer. If the fill should not be drawn, usesetFillAlpha(0)
.Default is 0xFFFFFF (white).
- Parameters:
color
- the color of the fill of thisShape
.curve
- the transition to animate between values of this property.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if color isn't a valid RGB integer
-
getFillColor
Returns the color of the fill of thisShape
as an RGB integer.Default is 0xFFFFFF (white).
- Returns:
- the color of the fill of this
Shape
.
-
setFillAlpha
Sets the alpha of the fill of thisShape
as a percentage.Default is 1.
- Parameters:
alpha
- the alpha of the fill of thisShape
.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if alpha < 0 or alpha > 1
-
setFillAlpha
Sets the alpha of the fill of thisShape
as a percentage.Default is 1.
- Parameters:
alpha
- the alpha of the fill of thisShape
.curve
- the transition to animate between values of this property.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if alpha < 0 or alpha > 1
-
getFillAlpha
public double getFillAlpha()Returns the alpha of the fill of thisShape
as a percentage.Default is 1.
- Returns:
- the alpha of the fill of this
Shape
.
-
setLineAlpha
Sets the alpha of the border of thisShape
as a percentage.Default is 1.
- Parameters:
alpha
- the alpha for the border of thisShape
.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if alpha < 0 or alpha > 1
-
setLineAlpha
Sets the alpha of the border of thisShape
as a percentage.Default is 1.
- Parameters:
alpha
- the alpha for the border of thisShape
.curve
- the transition to animate between values of this property.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if alpha < 0 or alpha > 1
-
getLineAlpha
public double getLineAlpha()Returns the alpha of the border of thisShape
as a percentage.Default is 1.
- Returns:
- the alpha for the border of this
Shape
.
-
setLineWidth
Sets the width of the border of thisShape
in world units.Default is 0.
- Parameters:
lineWidth
- the width for the border of thisShape
.- Returns:
- this
Shape
.
-
setLineWidth
Sets the width of the border of thisShape
in world units.Default is 0.
- Parameters:
lineWidth
- the width for the border of thisShape
.curve
- the transition to animate between values of this property.- Returns:
- this
Shape
.
-
getLineWidth
public double getLineWidth()Returns the width of the border of thisShape
in world units.Default is 0.
- Returns:
- the width of the border of this
Shape
.
-
setLineColor
Sets the color of the border of thisShape
as an RGB integer.Default is 0xFFFFFF (white).
- Parameters:
lineColor
- the color for the border of thisShape
.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if lineColor isn't a valid RGB integer
-
setLineColor
Sets the color of the border of thisShape
as an RGB integer.Default is 0xFFFFFF (white).
- Parameters:
lineColor
- the color for the border of thisShape
.curve
- the transition to animate between values of this property.- Returns:
- this
Shape
. - Throws:
IllegalArgumentException
- if lineColor isn't a valid RGB integer
-
getLineColor
public int getLineColor()Returns the color of the border of thisShape
as an RGB integer.Default is 0xFFFFFF (white).
- Returns:
- the color of the border of this
Shape
.
-