Browse Source

Separate experiments folder, gulpfile fixes, and general repo clean-up

feature/coffeescript
Sven Slootweg 8 years ago
parent
commit
e7297ab811
  1. 6
      TODO.md
  2. 168
      docs/api/draw.html
  3. 94
      docs/api/draw.zpy
  4. 162
      docs/api/math.html
  5. 150
      docs/api/math.zpy
  6. 163
      docs/api/random.html
  7. 123
      docs/api/random.zpy
  8. 13
      easing.html
  9. BIN
      easing/assets/images/cursor.png
  10. 33
      easing/core.coffee
  11. 7
      easing/easing.css
  12. 7
      easing/easing.css.map
  13. 29
      easing/easing.js
  14. 9
      easing/easing.scss
  15. BIN
      experiments/assets/ball.png
  16. 8
      experiments/assets/style.css
  17. 7
      experiments/assets/style.css.map
  18. 10
      experiments/assets/style.scss
  19. 11
      experiments/drag.html
  20. 27
      experiments/drag.js
  21. 37
      experiments/drag/core.coffee
  22. 11
      experiments/easing.html
  23. 31
      experiments/easing.js
  24. 41
      experiments/easing/core.coffee
  25. 59
      gulpfile.js
  26. 1462
      lib/engine.js
  27. 78
      lib/soundmanager2.js
  28. BIN
      lib/soundmanager2.swf
  29. BIN
      lib/soundmanager2_debug.swf
  30. 4
      watch.sh

6
TODO.md

@ -8,6 +8,10 @@
* Make the first frame draw correctly, without requiring a `return true` from the onStep event.
## Build process
* Add build-games.sh functionality (ie. SVG-to-PNG export) to gulpfile.
## Ideas
None.
jQuery-like $ selector on scene objects (ie. @$) for selecting instances by name, coordinates, etc.

168
docs/api/draw.html

@ -1,168 +0,0 @@
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example
{
padding: 5px 6px;
font-weight: bold;
font-size: 15px;
background-color: #E6E6E6;
margin-top: 11px;
}
.example > .children
{
padding-top: 11px;
padding-left: 10px;
}
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>Engine.Draw</h1><div class="text">The Draw library provides functions to draw shapes, text, and sprites on a scene.</div><div class="toc"><h2>Table of contents</h2><ul><li><a href="#Engine_Draw_Linex1y1x2y2options">Engine.Draw.Line(x1, y1, x2, y2, options)</a> Draws a line. </li><li><a href="#Engine_Draw_Rectanglex1y1x2y2options">Engine.Draw.Rectangle(x1, y1, x2, y2, options)</a> Draws a rectangle. </li></ul></div><div class="definition"><a name="Engine_Draw_Linex1y1x2y2options">Engine.Draw.Line(<em>x1</em>, <em>y1</em>, <em>x2</em>, <em>y2</em>, <em>options</em>) <div class="children"><div class="text">Draws a line.</div><dl><dt>x1</dt><dd>The X coordinate of the starting position.<div class="children"></div></dd></dl><dl><dt>y1</dt><dd>The Y coordinate of the starting position.<div class="children"></div></dd></dl><dl><dt>x2</dt><dd>The X coordinate of the ending position.<div class="children"></div></dd></dl><dl><dt>y2</dt><dd>The Y coordinate of the ending position.<div class="children"></div></dd></dl><dl><dt>options</dt><dd><em>Optional.</em> Options for drawing the line.<div class="children"><dl><dt>width</dt><dd>Width of the line in pixels.<div class="children"></div></dd></dl><dl><dt>color</dt><dd>The line <a href="../drawing.html">color</a>.<div class="children"></div></dd></dl><dl><dt>cap</dt><dd>The type of <a href="../drawing.html">line cap</a>.<div class="children"></div></dd></dl><dl><dt>alpha</dt><dd>The alpha value of the line.<div class="children"></div></dd></dl></div></dd></dl><div class="example">Example: Draw a blue line <div class="children"><h7>Code:</h7><pre class="code">Engine.Draw.Line(10, 10, 120, 120, {
color: "blue"
});</pre></div></div></div></a></div><div class="definition"><a name="Engine_Draw_Rectanglex1y1x2y2options">Engine.Draw.Rectangle(<em>x1</em>, <em>y1</em>, <em>x2</em>, <em>y2</em>, <em>options</em>) <div class="children"><div class="text">Draws a rectangle.</div><dl><dt>x1</dt><dd>The X coordinate of the top left corner.<div class="children"></div></dd></dl><dl><dt>y1</dt><dd>The Y coordinate of the top left corner.<div class="children"></div></dd></dl><dl><dt>x2</dt><dd>The X coordinate of the right bottom corner.<div class="children"></div></dd></dl><dl><dt>y2</dt><dd>The Y coordinate of the right bottom corner.<div class="children"></div></dd></dl><dl><dt>options</dt><dd><em>Optional.</em> Options for drawing the rectangle.<div class="children"><dl><dt>width</dt><dd>Width of the outline in pixels.<div class="children"></div></dd></dl><dl><dt>linecolor</dt><dd>The <a href="../drawing.html">color</a> of the outline.<div class="children"></div></dd></dl><dl><dt>cap</dt><dd>The type <a href="../drawing.html">line cap</a> for the outline.<div class="children"></div></dd></dl><dl><dt>rx</dt><dd>The horizontal radius of the corners of the rectangle.<div class="children"></div></dd></dl><dl><dt>ry</dt><dd>The vertical radius of the corners of the rectangle.<div class="children"></div></dd></dl><dl><dt>radius</dt><dd>A short-hand option that sets both <span class="fixed">rx</span> and <span class="fixed">ry</span>.<div class="children"></div></dd></dl><dl><dt>color</dt><dd>The fill color of the rectangle.<div class="children"></div></dd></dl><dl><dt>alpha</dt><dd>The alpha value of the rectangle.<div class="children"></div></dd></dl></div></dd></dl><div class="example">Example: Draw a blue rectangle with a yellow outline, rounded borders and at 70% opacity <div class="children"><h7>Code:</h7><pre class="code">Engine.Draw.Rectangle(20, 30, 150, 180, {
linecolor: "yellow",
color: "blue",
radius: 8,
alpha: 0.7
});</pre></div></div></div></a></div></div>
</body>
</html>

94
docs/api/draw.zpy

