Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/jgame.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 138 by tsugehara, Sat Aug 3 08:00:18 2013 UTC revision 139 by tsugehara, Sat Aug 3 15:38:39 2013 UTC
# Line 2067  var jg; Line 2067  var jg;
2067          __extends(AutoTileChipSet, _super);          __extends(AutoTileChipSet, _super);
2068          function AutoTileChipSet() {          function AutoTileChipSet() {
2069              _super.apply(this, arguments);              _super.apply(this, arguments);
2070                this.afterDraw = true;
2071          }          }
2072          AutoTileChipSet.prototype.map = function (x, y) {          AutoTileChipSet.prototype.map = function (x, y) {
2073              if (x < 0 || y < 0 || x >= this.tile.size.width || y >= this.tile.size.height)              if (x < 0 || y < 0 || x >= this.tile.size.width || y >= this.tile.size.height)
# Line 2074  var jg; Line 2075  var jg;
2075              return this.tile.data[x][y];              return this.tile.data[x][y];
2076          };          };
2077    
2078            AutoTileChipSet.prototype.count = function () {
2079                return 1;
2080            };
2081    
2082          AutoTileChipSet.prototype.draw = function (c, x, y, chip) {          AutoTileChipSet.prototype.draw = function (c, x, y, chip) {
2083              var tw = this.tile.tileWidth;              var tw = this.tile.tileWidth;
2084              var th = this.tile.tileHeight;              var th = this.tile.tileHeight;
2085              var tw2 = Math.floor(this.tile.tileWidth / 2);              var tw2 = Math.floor(this.tile.tileWidth / 2);
2086              var th2 = Math.floor(this.tile.tileHeight / 2);              var th2 = Math.floor(this.tile.tileHeight / 2);
2087                var chip = this.tile.data[x][y];
2088              for (var i = 0; i < 4; i++) {              for (var i = 0; i < 4; i++) {
2089                  for (var j = 0; j < 4; j++) {                  for (var j = 0; j < 4; j++) {
2090                      var ox = x + (Math.floor((i + 1) / 2) - 1);                      var ox = x + (Math.floor((i + 1) / 2) - 1);
2091                      var oy = y + (Math.floor((j + 1) / 2) - 1);                      var oy = y + (Math.floor((j + 1) / 2) - 1);
2092                      var n = this.map(ox, oy);                      var n = this.map(ox, oy);
2093                      if (n == -1)                      if (n == -1 || n != chip)
2094                          continue;                          continue;
2095    
2096                      var tx = ox + (i % 2 == 0 ? 1 : -1);                      var tx = ox + (i % 2 == 0 ? 1 : -1);
# Line 2196  var jg; Line 2202  var jg;
2202              this.canvas = window.createCanvas(this.width, this.height);              this.canvas = window.createCanvas(this.width, this.height);
2203              var c = this.canvas.getContext("2d");              var c = this.canvas.getContext("2d");
2204    
2205              for (var x = 0; x < this.size.width; x++)              var chipset;
2206                  for (var y = 0; y < this.size.height; y++)              var w = this.size.width;
2207                      this.drawChip(x, y, false, c);              var h = this.size.height;
2208                var d = this.data;
2209                var cm = this.chipMap;
2210                for (var x = 0; x < w; x++)
2211                    for (var y = 0; y < h; y++)
2212                        if (cm[d[x][y]] && !cm[d[x][y]].afterDraw)
2213                            this.drawChip(x, y, false, c);
2214    
2215                for (var x = 0; x < w; x++)
2216                    for (var y = 0; y < h; y++)
2217                        if (cm[d[x][y]] && cm[d[x][y]].afterDraw)
2218                            this.drawChip(x, y, false, c);
2219    
2220              this.updated();              this.updated();
2221          };          };

Legend:
Removed from v.138  
changed lines
  Added in v.139

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26