Skip to content

Commit

Permalink
update engine
Browse files Browse the repository at this point in the history
  • Loading branch information
luizbills committed May 8, 2024
1 parent 9cf4bdb commit a2cccec
Show file tree
Hide file tree
Showing 8 changed files with 976 additions and 38 deletions.
15 changes: 9 additions & 6 deletions package-lock.json

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

21 changes: 6 additions & 15 deletions public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,11 @@ <h2><a id="globals">Variables</a></h2>

<h2><a id="plugin-api">Plugin API</a></h2>

<pre><code class="language-typescript">// create or update variables
<pre><code class="language-typescript">// loads a plugin
// see: https://github.com/litecanvas/game-engine/blob/main/samples/plugin-basics/plugin-basics.js
use(callback): object|void

// create or update variables
setvar(name: string, value: any): void

// get the color value
Expand All @@ -514,20 +518,7 @@ <h2><a id="advanced">Advanced Features</a></h2>

<pre><code class="language-typescript">// the plugin "Asset Loader" is automatically loaded into the playground
// see: https://github.com/litecanvas/plugin-asset-loader

// Asynchronously load an image
loadImage(url: string, callback: function): void

// Asynchronously load an external JavaScript file
loadScript(url: string, callback: function): void

// Asynchronously load a font
loadFont(fontName:string, url: string, callback: function): void

// a special variable that indicates if are loading or not
// if equal to 0 then are not loading any asset
// note: put `if (LOADING > 0) return` in your `update()` and `draw()`
LOADING: number</code></pre>
</code></pre>
</main>
<script src="prism/prism.js" defer></script>
<script src="prism/prism-typescript.js" defer></script>
Expand Down
13 changes: 8 additions & 5 deletions public/app.js

Large diffs are not rendered by default.

944 changes: 941 additions & 3 deletions public/litecanvas.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/sw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const cacheName = "luizbills.litecanvas-editor-v1";
const version = "1.43.0";
const version = "1.44.0";

const precacheResources = [
"/",
Expand Down
8 changes: 4 additions & 4 deletions src/completions.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ export default function customCompletions(context) {
info: "Check collision between 2 circles",
},
{
label: "plugin",
label: "use",
type: "function",
apply: "plugin(",
detail: "(callback|object)",
info: "Load a plugin to extend the litecanvas engine",
apply: "use(",
detail: "(callback)",
info: "Loads a plugin to extend the litecanvas engine",
},
{
label: "setvar",
Expand Down
5 changes: 4 additions & 1 deletion src/demo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export default () =>
`litecanvas()
`// Welcome to litecanvas playground!
// Learn more tapping on the question mark above
// or join our discord community: https://discord.com/invite/r2c3rGsvH3
litecanvas()
function init () {
color = 0
Expand Down
6 changes: 3 additions & 3 deletions src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export default function template(library, game) {
<script>
((lc) => {
window.litecanvas = (config = {}) => {
config.plugins = config.plugins || [];
config.plugins.push(pluginAssetLoader);
return lc(config);
let instance = lc(config);
instance.use(pluginAssetLoader)
return instance;
};
})(window.litecanvas);
</script>
Expand Down

0 comments on commit a2cccec

Please sign in to comment.