Skip to content

Commit

Permalink
move builds to dist folder 1.9.2
Browse files Browse the repository at this point in the history
also rework examples to be more like starter
  • Loading branch information
KilledByAPixel committed Jul 26, 2024
1 parent 71436ed commit 3b6455d
Show file tree
Hide file tree
Showing 47 changed files with 358 additions and 331 deletions.
14 changes: 7 additions & 7 deletions build/littlejs.d.ts → dist/littlejs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ declare module "littlejs.esm" {
* let a = new Color; // white
* let b = new Color(1, 0, 0); // red
* let c = new Color(0, 0, 0, 0); // transparent black
* let d = RGB(0, 0, 1); // blue using rgb color
* let e = HSL(.3, 1, .5); // green using hsl color
* let d = rgb(0, 0, 1); // blue using rgb color
* let e = hsl(.3, 1, .5); // green using hsl color
*/
export class Color {
/** Create a color with the rgba components passed in, white by default
Expand Down Expand Up @@ -1847,12 +1847,12 @@ declare module "littlejs.esm" {
* @example
* // create a particle emitter
* let pos = vec2(2,3);
* let particleEmiter = new ParticleEmitter
* let particleEmitter = new ParticleEmitter
* (
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
Expand Down
28 changes: 13 additions & 15 deletions build/littlejs.esm.js → dist/littlejs.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ let debugPrimitives = [], debugPhysics = false, debugRaycast = false, debugParti
* @memberof Debug */
function ASSERT(assert, output)
{
if (!enableAsserts)
return;

output ? console.assert(assert, output) : console.assert(assert);
if (enableAsserts)
output ? console.assert(assert, output) : console.assert(assert);
}

/** Draw a debug rectangle in world space
Expand Down Expand Up @@ -943,8 +941,8 @@ function isColor(c) { return c instanceof Color; }
* let a = new Color; // white
* let b = new Color(1, 0, 0); // red
* let c = new Color(0, 0, 0, 0); // transparent black
* let d = RGB(0, 0, 1); // blue using rgb color
* let e = HSL(.3, 1, .5); // green using hsl color
* let d = rgb(0, 0, 1); // blue using rgb color
* let e = hsl(.3, 1, .5); // green using hsl color
*/
class Color
{
Expand Down Expand Up @@ -3699,7 +3697,7 @@ class TileLayerData
* @param {Number} [direction] - Integer direction of tile, in 90 degree increments
* @param {Boolean} [mirror] - If the tile should be mirrored along the x axis
* @param {Color} [color] - Color of the tile */
constructor(tile, direction=0, mirror=false, color=new Color())
constructor(tile, direction=0, mirror=false, color=new Color)
{
/** @property {Number} - The tile to use, untextured if undefined */
this.tile = tile;
Expand Down Expand Up @@ -3939,12 +3937,12 @@ class TileLayer extends EngineObject
* @example
* // create a particle emitter
* let pos = vec2(2,3);
* let particleEmiter = new ParticleEmitter
* let particleEmitter = new ParticleEmitter
* (
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
Expand Down Expand Up @@ -4351,8 +4349,8 @@ class Medal
// draw containing rect and clip to that region
context.save();
context.beginPath();
context.fillStyle = rgb(.9,.9,.9).toString();
context.strokeStyle = rgb(0,0,0).toString();
context.fillStyle = new Color(.9,.9,.9).toString();
context.strokeStyle = new Color(0,0,0).toString();
context.lineWidth = 3;
context.rect(x, y, width, medalDisplaySize.y);
context.fill();
Expand Down Expand Up @@ -4984,7 +4982,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.9.1';
const engineVersion = '1.9.2';

/** Frames per second to update objects
* @type {Number}
Expand Down
2 changes: 1 addition & 1 deletion build/littlejs.esm.min.js → dist/littlejs.esm.min.js

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions build/littlejs.js → dist/littlejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ let debugPrimitives = [], debugPhysics = false, debugRaycast = false, debugParti
* @memberof Debug */
function ASSERT(assert, output)
{
if (!enableAsserts)
return;

output ? console.assert(assert, output) : console.assert(assert);
if (enableAsserts)
output ? console.assert(assert, output) : console.assert(assert);
}

/** Draw a debug rectangle in world space
Expand Down Expand Up @@ -943,8 +941,8 @@ function isColor(c) { return c instanceof Color; }
* let a = new Color; // white
* let b = new Color(1, 0, 0); // red
* let c = new Color(0, 0, 0, 0); // transparent black
* let d = RGB(0, 0, 1); // blue using rgb color
* let e = HSL(.3, 1, .5); // green using hsl color
* let d = rgb(0, 0, 1); // blue using rgb color
* let e = hsl(.3, 1, .5); // green using hsl color
*/
class Color
{
Expand Down Expand Up @@ -3699,7 +3697,7 @@ class TileLayerData
* @param {Number} [direction] - Integer direction of tile, in 90 degree increments
* @param {Boolean} [mirror] - If the tile should be mirrored along the x axis
* @param {Color} [color] - Color of the tile */
constructor(tile, direction=0, mirror=false, color=new Color())
constructor(tile, direction=0, mirror=false, color=new Color)
{
/** @property {Number} - The tile to use, untextured if undefined */
this.tile = tile;
Expand Down Expand Up @@ -3939,12 +3937,12 @@ class TileLayer extends EngineObject
* @example
* // create a particle emitter
* let pos = vec2(2,3);
* let particleEmiter = new ParticleEmitter
* let particleEmitter = new ParticleEmitter
* (
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
Expand Down Expand Up @@ -4351,8 +4349,8 @@ class Medal
// draw containing rect and clip to that region
context.save();
context.beginPath();
context.fillStyle = rgb(.9,.9,.9).toString();
context.strokeStyle = rgb(0,0,0).toString();
context.fillStyle = new Color(.9,.9,.9).toString();
context.strokeStyle = new Color(0,0,0).toString();
context.lineWidth = 3;
context.rect(x, y, width, medalDisplaySize.y);
context.fill();
Expand Down Expand Up @@ -4984,7 +4982,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.9.1';
const engineVersion = '1.9.2';

/** Frames per second to update objects
* @type {Number}
Expand Down
2 changes: 1 addition & 1 deletion build/littlejs.min.js → dist/littlejs.min.js

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions build/littlejs.release.js → dist/littlejs.release.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ function isColor(c) { return c instanceof Color; }
* let a = new Color; // white
* let b = new Color(1, 0, 0); // red
* let c = new Color(0, 0, 0, 0); // transparent black
* let d = RGB(0, 0, 1); // blue using rgb color
* let e = HSL(.3, 1, .5); // green using hsl color
* let d = rgb(0, 0, 1); // blue using rgb color
* let e = hsl(.3, 1, .5); // green using hsl color
*/
class Color
{
Expand Down Expand Up @@ -3315,7 +3315,7 @@ class TileLayerData
* @param {Number} [direction] - Integer direction of tile, in 90 degree increments
* @param {Boolean} [mirror] - If the tile should be mirrored along the x axis
* @param {Color} [color] - Color of the tile */
constructor(tile, direction=0, mirror=false, color=new Color())
constructor(tile, direction=0, mirror=false, color=new Color)
{
/** @property {Number} - The tile to use, untextured if undefined */
this.tile = tile;
Expand Down Expand Up @@ -3555,12 +3555,12 @@ class TileLayer extends EngineObject
* @example
* // create a particle emitter
* let pos = vec2(2,3);
* let particleEmiter = new ParticleEmitter
* let particleEmitter = new ParticleEmitter
* (
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* new Color(1,1,1), new Color(0,0,0), // colorStartA, colorStartB
* new Color(1,1,1,0), new Color(0,0,0,0), // colorEndA, colorEndB
* pos, 0, 1, 0, 500, PI, // pos, angle, emitSize, emitTime, emitRate, emiteCone
* tile(0, 16), // tileInfo
* rgb(1,1,1), rgb(0,0,0), // colorStartA, colorStartB
* rgb(1,1,1,0), rgb(0,0,0,0), // colorEndA, colorEndB
* 2, .2, .2, .1, .05, // particleTime, sizeStart, sizeEnd, particleSpeed, particleAngleSpeed
* .99, 1, 1, PI, .05, // damping, angleDamping, gravityScale, particleCone, fadeRate,
* .5, 1 // randomness, collide, additive, randomColorLinear, renderOrder
Expand Down Expand Up @@ -3967,8 +3967,8 @@ class Medal
// draw containing rect and clip to that region
context.save();
context.beginPath();
context.fillStyle = rgb(.9,.9,.9).toString();
context.strokeStyle = rgb(0,0,0).toString();
context.fillStyle = new Color(.9,.9,.9).toString();
context.strokeStyle = new Color(0,0,0).toString();
context.lineWidth = 3;
context.rect(x, y, width, medalDisplaySize.y);
context.fill();
Expand Down Expand Up @@ -4600,7 +4600,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.9.1';
const engineVersion = '1.9.2';

/** Frames per second to update objects
* @type {Number}
Expand Down
4 changes: 2 additions & 2 deletions examples/breakout/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function gameUpdatePost()
function gameRender()
{
// draw a the background
drawRect(cameraPos, levelSize.scale(2), new Color(.5,.5,.5));
drawRect(cameraPos, levelSize, new Color(.02,.02,.02));
drawRect(cameraPos, levelSize.scale(2), hsl(0,0,.5));
drawRect(cameraPos, levelSize, hsl(0,0,.02));
}

///////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions examples/breakout/gameObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Wall extends EngineObject

this.mass = 0; // make object have static physics
this.setCollision(); // make object collide
this.color = new Color(0,0,0,0); // make object invisible
this.color = hsl(0,0,0,0); // make object invisible
}
}

Expand Down Expand Up @@ -60,7 +60,7 @@ class Brick extends EngineObject

// make explosion effect
const color1 = this.color;
const color2 = color1.lerp(new Color, .5);
const color2 = color1.lerp(hsl(), .5);
new ParticleEmitter(
this.pos, 0, // pos, angle
this.size, .1, 200, PI, // emitSize, emitTime, emitRate, emiteCone
Expand All @@ -76,7 +76,7 @@ class Brick extends EngineObject
if (o.trailEffect)
{
o.trailEffect.colorStartA = this.color;
o.trailEffect.colorStartB = this.color.lerp(new Color, .5);
o.trailEffect.colorStartB = this.color.lerp(hsl(), .5);
}

return 1;
Expand Down
6 changes: 3 additions & 3 deletions examples/breakout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<link rel=icon type=image/png href=../favicon.png>
</head><body>

<script src=../../build/littlejs.js?1812></script>
<script src=gameObjects.js?1812></script>
<script src=game.js?1812></script>
<script src=../../dist/littlejs.js?192></script>
<script src=gameObjects.js?192></script>
<script src=game.js?192></script>
4 changes: 2 additions & 2 deletions examples/breakoutTutorial/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<link rel=icon type=image/png href=../favicon.png>
</head><body>

<script src=../../build/littlejs.js?1812></script>
<script src=game.js?1812></script>
<script src=../../dist/littlejs.js?192></script>
<script src=game.js?192></script>
2 changes: 1 addition & 1 deletion examples/electron/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const PROGRAM_NAME = 'game';
const BUILD_FOLDER = 'build';
const sourceFiles =
[
'../../build/littlejs.release.js',
'../../dist/littlejs.release.js',
'game.js',
// add your game's files here
];
Expand Down
Loading

0 comments on commit 3b6455d

Please sign in to comment.