OSDN Git Service

ハードタブをソフトタブ(スペース8)に変換
[flapp/flapp.git] / src / main.js
index 225b58c..296b8e4 100644 (file)
@@ -34,12 +34,12 @@ Flapp.prototype = {
         this.run(this.dict, this.movieClip, this.canvas);
     },
     setHeader: function(header) {
-       this.frameTick = 1000 / header.framerate;
+        this.frameTick = 1000 / header.framerate;
 //        this.frameTick = 1000; // for debug
         this.movieClip.totalframes = header.framecount;
-       var canvas_width = this.canvas.width;
-       var factorX = this.canvas.canvas.width / (header.framesize.xmax / 20);
-       var factorY = this.canvas.canvas.height / (header.framesize.ymax / 20);
+        var canvas_width = this.canvas.width;
+        var factorX = this.canvas.canvas.width / (header.framesize.xmax / 20);
+        var factorY = this.canvas.canvas.height / (header.framesize.ymax / 20);
         if (factorX < factorY) {
             this.matrix[0] *= factorX;
             this.matrix[3] *= factorX;
@@ -51,13 +51,13 @@ Flapp.prototype = {
         }
         this.movieClip.absoluteMatrix = null;
         this.movieClip.setMatrix(this.matrix);
-       if (typeof this.timerId === 'number') {
-           clearInterval(this.timerId);
+        if (typeof this.timerId === 'number') {
+            clearInterval(this.timerId);
             this.ticks();
-       }
+        }
     },
     setBackground: function(red, green, blue) {
-       this.canvas.canvas.style.backgroundColor = 'rgb('+red+','+green+','+blue+')';
+        this.canvas.canvas.style.backgroundColor = 'rgb('+red+','+green+','+blue+')';
     },
     run: function(dict, movieClip, canvas) {
         console.debug("Flapp::run");
@@ -66,19 +66,19 @@ Flapp.prototype = {
         this.ticks();
     },
     ticks: function() {
-       var flapp = this;
-       var dict = this.dict;
-       var movieClip = this.movieClip;
-       var canvas = this.canvas;
+        var flapp = this;
+        var dict = this.dict;
+        var movieClip = this.movieClip;
+        var canvas = this.canvas;
         console.debug("Flapp::ticks "+movieClip.currentFrame);
         this.timerId = setInterval(function() {
             if (movieClip.control(dict)) {
-               movieClip.action();
-               canvas.clear();
-               movieClip.render(canvas, dict);
-               movieClip.increment();
+                movieClip.action();
+                canvas.clear();
+                movieClip.render(canvas, dict);
+                movieClip.increment();
             }
-       }, flapp.frameTick);
+        }, flapp.frameTick);
     }
 };