@ -1,94 +0,0 @@
# Engine.Draw
The Draw library provides functions to draw shapes, text, and sprites on a scene.
{TOC}
^ Engine.Draw.Line(**x1**, **y1**, **x2**, **y2**, **options**)
Draws a line.
x1::
The X coordinate of the starting position.
y1::
The Y coordinate of the starting position.
x2::
The X coordinate of the ending position.
y2::
The Y coordinate of the ending position.
options::
**Optional.** Options for drawing the line.
width::
Width of the line in pixels.
color::
The line {>../drawing}(color).
cap::
The type of {>../drawing}(line cap).
alpha::
The alpha value of the line.
@ Draw a blue line
$ Engine.Draw.Line(10, 10, 120, 120, {
color: "blue"
});
^ Engine.Draw.Rectangle(**x1**, **y1**, **x2**, **y2**, **options**)
Draws a rectangle.
x1::
The X coordinate of the top left corner.
y1::
The Y coordinate of the top left corner.
x2::
The X coordinate of the right bottom corner.
y2::
The Y coordinate of the right bottom corner.
options::
**Optional.** Options for drawing the rectangle.
width::
Width of the outline in pixels.
linecolor::
The {>../drawing}(color) of the outline.
cap::
The type {>../drawing}(line cap) for the outline.
rx::
The horizontal radius of the corners of the rectangle.
ry::
The vertical radius of the corners of the rectangle.
radius::
A short-hand option that sets both `rx` and `ry`.
color::
The fill color of the rectangle.
alpha::
The alpha value of the rectangle.
@ Draw a blue rectangle with a yellow outline, rounded borders and at 70% opacity
$ Engine.Draw.Rectangle(20, 30, 150, 180, {
linecolor: "yellow",
color: "blue",
radius: 8,
alpha: 0.7
});

162
docs/api/math.html

@ -1,162 +0,0 @@
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example
{
padding: 5px 6px;
font-weight: bold;
font-size: 15px;
background-color: #E6E6E6;
margin-top: 11px;
}
.example > .children
{
padding-top: 11px;
padding-left: 10px;
}
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>Engine.Math</h1><div class="text">The Math library provides several functions to do mathematical operations or calculations. Most of these functions are simply aliases of the functions built into JavaScript.</div><div class="toc"><h2>Table of contents</h2><ul><li><a href="#Engine_Math_Absolutex">Engine.Math.Absolute(x)</a> Returns the absolute value of <span class="fixed">x</span>. <span class="alternatives">(also: Engine.Math.Abs(x))</span></li><li><a href="#Engine_Random_Sumitemitemitem">Engine.Random.Sum(item [, item [, item ...]])</a> Returns the sum of all supplied numbers. <span class="alternatives">(also: Engine.Random.Sum(itemarray))</span></li><li><a href="#Engine_Math_Roundx">Engine.Math.Round(x)</a> Rounds <span class="fixed">x</span> to the nearest integer. </li><li><a href="#Engine_Math_Ceilingx">Engine.Math.Ceiling(x)</a> Rounds up <span class="fixed">x</span>. <span class="alternatives">(also: Engine.Math.Ceil(x))</span></li><li><a href="#Engine_Math_Floorx">Engine.Math.Floor(x)</a> Rounds down <span class="fixed">x</span>. </li><li><a href="#Engine_Math_Tangentx">Engine.Math.Tangent(x)</a> Returns the tangent of angle <span class="fixed">x</span>. <span class="alternatives">(also: Engine.Math.Tan(x))</span></li><li><a href="#Engine_Math_Cosinex">Engine.Math.Cosine(x)</a> Returns the cosine of <span class="fixed">x</span>. <span class="alternatives">(also: Engine.Math.Cos(x))</span></li><li><a href="#Engine_Math_Sinex">Engine.Math.Sine(x)</a> Returns the sine of <span class="fixed">x</span>. <span class="alternatives">(also: Engine.Math.Sin(x))</span></li></ul></div><div class="definition"><a name="Engine_Math_Absolutex">Engine.Math.Absolute(<em>x</em>)<br>Engine.Math.Abs(<em>x</em>) <div class="children"><div class="text">Returns the absolute value of <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.abs function in JavaScript.</em></div><dl><dt>x</dt><dd>The number.<div class="children"></div></dd></dl><div class="example">Example: Get the absolute value of a positive number <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Absolute(16);</pre><h7>Output:</h7><pre class="output">16</pre></div></div><div class="example">Example: Get the absolute value of a negative number <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Absolute(-23);</pre><h7>Output:</h7><pre class="output">23</pre></div></div></div></a></div><div class="definition"><a name="Engine_Random_Sumitemitemitem">Engine.Random.Sum(<em>item</em> [, <em>item</em> [, <em>item</em> ...]])<br>Engine.Random.Sum(<em>itemarray</em>) <div class="children"><div class="text">Returns the sum of all supplied numbers.</div><dl><dt>item</dt><dd>An individual number. itemarray:: An array of numbers.<div class="children"></div></dd></dl><div class="example">Example: Sum several numbers using individual arguments <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Sum(42, 6, 17, 2, 7);</pre><h7>Output:</h7><pre class="output">74</pre></div></div><div class="example">Example: Sum several numbers using an array <div class="children"><h7>Code:</h7><pre class="code">var numbers = [42, 6, 17, 2, 7];
Engine.Math.Sum(numbers);</pre><h7>Output:</h7><pre class="output">74</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Roundx">Engine.Math.Round(<em>x</em>) <div class="children"><div class="text">Rounds <span class="fixed">x</span> to the nearest integer.</div><div class="text"><em>This is an alias of the standard Math.round function in JavaScript.</em></div><dl><dt>x</dt><dd>The value to round.<div class="children"></div></dd></dl><div class="example">Example: Rounding a number in the upper half <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Ceiling(82.62);</pre><h7>Output:</h7><pre class="output">83</pre></div></div><div class="example">Example: Rounding a number in the lower half <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Ceiling(82.13);</pre><h7>Output:</h7><pre class="output">82</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Ceilingx">Engine.Math.Ceiling(<em>x</em>)<br>Engine.Math.Ceil(<em>x</em>) <div class="children"><div class="text">Rounds up <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.ceil function in JavaScript.</em></div><dl><dt>x</dt><dd>The value to round up.<div class="children"></div></dd></dl><div class="example">Example: Rounding up a number <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Ceiling(614.2162);</pre><h7>Output:</h7><pre class="output">615</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Floorx">Engine.Math.Floor(<em>x</em>) <div class="children"><div class="text">Rounds down <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.floor function in JavaScript.</em></div><dl><dt>x</dt><dd>The value to round down.<div class="children"></div></dd></dl><div class="example">Example: Rounding down a number <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Floor(7.612);</pre><h7>Output:</h7><pre class="output">7</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Tangentx">Engine.Math.Tangent(<em>x</em>)<br>Engine.Math.Tan(<em>x</em>) <div class="children"><div class="text">Returns the tangent of angle <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.tan function in JavaScript.</em></div><dl><dt>x</dt><dd>The value.<div class="children"></div></dd></dl><div class="example">Example: Calculating the tangent <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Tangent(84.15);</pre><h7>Output:</h7><pre class="output">-0.7971515163204654</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Cosinex">Engine.Math.Cosine(<em>x</em>)<br>Engine.Math.Cos(<em>x</em>) <div class="children"><div class="text">Returns the cosine of <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.cos function in JavaScript.</em></div><dl><dt>x</dt><dd>The value (in radians).<div class="children"></div></dd></dl><div class="example">Example: Calculating the cosine <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Cosine(162.54);</pre><h7>Output:</h7><pre class="output">0.6801581420388815</pre></div></div></div></a></div><div class="definition"><a name="Engine_Math_Sinex">Engine.Math.Sine(<em>x</em>)<br>Engine.Math.Sin(<em>x</em>) <div class="children"><div class="text">Returns the sine of <span class="fixed">x</span>.</div><div class="text"><em>This is an alias of the standard Math.sin function in JavaScript.</em></div><dl><dt>x</dt><dd>The value (in radians).<div class="children"></div></dd></dl><div class="example">Example: Calculating the sine <div class="children"><h7>Code:</h7><pre class="code">Engine.Math.Sine(62.4);</pre><h7>Output:</h7><pre class="output">-0.41855446451842543</pre></div></div></div></a></div></div>
</body>
</html>

