(readonly) Type:
-
-
-
-Array.<{x: Number, y: Number, z: Number}>
-
-
-
-
-
@@ -394,7 +374,7 @@ Parameters:
-*
+Number
@@ -417,7 +397,7 @@ Parameters:
-*
+Number
@@ -440,7 +420,7 @@ Parameters:
-*
+Number
@@ -483,6 +463,187 @@ Parameters:
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ scale(x, y, z)
+
+
+
+
+
+
+
+ Change scaling of all polygons in rect.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ y
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ z
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -521,6 +682,141 @@ Parameters:
+
+
+
+
+ setAsUIElement(bool)
+
+
+
+
+
+
+
+ Sets whether the all polygons will be attached to the camera like UI element.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ bool
+
+
+
+
+
+bolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -626,7 +922,7 @@ Parameters:
Source:
@@ -807,7 +1103,7 @@ Parameters:
Source:
@@ -1169,7 +1465,7 @@ Parameters:
Source:
@@ -1506,13 +1802,13 @@ Parameters:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/Texture.html b/docs/Texture.html
index 7455cb9..85d90d2 100644
--- a/docs/Texture.html
+++ b/docs/Texture.html
@@ -841,13 +841,13 @@ Parameters:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/Texture.js.html b/docs/Texture.js.html
index 04f1841..91656fa 100644
--- a/docs/Texture.js.html
+++ b/docs/Texture.js.html
@@ -111,13 +111,13 @@ Source: Texture.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/UI.html b/docs/UI.html
new file mode 100644
index 0000000..5b9ca96
--- /dev/null
+++ b/docs/UI.html
@@ -0,0 +1,770 @@
+
+
+
+
+ JSDoc: Class: UI
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: UI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
new UI(e)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ e
+
+
+
+
+
+Engine
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+ context :CanvasRenderingContext2D
+
+
+
+
+
+ 2D context for UI drawing.
+
+
+
+
+ Type:
+
+
+
+CanvasRenderingContext2D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ elements :Array.<Objects>
+
+
+
+
+
+ There are objects which object needs to draw.
+
+
+
+
+ Type:
+
+
+
+Array.<Objects>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+
+
+
+ addElement(element)
+
+
+
+
+
+
+
+ Adds object to draw.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ element
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ some UI element.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ appendDOMElement(element)
+
+
+
+
+
+
+
+ Adding DOM element upper game engine canvas.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ element
+
+
+
+
+
+HTMLElement
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ removeElement(element)
+
+
+
+
+
+
+
+ Removes element from drawing function.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ element
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Modules Classes Global
+
+
+
+
+
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Utils.js.html b/docs/Utils.js.html
index 1ee632f..b092d96 100644
--- a/docs/Utils.js.html
+++ b/docs/Utils.js.html
@@ -130,13 +130,13 @@ Source: Utils.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/global.html b/docs/global.html
index 99fa69d..5a6f503 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -859,13 +859,13 @@ Returns:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/index.html b/docs/index.html
index 5142716..1969124 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -50,13 +50,13 @@
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/math_Math.js.html b/docs/math_Math.js.html
index 7389593..7ee6bc1 100644
--- a/docs/math_Math.js.html
+++ b/docs/math_Math.js.html
@@ -62,13 +62,13 @@ Source: math/Math.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/math_Matrixes.js.html b/docs/math_Matrixes.js.html
index a6d8b63..7ac0d7d 100644
--- a/docs/math_Matrixes.js.html
+++ b/docs/math_Matrixes.js.html
@@ -66,6 +66,29 @@ Source: math/Matrixes.js
]
return this
}
+
+ /**
+ * Sets this matrxi to projection matrix without perscpective.
+ * @param {Number} width
+ * @param {Number} height
+ * @public
+ */
+ projection (fieldOfViewInRadians, width, height, near, far) {
+
+ this.matrix = [
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 1,
+ 0, 0, 0, 1
+ ]
+ this.matrix = ([
+ 2 / width, 0, 0, 0,
+ 0, -2 / height, 0, 0,
+ 0, 0, 2 / far, 0,
+ 0, 0, 0, 1,
+ ])
+ return this
+ }
/**
* Multiplying this matrix by another.
@@ -417,11 +440,6 @@ Source: math/Matrixes.js
* @public
*/
export function vec3Multiply (matrix, vector4) {
- // c11 = a11 · b11 + a12 · b21 + a13 · b31 + a14 · b41
- // c21 = a21 · b11 + a22 · b21 + a23 · b31 + a24 · b41
- // c31 = a31 · b11 + a32 · b21 + a33 · b31 + a34 · b41
- // c41 = a41 · b11 + a42 · b21 + a43 · b31 + a44 · b41
- // console.log(matrix[0] * vector4[0] )
let c1 = matrix[0] * vector4[0] + matrix[1] * vector4[1] + matrix[2] * vector4[2] + matrix[3] * vector4[3]
let c2 = matrix[4] * vector4[0] + matrix[5] * vector4[1] + matrix[6] * vector4[2] + matrix[7] * vector4[3]
let c3 = matrix[8] * vector4[0] + matrix[9] * vector4[1] + matrix[10] * vector4[2] + matrix[11] * vector4[3]
@@ -541,13 +559,13 @@ Source: math/Matrixes.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/math_Vectors.js.html b/docs/math_Vectors.js.html
index 38155cd..730bad8 100644
--- a/docs/math_Vectors.js.html
+++ b/docs/math_Vectors.js.html
@@ -55,13 +55,13 @@ Source: math/Vectors.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/module-Math.html b/docs/module-Math.html
index 5b9fc93..7276244 100644
--- a/docs/module-Math.html
+++ b/docs/module-Math.html
@@ -523,13 +523,13 @@ Returns:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/module-Matrixes.Matrix.html b/docs/module-Matrixes.Matrix.html
index d65925e..9456c78 100644
--- a/docs/module-Matrixes.Matrix.html
+++ b/docs/module-Matrixes.Matrix.html
@@ -245,7 +245,7 @@ Parameters:
Source:
@@ -380,7 +380,7 @@ Parameters:
Source:
@@ -659,6 +659,164 @@ Parameters:
+
+
+
+
+ projection(width, height)
+
+
+
+
+
+
+
+ Sets this matrxi to projection matrix without perscpective.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ width
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ height
+
+
+
+
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -764,7 +922,7 @@ Parameters:
Source:
@@ -899,7 +1057,7 @@ Parameters:
Source:
@@ -1034,7 +1192,7 @@ Parameters:
Source:
@@ -1215,7 +1373,7 @@ Parameters:
Source:
@@ -1396,7 +1554,7 @@ Parameters:
Source:
@@ -1577,7 +1735,7 @@ Parameters:
Source:
@@ -1621,13 +1779,13 @@ Parameters:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/module-Matrixes.html b/docs/module-Matrixes.html
index 7dc8563..9f82211 100644
--- a/docs/module-Matrixes.html
+++ b/docs/module-Matrixes.html
@@ -172,7 +172,7 @@ Parameters:
Source:
@@ -352,7 +352,7 @@ Parameters:
Source:
@@ -505,7 +505,7 @@ Parameters:
Source:
@@ -658,7 +658,7 @@ Parameters:
Source:
@@ -811,7 +811,7 @@ Parameters:
Source:
@@ -1010,7 +1010,7 @@ Parameters:
Source:
@@ -1209,7 +1209,7 @@ Parameters:
Source:
@@ -1313,7 +1313,7 @@ (static) unitSource:
@@ -1485,7 +1485,7 @@ Parameters:
Source:
@@ -1551,13 +1551,13 @@ Returns:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/module-Vectors.html b/docs/module-Vectors.html
index aa48bd6..c4464d8 100644
--- a/docs/module-Vectors.html
+++ b/docs/module-Vectors.html
@@ -210,13 +210,13 @@ Returns:
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/objects_Cube.js.html b/docs/objects_Cube.js.html
index 8fd5de2..5ffdb39 100644
--- a/docs/objects_Cube.js.html
+++ b/docs/objects_Cube.js.html
@@ -37,6 +37,9 @@ Source: objects/Cube.js
*/
export class Cube {
constructor (engine) {
+
+ this.engine = engine
+
/**
* Faces of cube
* @private
@@ -65,6 +68,12 @@ Source: objects/Cube.js
*/
this.rotation = [0, 0, 0]
+ /**
+ * @type {boolean}
+ * @readonly
+ */
+ this.UIElement = false
+
this.faces[0].rotate(0, 0, 0)
this.faces[0].setRotationPoint(-100, -100, 100)
this.faces[0].setPosition(0, 0, 0)
@@ -171,13 +180,23 @@ Source: objects/Cube.js
* @public
*/
setPosition(x, y, z) {
- this.position = [x, y, z]
- this.faces[0].setPosition(x, y, z)
- this.faces[1].setPosition(x, y, z)
- this.faces[2].setPosition(x, y, z)
- this.faces[3].setPosition(x, y, z)
- this.faces[4].setPosition(x, y, z)
- this.faces[5].setPosition(x, y, z)
+ if (!this.UIElement) {
+ this.position = [x, y, z]
+ this.faces[0].setPosition(x, y, z)
+ this.faces[1].setPosition(x, y, z)
+ this.faces[2].setPosition(x, y, z)
+ this.faces[3].setPosition(x, y, z)
+ this.faces[4].setPosition(x, y, z)
+ this.faces[5].setPosition(x, y, z)
+ } else {
+ this.faces[0].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.faces[1].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.faces[2].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.faces[3].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.faces[4].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.faces[5].setPosition(this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z)
+ this.position = [this.engine.width / 2 * x / 100, this.engine.height / 2 * y / 100, z]
+ }
}
/**
@@ -199,6 +218,16 @@ Source: objects/Cube.js
})
}
+ /**
+ * Setting scaling for cube in percent
+ * @param {Number} x scaling in percent
+ * @param {Number} y scaling in percent
+ * @param {Number} z scaling in percent
+ */
+ scale (x, y, z) {
+ this.setSize(this.width * x, this.height * y, this.depth * z)
+ }
+
/**
* Set rotation for x, y, z axis.
* @param {*} x in degrees.
@@ -241,6 +270,21 @@ Source: objects/Cube.js
removeAnimation () {
clearInterval(this._animationInterval)
}
+
+ /**
+ * Sets whether the all polygons will be attached to the camera like UI element.
+ * @deprecated
+ * @param {bolean} bool
+ */
+ setAsUIElement (bool) {
+ this.UIElement = bool
+ this.faces[0].setAsUIElement(bool)
+ this.faces[1].setAsUIElement(bool)
+ this.faces[2].setAsUIElement(bool)
+ this.faces[3].setAsUIElement(bool)
+ this.faces[4].setAsUIElement(bool)
+ this.faces[5].setAsUIElement(bool)
+ }
}
@@ -252,13 +296,13 @@ Source: objects/Cube.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/objects_Object.js.html b/docs/objects_Object.js.html
index bb1da23..f384d35 100644
--- a/docs/objects_Object.js.html
+++ b/docs/objects_Object.js.html
@@ -27,6 +27,7 @@ Source: objects/Object.js
import * as Matrixes from "../math/Matrixes"
+import * as Math from '../math/Math'
/**
* Creates and bind to engine object. The object must be loaded from .obj file.
@@ -174,9 +175,15 @@ Source: objects/Object.js
* @public
*/
setPosition (x, y, z) {
- this.position[0] = x
- this.position[1] = y
- this.position[2] = z
+ if (!this.UIElement) {
+ this.position[0] = x
+ this.position[1] = y
+ this.position[2] = z
+ } else {
+ this.position[0] = this.engine.width / 2 * x / 100
+ this.position[1] = this.engine.height / 2 * y / 100
+ this.position[2] = z
+ }
}
/**
@@ -228,9 +235,9 @@ Source: objects/Object.js
* @public
*/
setRotation (x, y, z) {
- this.rotation[0] = x
- this.rotation[1] = y
- this.rotation[2] = z
+ this.rotation[0] = Math.degToRad(x)
+ this.rotation[1] = Math.degToRad(y)
+ this.rotation[2] = Math.degToRad(z)
}
/**
@@ -442,13 +449,13 @@ Source: objects/Object.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/objects_Polygon.js.html b/docs/objects_Polygon.js.html
index c2f3a87..cce6652 100644
--- a/docs/objects_Polygon.js.html
+++ b/docs/objects_Polygon.js.html
@@ -55,38 +55,45 @@ Source: objects/Polygon.js
/**
* Polygon position.
- * @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @public
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.position = [0, 0, 0]
/**
* Polygon rotation.
- * @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @public
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.rotation = [0, 0, 0]
/**
- * Polygon rotation point.
+ * Polygon scaling.
* @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
+ */
+ this.scaling = [1, 1, 1]
+
+ /**
+ * Polygon rotation point.
+ * @public
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.rotationPoint = [0, 0, 0]
/**
* Polygon parent rotation.
- * @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @public
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.parentRotation = [0, 0, 0]
/**
* Polygon normals.
- * @readonly
- * @type {Array.<{0: Number, 1: Number, 2: Number,
+ * @public
+ * @type {Array.{0: Number, 1: Number, 2: Number,
* 3: Number, 4: Number, 5: Number,
- * 6: Number, 7: Number, 8: Number,}>} matrix 9
+ * 6: Number, 7: Number, 8: Number,}} matrix 9
*/
this.normals = [
0, 1, 0,
@@ -99,6 +106,13 @@ Source: objects/Polygon.js
* @private
*/
this._vertexesBuffer = null
+
+ /**
+ * Sets whether the object will be attached to the camera like UI element.
+ * @type {boolean}
+ * @public
+ */
+ this.UIElement = false
}
/**
@@ -148,6 +162,20 @@ Source: objects/Polygon.js
this.position[2] = z
}
+ /**
+ * Scaling polygon for x,y,z percent.
+ *
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Number} z
+ * @public
+ */
+ scale (x, y, z) {
+ this.scaling[0] = x
+ this.scaling[1] = y
+ this.scaling[2] = z
+ }
+
/**
* Add rotation for x, y, z axis for current rotation.
* @param {Number} x
@@ -225,13 +253,13 @@ Source: objects/Polygon.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/objects_Rect.js.html b/docs/objects_Rect.js.html
index 10cb258..7299433 100644
--- a/docs/objects_Rect.js.html
+++ b/docs/objects_Rect.js.html
@@ -44,21 +44,21 @@ Source: objects/Rect.js
/**
* Rect polygons.
* @private
- * @type {Array.<{0: Polygon, 1: Polygon}>} vector 3
+ * @type {Array.{0: Polygon, 1: Polygon}} vector 3
*/
this.polygons = new Array(2)
/**
* Rect position.
* @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.position = [0, 0, 0]
/**
* Rect rotation point.
* @readonly
- * @type {Array.<{x: Number, y: Number, z: Number}>} vector 3
+ * @type {Array.{0: Number, 1: Number, 2: Number}} vector 3
*/
this.rotationPoint = [0, 0, 0]
@@ -138,11 +138,23 @@ Source: objects/Rect.js
this.polygons[1].setPosition(x, y, z)
}
+ /**
+ * Change scaling of all polygons in rect.
+ * @param {Number} x
+ * @param {Number} y
+ * @param {Number} z
+ * @public
+ */
+ scale(x, y, z) {
+ this.polygons[0].scale(x, y, z)
+ this.polygons[1].scale(x, y, z)
+ }
+
/**
* Set rotation for x, y, z axis.
- * @param {*} x in deg.
- * @param {*} y in deg.
- * @param {*} z in deg.
+ * @param {Number} x in deg.
+ * @param {Number} y in deg.
+ * @param {Number} z in deg.
* @public
*/
rotate(x, y, z) {
@@ -186,6 +198,15 @@ Source: objects/Rect.js
this.polygons[0].setNormals(normals)
this.polygons[1].setNormals(normals)
}
+
+ /**
+ * Sets whether the all polygons will be attached to the camera like UI element.
+ * @param {bolean} bool
+ */
+ setAsUIElement (bool) {
+ this.polygons[0].UIElement = bool
+ this.polygons[1].UIElement = bool
+ }
}
@@ -197,13 +218,13 @@ Source: objects/Rect.js
- Modules Classes Global
+ Modules Classes Global
- Documentation generated by JSDoc 3.5.5 on Sun Mar 10 2019 14:24:57 GMT+0200 (Eastern European Standard Time)
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
diff --git a/docs/ui_UI.js.html b/docs/ui_UI.js.html
new file mode 100644
index 0000000..a78be4b
--- /dev/null
+++ b/docs/ui_UI.js.html
@@ -0,0 +1,123 @@
+
+
+
+
+ JSDoc: Source: ui/UI.js
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: ui/UI.js
+
+
+
+
+
+
+
+
+ /**
+ * @class
+ * @constructor
+ * @param {Engine} e
+ */
+export class UI {
+ constructor (engine) {
+ this.canvas = document.createElement('canvas')
+ this.canvas.width = engine.div.width
+ this.canvas.height = engine.div.height
+ this.canvas.style = 'position: absolute; height: 100%; width: 100%; z-index: 999999; left: 0; right: 0; top: 0;'
+
+ this.div = document.createElement('div')
+ this.div.style = 'position: absolute; height: 100%; width: 100%; z-index: 999999; left: 0; right: 0; top: 0;'
+
+ engine.div.appendChild(this.canvas)
+ engine.div.appendChild(this.div)
+
+ /**
+ * 2D context for UI drawing.
+ * @type {CanvasRenderingContext2D}
+ */
+ this.context = this.canvas.getContext('2d')
+
+ /**
+ * There are objects which object needs to draw.
+ * @type {Objects[]}
+ */
+ this.elements = []
+
+ engine.ui = this
+ }
+
+ /**
+ * Adds object to draw.
+ * @param {Object} element some UI element.
+ */
+ addElement (element) {
+ this.elements.push(element)
+ }
+
+ /**
+ * Removes element from drawing function.
+ * @param {Object} element
+ */
+ removeElement (element) {
+ let index = this.elements.indexOf(element)
+ this.elements.removeAt(index)
+ }
+
+ /**
+ * Adding DOM element upper game engine canvas.
+ * @param {HTMLElement} element
+ */
+ appendDOMElement (element, properties) {
+ let style = ''
+ for (let property in properties) {
+ style += property + ': ' + properties[property] + ';'
+ }
+ element.style = style
+ this.div.appendChild(element)
+ }
+
+ /**
+ * This function draws all elements.
+ * @private
+ */
+ _draw () {
+ this.elements.forEach(element => {
+ element.draw()
+ })
+ }
+}
+
+
+
+
+
+
+
+
+
+ Modules Classes Global
+
+
+
+
+
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
+
+
+
+
+
+
diff --git a/docs/ui_elements_Picture.js.html b/docs/ui_elements_Picture.js.html
new file mode 100644
index 0000000..9355092
--- /dev/null
+++ b/docs/ui_elements_Picture.js.html
@@ -0,0 +1,111 @@
+
+
+
+
+ JSDoc: Source: ui/elements/Picture.js
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: ui/elements/Picture.js
+
+
+
+
+
+
+
+
+ /**
+ * @class
+ * @constructor
+ */
+export class Picture extends Image {
+ constructor () {
+ super()
+ /**
+ * @type {boolean}
+ * @readonly
+ */
+ this.loaded = false
+
+ /**
+ * @type {Object}
+ * @property {Number} position.x
+ * @property {Number} position.y
+ */
+ this.position = {
+ x: 0,
+ y: 0
+ }
+
+ /**
+ * @type {Object}
+ * @property {Number} size.width
+ * @property {Number} size.height
+ */
+ this.size = {
+ width: 0,
+ height: 0
+ }
+ }
+
+ /**
+ * Load image from path
+ * @param {String} path
+ * @param {Number} width
+ * @param {Number} height
+ */
+ load (path, width, height) {
+ this.src = path
+ if (width != null && height != null) {
+ this.width = width
+ this.height = height
+ }
+ this.addEventListener('load', () => {
+ this.loaded = true
+ })
+ }
+
+ /**
+ * Creates Picture from Image object.
+ * @param {Image} image
+ */
+ fromImage (image) {
+ this.load(image.src, image.width, image.height)
+ }
+
+
+}
+
+
+
+
+
+
+
+
+
+ Modules Classes Global
+
+
+
+
+
+ Documentation generated by JSDoc 3.5.5 on Fri Mar 15 2019 21:55:16 GMT+0200 (Eastern European Standard Time)
+
+
+
+
+
+