@@ -13,83 +13,85 @@ After it's loaded you can initialize the engine. There are a options you can pas
1313 check out the annotted source code in `docs/` for more on this.
1414
1515 ```javascript
16- var ff = new FlyingFunctions({
17- width: 640,
18- height: 320
19- });
16+var ff = new FlyingFunctions({
17+ width: 640,
18+ height: 320
19+});
2020
21- ff.on('frame', function () {
22- // my drawing code
23- });
21+ff.on('frame', function () {
22+ // my drawing code
23+});
2424
25- // start the game loop
26- ff.loop();
25+// start the game loop
26+ff.loop();
2727 ```
2828
2929 Here is a full example (form the test folder):
3030
31- <!doctype html>
32- <html lang="en">
33- <head>
34- <title>Flying Functions Main test</title>
35- </head>
36- <body>
37-
38- <script src="../lib/flying-functions.js"></script>
39- <script>
40- console.log(FlyingFunctions);
41- console.log(FlyingFunctions.prototype);
42-
43- var ff = new FlyingFunctions({
44- width: 640,
45- height: 320,
46- init: function (o) {
47- console.log('in init func');
48- // this is the ff object
49- console.log(typeof this);
50- console.log(this instanceof FlyingFunctions);
51- console.log(o);
52- }
53- });
54-
55- console.log(ff);
56-
57- var particle = {
58- x: 10,
59- y: 10,
60- speed: 5,
61- size: 2,
62- random: true
63- };
64-
65- ff.on('frame', function () {
66- var c = this.c;
67-
68- if (particle.random) {
69- particle.x += particle.speed + Math.floor(Math.random() * 220);
70- particle.y += particle.speed + Math.floor(Math.random() * 160);
71- } else {
72- particle.x += particle.speed;
73- particle.y += particle.speed;
74- }
75-
76- if (particle.x >= this.canvas.width || particle.y >= this.canvas.height) {
77- particle.x = 10;
78- particle.y = 10;
79- }
80-
81- c.save();
82- c.fillStyle = "hsl(190, 100%, 50%)";
83- c.beginPath();
84- c.arc(particle.x, particle.y, particle.size, 0, Math.PI * 2, true);
85- c.fill();
86- c.restore();
87- });
88-
89- window.onload = function () {
90- ff.loop();
91- };
92- </script>
93-
94- </body
95- </html>
31+```html
32+<!doctype html>
33+<html lang="en">
34+<head>
35+ <title>Flying Functions Main test</title>
36+</head>
37+<body>
38+
39+ <script src="../lib/flying-functions.js"></script>
40+ <script>
41+ console.log(FlyingFunctions);
42+ console.log(FlyingFunctions.prototype);
43+
44+ var ff = new FlyingFunctions({
45+ width: 640,
46+ height: 320,
47+ init: function (o) {
48+ console.log('in init func');
49+ // this is the ff object
50+ console.log(typeof this);
51+ console.log(this instanceof FlyingFunctions);
52+ console.log(o);
53+ }
54+ });
55+
56+ console.log(ff);
57+
58+ var particle = {
59+ x: 10,
60+ y: 10,
61+ speed: 5,
62+ size: 2,
63+ random: true
64+ };
65+
66+ ff.on('frame', function () {
67+ var c = this.c;
68+
69+ if (particle.random) {
70+ particle.x += particle.speed + Math.floor(Math.random() * 220);
71+ particle.y += particle.speed + Math.floor(Math.random() * 160);
72+ } else {
73+ particle.x += particle.speed;
74+ particle.y += particle.speed;
75+ }
76+
77+ if (particle.x >= this.canvas.width || particle.y >= this.canvas.height) {
78+ particle.x = 10;
79+ particle.y = 10;
80+ }
81+
82+ c.save();
83+ c.fillStyle = "hsl(190, 100%, 50%)";
84+ c.beginPath();
85+ c.arc(particle.x, particle.y, particle.size, 0, Math.PI * 2, true);
86+ c.fill();
87+ c.restore();
88+ });
89+
90+ window.onload = function () {
91+ ff.loop();
92+ };
93+ </script>
94+
95+</body
96+</html>
97+```