There is a big difference in the look and feel of a 2D game with dynamic lighting and one without it. The bad thing is that, while 2D game development is relatively accessible, lighting algorithms are not as much.
Fortunately, we have amazing people in this world, like javidx9, that has this amazing tutorial on 2D shadow casting. It inspired me to write Candle. It is easy to integrate, it has no dependencies other than SFML itself and it's open for further development!
The code comes with a demo to test the main features, which are dynamic lights, fog and shadows.
Any feedback is appreciated! Thank you and have a nice day ;)
Code: https://github.com/MguelMJ/Candle
Documentation: https://github.com/MiguelMJ/Candle
Candle
2D lighting for SFML
Candle is a SFML based C++ library that provides light, shadow casting and field of view functionalities with easy integration.
Contents
Demo
Before anything, here you have a little example of how it looks.
The code comes with a demo program showing the basic functionalities provided by the library. In it you can place lights and blocks that will cast shadows, and modify the opacity of the fog.
Controls
-
Right click. Alternate between block and light.
-
Left click. Put a block or light.
-
Spacebar. Erase all lights and blocks.
-
Mouse wheel. Increase / Decrease light radius.
-
G. Toggle glow.
-
C. Alternate glow color between white, magenta, yellow and cyan.
-
A / S. Increase / Decrease light intensity.
-
Z / X. Increase / Decrease fog opacity.
-
P. Capture…
Discussion (0)