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 133 by tsugehara, Fri Aug 2 17:46:24 2013 UTC revision 137 by tsugehara, Sat Aug 3 06:35:40 2013 UTC
# Line 2168  var jg; Line 2168  var jg;
2168              this.refresh();              this.refresh();
2169          };          };
2170    
2171          Tile.prototype.generate = function (data, width, height) {          Tile.prototype.generate = function (data, width, height, transpose) {
2172              this.data = data;              if (width === true) {
2173                    transpose = true;
2174                    width = data.length;
2175                    height = data[0].length;
2176                }
2177              if (!width)              if (!width)
2178                  width = this.data.length;                  width = data.length;
2179              if (!height)              if (!height)
2180                  height = this.data[0].length;                  height = data[0].length;
2181    
2182                this.data = transpose ? jg.JGUtil.transpose(data) : data;
2183    
2184              this._clear(width, height);              this._clear(width, height);
2185              this.refresh();              this.refresh();
2186          };          };
# Line 5125  var jg; Line 5132  var jg;
5132              JGUtil.idData.push(new IdData());              JGUtil.idData.push(new IdData());
5133              return JGUtil.idData.length - 1;              return JGUtil.idData.length - 1;
5134          };          };
5135    
5136            JGUtil.transpose = function (src) {
5137                var ret = new Array(src[0].length);
5138                for (var y = 0, ylen = ret.length; y < ylen; y++)
5139                    ret[y] = new Array(src.length);
5140    
5141                for (var x = 0, xlen = src.length; x < xlen; x++)
5142                    for (var y = 0, ylen = src[x].length; y < ylen; y++)
5143                        ret[y][x] = src[x][y];
5144    
5145                return ret;
5146            };
5147          return JGUtil;          return JGUtil;
5148      })();      })();
5149      jg.JGUtil = JGUtil;      jg.JGUtil = JGUtil;

Legend:
Removed from v.133  
changed lines
  Added in v.137

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