150
docs/api/math.zpy

@ -1,150 +0,0 @@
# Engine.Math
The Math library provides several functions to do mathematical operations or calculations. Most of these functions are simply aliases of the functions built into JavaScript.
{TOC}
^ Engine.Math.Absolute(**x**)
Engine.Math.Abs(**x**)
Returns the absolute value of `x`.
**This is an alias of the standard Math.abs function in JavaScript.**
x::
The number.
@ Get the absolute value of a positive number
$ Engine.Math.Absolute(16);
> 16
@ Get the absolute value of a negative number
$ Engine.Math.Absolute(-23);
> 23
^ Engine.Random.Sum(**item** [, **item** [, **item** ...]])
Engine.Random.Sum(**itemarray**)
Returns the sum of all supplied numbers.
item::
An individual number.
itemarray::
An array of numbers.
@ Sum several numbers using individual arguments
$ Engine.Math.Sum(42, 6, 17, 2, 7);
> 74
@ Sum several numbers using an array
$ var numbers = [42, 6, 17, 2, 7];
Engine.Math.Sum(numbers);
> 74
^ Engine.Math.Round(**x**)
Rounds `x` to the nearest integer.
**This is an alias of the standard Math.round function in JavaScript.**
x::
The value to round.
@ Rounding a number in the upper half
$ Engine.Math.Ceiling(82.62);
> 83
@ Rounding a number in the lower half
$ Engine.Math.Ceiling(82.13);
> 82
^ Engine.Math.Ceiling(**x**)
Engine.Math.Ceil(**x**)
Rounds up `x`.
**This is an alias of the standard Math.ceil function in JavaScript.**
x::
The value to round up.
@ Rounding up a number
$ Engine.Math.Ceiling(614.2162);
> 615
^ Engine.Math.Floor(**x**)
Rounds down `x`.
**This is an alias of the standard Math.floor function in JavaScript.**
x::
The value to round down.
@ Rounding down a number
$ Engine.Math.Floor(7.612);
> 7
^ Engine.Math.Tangent(**x**)
Engine.Math.Tan(**x**)
Returns the tangent of angle `x`.
**This is an alias of the standard Math.tan function in JavaScript.**
x::
The value.
@ Calculating the tangent
$ Engine.Math.Tangent(84.15);
> -0.7971515163204654
^ Engine.Math.Cosine(**x**)
Engine.Math.Cos(**x**)
Returns the cosine of `x`.
**This is an alias of the standard Math.cos function in JavaScript.**
x::
The value (in radians).
@ Calculating the cosine
$ Engine.Math.Cosine(162.54);
> 0.6801581420388815
^ Engine.Math.Sine(**x**)
Engine.Math.Sin(**x**)
Returns the sine of `x`.
**This is an alias of the standard Math.sin function in JavaScript.**
x::
The value (in radians).
@ Calculating the sine
$ Engine.Math.Sine(62.4);
> -0.41855446451842543

163
docs/api/random.html

