Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/src/js/jgame.js

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

revision 25 by tsugehara, Sat Feb 16 10:45:33 2013 UTC revision 26 by tsugehara, Tue Feb 19 14:06:56 2013 UTC
# Line 2  window.getTime = ((function () { Line 2  window.getTime = ((function () {
2      if(window.performance && window.performance.now) {      if(window.performance && window.performance.now) {
3          return function () {          return function () {
4              return window.performance.now();              return window.performance.now();
5          }          };
6        } else if(window.performance && window.performance.webkitNow) {
7            return function () {
8                return window.performance.webkitNow();
9            };
10      } else {      } else {
11          if(window.performance && window.performance.webkitNow) {          return Date.now;
             return function () {  
                 return window.performance.webkitNow();  
             }  
         } else {  
             return Date.now;  
         }  
12      }      }
13  })());  })());
14  window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || ((function () {  window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || ((function () {
# Line 23  window.requestAnimationFrame = window.re Line 21  window.requestAnimationFrame = window.re
21          }, Math.max(0, lastTime + frame - currentTime));          }, Math.max(0, lastTime + frame - currentTime));
22          lastTime = currentTime;          lastTime = currentTime;
23          return _id;          return _id;
24      }      };
25  })());  })());
26  window.createCanvas = function (width, height) {  window.createCanvas = function (width, height) {
27      var canvas = document.createElement("canvas");      var canvas = document.createElement("canvas");
# Line 33  window.createCanvas = function (width, h Line 31  window.createCanvas = function (width, h
31          var browser = JGUtil.getBrowser();          var browser = JGUtil.getBrowser();
32          if(browser.opera) {          if(browser.opera) {
33              canvas.style["imageRendering"] = "-o-crisp-edges";              canvas.style["imageRendering"] = "-o-crisp-edges";
34          } else {          } else if(browser.msie) {
35              if(browser.msie) {              canvas.style["msInterpolationMode"] = "nearest-neighbor";
36                  canvas.style["msInterpolationMode"] = "nearest-neighbor";          } else if(browser.safari) {
37              } else {              canvas.style["imageRendering"] = "-webkit-optimize-contrast";
                 if(browser.safari) {  
                     canvas.style["imageRendering"] = "-webkit-optimize-contrast";  
                 }  
             }  
38          }          }
39          var context = canvas.getContext("2d");          var context = canvas.getContext("2d");
40          if(context["imageSmoothingEnabled"]) {          if(context["imageSmoothingEnabled"]) {
# Line 89  var Rectangle = (function () { Line 83  var Rectangle = (function () {
83      Rectangle.prototype.fit = function (point) {      Rectangle.prototype.fit = function (point) {
84          if(point.y < this.top) {          if(point.y < this.top) {
85              point.y = this.top;              point.y = this.top;
86          } else {          } else if(point.y > this.bottom) {
87              if(point.y > this.bottom) {              point.y = this.bottom;
                 point.y = this.bottom;  
             }  
88          }          }
89          if(point.x < this.left) {          if(point.x < this.left) {
90              point.x = this.left;              point.x = this.left;
91          } else {          } else if(point.x > this.right) {
92              if(point.x > this.right) {              point.x = this.right;
                 point.x = this.right;  
             }  
93          }          }
94      };      };
95      Rectangle.prototype.width = function () {      Rectangle.prototype.width = function () {
# Line 114  var Easing = (function () { Line 104  var Easing = (function () {
104      function Easing() { }      function Easing() { }
105      Easing.LINEAR = function LINEAR(t, b, c, d) {      Easing.LINEAR = function LINEAR(t, b, c, d) {
106          return c * t / d + b;          return c * t / d + b;
107      }      };
108      Easing.SWING = function SWING(t, b, c, d) {      Easing.SWING = function SWING(t, b, c, d) {
109          return c * (0.5 - Math.cos(((t / d) * Math.PI)) / 2) + b;          return c * (0.5 - Math.cos(((t / d) * Math.PI)) / 2) + b;
110      }      };
111      Easing.QUAD_EASEIN = function QUAD_EASEIN(t, b, c, d) {      Easing.QUAD_EASEIN = function QUAD_EASEIN(t, b, c, d) {
112          return c * (t /= d) * t + b;          return c * (t /= d) * t + b;
113      }      };
114      Easing.QUAD_EASEOUT = function QUAD_EASEOUT(t, b, c, d) {      Easing.QUAD_EASEOUT = function QUAD_EASEOUT(t, b, c, d) {
115          return -c * (t /= d) * (t - 2) + b;          return -c * (t /= d) * (t - 2) + b;
116      }      };
117      Easing.QUAD_EASEINOUT = function QUAD_EASEINOUT(t, b, c, d) {      Easing.QUAD_EASEINOUT = function QUAD_EASEINOUT(t, b, c, d) {
118          if((t /= d / 2) < 1) {          if((t /= d / 2) < 1) {
119              return c / 2 * t * t + b;              return c / 2 * t * t + b;
120          }          }
121          return -c / 2 * ((--t) * (t - 2) - 1) + b;          return -c / 2 * ((--t) * (t - 2) - 1) + b;
122      }      };
123      Easing.CUBIC_EASEIN = function CUBIC_EASEIN(t, b, c, d) {      Easing.CUBIC_EASEIN = function CUBIC_EASEIN(t, b, c, d) {
124          return c * (t /= d) * t * t + b;          return c * (t /= d) * t * t + b;
125      }      };
126      Easing.CUBIC_EASEOUT = function CUBIC_EASEOUT(t, b, c, d) {      Easing.CUBIC_EASEOUT = function CUBIC_EASEOUT(t, b, c, d) {
127          return c * ((t = t / d - 1) * t * t + 1) + b;          return c * ((t = t / d - 1) * t * t + 1) + b;
128      }      };
129      Easing.CUBIC_EASEINOUT = function CUBIC_EASEINOUT(t, b, c, d) {      Easing.CUBIC_EASEINOUT = function CUBIC_EASEINOUT(t, b, c, d) {
130          if((t /= d / 2) < 1) {          if((t /= d / 2) < 1) {
131              return c / 2 * t * t * t + b;              return c / 2 * t * t * t + b;
132          }          }
133          return c / 2 * ((t -= 2) * t * t + 2) + b;          return c / 2 * ((t -= 2) * t * t + 2) + b;
134      }      };
135      Easing.QUART_EASEIN = function QUART_EASEIN(t, b, c, d) {      Easing.QUART_EASEIN = function QUART_EASEIN(t, b, c, d) {
136          return c * (t /= d) * t * t * t + b;          return c * (t /= d) * t * t * t + b;
137      }      };
138      Easing.QUART_EASEOUT = function QUART_EASEOUT(t, b, c, d) {      Easing.QUART_EASEOUT = function QUART_EASEOUT(t, b, c, d) {
139          return -c * ((t = t / d - 1) * t * t * t - 1) + b;          return -c * ((t = t / d - 1) * t * t * t - 1) + b;
140      }      };
141      Easing.QUART_EASEINOUT = function QUART_EASEINOUT(t, b, c, d) {      Easing.QUART_EASEINOUT = function QUART_EASEINOUT(t, b, c, d) {
142          if((t /= d / 2) < 1) {          if((t /= d / 2) < 1) {
143              return c / 2 * t * t * t * t + b;              return c / 2 * t * t * t * t + b;
144          }          }
145          return -c / 2 * ((t -= 2) * t * t * t - 2) + b;          return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
146      }      };
147      Easing.QUINT_EASEIN = function QUINT_EASEIN(t, b, c, d) {      Easing.QUINT_EASEIN = function QUINT_EASEIN(t, b, c, d) {
148          return c * (t /= d) * t * t * t * t + b;          return c * (t /= d) * t * t * t * t + b;
149      }      };
150      Easing.QUINT_EASEOUT = function QUINT_EASEOUT(t, b, c, d) {      Easing.QUINT_EASEOUT = function QUINT_EASEOUT(t, b, c, d) {
151          return c * ((t = t / d - 1) * t * t * t * t + 1) + b;          return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
152      }      };
153      Easing.QUINT_EASEINOUT = function QUINT_EASEINOUT(t, b, c, d) {      Easing.QUINT_EASEINOUT = function QUINT_EASEINOUT(t, b, c, d) {
154          if((t /= d / 2) < 1) {          if((t /= d / 2) < 1) {
155              return c / 2 * t * t * t * t * t + b;              return c / 2 * t * t * t * t * t + b;
156          }          }
157          return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;          return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
158      }      };
159      Easing.SIN_EASEIN = function SIN_EASEIN(t, b, c, d) {      Easing.SIN_EASEIN = function SIN_EASEIN(t, b, c, d) {
160          return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;          return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
161      }      };
162      Easing.SIN_EASEOUT = function SIN_EASEOUT(t, b, c, d) {      Easing.SIN_EASEOUT = function SIN_EASEOUT(t, b, c, d) {
163          return c * Math.sin(t / d * (Math.PI / 2)) + b;          return c * Math.sin(t / d * (Math.PI / 2)) + b;
164      }      };
165      Easing.SIN_EASEINOUT = function SIN_EASEINOUT(t, b, c, d) {      Easing.SIN_EASEINOUT = function SIN_EASEINOUT(t, b, c, d) {
166          return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;          return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
167      }      };
168      Easing.CIRC_EASEIN = function CIRC_EASEIN(t, b, c, d) {      Easing.CIRC_EASEIN = function CIRC_EASEIN(t, b, c, d) {
169          return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;          return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
170      }      };
171      Easing.CIRC_EASEOUT = function CIRC_EASEOUT(t, b, c, d) {      Easing.CIRC_EASEOUT = function CIRC_EASEOUT(t, b, c, d) {
172          return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;          return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
173      }      };
174      Easing.CIRC_EASEINOUT = function CIRC_EASEINOUT(t, b, c, d) {      Easing.CIRC_EASEINOUT = function CIRC_EASEINOUT(t, b, c, d) {
175          if((t /= d / 2) < 1) {          if((t /= d / 2) < 1) {
176              return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;              return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
177          }          }
178          return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;          return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
179      }      };
180      Easing.ELASTIC_EASEIN = function ELASTIC_EASEIN(t, b, c, d, a, p) {      Easing.ELASTIC_EASEIN = function ELASTIC_EASEIN(t, b, c, d, a, p) {
181          if(t === 0) {          if(t === 0) {
182              return b;              return b;
# Line 205  var Easing = (function () { Line 195  var Easing = (function () {
195              s = p / (2 * Math.PI) * Math.asin(c / a);              s = p / (2 * Math.PI) * Math.asin(c / a);
196          }          }
197          return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;          return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
198      }      };
199      Easing.ELASTIC_EASEOUT = function ELASTIC_EASEOUT(t, b, c, d, a, p) {      Easing.ELASTIC_EASEOUT = function ELASTIC_EASEOUT(t, b, c, d, a, p) {
200          if(t === 0) {          if(t === 0) {
201              return b;              return b;
# Line 224  var Easing = (function () { Line 214  var Easing = (function () {
214              s = p / (2 * Math.PI) * Math.asin(c / a);              s = p / (2 * Math.PI) * Math.asin(c / a);
215          }          }
216          return (a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b);          return (a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b);
217      }      };
218      Easing.ELASTIC_EASEINOUT = function ELASTIC_EASEINOUT(t, b, c, d, a, p) {      Easing.ELASTIC_EASEINOUT = function ELASTIC_EASEINOUT(t, b, c, d, a, p) {
219          if(t === 0) {          if(t === 0) {
220              return b;              return b;
# Line 246  var Easing = (function () { Line 236  var Easing = (function () {
236              return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;              return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
237          }          }
238          return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;          return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
239      }      };
240      Easing.BOUNCE_EASEOUT = function BOUNCE_EASEOUT(t, b, c, d) {      Easing.BOUNCE_EASEOUT = function BOUNCE_EASEOUT(t, b, c, d) {
241          if((t /= d) < (1 / 2.75)) {          if((t /= d) < (1 / 2.75)) {
242              return c * (7.5625 * t * t) + b;              return c * (7.5625 * t * t) + b;
243            } else if(t < (2 / 2.75)) {
244                return c * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75) + b;
245            } else if(t < (2.5 / 2.75)) {
246                return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;
247          } else {          } else {
248              if(t < (2 / 2.75)) {              return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;
                 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75) + b;  
             } else {  
                 if(t < (2.5 / 2.75)) {  
                     return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;  
                 } else {  
                     return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;  
                 }  
             }  
249          }          }
250      }      };
251      Easing.BOUNCE_EASEIN = function BOUNCE_EASEIN(t, b, c, d) {      Easing.BOUNCE_EASEIN = function BOUNCE_EASEIN(t, b, c, d) {
252          return c - Easing.BOUNCE_EASEOUT(d - t, 0, c, d) + b;          return c - Easing.BOUNCE_EASEOUT(d - t, 0, c, d) + b;
253      }      };
254      Easing.BOUNCE_EASEINOUT = function BOUNCE_EASEINOUT(t, b, c, d) {      Easing.BOUNCE_EASEINOUT = function BOUNCE_EASEINOUT(t, b, c, d) {
255          if(t < d / 2) {          if(t < d / 2) {
256              return Easing.BOUNCE_EASEIN(t * 2, 0, c, d) * 0.5 + b;              return Easing.BOUNCE_EASEIN(t * 2, 0, c, d) * 0.5 + b;
257          } else {          } else {
258              return Easing.BOUNCE_EASEOUT(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;              return Easing.BOUNCE_EASEOUT(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;
259          }          }
260      }      };
261      Easing.BACK_EASEIN = function BACK_EASEIN(t, b, c, d, s) {      Easing.BACK_EASEIN = function BACK_EASEIN(t, b, c, d, s) {
262          if(s === undefined) {          if(s === undefined) {
263              s = 1.70158;              s = 1.70158;
264          }          }
265          return c * (t /= d) * t * ((s + 1) * t - s) + b;          return c * (t /= d) * t * ((s + 1) * t - s) + b;
266      }      };
267      Easing.BACK_EASEOUT = function BACK_EASEOUT(t, b, c, d, s) {      Easing.BACK_EASEOUT = function BACK_EASEOUT(t, b, c, d, s) {
268          if(s === undefined) {          if(s === undefined) {
269              s = 1.70158;              s = 1.70158;
270          }          }
271          return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;          return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
272      }      };
273      Easing.BACK_EASEINOUT = function BACK_EASEINOUT(t, b, c, d, s) {      Easing.BACK_EASEINOUT = function BACK_EASEINOUT(t, b, c, d, s) {
274          if(s === undefined) {          if(s === undefined) {
275              s = 1.70158;              s = 1.70158;
# Line 292  var Easing = (function () { Line 278  var Easing = (function () {
278              return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;              return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
279          }          }
280          return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;          return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
281      }      };
282      Easing.EXPO_EASEIN = function EXPO_EASEIN(t, b, c, d) {      Easing.EXPO_EASEIN = function EXPO_EASEIN(t, b, c, d) {
283          return (t === 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;          return (t === 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
284      }      };
285      Easing.EXPO_EASEOUT = function EXPO_EASEOUT(t, b, c, d) {      Easing.EXPO_EASEOUT = function EXPO_EASEOUT(t, b, c, d) {
286          return (t === d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;          return (t === d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
287      }      };
288      Easing.EXPO_EASEINOUT = function EXPO_EASEINOUT(t, b, c, d) {      Easing.EXPO_EASEINOUT = function EXPO_EASEINOUT(t, b, c, d) {
289          if(t === 0) {          if(t === 0) {
290              return b;              return b;
# Line 310  var Easing = (function () { Line 296  var Easing = (function () {
296              return c / 2 * Math.pow(2, 10 * (t - 1)) + b;              return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
297          }          }
298          return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;          return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
299      }      };
300      Easing.RANDOM = function RANDOM() {      Easing.RANDOM = function RANDOM() {
301          var ary = [];          var ary = [];
302          for(var i in Easing) {          for(var i in Easing) {
# Line 319  var Easing = (function () { Line 305  var Easing = (function () {
305              }              }
306          }          }
307          return Easing[ary[Math.floor(Math.random() * ary.length)]];          return Easing[ary[Math.floor(Math.random() * ary.length)]];
308      }      };
309      return Easing;      return Easing;
310  })();  })();
311  var ENTITY_OPTIONS_DEFAULT_VALUES = {  var ENTITY_OPTIONS_DEFAULT_VALUES = {
# Line 729  var Shape = (function (_super) { Line 715  var Shape = (function (_super) {
715          }          }
716          context.beginPath();          context.beginPath();
717          switch(this.type) {          switch(this.type) {
718              case ShapeType.rect: {              case ShapeType.rect:
719                  context.rect(0, 0, this.width, this.height);                  context.rect(0, 0, this.width, this.height);
720                  break;                  break;
721                case ShapeType.arc:
             }  
             case ShapeType.arc: {  
722                  var w2 = this.width / 2;                  var w2 = this.width / 2;
723                  context.arc(w2, w2, w2, 0, Shape.PI_200_PER, false);                  context.arc(w2, w2, w2, 0, Shape.PI_200_PER, false);
724                  break;                  break;
   
             }  
725          }          }
726          if(this.style == ShapeStyle.fill) {          if(this.style == ShapeStyle.fill) {
727              context.fill();              context.fill();
# Line 910  var Resource = (function () { Line 892  var Resource = (function () {
892          this.loaders["js"] = new ScriptResourceLoader(this);          this.loaders["js"] = new ScriptResourceLoader(this);
893          this.loaders["default"] = new ImageResourceLoader(this);          this.loaders["default"] = new ImageResourceLoader(this);
894      }      }
     Resource.instance = null;  
895      Resource.getInstance = function getInstance() {      Resource.getInstance = function getInstance() {
896          return (function () {          return (function () {
897              if(!Resource.instance) {              if(!Resource.instance) {
# Line 918  var Resource = (function () { Line 899  var Resource = (function () {
899              }              }
900              return Resource.instance;              return Resource.instance;
901          })();          })();
902      }      };
903      Resource.prototype.get = function (name) {      Resource.prototype.get = function (name) {
904          return this.images[name];          return this.images[name];
905      };      };
# Line 1213  var Character = (function (_super) { Line 1194  var Character = (function (_super) {
1194          this.currentAngle = angle;          this.currentAngle = angle;
1195          var rowP = Math.floor(this.charaSeq / this.charaCol) * 4;          var rowP = Math.floor(this.charaSeq / this.charaCol) * 4;
1196          switch(angle) {          switch(angle) {
1197              case Angle.up: {              case Angle.up:
1198                  rowP += (this.angleSeq ? this.angleSeq[Angle.up] : 3);                  rowP += (this.angleSeq ? this.angleSeq[Angle.up] : 3);
1199                  break;                  break;
1200                case Angle.down:
             }  
             case Angle.down: {  
1201                  rowP += (this.angleSeq ? this.angleSeq[Angle.down] : 0);                  rowP += (this.angleSeq ? this.angleSeq[Angle.down] : 0);
1202                  break;                  break;
1203                case Angle.left:
             }  
             case Angle.left: {  
1204                  rowP += (this.angleSeq ? this.angleSeq[Angle.left] : 1);                  rowP += (this.angleSeq ? this.angleSeq[Angle.left] : 1);
1205                  break;                  break;
1206                case Angle.right:
             }  
             case Angle.right: {  
1207                  rowP += (this.angleSeq ? this.angleSeq[Angle.right] : 2);                  rowP += (this.angleSeq ? this.angleSeq[Angle.right] : 2);
1208                  break;                  break;
   
             }  
1209          }          }
1210          var f = this.animeCnt * (this.charaSeq % this.charaCol) + this.charaCol * this.animeCnt * rowP;          var f = this.animeCnt * (this.charaSeq % this.charaCol) + this.charaCol * this.animeCnt * rowP;
1211          this.frame = [];          this.frame = [];
# Line 1449  var Tile = (function (_super) { Line 1422  var Tile = (function (_super) {
1422              dist.x -= src.x;              dist.x -= src.x;
1423              dist.width += src.x;              dist.width += src.x;
1424              src.x = 0;              src.x = 0;
1425          } else {          } else if((src.x + src.width) > this.width) {
1426              if((src.x + src.width) > this.width) {              var p = ((src.x + src.width) - this.width);
1427                  var p = ((src.x + src.width) - this.width);              src.width -= p;
1428                  src.width -= p;              if(src.width <= 0) {
1429                  if(src.width <= 0) {                  return;
                     return;  
                 }  
                 dist.width -= p;  
1430              }              }
1431                dist.width -= p;
1432          }          }
1433          if(src.y < 0) {          if(src.y < 0) {
1434              src.height += src.y;              src.height += src.y;
# Line 1467  var Tile = (function (_super) { Line 1438  var Tile = (function (_super) {
1438              dist.y -= src.y;              dist.y -= src.y;
1439              dist.height += src.y;              dist.height += src.y;
1440              src.y = 0;              src.y = 0;
1441          } else {          } else if((src.y + src.height) > this.height) {
1442              if((src.y + src.height) > this.height) {              var p = ((src.y + src.height) - this.height);
1443                  var p = ((src.y + src.height) - this.height);              src.height -= p;
1444                  src.height -= p;              if(src.height <= 0) {
1445                  if(src.height <= 0) {                  return;
                     return;  
                 }  
                 dist.height -= p;  
1446              }              }
1447                dist.height -= p;
1448          }          }
1449          context.drawImage(this.canvas, src.x, src.y, src.width, src.height, dist.x, dist.y, dist.width, dist.height);          context.drawImage(this.canvas, src.x, src.y, src.width, src.height, dist.x, dist.y, dist.width, dist.height);
1450      };      };
# Line 1701  var RenderTransferMode; Line 1670  var RenderTransferMode;
1670  })(RenderTransferMode || (RenderTransferMode = {}));  })(RenderTransferMode || (RenderTransferMode = {}));
1671  var GameRenderer = (function (_super) {  var GameRenderer = (function (_super) {
1672      __extends(GameRenderer, _super);      __extends(GameRenderer, _super);
1673      function GameRenderer(game, container, transferMode) {      function GameRenderer(game, container, transferMode, disableBg) {
1674          _super.call(this);          _super.call(this);
1675          this.game = game;          this.game = game;
1676          this.container = container ? container : document.getElementById("jgame");          this.container = container ? container : document.getElementById("jgame");
# Line 1718  var GameRenderer = (function (_super) { Line 1687  var GameRenderer = (function (_super) {
1687          this.handler = document.createElement("div");          this.handler = document.createElement("div");
1688          this.container.appendChild(this.handler);          this.container.appendChild(this.handler);
1689          this.changeTransferMode(transferMode ? transferMode : RenderTransferMode.Transfer);          this.changeTransferMode(transferMode ? transferMode : RenderTransferMode.Transfer);
1690          this.bg = this.fc.getImageData(0, 0, this.game.width, this.game.height);          if(!disableBg) {
1691          for(var i = 0; i < this.bg.data.length; i++) {              this.bg = this.fc.getImageData(0, 0, this.game.width, this.game.height);
1692              this.bg.data[i] = 255;              for(var i = 0; i < this.bg.data.length; i++) {
1693                    this.bg.data[i] = 255;
1694                }
1695          }          }
1696      }      }
1697      GameRenderer.prototype.changeFrontCanvasSize = function (size, offset) {      GameRenderer.prototype.changeFrontCanvasSize = function (size, offset) {
# Line 1760  var GameRenderer = (function (_super) { Line 1731  var GameRenderer = (function (_super) {
1731                  layer.reflected();                  layer.reflected();
1732                  if(this.transferMode == RenderTransferMode.Flip) {                  if(this.transferMode == RenderTransferMode.Flip) {
1733                      this.flip();                      this.flip();
1734                  } else {                  } else if(this.bc != this.fc) {
1735                      if(this.bc != this.fc) {                      this.fc.drawImage(this.buffer[1], 0, 0);
                         this.fc.drawImage(this.buffer[1], 0, 0);  
                     }  
1736                  }                  }
1737              }              }
1738          } else {          } else {
# Line 1789  var GameRenderer = (function (_super) { Line 1758  var GameRenderer = (function (_super) {
1758                  }                  }
1759                  if(this.bc != this.fc) {                  if(this.bc != this.fc) {
1760                      this.fc.drawImage(this.buffer[1], 0, 0);                      this.fc.drawImage(this.buffer[1], 0, 0);
1761                  } else {                  } else if(this.transferMode == RenderTransferMode.Flip) {
1762                      if(this.transferMode == RenderTransferMode.Flip) {                      this.flip();
                         this.flip();  
                     }  
1763                  }                  }
1764              }              }
1765          }          }
# Line 1804  var GameRenderer = (function (_super) { Line 1771  var GameRenderer = (function (_super) {
1771              this.handler.innerHTML = "";              this.handler.innerHTML = "";
1772              for(var i = 0; i < 2; i++) {              for(var i = 0; i < 2; i++) {
1773                  this.buffer[i] = window.createCanvas(this.game.width, this.game.height);                  this.buffer[i] = window.createCanvas(this.game.width, this.game.height);
1774                  ; ;                  ;
1775                  this.buffer[i].style.position = "absolute";                  this.buffer[i].style.position = "absolute";
1776                  this.buffer[i].style.zIndex = i.toString();                  this.buffer[i].style.zIndex = i.toString();
1777                  this.handler.appendChild(this.buffer[i]);                  this.handler.appendChild(this.buffer[i]);
# Line 1816  var GameRenderer = (function (_super) { Line 1783  var GameRenderer = (function (_super) {
1783                  this.buffer[1].style.width = this.frontCanvasSize.width + "px";                  this.buffer[1].style.width = this.frontCanvasSize.width + "px";
1784                  this.buffer[1].style.height = this.frontCanvasSize.height + "px";                  this.buffer[1].style.height = this.frontCanvasSize.height + "px";
1785              }              }
1786          } else {          } else if(this.transferMode == RenderTransferMode.Transfer) {
1787              if(this.transferMode == RenderTransferMode.Transfer) {              this.handler.innerHTML = "";
1788                  this.handler.innerHTML = "";              for(var i = 0; i < 2; i++) {
1789                  for(var i = 0; i < 2; i++) {                  this.buffer[i] = window.createCanvas(this.game.width, this.game.height);
1790                      this.buffer[i] = window.createCanvas(this.game.width, this.game.height);                  ;
                     ; ;  
                 }  
                 this.handler.appendChild(this.buffer[0]);  
                 this.fc = this.buffer[0].getContext("2d");  
                 this.bc = this.buffer[1].getContext("2d");  
             } else {  
                 this.handler.innerHTML = "";  
                 this.buffer[0] = window.createCanvas(this.game.width, this.game.height);  
                 ; ;  
                 this.handler.appendChild(this.buffer[0]);  
                 this.fc = this.buffer[0].getContext("2d");  
                 this.bc = this.fc;  
1791              }              }
1792                this.handler.appendChild(this.buffer[0]);
1793                this.fc = this.buffer[0].getContext("2d");
1794                this.bc = this.buffer[1].getContext("2d");
1795            } else {
1796                this.handler.innerHTML = "";
1797                this.buffer[0] = window.createCanvas(this.game.width, this.game.height);
1798                ;
1799                this.handler.appendChild(this.buffer[0]);
1800                this.fc = this.buffer[0].getContext("2d");
1801                this.bc = this.fc;
1802          }          }
1803          if(this.frontCanvasSize) {          if(this.frontCanvasSize) {
1804              this.buffer[0].style.width = this.frontCanvasSize.width + "px";              this.buffer[0].style.width = this.frontCanvasSize.width + "px";
# Line 1926  var Game = (function () { Line 1891  var Game = (function () {
1891          for(var i = 2; i < arguments.length; i++) {          for(var i = 2; i < arguments.length; i++) {
1892              if(arguments[i] instanceof HTMLElement) {              if(arguments[i] instanceof HTMLElement) {
1893                  container = arguments[i];                  container = arguments[i];
1894                } else if(typeof arguments[i] == "string") {
1895                    this.renderer = new window[arguments[i]](this, container, transferMode);
1896                    this.renderer.changeScene(this.currentScene);
1897              } else {              } else {
1898                  transferMode = arguments[i];                  transferMode = arguments[i];
1899              }              }
1900          }          }
1901          this.renderer = new GameRenderer(this, container, transferMode);          if(!this.renderer) {
1902          this.renderer.changeScene(this.currentScene);              this.renderer = new GameRenderer(this, container, transferMode);
1903                this.renderer.changeScene(this.currentScene);
1904            }
1905          this.keyboardHandler();          this.keyboardHandler();
1906          this.pointHandler();          this.pointHandler();
1907          if(document.getElementById("fps_show")) {          if(document.getElementById("fps_show")) {
# Line 2179  var Game = (function () { Line 2149  var Game = (function () {
2149              for(var i = 0; i < ary.length; i++) {              for(var i = 0; i < ary.length; i++) {
2150                  this.resource.load(ary[i], ary[i]);                  this.resource.load(ary[i], ary[i]);
2151              }              }
2152          } else {          } else if(typeof ary == "string") {
2153              if(typeof ary == "string") {              var hasLoadingScene = false;
2154                  var hasLoadingScene = false;              for(var i = 0; i < arguments.length; i++) {
2155                  for(var i = 0; i < arguments.length; i++) {                  if(typeof arguments[i] != "string") {
2156                      if(typeof arguments[i] != "string") {                      loadingScene = arguments[i];
2157                          loadingScene = arguments[i];                      hasLoadingScene = true;
2158                          hasLoadingScene = true;                  } else {
2159                      } else {                      this.resource.load(arguments[i], arguments[i]);
                         this.resource.load(arguments[i], arguments[i]);  
                     }  
                 }  
                 if(!hasLoadingScene) {  
                     loadingScene = new LoadingScene(this, this.resource);  
                 }  
             } else {  
                 for(var i in ary) {  
                     this.resource.load(i, ary[i]);  
2160                  }                  }
2161              }              }
2162                if(!hasLoadingScene) {
2163                    loadingScene = new LoadingScene(this, this.resource);
2164                }
2165            } else {
2166                for(var i in ary) {
2167                    this.resource.load(i, ary[i]);
2168                }
2169          }          }
2170          if(!loadingScene) {          if(!loadingScene) {
2171              loadingScene = new LoadingScene(this, this.resource);              loadingScene = new LoadingScene(this, this.resource);
# Line 2271  var Game = (function () { Line 2239  var Game = (function () {
2239      };      };
2240      return Game;      return Game;
2241  })();  })();
2242  ; ;  ;
2243  var FrameGame = (function (_super) {  var FrameGame = (function (_super) {
2244      __extends(FrameGame, _super);      __extends(FrameGame, _super);
2245      function FrameGame(width, height, fps) {      function FrameGame(width, height, fps) {
# Line 2390  var ParallelAction = (function (_super) Line 2358  var ParallelAction = (function (_super)
2358          _super.prototype.actionTick.call(this, evt);          _super.prototype.actionTick.call(this, evt);
2359          var self = this;          var self = this;
2360          var i, len, timeline = {          var i, len, timeline = {
2361  next: function (remaining) {              next: function (remaining) {
2362  action = self.actions[i];                  var action = self.actions[i];
2363                  self.actions.splice(i--, 1);                  self.actions.splice(i--, 1);
2364                  len = self.actions.length;                  len = self.actions.length;
2365                  self.endedActions.push(action);                  self.endedActions.push(action);
# Line 2438  for(var p in ENTITY_OPTIONS_DEFAULT_VALU Line 2406  for(var p in ENTITY_OPTIONS_DEFAULT_VALU
2406                  entity.setDrawOption(name, ret);                  entity.setDrawOption(name, ret);
2407                  return ret;                  return ret;
2408              };              };
2409          } else {          } else if(p == "transform") {
2410              if(p == "transform") {              TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {
2411                  TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {                  throw "unsupported transform tween";
2412                      throw "unsupported transform tween";              };
2413            } else if(p == "scale") {
2414                TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {
2415                    var ret = {
2416                        x: old.x + (target.x - origin.x) * ratio,
2417                        y: old.y + (target.y - origin.y) * ratio
2418                  };                  };
2419              } else {                  entity.setDrawOption(name, ret);
2420                  if(p == "scale") {                  return ret;
2421                      TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {              };
                         var ret = {  
                             x: old.x + (target.x - origin.x) * ratio,  
                             y: old.y + (target.y - origin.y) * ratio  
                         };  
                         entity.setDrawOption(name, ret);  
                         return ret;  
                     };  
                 }  
             }  
2422          }          }
2423      } else {      } else {
2424          TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {          TWEEN_DRAW_OPTION_SETTERS[p] = function (entity, name, old, target, origin, ratio) {
# Line 2967  var JGUtil = (function () { Line 2931  var JGUtil = (function () {
2931              };              };
2932          }          }
2933          return p;          return p;
2934      }      };
2935      JGUtil.getMargin = function getMargin(p) {      JGUtil.getMargin = function getMargin(p) {
2936          var a = p;          var a = p;
2937          if(a.width && a.height) {          if(a.width && a.height) {
# Line 2980  var JGUtil = (function () { Line 2944  var JGUtil = (function () {
2944              x: 0,              x: 0,
2945              y: 0              y: 0
2946          };          };
2947      }      };
2948      JGUtil.intersect = function intersect(p1, p2) {      JGUtil.intersect = function intersect(p1, p2) {
2949          var a1 = p1;          var a1 = p1;
2950          var a2 = p2;          var a2 = p2;
# Line 2990  var JGUtil = (function () { Line 2954  var JGUtil = (function () {
2954              } else {              } else {
2955                  return a2.x >= a1.x && a2.x <= (a1.x + a1.width) && a2.y >= a1.y && a2.y <= (a1.y + a1.height);                  return a2.x >= a1.x && a2.x <= (a1.x + a1.width) && a2.y >= a1.y && a2.y <= (a1.y + a1.height);
2956              }              }
2957          } else {          } else if(a2.width && a2.height) {
2958              if(a2.width && a2.height) {              return a1.x >= a2.x && a1.x <= (a2.x + a2.width) && a1.y >= a2.y && a1.y <= (a2.y + a2.height);
                 return a1.x >= a2.x && a1.x <= (a2.x + a2.width) && a1.y >= a2.y && a1.y <= (a2.y + a2.height);  
             }  
2959          }          }
2960          return p1.x == p2.x && p1.y == p2.y;          return p1.x == p2.x && p1.y == p2.y;
2961      }      };
2962      JGUtil.getDistance = function getDistance(p1, p2) {      JGUtil.getDistance = function getDistance(p1, p2) {
2963          var _p1 = JGUtil.getCenterPoint(p1);          var _p1 = JGUtil.getCenterPoint(p1);
2964          var _p2 = JGUtil.getCenterPoint(p2);          var _p2 = JGUtil.getCenterPoint(p2);
# Line 3004  var JGUtil = (function () { Line 2966  var JGUtil = (function () {
2966              x: Math.abs(_p1.x - _p2.x),              x: Math.abs(_p1.x - _p2.x),
2967              y: Math.abs(_p1.y - _p2.y)              y: Math.abs(_p1.y - _p2.y)
2968          };          };
2969      }      };
2970      JGUtil.getMovePoint = function getMovePoint(p1, p2, power, maxMove) {      JGUtil.getMovePoint = function getMovePoint(p1, p2, power, maxMove) {
2971          var _p1 = JGUtil.getCenterPoint(p1);          var _p1 = JGUtil.getCenterPoint(p1);
2972          var _p2 = JGUtil.getCenterPoint(p2);          var _p2 = JGUtil.getCenterPoint(p2);
# Line 3035  var JGUtil = (function () { Line 2997  var JGUtil = (function () {
2997              }              }
2998          }          }
2999          return ret;          return ret;
3000      }      };
3001      JGUtil.getDirectionAngle = function getDirectionAngle(p1, p2, minDistance) {      JGUtil.getDirectionAngle = function getDirectionAngle(p1, p2, minDistance) {
3002          var _p1 = JGUtil.getCenterPoint(p1);          var _p1 = JGUtil.getCenterPoint(p1);
3003          var _p2 = JGUtil.getCenterPoint(p2);          var _p2 = JGUtil.getCenterPoint(p2);
# Line 3057  var JGUtil = (function () { Line 3019  var JGUtil = (function () {
3019                  return Angle.down;                  return Angle.down;
3020              }              }
3021          }          }
3022      }      };
3023      JGUtil.getDirectionKeytype = function getDirectionKeytype(p1, p2, minDistance) {      JGUtil.getDirectionKeytype = function getDirectionKeytype(p1, p2, minDistance) {
3024          var _p1 = JGUtil.getCenterPoint(p1);          var _p1 = JGUtil.getCenterPoint(p1);
3025          var _p2 = JGUtil.getCenterPoint(p2);          var _p2 = JGUtil.getCenterPoint(p2);
# Line 3079  var JGUtil = (function () { Line 3041  var JGUtil = (function () {
3041                  return Keytype.down;                  return Keytype.down;
3042              }              }
3043          }          }
3044      }      };
3045      JGUtil.homingX = function homingX(p1, p2, speed, t) {      JGUtil.homingX = function homingX(p1, p2, speed, t) {
3046          var m1 = JGUtil.getMargin(p1);          var m1 = JGUtil.getMargin(p1);
3047          var m2 = JGUtil.getMargin(p2);          var m2 = JGUtil.getMargin(p2);
# Line 3091  var JGUtil = (function () { Line 3053  var JGUtil = (function () {
3053                  return true;                  return true;
3054              }              }
3055              return false;              return false;
3056          } else {          } else if(p1.x < x) {
3057              if(p1.x < x) {              p1.x += speed * t;
3058                  p1.x += speed * t;              if(p1.x > x) {
3059                  if(p1.x > x) {                  p1.x = x;
3060                      p1.x = x;                  return true;
                     return true;  
                 }  
                 return false;  
3061              }              }
3062                return false;
3063          }          }
3064          return true;          return true;
3065      }      };
3066      JGUtil.homingY = function homingY(p1, p2, speed, t) {      JGUtil.homingY = function homingY(p1, p2, speed, t) {
3067          var m1 = JGUtil.getMargin(p1);          var m1 = JGUtil.getMargin(p1);
3068          var m2 = JGUtil.getMargin(p2);          var m2 = JGUtil.getMargin(p2);
# Line 3114  var JGUtil = (function () { Line 3074  var JGUtil = (function () {
3074                  return true;                  return true;
3075              }              }
3076              return false;              return false;
3077          } else {          } else if(p1.y < y) {
3078              if(p1.y < y) {              p1.y += speed * t;
3079                  p1.y += speed * t;              if(p1.y > y) {
3080                  if(p1.y > y) {                  p1.y = y;
3081                      p1.y = y;                  return true;
                     return true;  
                 }  
                 return false;  
3082              }              }
3083                return false;
3084          }          }
3085          return true;          return true;
3086      }      };
3087      JGUtil.homing = function homing(p1, p2, speed, t) {      JGUtil.homing = function homing(p1, p2, speed, t) {
3088          var m1 = JGUtil.getMargin(p1);          var m1 = JGUtil.getMargin(p1);
3089          var m2 = JGUtil.getMargin(p2);          var m2 = JGUtil.getMargin(p2);
# Line 3141  var JGUtil = (function () { Line 3099  var JGUtil = (function () {
3099              } else {              } else {
3100                  xng = true;                  xng = true;
3101              }              }
3102          } else {          } else if(p1.x < p.x) {
3103              if(p1.x < p.x) {              p1.x += speed * t;
3104                  p1.x += speed * t;              if(p1.x > p.x) {
3105                  if(p1.x > p.x) {                  p1.x = p.x;
3106                      p1.x = p.x;              } else {
3107                  } else {                  xng = true;
                     xng = true;  
                 }  
3108              }              }
3109          }          }
3110          if(p1.y > p.y) {          if(p1.y > p.y) {
# Line 3158  var JGUtil = (function () { Line 3114  var JGUtil = (function () {
3114              } else {              } else {
3115                  yng = true;                  yng = true;
3116              }              }
3117          } else {          } else if(p1.y < p.y) {
3118              if(p1.y < p.y) {              p1.y += speed * t;
3119                  p1.y += speed * t;              if(p1.y > p.y) {
3120                  if(p1.y > p.y) {                  p1.y = p.y;
3121                      p1.y = p.y;              } else {
3122                  } else {                  yng = true;
                     yng = true;  
                 }  
3123              }              }
3124          }          }
3125          return xng || yng ? false : true;          return xng || yng ? false : true;
3126      }      };
3127      JGUtil.orderDrawY = function orderDrawY() {      JGUtil.orderDrawY = function orderDrawY() {
3128          var e = this.entities, len = e.length;          var e = this.entities, len = e.length;
3129          for(var i = 1; i < len; i++) {          for(var i = 1; i < len; i++) {
# Line 3182  var JGUtil = (function () { Line 3136  var JGUtil = (function () {
3136                  e[j - 1] = tmp;                  e[j - 1] = tmp;
3137              }              }
3138          }          }
3139      }      };
3140      JGUtil.createLinearGradient = function createLinearGradient(rect, colors, offsets) {      JGUtil.createLinearGradient = function createLinearGradient(rect, colors, offsets) {
3141          var canvas = window.createCanvas(1, 1);          var canvas = window.createCanvas(1, 1);
3142          var context = canvas.getContext("2d");          var context = canvas.getContext("2d");
# Line 3203  var JGUtil = (function () { Line 3157  var JGUtil = (function () {
3157              gradient.addColorStop(offsets[i], colors[i]);              gradient.addColorStop(offsets[i], colors[i]);
3158          }          }
3159          return gradient;          return gradient;
3160      }      };
3161      JGUtil.createRadialGradient = function createRadialGradient(rect, radius1, radius2, colors, offsets) {      JGUtil.createRadialGradient = function createRadialGradient(rect, radius1, radius2, colors, offsets) {
3162          var canvas = window.createCanvas(1, 1);          var canvas = window.createCanvas(1, 1);
3163          var context = canvas.getContext("2d");          var context = canvas.getContext("2d");
# Line 3226  var JGUtil = (function () { Line 3180  var JGUtil = (function () {
3180              gradient.addColorStop(offsets[i], colors[i]);              gradient.addColorStop(offsets[i], colors[i]);
3181          }          }
3182          return gradient;          return gradient;
3183      }      };
3184      JGUtil.createPattern = function createPattern(image, repeat) {      JGUtil.createPattern = function createPattern(image, repeat) {
3185          var canvas = window.createCanvas(1, 1);          var canvas = window.createCanvas(1, 1);
3186          var context = canvas.getContext("2d");          var context = canvas.getContext("2d");
3187          return context.createPattern(image, repeat == undefined ? "repeat" : repeat);          return context.createPattern(image, repeat == undefined ? "repeat" : repeat);
3188      }      };
     JGUtil.browser = null;  
