dylhunn / simple-love-lights

A simple raycasting light/shadow library for Love2D.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SIMPLE LOVE LIGHTS

This is a very simple implementation of mattdesl's Pixel Perfect 2D 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

About

A simple raycasting light/shadow library for Love2D.

License:MIT License


Languages

Language:Lua 100.0%