@ -1,163 +0,0 @@
<!doctype html>
<html>
<head>
<style>
body {
background-color: #F5F5F5;
font-family: sans-serif;
margin-right: 40px;
}
h2, h3, h4, h5, h6, h7
{
margin-top: 16px;
margin-bottom: 4px;
}
.children { padding-left: 40px; }
.definition
{
font-weight: bold;
margin-bottom: 32px;
}
.example
{
padding: 5px 6px;
font-weight: bold;
font-size: 15px;
background-color: #E6E6E6;
margin-top: 11px;
}
.example > .children
{
padding-top: 11px;
padding-left: 10px;
}
.example > .children > h7
{
font-size: 13px;
}
h7
{
font-size: 14px;
font-weight: bold;
margin-bottom: 2px;
}
pre
{
margin-top: 0px;
padding: 6px 7px;
background-color: #D9D9D9;
font-weight: normal;
font-size: 13px;
}
dl
{
margin: 5px 0px;
}
dt
{
font-weight: bold;
}
dd
{
font-size: 14px;
font-weight: normal;
margin-left: 8px;
}
dd > .children
{
font-size: 95%;
}
dd > .children > dl > dd
{
margin-left: 13px;
}
.exclamation
{
padding: 7px 8px;
margin: 11px 0px;
background-color: #FFE9AA;
border: 1px solid yellow;
font-size: 15px;
font-weight: normal;
}
.text
{
font-size: 15px;
font-weight: normal;
margin-bottom: 14px;
margin-top: 10px;
}
.toc
{
border: 1px solid gray;
background-color: #E6E6E6;
padding: 8px 9px;
font-size: 15px;
margin-bottom: 12px;
}
.toc h2
{
margin: 0px 0px 3px 0px;
font-size: 19px;
}
.toc ul
{
margin-top: 0px;
margin-bottom: 0px;
padding-left: 25px;
}
.toc li
{
margin-bottom: 2px;
}
.toc .alternatives
{
font-size: 12px;
}
.toc a
{
color: #292722;
}
.toc a:hover
{
color: black;
}
.fixed
{
font-family: monospace;
background-color: white;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 4px;
}
</style>
</head>
<body>
<div class="children"><h1>Engine.Random</h1><div class="text">The Random library provides several functions to pick random numbers or items.</div><div class="toc"><h2>Table of contents</h2><ul><li><a href="#Engine_Random_Numberminmaxprecision">Engine.Random.Number(min, max, precision)</a> Selects a random number between <span class="fixed">min</span> and <span class="fixed">max</span>, excluding <span class="fixed">max</span> itself. </li><li><a href="#Engine_Random_Chooseitemitemitem">Engine.Random.Choose(item [, item [, item ...]])</a> Selects a random item from the supplied items. <span class="alternatives">(also: Engine.Random.Choose(itemarray))</span></li><li><a href="#Engine_Random_Pickamountitemitemitem">Engine.Random.Pick(amount, item [, item [, item ...]])</a> Selects <span class="fixed">amount</span> unique random items from the supplied items. Each item can only... <span class="alternatives">(also: Engine.Random.Pick(amount, itemarray))</span></li><li><a href="#Engine_Random_Stringlengthalphabet">Engine.Random.String(length [, alphabet])</a> Generates a random string with the specified <span class="fixed">length</span>, and optionally a custom... </li></ul></div><div class="definition"><a name="Engine_Random_Numberminmaxprecision">Engine.Random.Number(<em>min</em>, <em>max</em>, <em>precision</em>) <div class="children"><div class="text">Selects a random number between <span class="fixed">min</span> and <span class="fixed">max</span>, excluding <span class="fixed">max</span> itself.</div><dl><dt>min</dt><dd><em>Optional:</em> The minimum number. <em>Defaults to 0.</em><div class="children"></div></dd></dl><dl><dt>max</dt><dd><em>Optional:</em> The maximum number (itself excluded). <em>Defaults to 1.</em><div class="children"></div></dd></dl><dl><dt>precision</dt><dd><em>Optional:</em> The precision; this is what the result will be rounded to. <em>Defaults to 0.00000001.</em><div class="children"></div></dd></dl><div class="example">Example: Get a whole number from 0 to 9 <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.Number(0, 10, 1);</pre><h7>Output:</h7><pre class="output">7</pre></div></div><div class="example">Example: Get a one-tenth-precision number from 0 to 9.9 <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.Number(0, 10, 0.1);</pre><h7>Output:</h7><pre class="output">3.7</pre></div></div><div class="example">Example: Get a one-fifth-precision number from 5 to 9.8: <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.Number(5, 10, 0.2);</pre><h7>Output:</h7><pre class="output">6.4</pre></div></div></div></a></div><div class="definition"><a name="Engine_Random_Chooseitemitemitem">Engine.Random.Choose(<em>item</em> [, <em>item</em> [, <em>item</em> ...]])<br>Engine.Random.Choose(<em>itemarray</em>) <div class="children"><div class="text">Selects a random item from the supplied items.</div><dl><dt>item</dt><dd>An item to choose from.<div class="children"></div></dd></dl><dl><dt>itemarray</dt><dd>An array of items to choose from.<div class="children"></div></dd></dl><div class="example">Example: Select a random color from a list using multiple arguments <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.Choose("blue", "green", "red", "yellow");</pre><h7>Output:</h7><pre class="output">"green"</pre></div></div><div class="example">Example: Select a random day from a list using an array <div class="children"><h7>Code:</h7><pre class="code">var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
Engine.Random.Choose(days);</pre><h7>Output:</h7><pre class="output">"Thursday"</pre></div></div></div></a></div><div class="definition"><a name="Engine_Random_Pickamountitemitemitem">Engine.Random.Pick(<em>amount</em>, <em>item</em> [, <em>item</em> [, <em>item</em> ...]])<br>Engine.Random.Pick(<em>amount</em>, <em>itemarray</em>) <div class="children"><div class="text">Selects <span class="fixed">amount</span> unique random items from the supplied items. Each item can only appear in the result once.</div><div class="exclamation"><strong>Important:</strong> The <span class="fixed">amount</span> argument must always be equal to or higher than the amount of supplied items! <div class="children"></div></div><dl><dt>amount</dt><dd>The amount of items to select.<div class="children"></div></dd></dl><dl><dt>item</dt><dd>An item to choose from.<div class="children"></div></dd></dl><dl><dt>itemarray</dt><dd>An array of items to choose from.<div class="children"></div></dd></dl><div class="example">Example: Select three random colors from a list using multiple arguments <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.Pick(3, "red", "green", "blue", "yellow", "purple", "brown", "black", "white", "orange");</pre><h7>Output:</h7><pre class="output">["blue", "orange", "red"]</pre></div></div><div class="example">Example: Select two vegetables from a list using an array <div class="children"><h7>Code:</h7><pre class="code">var vegetables = ["celery", "potato", "tomato", "coleslaw", "onion"];
Engine.Random.Pick(2, vegetables);</pre><h7>Output:</h7><pre class="output">["tomato", "onion"]</pre></div></div></div></a></div><div class="definition"><a name="Engine_Random_Stringlengthalphabet">Engine.Random.String(<em>length</em> [, <em>alphabet</em>]) <div class="children"><div class="text">Generates a random string with the specified <span class="fixed">length</span>, and optionally a custom alphabet.</div><dl><dt>length</dt><dd>The length of the string that has to be generated.<div class="children"></div></dd></dl><dl><dt>alphabet</dt><dd><em>Optional:</em> The alphabet (set of characters) to choose from. <em>Defaults to a-z, A-Z, 0-9.</em><div class="children"></div></dd></dl><div class="example">Example: Generate a random string with the default alphabet <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.String(14);</pre><h7>Output:</h7><pre class="output">"NCm2Y7lEleCTa5"</pre></div></div><div class="example">Example: Generate a random string with a custom alphabet <div class="children"><h7>Code:</h7><pre class="code">Engine.Random.String(10, "abcde");</pre><h7>Output:</h7><pre class="output">"baeddebaca"</pre></div></div></div></a></div></div>
</body>
</html>

123
docs/api/random.zpy

