public class LightSource extends Entity implements IRenderable
Modifier and Type | Class and Description |
---|---|
static class |
LightSource.Type |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INTENSITY |
static java.lang.String |
TOGGLE_MESSAGE |
ANY_MESSAGE
Constructor and Description |
---|
LightSource(int intensity,
java.awt.Color lightColor,
LightSource.Type shapeType,
boolean activated)
Instantiates a new
LightSource entity. |
Modifier and Type | Method and Description |
---|---|
void |
activate() |
void |
deactivate() |
java.awt.Color |
getColor() |
double |
getFocusOffsetX() |
double |
getFocusOffsetY() |
int |
getIntensity() |
java.awt.Shape |
getLightShape() |
LightSource.Type |
getLightShapeType() |
int |
getRadius() |
boolean |
isActive() |
void |
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.
|
java.lang.String |
sendMessage(java.lang.Object sender,
java.lang.String message) |
void |
setColor(java.awt.Color result) |
void |
setFocusOffsetX(double focusOffsetX) |
void |
setFocusOffsetY(double focusOffsetY) |
void |
setHeight(double height) |
void |
setIntensity(int intensity) |
void |
setLightShapeType(LightSource.Type shapeType) |
void |
setLocation(java.awt.geom.Point2D location)
Sets the map location.
|
void |
setSize(double width,
double height) |
void |
setWidth(double width) |
void |
setX(double x) |
void |
setY(double y) |
void |
toggle() |
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeEntityRenderedListener, removeEntityRenderListener, removeListener, removeMessageListener, removeTag, removeTransformListener, rendered, rendering, renderWithLayer, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, toString
public static final java.lang.String TOGGLE_MESSAGE
public static final int DEFAULT_INTENSITY
public LightSource(int intensity, java.awt.Color lightColor, LightSource.Type shapeType, boolean activated)
LightSource
entity.intensity
- The intensity of this instance.lightColor
- The color of this instance.shapeType
- The shape type of this instance.activated
- A flag indicating whether this light is activated by default.public void activate()
public void deactivate()
public java.awt.Color getColor()
public double getFocusOffsetX()
public double getFocusOffsetY()
public int getIntensity()
public java.awt.Shape getLightShape()
public LightSource.Type getLightShapeType()
public int getRadius()
public boolean isActive()
public void render(java.awt.Graphics2D g)
IRenderable
If an Entity
implements this interface, this method will be called right after the entity was rendered from the environment.
Allowing for a custom rendering mechanism.
This interface can be implemented in general by anything that should be rendered to the game's screen.
render
in interface IRenderable
g
- The current graphics object onto which this instance will render its visual contents.RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
public void setFocusOffsetX(double focusOffsetX)
public void setFocusOffsetY(double focusOffsetY)
public void setColor(java.awt.Color result)
public void setIntensity(int intensity)
public void setLightShapeType(LightSource.Type shapeType)
public void setX(double x)
public void setY(double y)
public void setWidth(double width)
public void setHeight(double height)
public void setLocation(java.awt.geom.Point2D location)
Entity
setLocation
in interface IEntity
setLocation
in class Entity
location
- the new map locationpublic void setSize(double width, double height)
public void toggle()
public java.lang.String sendMessage(java.lang.Object sender, java.lang.String message)
sendMessage
in interface IEntity
sendMessage
in class Entity