Package io.github.team6ENG.EscapeUni
Class Lighting
java.lang.Object
io.github.team6ENG.EscapeUni.Lighting
Stores light sources and renders a dark overlay with
light sources (circles) to simulate 2D lighting effects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLightSource(String lightName, float circleX, float circleY, com.badlogic.gdx.graphics.Color colour, int radius) create new light source and add to list of lightsvoidadjustRadius(String lightName, int radius) Adjust radius of a light sourcevoidReset list of lightsvoiddispose()voidSet visibility of light sourcevoidremoveLightSource(String lightName) Remove a light source from lightscom.badlogic.gdx.graphics.Texturerender(com.badlogic.gdx.graphics.OrthographicCamera camera, int mapWidth, int mapHeight) Renders the lighting system: 1.voidupdateLightSource(String lightName, float circleX, float circleY) Reposition light source
-
Constructor Details
-
Lighting
public Lighting(int mapWidth, int mapHeight)
-
-
Method Details
-
addLightSource
public void addLightSource(String lightName, float circleX, float circleY, com.badlogic.gdx.graphics.Color colour, int radius) create new light source and add to list of lights- Parameters:
lightName-circleX-circleY-colour-radius-
-
removeLightSource
Remove a light source from lights- Parameters:
lightName-
-
clearLightSources
public void clearLightSources()Reset list of lights -
updateLightSource
Reposition light source -
adjustRadius
Adjust radius of a light source- Parameters:
lightName-radius-
-
isVisible
Set visibility of light source- Parameters:
lightName-isVisible-
-
render
public com.badlogic.gdx.graphics.Texture render(com.badlogic.gdx.graphics.OrthographicCamera camera, int mapWidth, int mapHeight) Renders the lighting system: 1. Draws a dark overlay 2. Adds transparent circles- Parameters:
camera- The cameramapWidth- Dimensions of world map for drawing darknessmapHeight- Dimensions of world map for drawing darkness- Returns:
- Texture representing the darkness and lights
-
dispose
public void dispose()
-