3189      JGUtil.getBrowser = function getBrowser() {      JGUtil.getBrowser = function getBrowser() {
3190          if(JGUtil.browser) {          if(JGUtil.browser) {
3191              return JGUtil.browser;              return JGUtil.browser;
# Line 3247  var JGUtil = (function () { Line 3200  var JGUtil = (function () {
3200          }          }
3201          if(ret.chrome) {          if(ret.chrome) {
3202              ret.webkit = true;              ret.webkit = true;
3203          } else {          } else if(ret.webkit) {
3204              if(ret.webkit) {              ret.safari = true;
                 ret.safari = true;  
             }  
3205          }          }
3206          JGUtil.browser = ret;          JGUtil.browser = ret;
3207          return ret;          return ret;
3208      }      };
3209      JGUtil.setCrispEdges = function setCrispEdges(game, crispEdges) {      JGUtil.setCrispEdges = function setCrispEdges(game, crispEdges) {
3210          if(crispEdges) {          if(crispEdges) {
3211              window["imageSmoothingEnabled"] = crispEdges;              window["imageSmoothingEnabled"] = crispEdges;
# Line 3262  var JGUtil = (function () { Line 3213  var JGUtil = (function () {
3213              delete window["imageSmoothingEnabled"];              delete window["imageSmoothingEnabled"];
3214          }          }
3215          game.refresh();          game.refresh();
3216      }      };
3217      return JGUtil;      return JGUtil;
3218  })();  })();
3219  var Line = (function (_super) {  var Line = (function (_super) {
# Line 3304  var Line = (function (_super) { Line 3255  var Line = (function (_super) {
3255              var y = this.p[0].y + this.p[i].y;              var y = this.p[0].y + this.p[i].y;
3256              if(min.x > x) {              if(min.x > x) {
3257                  min.x = x;                  min.x = x;
3258              } else {              } else if(max.x < x) {
3259                  if(max.x < x) {                  max.x = x;
                     max.x = x;  
                 }  
3260              }              }
3261              if(min.y > y) {              if(min.y > y) {
3262                  min.y = y;                  min.y = y;
3263              } else {              } else if(max.y < y) {
3264                  if(max.y < y) {                  max.y = y;
                     max.y = y;  
                 }  
3265              }              }
3266          }          }
3267          this.width = max.x - min.x;          this.width = max.x - min.x;
# Line 3393  var Line = (function (_super) { Line 3340  var Line = (function (_super) {
3340                  x: arguments[2],                  x: arguments[2],
3341                  y: arguments[3]                  y: arguments[3]
3342              };              };
3343            } else if(arguments.length == 2) {
3344                qp = {
3345                    cp1x: cp.x,
3346                    cp1y: cp.y,
3347                    x: p.x,
3348                    y: p.y
3349                };
3350          } else {          } else {
3351              if(arguments.length == 2) {              qp = cp;
                 qp = {  
                     cp1x: cp.x,  
                     cp1y: cp.y,  
                     x: p.x,  
                     y: p.y  
                 };  
             } else {  
                 qp = cp;  
             }  
3352          }          }
3353          this.p.push(qp);          this.p.push(qp);
3354          this.updateSize();          this.updateSize();
# Line 3420  var Line = (function (_super) { Line 3365  var Line = (function (_super) {
3365                  x: arguments[4],                  x: arguments[4],
3366                  y: arguments[5]                  y: arguments[5]
3367              };              };
3368            } else if(arguments.length == 3) {
3369                bp = {
3370                    cp1x: cp1.x,
3371                    cp1y: cp1.y,
3372                    cp2x: cp2.x,
3373                    cp2y: cp2.y,
3374                    x: p.x,
3375                    y: p.y
3376                };
3377          } else {          } else {
3378              if(arguments.length == 3) {              bp = cp1;
                 bp = {  
                     cp1x: cp1.x,  
                     cp1y: cp1.y,  
                     cp2x: cp2.x,  
                     cp2y: cp2.y,  
                     x: p.x,  
                     y: p.y  
                 };  
             } else {  
                 bp = cp1;  
             }  
3379          }          }
3380          this.p.push(bp);          this.p.push(bp);
3381          this.updateSize();          this.updateSize();
# Line 3448  var Line = (function (_super) { Line 3391  var Line = (function (_super) {
3391                  y2: arguments[3],                  y2: arguments[3],
3392                  radius: arguments[4]                  radius: arguments[4]
3393              };              };
3394            } else if(arguments.length == 3) {
3395                ap = {
3396                    x: p.x,
3397                    y: p.y,
3398                    x2: p2.x,
3399                    y2: p2.y,
3400                    radius: radius
3401                };
3402          } else {          } else {
3403              if(arguments.length == 3) {              ap = p;
                 ap = {  
                     x: p.x,  
                     y: p.y,  
                     x2: p2.x,  
                     y2: p2.y,  
                     radius: radius  
                 };  
             } else {  
                 ap = p;  
             }  
3404          }          }
3405          this.p.push(ap);          this.p.push(ap);
3406          this.updateSize();          this.updateSize();
# Line 3483  var Line = (function (_super) { Line 3424  var Line = (function (_super) {
3424              var p = this.p[i];              var p = this.p[i];
3425              if(p.cp2x !== undefined) {              if(p.cp2x !== undefined) {
3426                  context.bezierCurveTo(p.cp1x, p.cp1y, p.cp2x, p.cp2y, p.x, p.y);                  context.bezierCurveTo(p.cp1x, p.cp1y, p.cp2x, p.cp2y, p.x, p.y);
3427                } else if(p.cp1x !== undefined) {
3428                    context.quadraticCurveTo(p.cp1x, p.cp1y, p.x, p.y);
3429              } else {              } else {
3430                  if(p.cp1x !== undefined) {                  if((this.p[i]).radius !== undefined) {
3431                      context.quadraticCurveTo(p.cp1x, p.cp1y, p.x, p.y);                      var ap = this.p[i];
3432                        context.arcTo(ap.x, ap.y, ap.x2, ap.y2, ap.radius);
3433                  } else {                  } else {
3434                      if((this.p[i]).radius !== undefined) {                      context.lineTo(p.x, p.y);
                         var ap = this.p[i];  
                         context.arcTo(ap.x, ap.y, ap.x2, ap.y2, ap.radius);  
                     } else {  
                         context.lineTo(p.x, p.y);  
                     }  
3435                  }                  }
3436              }              }
3437          }          }

Legend:
Removed from v.25  
changed lines
  Added in v.26

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