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 13 by tsugehara, Tue Jan 29 00:46:04 2013 UTC revision 14 by tsugehara, Wed Jan 30 02:27:06 2013 UTC
# Line 78  var Rectangle = (function () { Line 78  var Rectangle = (function () {
78              }              }
79          }          }
80      };      };
81        Rectangle.prototype.width = function () {
82            return Math.abs(this.right - this.left);
83        };
84        Rectangle.prototype.height = function () {
85            return Math.abs(this.bottom - this.top);
86        };
87      return Rectangle;      return Rectangle;
88  })();  })();
89  var Easing = (function () {  var Easing = (function () {
# Line 434  var E = (function () { Line 440  var E = (function () {
440          }          }
441          for(var i = 0; i < this.entities.length; i++) {          for(var i = 0; i < this.entities.length; i++) {
442              if(this.entities[i] == entity) {              if(this.entities[i] == entity) {
443                    if(entity.entities) {
444                        var childEntity;
445                        while(childEntity = entity.entities.pop()) {
446                            entity.removeChild(childEntity);
447                        }
448                    }
449                  this.entities.splice(i, 1);                  this.entities.splice(i, 1);
450                  entity.destroy();                  entity.destroy();
451                  return true;                  return true;
# Line 1537  var Renderer = (function () { Line 1549  var Renderer = (function () {
1549                  this.useDrawOption(entity, c);                  this.useDrawOption(entity, c);
1550              }              }
1551              entity.draw(area, c);              entity.draw(area, c);
1552                if(entity.entities) {
1553                    for(var i = 0; i < entity.entities.length; i++) {
1554                        this.renderEntity(new Area(0, 0, 0, 0), entity.entities[i], c);
1555                    }
1556                }
1557              c.restore();              c.restore();
1558          }          }
1559      };      };
# Line 2687  var Timeline = (function () { Line 2704  var Timeline = (function () {
2704              this.setDrawOption("globalAlpha", 1);              this.setDrawOption("globalAlpha", 1);
2705          });          });
2706      };      };
2707        Timeline.prototype.resizeTo = function (size, time, easing) {
2708            if(typeof easing === "number") {
2709                return this.tween({
2710                    width: arguments[0],
2711                    height: arguments[1],
2712                    time: arguments[2],
2713                    easing: arguments[3]
2714                });
2715            }
2716            return this.tween({
2717                width: size,
2718                height: size,
2719                time: time,
2720                easing: easing
2721            });
2722        };
2723        Timeline.prototype.resizeBy = function (size, time, easing) {
2724            if(typeof easing === "number") {
2725                return this.tween({
2726                    width: function () {
2727                        return this.width + arguments[0];
2728                    },
2729                    height: function () {
2730                        return this.height + arguments[1];
2731                    },
2732                    time: arguments[2],
2733                    easing: arguments[3]
2734                });
2735            }
2736            return this.tween({
2737                width: function () {
2738                    return this.width + size;
2739                },
2740                height: function () {
2741                    return this.height + size;
2742                },
2743                time: time,
2744                easing: easing
2745            });
2746        };
2747      Timeline.prototype.scaleTo = function (scale, time, easing) {      Timeline.prototype.scaleTo = function (scale, time, easing) {
2748          if(typeof easing === "number") {          if(typeof easing === "number") {
2749              return this.tween({              return this.tween({
# Line 2986  var JGUtil = (function () { Line 3043  var JGUtil = (function () {
3043      }      }
3044      return JGUtil;      return JGUtil;
3045  })();  })();
3046    var Line = (function (_super) {
3047        __extends(Line, _super);
3048        function Line(pos, line, color, width) {
3049            _super.call(this);
3050            this.x = pos.x;
3051            this.y = pos.y;
3052            this.p = new Array();
3053            this.p.push({
3054                x: pos.x,
3055                y: pos.y
3056            });
3057            this.p.push({
3058                x: line.x,
3059                y: line.y
3060            });
3061            this.width = line.x;
3062            this.height = line.y;
3063            if(color) {
3064                this.setColor(color);
3065            }
3066            if(width) {
3067                this.setLineWidth(width);
3068            }
3069        }
3070        Line.prototype.setColor = function (color) {
3071            this.setDrawOption("strokeStyle", color);
3072            return this;
3073        };
3074        Line.prototype.getColor = function () {
3075            return this.getDrawOption("strokeStyle");
3076        };
3077        Line.prototype.setLineWidth = function (width) {
3078            this.setDrawOption("lineWidth", width);
3079            return this;
3080        };
3081        Line.prototype.getLineWidth = function () {
3082            return this.getDrawOption("lineWidth");
3083        };
3084        Line.prototype.setLineCap = function (lineCap) {
3085            this.setDrawOption("lineCap", lineCap);
3086            return this;
3087        };
3088        Line.prototype.getLineCap = function () {
3089            return this.getDrawOption("lineCap");
3090        };
3091        Line.prototype.setLineJoin = function (lineJoin) {
3092            this.setDrawOption("lineJoin", lineJoin);
3093            return this;
3094        };
3095        Line.prototype.getLineJoin = function () {
3096            return this.getDrawOption("lineJoin");
3097        };
3098        Line.prototype.setMiterLimit = function (miterLimit) {
3099            this.setDrawOption("miterLimit", miterLimit);
3100            return this;
3101        };
3102        Line.prototype.getMiterLimit = function () {
3103            return this.getDrawOption("miterLimit");
3104        };
3105        Line.prototype.addLine = function (line) {
3106            this.p.push(line);
3107        };
3108        Line.prototype.draw = function (area, context) {
3109            context.beginPath();
3110            context.moveTo(0, 0);
3111            for(var i = 1; i < this.p.length; i++) {
3112                context.lineTo(this.p[i].x, this.p[i].y);
3113            }
3114            context.stroke();
3115        };
3116        return Line;
3117    })(E);

Legend:
Removed from v.13  
changed lines
  Added in v.14

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