Using MATH_CONST properly to avoid entire library import. Swapping to removing all index.js listings to avoid globbing.

This commit is contained in:
Richard Davey 2017-09-13 17:09:16 +01:00
parent 10b08539a8
commit 56bc4d1547
6 changed files with 69 additions and 13 deletions

View file

@ -1,7 +1,7 @@
var Class = require('../utils/Class');
var CONST = require('../const');
var GetValue = require('../utils/object/GetValue');
var MATH = require('../math');
var MATH = require('../math/const');
var NOOP = require('../utils/NOOP');
var ValueToColor = require('../graphics/color/ValueToColor');

View file

@ -1,10 +1,15 @@
var RND = require('./random-data-generator/RandomDataGenerator');
var MATH_CONST = {
PI2: Math.PI * 2,
TAU: Math.PI * 0.5,
EPSILON: 1.0e-6,
DEG_TO_RAD: Math.PI / 180,
RAD_TO_DEG: 180 / Math.PI
RAD_TO_DEG: 180 / Math.PI,
// Random Data Generator
RND: new RND()
};

View file

@ -1,3 +1,4 @@
/*
var RND = require('./random-data-generator/RandomDataGenerator');
module.exports = {
@ -53,3 +54,48 @@ module.exports = {
Wrap: require('./Wrap')
};
*/
module.exports = {
// Collections of functions
Angle: require('./angle/'),
Distance: require('./distance/'),
Easing: require('./easing/'),
Fuzzy: require('./fuzzy/'),
Interpolation: require('./interpolation/'),
Pow2: require('./pow2/'),
Snap: require('./snap/'),
// Single functions
Average: require('./Average'),
Bernstein: require('./Bernstein'),
Between: require('./Between'),
CatmullRom: require('./CatmullRom'),
CeilTo: require('./CeilTo'),
Clamp: require('./Clamp'),
DegToRad: require('./DegToRad'),
Difference: require('./Difference'),
Factorial: require('./Factorial'),
FloatBetween: require('./FloatBetween'),
FloorTo: require('./FloorTo'),
GetSpeed: require('./GetSpeed'),
IsEven: require('./IsEven'),
IsEvenStrict: require('./IsEvenStrict'),
Linear: require('./Linear'),
MaxAdd: require('./MaxAdd'),
MinSub: require('./MinSub'),
Percent: require('./Percent'),
RadToDeg: require('./RadToDeg'),
Rotate: require('./Rotate'),
RotateAround: require('./RotateAround'),
RotateAroundDistance: require('./RotateAroundDistance'),
RoundAwayFromZero: require('./RoundAwayFromZero'),
RoundTo: require('./RoundTo'),
SinCosTableGenerator: require('./SinCosTableGenerator'),
SmootherStep: require('./SmootherStep'),
SmoothStep: require('./SmoothStep'),
Within: require('./Within'),
Wrap: require('./Wrap')
};

View file

@ -5,6 +5,14 @@ var Extend = require('./utils/object/Extend');
// This object is exported globally
/*
var Phaser = {
Game: require('./boot/Game')
};
*/
var Phaser = {
Actions: require('./actions/'),

View file

@ -1,4 +1,4 @@
var MATH = require('../../math');
var MATH = require('../../math/const');
var GetValue = require('./GetValue');
// Allowed types:

View file

@ -2,7 +2,7 @@
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
@ -23,10 +23,15 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
'CANVAS_RENDERER': JSON.stringify(true),
'WEBGL_RENDERER': JSON.stringify(true)
}),
new UglifyJSPlugin({
include: /\.min\.js$/,
parallel: true,
sourceMap: true,
sourceMap: false,
compress: true,
comments: false,
uglifyOptions: {
@ -43,12 +48,4 @@ module.exports = {
]
// new webpack.DefinePlugin({
// PRODUCTION: JSON.stringify(true),
// VERSION: JSON.stringify("5fa3b9"),
// BROWSER_SUPPORTS_HTML5: true,
// TWO: "1+1",
// "typeof window": JSON.stringify("object")
// })
};