Skip to content
Chico edited this page Mar 13, 2019 · 7 revisions

Functions

luven.camera:init( x, y ) :

  • Description
    • Init the integrated camera, not done automatically, very important step.
  • Params
    • x : NUMBER
    • y : NUMBER

luven.camera:set() :

  • Description
    • This call works in pair with luven.camera:unset(), this act like luven.drawBegin() and luven.drawEnd() but without the light effect, so it can be used to draw an UI at the same scale coordinate of the camera without the light interacting with it.

luven.camera:unset() :

  • Description
    • Call it after luven.camera:set().

luven.camera:draw() :

  • Description
    • Call it on top of everything (used to draw the fade feature)

luven.camera:setPosition( x, y ) :

  • Description
    • Name = function, set the position of the camera.
  • Params
    • x : NUMBER
    • y : NUMBER

luven.camera:move( dx, dy ) :

  • Description
    • Allow moving relatively the camera.
  • Params
    • dx : NUMBER
      • Move amount on x axis.
    • dy : NUMBER
      • Move amount on y axis.

luven.camera:setRotation( dr ) :

  • Description
    • Set the rotation of the camera.
  • Params
    • dr : NUMBER
      • Rotation to set in radians.

luven.camera:setScale( [ sx ], [ sy ] ) :

  • Description
    • Set the scale factor for the camera. Parameters are optional.
  • Params
    • sx : NUMBER
      • Scale on the x axis, can be given alone without sy. 1 by default.
    • sy : NUMBER
      • Scale on the y axis, while take the sx value if absent. 1 by default.

luven.camera:setShake( duration, magnitude ) :

  • Description
    • Define the shake for the camera.
  • Params
    • duration : NUMBER : Positive
      • Duration in seconds of the camera shake.
    • magnitude : NUMBER : Positive
      • Force of the camera shake.

luven.camera:setFade( duration, color, [action] ) :

  • Description
    • Define a fading action
  • Params
    • duration : NUMBER : Positive
      • Duration in seconds of the fading.
    • color : COLOR : { r, g, b, a }
      • The default color is { 0, 0, 0, 0 }, the alpha channel is very important.
    • action : FUNCTION
      • This action is executed when the fading is over.

luven.camera:setMoveTarget( x, y ) :

  • Description
    • Define the target that the camera have to move to.
  • Params
    • x : NUMBER
    • y : NUMBER

luven.camera:setMoveSmooth( x, [y] ) :

  • Description
    • Define the smoothness of the camera follow movement
  • Params
    • x : NUMBER
    • y : NUMBER
      • Optional takes same value as x if omitted.

Public fields

All these are accessible... but I encourage you to only read them.

  • luven.camera.x

  • luven.camera.y

  • luven.camera.scaleX

  • luven.camera.scaleY

  • luven.camera.rotation

  • luven.camera.transform

  • luven.camera.shakeDuration

  • luven.camera.shakeMagnitude

  • luven.camera.fading

  • luven.camera.fadeDuration

  • luven.camera.fadeTimer

  • luven.camera.fadeColor

  • luven.camera.startFadeColor

  • luven.camera.endFadeColor

  • luven.camera.fadeAction

  • luven.camera.useTarget

  • luven.camera.moveTarget

  • luven.camera.moveSmooth


Clone this wiki locally