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 108 by tsugehara, Thu Jul 11 08:19:32 2013 UTC revision 109 by tsugehara, Sat Jul 27 09:50:09 2013 UTC
# Line 43  var jg; Line 43  var jg;
43          Keytype[Keytype["Esc"] = 6] = "Esc";          Keytype[Keytype["Esc"] = 6] = "Esc";
44      })(jg.Keytype || (jg.Keytype = {}));      })(jg.Keytype || (jg.Keytype = {}));
45      var Keytype = jg.Keytype;      var Keytype = jg.Keytype;
46    
47      (function (ShapeStyle) {      (function (ShapeStyle) {
48          ShapeStyle[ShapeStyle["Unknown"] = 0] = "Unknown";          ShapeStyle[ShapeStyle["Unknown"] = 0] = "Unknown";
49    
50          ShapeStyle[ShapeStyle["Stroke"] = 1] = "Stroke";          ShapeStyle[ShapeStyle["Stroke"] = 1] = "Stroke";
51    
52          ShapeStyle[ShapeStyle["Fill"] = 2] = "Fill";          ShapeStyle[ShapeStyle["Fill"] = 2] = "Fill";
53      })(jg.ShapeStyle || (jg.ShapeStyle = {}));      })(jg.ShapeStyle || (jg.ShapeStyle = {}));
54      var ShapeStyle = jg.ShapeStyle;      var ShapeStyle = jg.ShapeStyle;
55    
56      (function (ShapeType) {      (function (ShapeType) {
57          ShapeType[ShapeType["Unknown"] = 0] = "Unknown";          ShapeType[ShapeType["Unknown"] = 0] = "Unknown";
58          ShapeType[ShapeType["Rect"] = 1] = "Rect";          ShapeType[ShapeType["Rect"] = 1] = "Rect";
# Line 754  var jg; Line 757  var jg;
757    
758          E.prototype.show = function () {          E.prototype.show = function () {
759              this.opacity = 1;              this.opacity = 1;
760                this.updated();
761          };          };
762          E.prototype.hide = function () {          E.prototype.hide = function () {
763              this.opacity = 0;              this.opacity = 0;
764                this.updated();
765          };          };
766          return E;          return E;
767      })();      })();
# Line 806  var jg; Line 811  var jg;
811          Shape.prototype.setLineWidth = function (width) {          Shape.prototype.setLineWidth = function (width) {
812              this.setDrawOption("lineWidth", width);              this.setDrawOption("lineWidth", width);
813          };          };
814    
815          Shape.prototype.getLineWidth = function () {          Shape.prototype.getLineWidth = function () {
816              return this.getDrawOption("lineWidth");              return this.getDrawOption("lineWidth");
817          };          };
# Line 815  var jg; Line 821  var jg;
821                  this.setDrawOption("strokeStyle", color); else                  this.setDrawOption("strokeStyle", color); else
822                  this.setDrawOption("fillStyle", color);                  this.setDrawOption("fillStyle", color);
823          };          };
824    
825          Shape.prototype.getColor = function () {          Shape.prototype.getColor = function () {
826              if (this.style == jg.ShapeStyle.Stroke)              if (this.style == jg.ShapeStyle.Stroke)
827                  return this.getDrawOption("strokeStyle"); else                  return this.getDrawOption("strokeStyle"); else
# Line 2030  var jg; Line 2037  var jg;
2037              var th = this.tile.tileHeight;              var th = this.tile.tileHeight;
2038              c.drawImage(this.image, (chip % this.sep) * tw, Math.floor(chip / this.sep) * th, tw, th, x * tw, y * th, tw, th);              c.drawImage(this.image, (chip % this.sep) * tw, Math.floor(chip / this.sep) * th, tw, th, x * tw, y * th, tw, th);
2039          };          };
2040    
2041            ChipSet.prototype.getChips = function () {
2042                var len = this.count();
2043                var sprite = new jg.Sprite(this.image);
2044                var buf = new jg.BufferedRenderer(sprite);
2045                var ret = [];
2046                var w = this.tile.tileWidth;
2047                var h = this.tile.tileHeight;
2048                var area = {
2049                    x: 0,
2050                    y: 0,
2051                    width: w,
2052                    height: h
2053                };
2054                buf.renderUnit(sprite);
2055    
2056                for (var i = 0; i < len; i++) {
2057                    ret.push(buf.createSprite({
2058                        x: (i % this.sep) * w,
2059                        y: Math.floor(i / this.sep) * h,
2060                        width: w,
2061                        height: h
2062                    }, area, area));
2063                }
2064                return ret;
2065            };
2066          return ChipSet;          return ChipSet;
2067      })();      })();
2068      jg.ChipSet = ChipSet;      jg.ChipSet = ChipSet;
# Line 2190  var jg; Line 2223  var jg;
2223    
2224              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);
2225          };          };
2226    
2227            Tile.prototype.getChips = function () {
2228                var ret = [];
2229                var len = this.chips.length;
2230                for (var i = 0; i < len; i++)
2231                    ret = ret.concat(this.chips[i].getChips());
2232                return ret;
2233            };
2234          return Tile;          return Tile;
2235      })(jg.E);      })(jg.E);
2236      jg.Tile = Tile;      jg.Tile = Tile;

Legend:
Removed from v.108  
changed lines
  Added in v.109

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