11local luven = {
2- _VERSION = ' Luven v1.2 ' ,
2+ _VERSION = ' Luven v1.3 ' ,
33 _URL = ' https://github.com/chicogamedev/Luven' ,
44 _DESCRIPTION = ' A minimalist light engine for Löve2D' ,
55 _CONTRIBUTORS = ' Lionel Leeser, Pedro Gimeno (Help with camera)' ,
66 _LICENSE = [[
77 MIT License
88
9- Copyright (c) 2019 Lionel Leeser
9+ Copyright (c) 2020 Lionel Leeser
1010
1111 Permission is hereby granted, free of charge, to any person obtaining a copy
1212 of this software and associated documentation files (the "Software"), to deal
@@ -460,6 +460,28 @@ function luven.getLightCount()
460460 return count
461461end
462462
463+ -- ///////////////////////////////////////////////
464+ -- /// Luven utils functions
465+ -- ///////////////////////////////////////////////
466+
467+ function luven .newColor (r , g , b )
468+ return { r , g , b }
469+ end
470+
471+ function luven .newColorRange (minR , minG , minB , maxR , maxG , maxB )
472+ minR = minR or 0
473+ minG = minG or 0
474+ minB = minB or 0
475+ maxR = maxR or 0
476+ maxG = maxG or 0
477+ maxB = maxB or 0
478+ return { min = { minR , minG , minB }, max = { maxR , maxG , maxB } }
479+ end
480+
481+ function luven .newNumberRange (minN , maxN )
482+ return { min = minN , max = maxN }
483+ end
484+
463485-- ///////////////////////////////////////////////
464486-- /// Luven lights functions
465487-- ///////////////////////////////////////////////
@@ -608,13 +630,21 @@ function luven.moveLight(lightId, dx, dy)
608630 currentLights [lightId ].y = currentLights [index ].y + dy
609631end
610632
611- function luven .setLightPower (lightId , power )
612- currentLights [lightId ].power = power
633+ function luven .setLightPower (lightId , p )
634+ currentLights [lightId ].power = p
635+ end
636+
637+ function luven .setLightPowerRange (lightId , r )
638+ currentLights [lightId ].powerRange = r
613639end
614640
615641-- param : color = { r, g, b } (values between 0 - 1)
616- function luven .setLightColor (lightId , color )
617- currentLights [lightId ].color = color
642+ function luven .setLightColor (lightId , c )
643+ currentLights [lightId ].color = c
644+ end
645+
646+ function luven .setLightColorRange (lightId , r )
647+ currentLights [lightId ].colorRange = r
618648end
619649
620650function luven .setLightPosition (lightId , x , y )
@@ -626,6 +656,10 @@ function luven.setLightRotation(lightId, dr)
626656 currentLights [lightId ].angle = dr
627657end
628658
659+ function luven .setLightSpeedRange (lightId , r )
660+ currentLights [lightId ].speedRange = r
661+ end
662+
629663function luven .setLightScale (lightId , sx , sy )
630664 sx = sx or 1
631665 sy = sy or sx
@@ -638,10 +672,18 @@ function luven.getLightPower(lightId)
638672 return currentLights [lightId ].power
639673end
640674
675+ function luven .getLightPowerRange (lightId )
676+ return currentLights [lightId ].powerRange
677+ end
678+
641679function luven .getLightColor (lightId )
642680 return currentLights [lightId ].color
643681end
644682
683+ function luven .getLightColorRange (lightId )
684+ return currentLights [lightId ].colorRange
685+ end
686+
645687function luven .getLightPosition (lightId )
646688 return currentLights [lightId ].x , currentLights [lightId ].y
647689end
@@ -650,6 +692,10 @@ function luven.getLightRotation(lightId)
650692 return currentLights [lightId ].angle
651693end
652694
695+ function luven .getLightSpeedRange (lightId )
696+ return currentLights [lightId ].speedRange
697+ end
698+
653699function luven .getLightScale (lightId )
654700 return currentLights [lightId ].scaleX , currentLights [lightId ].scaleY
655701end
0 commit comments