@ -1,123 +0,0 @@
# Engine.Random
The Random library provides several functions to pick random numbers or items.
{TOC}
^ Engine.Random.Number(**min**, **max**, **precision**)
Selects a random number between `min` and `max`, excluding `max` itself.
min::
**Optional:** The minimum number. **Defaults to 0.**
max::
**Optional:** The maximum number (itself excluded). **Defaults to 1.**
precision::
**Optional:** The precision; this is what the result will be rounded to. **Defaults to 0.00000001.**
@ Get a whole number from 0 to 9
$ Engine.Random.Number(0, 10, 1);
> 7
@ Get a one-tenth-precision number from 0 to 9.9
$ Engine.Random.Number(0, 10, 0.1);
> 3.7
@ Get a one-fifth-precision number from 5 to 9.8:
$ Engine.Random.Number(5, 10, 0.2);
> 6.4
^ Engine.Random.Choose(**item** [, **item** [, **item** ...]])
Engine.Random.Choose(**itemarray**)
Selects a random item from the supplied items.
item::
An item to choose from.
itemarray::
An array of items to choose from.
@ Select a random color from a list using multiple arguments
$ Engine.Random.Choose("blue", "green", "red", "yellow");
> "green"
@ Select a random day from a list using an array
$ var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
Engine.Random.Choose(days);
> "Thursday"
^ Engine.Random.Pick(**amount**, **item** [, **item** [, **item** ...]])
Engine.Random.Pick(**amount**, **itemarray**)
Selects `amount` unique random items from the supplied items. Each item can only appear in the result once.
! The `amount` argument must always be equal to or higher than the amount of supplied items!
amount::
The amount of items to select.
item::
An item to choose from.
itemarray::
An array of items to choose from.
@ Select three random colors from a list using multiple arguments
$ Engine.Random.Pick(3, "red", "green", "blue", "yellow", "purple", "brown", "black", "white", "orange");
> ["blue", "orange", "red"]
@ Select two vegetables from a list using an array
$ var vegetables = ["celery", "potato", "tomato", "coleslaw", "onion"];
Engine.Random.Pick(2, vegetables);
> ["tomato", "onion"]
^ Engine.Random.String(**length** [, **alphabet**])
Generates a random string with the specified `length`, and optionally a custom alphabet.
length::
The length of the string that has to be generated.
alphabet::
**Optional:** The alphabet (set of characters) to choose from. **Defaults to a-z, A-Z, 0-9.**
@ Generate a random string with the default alphabet
$ Engine.Random.String(14);
> "NCm2Y7lEleCTa5"
@ Generate a random string with a custom alphabet
$ Engine.Random.String(10, "abcde");
> "baeddebaca"

13
easing.html

@ -1,13 +0,0 @@
<!doctype html>
<html>
<head>
<title>Easing Demo</title>
<script src="compiled/radium.js"></script>
<script src="easing/easing.js"></script>
<link rel="stylesheet" href="easing/easing.css">
</head>
<body>
<canvas id="gamecanvas"></canvas>
<div id="debug"></div>
</body>
</html>

BIN
easing/assets/images/cursor.png

Before

Width: 82  |  Height: 82  |  Size: 1.4 KiB

33
easing/core.coffee

@ -1,33 +0,0 @@
$(->
manager = new ResourceManager("easing/assets")
engine = new Engine(manager)
window.debug_engine = engine
# Configure game assets
manager.addImages([
"images/cursor.png"
])
manager.prepare()
manager.preload(null, ->
engine.addCanvas($("#gamecanvas"));
scene = engine.createScene("main")
engine.createSprite("cursor", "images/cursor.png")
cursor = engine.createObject("cursor")
cursor.sprite = engine.getSprite("cursor")
cursor.onClickGlobal = (event) ->
@x = @engine.ease.quadInOut(@x, event.x - 41, 35)
@y = @engine.ease.quadInOut(@y, event.y - 41, 35)
cursor.onStep = ->
return true
scene.createInstance(cursor, 0, 0)
engine.start()
)
)

7
easing/easing.css

