API Docs for: 0.2.0
Show:

Utilities Class

Module: LE

A static class with functions for performing calculations

Methods

centerOfVerts

(
  • vertcies
)
Object private

Returns a Vector container the center point from a set of vertices

Parameters:

  • vertcies Object

Returns:

Object:

xAndY

checkPointCollision

(
  • testX
  • testY
  • object
)
Boolean

Returns a Vector container the center point from a set of vertices

Parameters:

  • testX Number

    X position to be checked

  • testY Number

    Y position to be checked

  • object Object

    Object to be checked. Takes a Polygon or a Texture

Returns:

Boolean:

isColliding

checkScreenBounds

(
  • boundX
  • boundY
  • boundWidth
  • boundHeight
  • boundXAdditive
  • boundYAdditive
  • testX
  • testY
)
Boolean

Checks if an x and y position is within the bounds provided as parameters

Parameters:

  • boundX Number

    Camera x position

  • boundY Number

    Camera y position

  • boundWidth Number

    Viewport width

  • boundHeight Number

    Viewport height

  • boundXAdditive Number

    Extra amount to allow for on x boundaries

  • boundYAdditive Number

    Extra amount to allow for on y boundaries

  • testX Number

    The x position to test

  • testY Number

    The y position to test

Returns:

Boolean:

degToRad

(
  • degrees
)
Number

Converts from degrees (angle) to radians

Parameters:

  • degrees Number

Returns:

Number:

radian

minMaxFromVerts

(
  • vertcies
)
Object private

Returns the minimum width and height and maximum width and height from a set of vertices

Parameters:

  • vertcies Object

Returns:

Object:

minAndMax

sizeFromVerts

(
  • vertcies
)
Object private

Returns the total width and height from a set of vertices

Parameters:

  • vertcies Object

Returns:

Object:

widthAndHeight

toMatrix

(
  • gl
  • value
  • isWidth
)
Number private

Used to convert pixel positions to WebGL matrix positions

Parameters:

  • gl Object
  • value Number
  • isWidth Boolean

Returns:

Number:

newValue

vertToMatrix

(
  • gl
  • x
  • y
)
Object private

Used to convert pixel positions to WebGL matrix positions

Parameters:

  • gl Object
  • x Number
  • y Number

Returns:

Object:

newVector