Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dylhunn/simple-love-lights
A simple raycasting light/shadow library for Love2D.
https://github.com/dylhunn/simple-love-lights
Last synced: about 2 months ago
JSON representation
A simple raycasting light/shadow library for Love2D.
- Host: GitHub
- URL: https://github.com/dylhunn/simple-love-lights
- Owner: dylhunn
- License: mit
- Created: 2018-01-17T18:39:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-24T11:11:46.000Z (over 4 years ago)
- Last Synced: 2024-10-04T12:53:21.883Z (2 months ago)
- Language: Lua
- Size: 292 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-love2d - Simple Love Lights - A very simple raycasting light implementation. (Lighting)
README
# SIMPLE LOVE LIGHTS
This is a very simple implementation of [mattdesl's *Pixel Perfect 2D Shadows*](https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows) in Love2d/Lua. The code is simple and easy to understand. It is useful for applications that need bare-bone 2D raycasted lights and shadows. (No advanced features, such as normal maps, are provided.)This was built and tested with Love 0.10.2.
# API
```
addLight(x, y, size, r, g, b)
clearLights()
```From your `love.draw()` function, you **must** call the provided function `drawLights(drawOccludersFn, coordTransX, coordTransY)`. `drawOccludersFn` is a callback that draws all shadow-casting objects in the scene. (I recommend you store this in a variable, and then call it a second time from `love.draw()` to actually draw the objects.)
# Examples
![Simple Love Lights example image](example.png)