@ -1,7 +0,0 @@
body {
background-color: #ebebeb; }
canvas {
background-color: white; }
/*# sourceMappingURL=easing.css.map */

7
easing/easing.css.map

@ -1,7 +0,0 @@
{
"version": 3,
"file": "",
"sources": ["easing.scss"],
"names": [],
"mappings": "AAAA;EAEC,kBAAkB;;AAGnB;EAEC,kBAAkB"
}

29
easing/easing.js

@ -1,29 +0,0 @@
// Generated by CoffeeScript 1.7.1
(function() {
$(function() {
var engine, manager;
manager = new ResourceManager("easing/assets");
engine = new Engine(manager);
window.debug_engine = engine;
manager.addImages(["images/cursor.png"]);
manager.prepare();
return manager.preload(null, function() {
var cursor, scene;
engine.addCanvas($("#gamecanvas"));
scene = engine.createScene("main");
engine.createSprite("cursor", "images/cursor.png");
cursor = engine.createObject("cursor");
cursor.sprite = engine.getSprite("cursor");
cursor.onClickGlobal = function(event) {
this.x = this.engine.ease.quadInOut(this.x, event.x - 41, 35);
return this.y = this.engine.ease.quadInOut(this.y, event.y - 41, 35);
};
cursor.onStep = function() {
return true;
};
scene.createInstance(cursor, 0, 0);
return engine.start();
});
});
}).call(this);

9
easing/easing.scss

@ -1,9 +0,0 @@
body
{
background-color: #ebebeb;
}
canvas
{
background-color: white;
}

BIN
experiments/assets/ball.png

After

Width: 64  |  Height: 64  |  Size: 9.8 KiB

8
experiments/assets/style.css

@ -0,0 +1,8 @@
body {
background-color: #e0e0e0; }
#gamecanvas {
background-color: white;
margin: 0px auto; }
/*# sourceMappingURL=style.css.map */

7
experiments/assets/style.css.map

@ -0,0 +1,7 @@
{
"version": 3,
"file": "",
"sources": ["style.scss"],
"names": [],
"mappings": "AAAA;EAEC,kBAAkB;;AAGnB;EAEC,kBAAkB;EAClB,QAAQ"
}

10
experiments/assets/style.scss

@ -0,0 +1,10 @@
body
{
background-color: #e0e0e0;
}
#gamecanvas
{
background-color: white;
margin: 0px auto;
}

11
experiments/drag.html

@ -0,0 +1,11 @@
<html>
<head>
<title>Drag Experiment</title>
<link rel="stylesheet" href="assets/style.css">
<script src="../compiled/radium.js"></script>
<script src="drag.js"></script>
</head>
<body>
<canvas id="gamecanvas"></canvas>
</body>
</html>

27
experiments/drag.js

@ -0,0 +1,27 @@
(function () {$(function() {
var engine, manager;
manager = new ResourceManager("assets");
engine = new Engine(manager);
window.debug_engine = engine;
manager.addImages(["ball.png"]);
return manager.prepare(function() {
engine.addCanvas($("#gamecanvas"));
engine.setInitialScene(engine.createScene("main"));
return manager.load(function() {
var ball;
engine.createSprites({
"ball": "ball.png"
});
ball = engine.createObject("ball");
ball.sprite = engine.getSprite("ball");
ball.onStep = function() {
return true;
};
engine.getScene("main").onLoad = function() {
return this.createInstance(ball, 0, 0);
};
return engine.start();
});
});
});
})();

37
experiments/drag/core.coffee

@ -0,0 +1,37 @@
$(->
manager = new ResourceManager("assets")
engine = new Engine(manager)
window.debug_engine = engine
# Configure game assets
manager.addImages([
"ball.png"
])
manager.prepare ->
# Set up the engine
engine.addCanvas($("#gamecanvas"));
engine.setInitialScene(engine.createScene("main"))
manager.load ->
# Game asset initialization...
engine.createSprites({
"ball": "ball.png",
})
# Object definitions
ball = engine.createObject("ball")
ball.sprite = engine.getSprite("ball")
ball.onStep = ->
return true
# Scene configuration
engine.getScene("main").onLoad = ->
# Actual game initialization
@createInstance(ball, 0, 0)
# Let's go!
engine.start()
)

11
experiments/easing.html

@ -0,0 +1,11 @@
<html>
<head>
<title>Easing Experiment</title>
<link rel="stylesheet" href="assets/style.css">
<script src="../compiled/radium.js"></script>
<script src="easing.js"></script>
</head>
<body>
<canvas id="gamecanvas"></canvas>
</body>
</html>

31
experiments/easing.js

@ -0,0 +1,31 @@
(function () {$(function() {
var engine, manager;
manager = new ResourceManager("assets");
engine = new Engine(manager);
window.debug_engine = engine;
manager.addImages(["ball.png"]);
return manager.prepare(function() {
engine.addCanvas($("#gamecanvas"));
engine.setInitialScene(engine.createScene("main"));
return manager.load(function() {
var ball;
engine.createSprites({
"ball": "ball.png"
});
ball = engine.createObject("ball");
ball.sprite = engine.getSprite("ball");
ball.onStep = function() {
return true;
};
ball.onClickGlobal = function(event) {
this.x = this.engine.ease.quadInOut(this.x, event.x - 41, 35);
return this.y = this.engine.ease.quadInOut(this.y, event.y - 41, 35);
};
engine.getScene("main").onLoad = function() {
return this.createInstance(ball, 0, 0);
};
return engine.start();
});
});
});
})();

41
experiments/easing/core.coffee

@ -0,0 +1,41 @@
$(->
manager = new ResourceManager("assets")
engine = new Engine(manager)
window.debug_engine = engine
# Configure game assets
manager.addImages([
"ball.png"
])
manager.prepare ->
# Set up the engine
engine.addCanvas($("#gamecanvas"));
engine.setInitialScene(engine.createScene("main"))
manager.load ->
# Game asset initialization...
engine.createSprites({
"ball": "ball.png",
})
# Object definitions
ball = engine.createObject("ball")
ball.sprite = engine.getSprite("ball")
ball.onStep = ->
return true
ball.onClickGlobal = (event) ->
@x = @engine.ease.quadInOut(@x, event.x - 41, 35)
@y = @engine.ease.quadInOut(@y, event.y - 41, 35)
# Scene configuration
engine.getScene("main").onLoad = ->
# Actual game initialization
@createInstance(ball, 0, 0)
# Let's go!
engine.start()
)

59
gulpfile.js

@ -11,6 +11,9 @@ var header = require('gulp-header');
var footer = require('gulp-footer');
var plumber = require('gulp-plumber');
/* Configuration */
var experiments = ["drag", "easing"]
/* Engine build tasks */
engine = {
source: "radium/*.coffee",
@ -44,6 +47,45 @@ gulp.task("prod-engine", ["dev-engine"], function(){
.pipe(gulp.dest(engine.target.path));
});
/* Experiment build tasks */
var experiment_settings = {};
for(var i in experiments)
{
var name = experiments[i];
experiment_settings[name] = {
source: "experiments/" + name + "/*.coffee",
external: "",
target: {
path: "experiments",
name: name + ".js",
minName: name + ".min.js"
}
}
gulp.task('dev-' + name, function() {
return gulp.src(experiment_settings[name].source)
.pipe(plumber())
.pipe(cache(name))
.pipe(coffee({bare: true}).on('error', gutil.log)).on('data', gutil.log)
.pipe(remember(name))
.pipe(concat(name + ".coffee.js"))
.pipe(header('(function () {'))
.pipe(footer('})();'))
.pipe(concat(name + ".concat.js"))
.pipe(rename(experiment_settings[name].target.name))
.pipe(gulp.dest(experiment_settings[name].target.path));
});
gulp.task("prod-" + name, ["dev-" + name], function(){
return gulp.src(experiment_settings[name].target.path + "/" + experiment_settings[name].target.name)
.pipe(uglify())
.pipe(rename(experiment_settings[name].target.minName))
.pipe(gulp.dest(experiment_settings[name].target.path));
});
}
/* Sample game build tasks */
gemswap = {
source: "gemswap/*.coffee",
@ -79,21 +121,26 @@ gulp.task("prod-gemswap", ["dev-gemswap"], function(){
/* Watcher */
gulp.task('watch', function () {
targets = {
var targets = {
"gemswap": gemswap,
"engine": engine
}
for(name in targets)
for (var attrname in experiment_settings) { targets[attrname] = experiment_settings[attrname]; }
for(var tname in targets)
{
var watcher = gulp.watch(targets[name].source, ['dev-' + name]);
var watcher = gulp.watch(targets[tname].source, ['dev-' + tname]);
watcher.on('change', function (event) {
if (event.type === 'deleted')
{
delete cache.caches[name + '-coffee'][event.path];
remember.forget(name + '-coffee', event.path);
delete cache.caches[tname + '-coffee'][event.path];
remember.forget(tname + '-coffee', event.path);
}
});
/* Initial build */
gulp.start("dev-" + tname);
}
});

1462
lib/engine.js
File diff suppressed because it is too large
View File

78
lib/soundmanager2.js

@ -1,78 +0,0 @@
/** @license
*
* SoundManager 2: JavaScript Sound for the Web
* ----------------------------------------------
* http://schillmania.com/projects/soundmanager2/
*
* Copyright (c) 2007, Scott Schiller. All rights reserved.
* Code provided under the BSD License:
* http://schillmania.com/projects/soundmanager2/license.txt
*
* V2.97a.20130101
*/
(function(i,g){function R(R,fa){function S(b){return c.preferFlash&&A&&!c.ignoreFlash&&c.flash[b]!==g&&c.flash[b]}function m(b){return function(c){var d=this._s;return!d||!d._a?null:b.call(this,c)}}this.setupOptions={url:R||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1E3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,
html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1};this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100};this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null};
this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null};this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}};this.movieID=
"sm2-container";this.id=fa||"sm2movie";this.debugID="soundmanager-debug";this.debugURLParam=/([#?&])debug=1/i;this.versionNumber="V2.97a.20130101";this.altURL=this.movieURL=this.version=null;this.enabled=this.swfLoaded=!1;this.oMC=null;this.sounds={};this.soundIDs=[];this.didFlashBlock=this.muted=!1;this.filePattern=null;this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i};this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1};this.sandbox={};this.html5={usingFlash:null};
this.flash={};this.ignoreFlash=this.html5Only=!1;var Ga,c=this,Ha=null,h=null,T,q=navigator.userAgent,ga=i.location.href.toString(),l=document,ha,Ia,ia,k,r=[],J=!1,K=!1,j=!1,s=!1,ja=!1,L,t,ka,U,la,B,C,D,Ja,ma,V,na,W,oa,E,pa,M,qa,X,F,Ka,ra,La,sa,Ma,N=null,ta=null,v,ua,G,Y,Z,H,p,O=!1,va=!1,Na,Oa,Pa,$=0,P=null,aa,Qa=[],u=null,Ra,ba,Q,y,wa,xa,Sa,n,db=Array.prototype.slice,w=!1,ya,A,za,Ta,x,ca=q.match(/(ipad|iphone|ipod)/i),Ua=q.match(/android/i),z=q.match(/msie/i),eb=q.match(/webkit/i),Aa=q.match(/safari/i)&&
!q.match(/chrome/i),Ba=q.match(/opera/i),Ca=q.match(/(mobile|pre\/|xoom)/i)||ca||Ua,Va=!ga.match(/usehtml5audio/i)&&!ga.match(/sm2\-ignorebadua/i)&&Aa&&!q.match(/silk/i)&&q.match(/OS X 10_6_([3-7])/i),Da=l.hasFocus!==g?l.hasFocus():null,da=Aa&&(l.hasFocus===g||!l.hasFocus()),Wa=!da,Xa=/(mp3|mp4|mpa|m4a|m4b)/i,Ea=l.location?l.location.protocol.match(/http/i):null,Ya=!Ea?"http://":"",Za=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,$a="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),
fb=RegExp("\\.("+$a.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i;this.useAltURL=!Ea;var Fa;try{Fa=Audio!==g&&(Ba&&opera!==g&&10>opera.version()?new Audio(null):new Audio).canPlayType!==g}catch(hb){Fa=!1}this.hasHTML5=Fa;this.setup=function(b){var e=!c.url;b!==g&&(j&&u&&c.ok()&&(b.flashVersion!==g||b.url!==g||b.html5Test!==g))&&H(v("setupLate"));ka(b);e&&(M&&b.url!==g)&&c.beginDelayedInit();!M&&(b.url!==g&&"complete"===l.readyState)&&setTimeout(E,1);return c};
this.supported=this.ok=function(){return u?j&&!s:c.useHTML5Audio&&c.hasHTML5};this.getMovie=function(b){return T(b)||l[b]||i[b]};this.createSound=function(b,e){function d(){a=Y(a);c.sounds[a.id]=new Ga(a);c.soundIDs.push(a.id);return c.sounds[a.id]}var a,f=null;if(!j||!c.ok())return H(void 0),!1;e!==g&&(b={id:b,url:e});a=t(b);a.url=aa(a.url);if(p(a.id,!0))return c.sounds[a.id];ba(a)?(f=d(),f._setup_html5(a)):(8<k&&null===a.isMovieStar&&(a.isMovieStar=!(!a.serverURL&&!(a.type&&a.type.match(Za)||a.url.match(fb)))),
a=Z(a,void 0),f=d(),8===k?h._createSound(a.id,a.loops||1,a.usePolicyFile):(h._createSound(a.id,a.url,a.usePeakData,a.useWaveformData,a.useEQData,a.isMovieStar,a.isMovieStar?a.bufferTime:!1,a.loops||1,a.serverURL,a.duration||null,a.autoPlay,!0,a.autoLoad,a.usePolicyFile),a.serverURL||(f.connected=!0,a.onconnect&&a.onconnect.apply(f))),!a.serverURL&&(a.autoLoad||a.autoPlay)&&f.load(a));!a.serverURL&&a.autoPlay&&f.play();return f};this.destroySound=function(b,e){if(!p(b))return!1;var d=c.sounds[b],a;
d._iO={};d.stop();d.unload();for(a=0;a<c.soundIDs.length;a++)if(c.soundIDs[a]===b){c.soundIDs.splice(a,1);break}e||d.destruct(!0);delete c.sounds[b];return!0};this.load=function(b,e){return!p(b)?!1:c.sounds[b].load(e)};this.unload=function(b){return!p(b)?!1:c.sounds[b].unload()};this.onposition=this.onPosition=function(b,e,d,a){return!p(b)?!1:c.sounds[b].onposition(e,d,a)};this.clearOnPosition=function(b,e,d){return!p(b)?!1:c.sounds[b].clearOnPosition(e,d)};this.start=this.play=function(b,e){var d=
!1;return!j||!c.ok()?(H("soundManager.play(): "+v(!j?"notReady":"notOK")),d):!p(b)?(e instanceof Object||(e={url:e}),e&&e.url&&(e.id=b,d=c.createSound(e).play()),d):c.sounds[b].play(e)};this.setPosition=function(b,e){return!p(b)?!1:c.sounds[b].setPosition(e)};this.stop=function(b){return!p(b)?!1:c.sounds[b].stop()};this.stopAll=function(){for(var b in c.sounds)c.sounds.hasOwnProperty(b)&&c.sounds[b].stop()};this.pause=function(b){return!p(b)?!1:c.sounds[b].pause()};this.pauseAll=function(){var b;
for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].pause()};this.resume=function(b){return!p(b)?!1:c.sounds[b].resume()};this.resumeAll=function(){var b;for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].resume()};this.togglePause=function(b){return!p(b)?!1:c.sounds[b].togglePause()};this.setPan=function(b,e){return!p(b)?!1:c.sounds[b].setPan(e)};this.setVolume=function(b,e){return!p(b)?!1:c.sounds[b].setVolume(e)};this.mute=function(b){var e=0;b instanceof String&&(b=null);if(b)return!p(b)?
!1:c.sounds[b].mute();for(e=c.soundIDs.length-1;0<=e;e--)c.sounds[c.soundIDs[e]].mute();return c.muted=!0};this.muteAll=function(){c.mute()};this.unmute=function(b){b instanceof String&&(b=null);if(b)return!p(b)?!1:c.sounds[b].unmute();for(b=c.soundIDs.length-1;0<=b;b--)c.sounds[c.soundIDs[b]].unmute();c.muted=!1;return!0};this.unmuteAll=function(){c.unmute()};this.toggleMute=function(b){return!p(b)?!1:c.sounds[b].toggleMute()};this.getMemoryUse=function(){var b=0;h&&8!==k&&(b=parseInt(h._getMemoryUse(),
10));return b};this.disable=function(b){var e;b===g&&(b=!1);if(s)return!1;s=!0;for(e=c.soundIDs.length-1;0<=e;e--)La(c.sounds[c.soundIDs[e]]);L(b);n.remove(i,"load",C);return!0};this.canPlayMIME=function(b){var e;c.hasHTML5&&(e=Q({type:b}));!e&&u&&(e=b&&c.ok()?!!(8<k&&b.match(Za)||b.match(c.mimePattern)):null);return e};this.canPlayURL=function(b){var e;c.hasHTML5&&(e=Q({url:b}));!e&&u&&(e=b&&c.ok()?!!b.match(c.filePattern):null);return e};this.canPlayLink=function(b){return b.type!==g&&b.type&&c.canPlayMIME(b.type)?
!0:c.canPlayURL(b.href)};this.getSoundById=function(b){if(!b)throw Error("soundManager.getSoundById(): sID is null/_undefined");return c.sounds[b]};this.onready=function(b,c){if("function"===typeof b)c||(c=i),la("onready",b,c),B();else throw v("needFunction","onready");return!0};this.ontimeout=function(b,c){if("function"===typeof b)c||(c=i),la("ontimeout",b,c),B({type:"ontimeout"});else throw v("needFunction","ontimeout");return!0};this._wD=this._writeDebug=function(){return!0};this._debug=function(){};
this.reboot=function(b,e){var d,a,f;for(d=c.soundIDs.length-1;0<=d;d--)c.sounds[c.soundIDs[d]].destruct();if(h)try{z&&(ta=h.innerHTML),N=h.parentNode.removeChild(h)}catch(g){}ta=N=u=h=null;c.enabled=M=j=O=va=J=K=s=w=c.swfLoaded=!1;c.soundIDs=[];c.sounds={};if(b)r=[];else for(d in r)if(r.hasOwnProperty(d)){a=0;for(f=r[d].length;a<f;a++)r[d][a].fired=!1}c.html5={usingFlash:null};c.flash={};c.html5Only=!1;c.ignoreFlash=!1;i.setTimeout(function(){oa();e||c.beginDelayedInit()},20);return c};this.reset=
function(){return c.reboot(!0,!0)};this.getMoviePercent=function(){return h&&"PercentLoaded"in h?h.PercentLoaded():null};this.beginDelayedInit=function(){ja=!0;E();setTimeout(function(){if(va)return!1;X();W();return va=!0},20);D()};this.destruct=function(){c.disable(!0)};Ga=function(b){var e,d,a=this,f,ab,i,I,l,m,q=!1,j=[],n=0,s,u,r=null;d=e=null;this.sID=this.id=b.id;this.url=b.url;this._iO=this.instanceOptions=this.options=t(b);this.pan=this.options.pan;this.volume=this.options.volume;this.isHTML5=
!1;this._a=null;this.id3={};this._debug=function(){};this.load=function(b){var c=null;b!==g?a._iO=t(b,a.options):(b=a.options,a._iO=b,r&&r!==a.url&&(a._iO.url=a.url,a.url=null));a._iO.url||(a._iO.url=a.url);a._iO.url=aa(a._iO.url);b=a.instanceOptions=a._iO;if(b.url===a.url&&0!==a.readyState&&2!==a.readyState)return 3===a.readyState&&b.onload&&b.onload.apply(a,[!!a.duration]),a;a.loaded=!1;a.readyState=1;a.playState=0;a.id3={};if(ba(b))c=a._setup_html5(b),c._called_load||(a._html5_canplay=!1,a.url!==
b.url&&(a._a.src=b.url,a.setPosition(0)),a._a.autobuffer="auto",a._a.preload="auto",a._a._called_load=!0,b.autoPlay&&a.play());else try{a.isHTML5=!1,a._iO=Z(Y(b)),b=a._iO,8===k?h._load(a.id,b.url,b.stream,b.autoPlay,b.usePolicyFile):h._load(a.id,b.url,!!b.stream,!!b.autoPlay,b.loops||1,!!b.autoLoad,b.usePolicyFile)}catch(e){F({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}a.url=b.url;return a};this.unload=function(){0!==a.readyState&&(a.isHTML5?(I(),a._a&&(a._a.pause(),wa(a._a,"about:blank"),r="about:blank")):
8===k?h._unload(a.id,"about:blank"):h._unload(a.id),f());return a};this.destruct=function(b){a.isHTML5?(I(),a._a&&(a._a.pause(),wa(a._a),w||i(),a._a._s=null,a._a=null)):(a._iO.onfailure=null,h._destroySound(a.id));b||c.destroySound(a.id,!0)};this.start=this.play=function(b,c){var e,d;d=!0;d=null;c=c===g?!0:c;b||(b={});a.url&&(a._iO.url=a.url);a._iO=t(a._iO,a.options);a._iO=t(b,a._iO);a._iO.url=aa(a._iO.url);a.instanceOptions=a._iO;if(a._iO.serverURL&&!a.connected)return a.getAutoPlay()||a.setAutoPlay(!0),
a;ba(a._iO)&&(a._setup_html5(a._iO),l());1===a.playState&&!a.paused&&((e=a._iO.multiShot)||(d=a));if(null!==d)return d;b.url&&b.url!==a.url&&a.load(a._iO);a.loaded||(0===a.readyState?(a.isHTML5||(a._iO.autoPlay=!0),a.load(a._iO),a.instanceOptions=a._iO):2===a.readyState&&(d=a));if(null!==d)return d;!a.isHTML5&&(9===k&&0<a.position&&a.position===a.duration)&&(b.position=0);if(a.paused&&0<=a.position&&(!a._iO.serverURL||0<a.position))a.resume();else{a._iO=t(b,a._iO);if(null!==a._iO.from&&null!==a._iO.to&&
0===a.instanceCount&&0===a.playState&&!a._iO.serverURL