Skip to content

Commit

Permalink
Merge 412a7c4 into d891a0e
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Feb 22, 2019
2 parents d891a0e + 412a7c4 commit 8b2142b
Show file tree
Hide file tree
Showing 23 changed files with 1,635 additions and 136 deletions.
2 changes: 1 addition & 1 deletion dist/core.js

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

2 changes: 1 addition & 1 deletion dist/gameLoop.js

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

1 change: 1 addition & 0 deletions dist/plugin.js

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

2 changes: 1 addition & 1 deletion dist/sprite.js

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

20 changes: 20 additions & 0 deletions docs/api/gameLoop.html
Expand Up @@ -69,6 +69,12 @@ <h1>Kontra&#8203;.gameLoop(&#8203;properties)</h1>
<h2 id="toc"><a href="#toc" class="section-link">Table of Contents<span aria-hidden="true">#</span></a></h2>

<ul aria-labeledby="toc">
<li>
<ul>
<li><a href="#lifecycle">Lifecycle Events</a></li></li>
</ul>
</li>

<li>
<h3 id="properties">Properties</h3>
<ul aria-labeledby="properties">
Expand All @@ -92,6 +98,20 @@ <h3 id="methods">Methods</h3>



<section>
<h2 id="lifecycle"><a href="#lifecycle" class="section-link">Lifecycle Events<span aria-hidden="true">#</span></a></h2>

<p>Every frame it will emit a <code>tick</code> event.</p>

<pre><code class="language-javascript">kontra.on('tick', () => {
// run code every frame
});</code></pre>
</section>





<section>
<h2 id="isStopped"><a href="#isStopped" class="section-link">kontra.gameLoop&#8203;.isStopped<span aria-hidden="true">#</span></a></h2>

Expand Down
77 changes: 77 additions & 0 deletions docs/api/kontra.html
Expand Up @@ -36,13 +36,20 @@ <h1>Kontra</h1>
<h2 id="toc"><a href="#toc" class="section-link">Table of Contents<span aria-hidden="true">#</span></a></h2>

<ul aria-labeledby="toc">
<li>
<ul>
<li><a href="#lifecycle">Lifecycle Events</a></li></li>
</ul>
</li>

<li>
<h3 id="properties">Properties</h3>
<ul aria-labeledby="properties">
<li><a href="#canvas">kontra&#8203;.canvas</a></li>
<li><a href="#context">kontra&#8203;.context</a></li>
<li><a href="assets">kontra&#8203;.assets</a></li>
<li><a href="keyboard">kontra&#8203;.keys</a></li>
<li><a href="plugin">kontra&#8203;.plugin</a></li>
<li><a href="pointer">kontra&#8203;.pointer</a></li>
<li><a href="store">kontra&#8203;.store</a></li>
</ul>
Expand All @@ -51,7 +58,10 @@ <h3 id="properties">Properties</h3>
<li>
<h3 id="methods">Methods</h3>
<ul aria-labeledby="methods">
<li><a href="#emit">kontra&#8203;.emit(event[, ...args])</a></li>
<li><a href="#init">kontra&#8203;.init([canvas])</a></li>
<li><a href="#off">kontra&#8203;.off(event, callback)</a></li>
<li><a href="#on">kontra&#8203;.on(event, callback)</a></li>
<li><a href="animation">kontra&#8203;.animation(properties)</a></li>
<li><a href="gameLoop">kontra&#8203;.gameLoop(properties)</a></li>
<li><a href="pool">kontra&#8203;.pool(properties)</a></li>
Expand All @@ -69,6 +79,20 @@ <h3 id="methods">Methods</h3>



<section>
<h2 id="lifecycle"><a href="#lifecycle" class="section-link">Lifecycle Events<span aria-hidden="true">#</span></a></h2>

<p>When Kontra is initialized, it will emit an <code>init</code> event.</p>

<pre><code class="language-javascript">kontra.on('init', (canvas) => {
// run code when Kontra is initialized
});</code></pre>
</section>





<section>
<h2 id="canvas"><a href="#canvas" class="section-link">kontra.canvas<span aria-hidden="true">#</span></a></h2>

Expand All @@ -91,6 +115,24 @@ <h2 id="context"><a href="#context" class="section-link">kontra.context<span ari



<section>
<h2 id="emit"><a href="#emit" class="section-link">kontra&#8203;.emit(event[, ...args])<span aria-hidden="true">#</span></a></h2>

<dl>
<dt><strong>event</strong> <em>{string}</em></dt>
<dd>The name of the event to emit.</dd>
<dt><strong>args</strong> <em>{...*}</em></dt>
<dd>Arguments passed to all callbacks.</dd>
</dl>

<p>Emit an event and run all its callbacks, passing it any arguments.</p>

</section>





<section>
<h2 id="init"><a href="#init" class="section-link">kontra.init([canvas])<span aria-hidden="true">#</span></a></h2>

Expand All @@ -103,6 +145,41 @@ <h2 id="init"><a href="#init" class="section-link">kontra.init([canvas])<span ar

</section>





<section>
<h2 id="off"><a href="#off" class="section-link">kontra&#8203;.off(event, callback)<span aria-hidden="true">#</span></a></h2>

<dl>
<dt><strong>event</strong> <em>{string}</em></dt>
<dd>The name of the event to emit.</dd>
<dt><strong>callback</strong> <em>{function}</em></dt>
<dd>Function callback.</dd>
</dl>

<p>Remove the callback from the event so it will no longer be run when the event is emitted.</p>

</section>





<section>
<h2 id="on"><a href="#on" class="section-link">kontra&#8203;.on(event, callback)<span aria-hidden="true">#</span></a></h2>

<dl>
<dt><strong>event</strong> <em>{string}</em></dt>
<dd>The name of the event to emit.</dd>
<dt><strong>callback</strong> <em>{function}</em></dt>
<dd>Function callback.</dd>
</dl>

<p>Add the callback to the event so it will run when the event is emitted.</p>

</section>
</div>
</main>
</div>
Expand Down

0 comments on commit 8b2142b

Please sign in to comment.