Skip to content

Commit

Permalink
build 1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel committed Dec 13, 2024
1 parent c9dc8ac commit 6bf8834
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 30 deletions.
25 changes: 19 additions & 6 deletions dist/littlejs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1308,20 +1308,20 @@ declare module "littlejsengine" {
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
* @memberof Draw */
export function setBlendMode(additive?: boolean, useWebGL?: boolean, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
/** Draw text on overlay canvas in screen space
/** Draw text on main canvas in world space
* Automatically splits new lines into rows
* @param {String} text
* @param {Vector2} pos
* @param {Number} [size]
* @param {Color} [color=(1,1,1,1)]
* @param {Number} [lineWidth]
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
* @memberof Draw */
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, maxWidth?: number): void;
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
/** Draw text on overlay canvas in world space
* Automatically splits new lines into rows
* @param {String} text
Expand All @@ -1332,10 +1332,23 @@ declare module "littlejsengine" {
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @memberof Draw */
export function drawText(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, maxWidth?: number): void;
export function drawTextOverlay(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number): void;
/** Draw text on overlay canvas in screen space
* Automatically splits new lines into rows
* @param {String} text
* @param {Vector2} pos
* @param {Number} [size]
* @param {Color} [color=(1,1,1,1)]
* @param {Number} [lineWidth]
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign]
* @param {String} [font=fontDefault]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @memberof Draw */
export function drawTextScreen(text: string, pos: Vector2, size?: number, color?: Color, lineWidth?: number, lineColor?: Color, textAlign?: CanvasTextAlign, font?: string, maxWidth?: number, context?: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
export let engineFontImage: any;
/**
* Font Image Object - Draw text on a 2D canvas by using characters in an image
Expand Down
32 changes: 25 additions & 7 deletions dist/littlejs.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2759,6 +2759,24 @@ function setBlendMode(additive, useWebGL=glEnable, context)
}
}

/** Draw text on main canvas in world space
* Automatically splits new lines into rows
* @param {String} text
* @param {Vector2} pos
* @param {Number} [size]
* @param {Color} [color=(1,1,1,1)]
* @param {Number} [lineWidth]
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth, context=mainContext)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, maxWidth, context);
}

/** Draw text on overlay canvas in world space
* Automatically splits new lines into rows
* @param {String} text
Expand All @@ -2769,12 +2787,11 @@ function setBlendMode(additive, useWebGL=glEnable, context)
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, context, maxWidth)
function drawTextOverlay(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, context, maxWidth);
drawText(text, pos, size, color, lineWidth, lineColor, textAlign, font, maxWidth, overlayContext);
}

/** Draw text on overlay canvas in screen space
Expand All @@ -2787,10 +2804,10 @@ function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, f
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign]
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @memberof Draw */
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, context=overlayContext, maxWidth=undefined)
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, maxWidth=undefined, context=overlayContext)
{
context.fillStyle = color.toString();
context.lineWidth = lineWidth;
Expand Down Expand Up @@ -5277,7 +5294,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.10.8';
const engineVersion = '1.11.0';

/** Frames per second to update
* @type {Number}
Expand Down Expand Up @@ -6061,8 +6078,9 @@ export {
drawCircle,
drawCanvas2D,
setBlendMode,
drawTextScreen,
drawText,
drawTextOverlay,
drawTextScreen,
engineFontImage,
FontImage,
isFullscreen,
Expand Down
2 changes: 1 addition & 1 deletion dist/littlejs.esm.min.js

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions dist/littlejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2759,6 +2759,24 @@ function setBlendMode(additive, useWebGL=glEnable, context)
}
}

/** Draw text on main canvas in world space
* Automatically splits new lines into rows
* @param {String} text
* @param {Vector2} pos
* @param {Number} [size]
* @param {Color} [color=(1,1,1,1)]
* @param {Number} [lineWidth]
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth, context=mainContext)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, maxWidth, context);
}

/** Draw text on overlay canvas in world space
* Automatically splits new lines into rows
* @param {String} text
Expand All @@ -2769,12 +2787,11 @@ function setBlendMode(additive, useWebGL=glEnable, context)
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, context, maxWidth)
function drawTextOverlay(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, context, maxWidth);
drawText(text, pos, size, color, lineWidth, lineColor, textAlign, font, maxWidth, overlayContext);
}

/** Draw text on overlay canvas in screen space
Expand All @@ -2787,10 +2804,10 @@ function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, f
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign]
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @memberof Draw */
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, context=overlayContext, maxWidth=undefined)
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, maxWidth=undefined, context=overlayContext)
{
context.fillStyle = color.toString();
context.lineWidth = lineWidth;
Expand Down Expand Up @@ -5277,7 +5294,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.10.8';
const engineVersion = '1.11.0';

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

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions dist/littlejs.release.js
Original file line number Diff line number Diff line change
Expand Up @@ -2327,6 +2327,24 @@ function setBlendMode(additive, useWebGL=glEnable, context)
}
}

/** Draw text on main canvas in world space
* Automatically splits new lines into rows
* @param {String} text
* @param {Vector2} pos
* @param {Number} [size]
* @param {Color} [color=(1,1,1,1)]
* @param {Number} [lineWidth]
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=mainContext]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth, context=mainContext)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, maxWidth, context);
}

/** Draw text on overlay canvas in world space
* Automatically splits new lines into rows
* @param {String} text
Expand All @@ -2337,12 +2355,11 @@ function setBlendMode(additive, useWebGL=glEnable, context)
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign='center']
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @memberof Draw */
function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, context, maxWidth)
function drawTextOverlay(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, font, maxWidth)
{
drawTextScreen(text, worldToScreen(pos), size*cameraScale, color, lineWidth*cameraScale, lineColor, textAlign, font, context, maxWidth);
drawText(text, pos, size, color, lineWidth, lineColor, textAlign, font, maxWidth, overlayContext);
}

/** Draw text on overlay canvas in screen space
Expand All @@ -2355,10 +2372,10 @@ function drawText(text, pos, size=1, color, lineWidth=0, lineColor, textAlign, f
* @param {Color} [lineColor=(0,0,0,1)]
* @param {CanvasTextAlign} [textAlign]
* @param {String} [font=fontDefault]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @param {Number} [maxWidth]
* @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context=overlayContext]
* @memberof Draw */
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, context=overlayContext, maxWidth=undefined)
function drawTextScreen(text, pos, size=1, color=new Color, lineWidth=0, lineColor=new Color(0,0,0), textAlign='center', font=fontDefault, maxWidth=undefined, context=overlayContext)
{
context.fillStyle = color.toString();
context.lineWidth = lineWidth;
Expand Down Expand Up @@ -4845,7 +4862,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.10.8';
const engineVersion = '1.11.0';

/** Frames per second to update
* @type {Number}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "littlejsengine",
"version": "1.10.8",
"version": "1.11.0",
"description": "LittleJS - Tiny and Fast HTML5 Game Engine",
"main": "dist/littlejs.esm.js",
"types": "dist/littlejs.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const engineName = 'LittleJS';
* @type {String}
* @default
* @memberof Engine */
const engineVersion = '1.10.8';
const engineVersion = '1.11.0';

/** Frames per second to update
* @type {Number}
Expand Down

0 comments on commit 6bf8834

Please sign in to comment.