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 IRenderableNested Class Summary
Nested Classes Modifier and Type Class Description static classLightSource.TypeField Summary
Fields Modifier and Type Field Description static intDEFAULT_INTENSITYstatic java.lang.StringTOGGLE_MESSAGEConstructor Summary
Constructors Constructor Description LightSource(int intensity, java.awt.Color lightColor, LightSource.Type shapeType, boolean activated)Instantiates a newLightSourceentity.Method Summary
Modifier and Type Method Description voidactivate()voiddeactivate()java.awt.ColorgetColor()doublegetFocusOffsetX()doublegetFocusOffsetY()intgetIntensity()java.awt.ShapegetLightShape()LightSource.TypegetLightShapeType()intgetRadius()booleanisActive()voidrender(java.awt.Graphics2D g)Renders the visual contents of this instance onto the provided graphics context.java.lang.StringsendMessage(java.lang.Object sender, java.lang.String message)voidsetColor(java.awt.Color result)voidsetFocusOffsetX(double focusOffsetX)voidsetFocusOffsetY(double focusOffsetY)voidsetHeight(double height)voidsetIntensity(int intensity)voidsetLightShapeType(LightSource.Type shapeType)voidsetLocation(java.awt.geom.Point2D location)Sets the map location.voidsetSize(double width, double height)voidsetWidth(double width)voidsetX(double x)voidsetY(double y)voidtoggle()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 newLightSourceentity.- 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:IRenderableRenders the visual contents of this instance onto the provided graphics context.If an
Entityimplements 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:
renderin 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:EntitySets the map location.- Specified by:
setLocationin interfaceIEntity- Overrides:
setLocationin 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:
sendMessagein interfaceIEntity- Overrides:
sendMessagein classEntity
