Class LightSource
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.LightSource
- All Implemented Interfaces:
EntityRenderedListener
,EntityRenderListener
,IEntity
,IRenderable
,Tweenable
,java.util.EventListener
public class LightSource
extends Entity
implements IRenderable
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LightSource.Type
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INTENSITY
static java.lang.String
TOGGLE_MESSAGE
Constructor Summary
Constructors Constructor Description LightSource(int intensity, java.awt.Color lightColor, LightSource.Type shapeType, boolean activated)
Instantiates a newLightSource
entity.Method Summary
Modifier and Type Method 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()
Methods inherited from class de.gurkenlabs.litiengine.entities.Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getTweenValues, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, rendered, rendering, renderWithLayer, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setTweenValues, setVisible, toString
Field Details
TOGGLE_MESSAGE
public static final java.lang.String TOGGLE_MESSAGE- See Also:
- Constant Field Values
DEFAULT_INTENSITY
public static final int DEFAULT_INTENSITY- See Also:
- Constant Field Values
Constructor Details
LightSource
public LightSource(int intensity, java.awt.Color lightColor, LightSource.Type shapeType, boolean activated)Instantiates a newLightSource
entity.- Parameters:
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.
Method Details
activate
public void activate()deactivate
public void deactivate()getColor
public java.awt.Color getColor()getFocusOffsetX
public double getFocusOffsetX()getFocusOffsetY
public double getFocusOffsetY()getIntensity
public int getIntensity()getLightShape
public java.awt.Shape getLightShape()getLightShapeType
getRadius
public int getRadius()isActive
public boolean isActive()render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderable
Renders the visual contents of this instance onto the provided graphics context.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.
- Specified by:
render
in interfaceIRenderable
- Parameters:
g
- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
setFocusOffsetX
public void setFocusOffsetX(double focusOffsetX)setFocusOffsetY
public void setFocusOffsetY(double focusOffsetY)setColor
public void setColor(java.awt.Color result)setIntensity
public void setIntensity(int intensity)setLightShapeType
setX
public void setX(double x)setY
public void setY(double y)setWidth
public void setWidth(double width)setHeight
public void setHeight(double height)setLocation
public void setLocation(java.awt.geom.Point2D location)Description copied from class:Entity
Sets the map location.- Specified by:
setLocation
in interfaceIEntity
- Overrides:
setLocation
in classEntity
- Parameters:
location
- the new map location
setSize
public void setSize(double width, double height)toggle
public void toggle()sendMessage
public java.lang.String sendMessage(java.lang.Object sender, java.lang.String message)- Specified by:
sendMessage
in interfaceIEntity
- Overrides:
sendMessage
in classEntity