-
Notifications
You must be signed in to change notification settings - Fork 0
General functions
Chico edited this page Jan 18, 2020
·
6 revisions
luven.init( [ screenWidth ], [ screenHeight ], [ useCamera ] ) :
- Description
- Initialize the Luven lib, all parameters are optional to help simplicity.
- Params
- screenWidth : NUMBER : Positive
- Define the screen width for Luven's light calculations.
- love.graphics.getWidth() by default.
- screenHeight : NUMBER : Positive
- Define the screen height for Luven's light calculations.
- love.graphics.getHeight() by default.
- useCamera : BOOLEAN
- Allow to say to Luven that he should not use it's integrated camera.
- screenWidth : NUMBER : Positive
luven.setAmbientLightColor( color ) :
- Description
- Set the ambient light color, this value can be any color. rgb values have to be between 0 and 1.
- Params
- color : COLOR : { r, g, b, [ a ] }
- Define the ambient light color.
- { 0, 0, 0, 1 } by default (complete dark night).
- color : COLOR : { r, g, b, [ a ] }
luven.registerLightShape( name, spritePath, [ originX ], [ originY ] ) :
- Description
- Whatever light shape you dream about you can register it to Luven with this single function. Give it a name and access it later like that
Luven.lightShapes.exampleName
as a light shape parameter (see Lights page)
- Whatever light shape you dream about you can register it to Luven with this single function. Give it a name and access it later like that
- Params
- name : TEXT
- Have to be unique, else an error will be raised.
- spritePath : TEXT
- Path to light sprite.
- originX : NUMBER
- Set the origin on the x axis for the light shape
- half the width of the sprite by default
- originY : NUMBER
- Set the origin on the y axis for the light shape
- half the height of the sprite by default
- name : TEXT
luven.update( dt ) :
- Description
- Nothing more to say that, just call it in your
love.update()
.
- Nothing more to say that, just call it in your
- Params
- dt : NUMBER
- Deltatime
- dt : NUMBER
luven.drawBegin() :
- Description
- Work in pair with
luven.drawEnd()
. This call allow Luven to the camera transform and the light map.
- Work in pair with
luven.drawEnd() :
- Description
- Call after
luven.drawBegin()
... it's better.
- Call after
luven.dispose() :
- Description
- Let the Lua garbage collector do his job and clear the light map.
luven.getLightCount() :
- Description
- If you need to know how many lights are currently active.
- Return
- lightCount : NUMBER
luven.newColor(r, g, b, [a]) :
- Description
- Return a color table that can be given to Luven as a COLOR parameter.
- Params
- r : NUMBER
- Red channel
- g : NUMBER
- Green channel
- b : NUMBER
- Blue channel
- a : NUMBER
- Alpha channel (1 by default)
- r : NUMBER
- Return
- color : { r, g, b, a }
luven.newColorRange([minR], [minG], [minB], [maxR], [maxG], [maxB], [minA], [maxA]) :
- Description
- Return a color range table that can be given to Luven as a COLOR RANGE parameter.
- Params
- minR : NUMBER
- Minimal value of the red channel (0 by default)
- minG : NUMBER
- Minimal value of the green channel (0 by default)
- minB : NUMBER
- Minimal value of the blue channel (0 by default)
- maxR : NUMBER
- Maximal value of the red channel (0 by default)
- maxG : NUMBER
- Maximal value of the green channel (0 by default)
- maxB : NUMBER
- Maximal value of the blue channel (0 by default)
- minA : NUMBER
- Minimal value of the alpha channel (1 by default)
- maxA : NUMBER
- Maximal value of the alpha channel (1 by default)
- minR : NUMBER
- Return
- color range : { min = { minR, minG, minB, minA }, max = { maxR, maxG, maxB, maxA } }
luven.newNumberRange(minN, maxN) :
- Description
- Return a number range table that can be given to Luven as a NUMBER RANGE parameter.
- Params
- minN : NUMBER
- Minimal value
- maxN : NUMBER
- Minimal value
- minN : NUMBER
- Return
- number range : { min = minN, max = maxN }