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 111 by tsugehara, Mon Jul 29 08:41:06 2013 UTC revision 112 by tsugehara, Mon Jul 29 10:06:27 2013 UTC
# Line 1006  var jg; Line 1006  var jg;
1006              return this.sound + url;              return this.sound + url;
1007          };          };
1008          ResourceStructure.Default = new ResourceStructure("img/", "sound/");          ResourceStructure.Default = new ResourceStructure("img/", "sound/");
1009    
1010          ResourceStructure.Plain = new ResourceStructure("", "");          ResourceStructure.Plain = new ResourceStructure("", "");
1011          return ResourceStructure;          return ResourceStructure;
1012      })();      })();
# Line 2372  var jg; Line 2373  var jg;
2373          return InputEvent;          return InputEvent;
2374      })();      })();
2375      jg.InputEvent = InputEvent;      jg.InputEvent = InputEvent;
2376    
2377      var InputKeyboardEvent = (function (_super) {      var InputKeyboardEvent = (function (_super) {
2378          __extends(InputKeyboardEvent, _super);          __extends(InputKeyboardEvent, _super);
2379          function InputKeyboardEvent(action, key, e) {          function InputKeyboardEvent(action, key, e) {
# Line 2381  var jg; Line 2383  var jg;
2383          return InputKeyboardEvent;          return InputKeyboardEvent;
2384      })(InputEvent);      })(InputEvent);
2385      jg.InputKeyboardEvent = InputKeyboardEvent;      jg.InputKeyboardEvent = InputKeyboardEvent;
2386    
2387      var InputPointEvent = (function (_super) {      var InputPointEvent = (function (_super) {
2388          __extends(InputPointEvent, _super);          __extends(InputPointEvent, _super);
2389          function InputPointEvent(action, e, point) {          function InputPointEvent(action, e, point) {
# Line 2935  var jg; Line 2938  var jg;
2938              this.eventQueue.push(new jg.InputPointEvent(jg.InputEventAction.Down, e, this.getOffsetByEvent(e)));              this.eventQueue.push(new jg.InputPointEvent(jg.InputEventAction.Down, e, this.getOffsetByEvent(e)));
2939              e.preventDefault();              e.preventDefault();
2940          };          };
2941    
2942          Game.prototype.ontouchstart = function (e) {          Game.prototype.ontouchstart = function (e) {
2943              var touches = e.changedTouches;              var touches = e.changedTouches;
2944              this.isPointDown = true;              this.isPointDown = true;
# Line 2952  var jg; Line 2956  var jg;
2956    
2957              e.preventDefault();              e.preventDefault();
2958          };          };
2959    
2960          Game.prototype.ontouchmove = function (e) {          Game.prototype.ontouchmove = function (e) {
2961              if (!this.isPointDown)              if (!this.isPointDown)
2962                  return;                  return;
# Line 2973  var jg; Line 2978  var jg;
2978    
2979              e.preventDefault();              e.preventDefault();
2980          };          };
2981    
2982          Game.prototype.ontouchend = function (e) {          Game.prototype.ontouchend = function (e) {
2983              if (!this.isPointDown)              if (!this.isPointDown)
2984                  return;                  return;
# Line 3002  var jg; Line 3008  var jg;
3008              } catch (ex) {              } catch (ex) {
3009              }              }
3010          };          };
3011    
3012          Game.prototype.disablePointHandler = function () {          Game.prototype.disablePointHandler = function () {
3013              this.dragParam = null;              this.dragParam = null;
3014              try  {              try  {
# Line 3050  var jg; Line 3057  var jg;
3057              } catch (ex) {              } catch (ex) {
3058              }              }
3059          };          };
3060    
3061          Game.prototype.disableKeyboardHandler = function () {          Game.prototype.disableKeyboardHandler = function () {
3062              if (jg.JGUtil.getIdProxy(this.id, this.onkeydown, this)) {              if (jg.JGUtil.getIdProxy(this.id, this.onkeydown, this)) {
3063                  document.removeEventListener("keydown", jg.JGUtil.getIdProxy(this.id, this.onkeydown, this), false);                  document.removeEventListener("keydown", jg.JGUtil.getIdProxy(this.id, this.onkeydown, this), false);
# Line 5130  var jg; Line 5138  var jg;
5138          }          }
5139          return IdData;          return IdData;
5140      })();      })();
5141    
5142      var ProxyData = (function () {      var ProxyData = (function () {
5143          function ProxyData(func, self, proxy) {          function ProxyData(func, self, proxy) {
5144              this.func = func;              this.func = func;
# Line 5189  var jg; Line 5198  var jg;
5198              this.setDrawOption("strokeStyle", color);              this.setDrawOption("strokeStyle", color);
5199              return this;              return this;
5200          };          };
5201    
5202          Line.prototype.getColor = function () {          Line.prototype.getColor = function () {
5203              return this.getDrawOption("strokeStyle");              return this.getDrawOption("strokeStyle");
5204          };          };
# Line 5197  var jg; Line 5207  var jg;
5207              this.setDrawOption("fillStyle", color);              this.setDrawOption("fillStyle", color);
5208              return this;              return this;
5209          };          };
5210    
5211          Line.prototype.getFillColor = function () {          Line.prototype.getFillColor = function () {
5212              return this.getDrawOption("fillStyle");              return this.getDrawOption("fillStyle");
5213          };          };
# Line 5205  var jg; Line 5216  var jg;
5216              this.setDrawOption("lineWidth", width);              this.setDrawOption("lineWidth", width);
5217              return this;              return this;
5218          };          };
5219    
5220          Line.prototype.getLineWidth = function () {          Line.prototype.getLineWidth = function () {
5221              return this.getDrawOption("lineWidth");              return this.getDrawOption("lineWidth");
5222          };          };
# Line 5213  var jg; Line 5225  var jg;
5225              this.setDrawOption("lineCap", lineCap);              this.setDrawOption("lineCap", lineCap);
5226              return this;              return this;
5227          };          };
5228    
5229          Line.prototype.getLineCap = function () {          Line.prototype.getLineCap = function () {
5230              return this.getDrawOption("lineCap");              return this.getDrawOption("lineCap");
5231          };          };
# Line 5221  var jg; Line 5234  var jg;
5234              this.setDrawOption("lineJoin", lineJoin);              this.setDrawOption("lineJoin", lineJoin);
5235              return this;              return this;
5236          };          };
5237    
5238          Line.prototype.getLineJoin = function () {          Line.prototype.getLineJoin = function () {
5239              return this.getDrawOption("lineJoin");              return this.getDrawOption("lineJoin");
5240          };          };
# Line 5229  var jg; Line 5243  var jg;
5243              this.setDrawOption("miterLimit", miterLimit);              this.setDrawOption("miterLimit", miterLimit);
5244              return this;              return this;
5245          };          };
5246    
5247          Line.prototype.getMiterLimit = function () {          Line.prototype.getMiterLimit = function () {
5248              return this.getDrawOption("miterLimit");              return this.getDrawOption("miterLimit");
5249          };          };
# Line 5788  var jg; Line 5803  var jg;
5803              this.padding = padding ? padding : new jg.Rectangle(8, 8, 8, 8);              this.padding = padding ? padding : new jg.Rectangle(8, 8, 8, 8);
5804              this.entities = [];              this.entities = [];
5805              if (bgImage) {              if (bgImage) {
5806                  var bg;                  var bg = (bgImage instanceof jg.E) ? bgImage : new jg.Sprite(bgImage);
                 if (bgImage instanceof jg.E) {  
                     bg = bgImage;  
                 } else {  
                     bg = new jg.Sprite(bgImage);  
                 }  
5807                  this.setBg(this.createBgImage(bg));                  this.setBg(this.createBgImage(bg));
5808              } else {              } else {
5809                  this.defaultSkin();                  this.defaultSkin();
# Line 5802  var jg; Line 5812  var jg;
5812          UIWindow.prototype.getBg = function () {          UIWindow.prototype.getBg = function () {
5813              return this.entities[0];              return this.entities[0];
5814          };          };
5815    
5816          UIWindow.prototype.setBg = function (bg) {          UIWindow.prototype.setBg = function (bg) {
5817              if (this.bg)              if (this.bg)
5818                  this.bg.remove();                  this.bg.remove();
# Line 5812  var jg; Line 5823  var jg;
5823          UIWindow.prototype.createBgImage = function (e, srcPadding, buf) {          UIWindow.prototype.createBgImage = function (e, srcPadding, buf) {
5824              if (!buf)              if (!buf)
5825                  var buf = new jg.BufferedRenderer(e);                  var buf = new jg.BufferedRenderer(e);
5826                if (srcPadding === undefined)
5827                    srcPadding = this.padding;
5828              buf.renderUnit(e);              buf.renderUnit(e);
5829              if (buf.filter)              if (buf.filter)
5830                  buf.applyFilter(buf.c, buf.size);                  buf.applyFilter(buf.c, buf.size);
# Line 5820  var jg; Line 5833  var jg;
5833              bg.height = this.height;              bg.height = this.height;
5834              bg.entities = [];              bg.entities = [];
5835    
5836              var s4_1 = buf.createSprite({ x: 0, y: 0, width: this.padding.left, height: this.padding.top });              var s4_1 = buf.createSprite({ x: 0, y: 0, width: srcPadding.left, height: srcPadding.top });
5837              s4_1.moveTo(0, 0);              s4_1.moveTo(0, 0);
5838              bg.append(s4_1);              bg.append(s4_1);
5839              var s4_2 = buf.createSprite({ x: e.width - this.padding.right, y: 0, width: this.padding.right, height: this.padding.top });              var s4_2 = buf.createSprite({ x: e.width - srcPadding.right, y: 0, width: srcPadding.right, height: srcPadding.top });
5840              s4_2.moveTo(this.width - this.padding.right, 0);              s4_2.moveTo(this.width - srcPadding.right, 0);
5841              bg.append(s4_2);              bg.append(s4_2);
5842              var s4_3 = buf.createSprite({ x: e.width - this.padding.right, y: e.height - this.padding.bottom, width: this.padding.right, height: this.padding.bottom });              var s4_3 = buf.createSprite({ x: e.width - srcPadding.right, y: e.height - srcPadding.bottom, width: srcPadding.right, height: srcPadding.bottom });
5843              s4_3.moveTo(this.width - this.padding.right, this.height - this.padding.bottom);              s4_3.moveTo(this.width - srcPadding.right, this.height - srcPadding.bottom);
5844              bg.append(s4_3);              bg.append(s4_3);
5845              var s4_4 = buf.createSprite({ x: 0, y: e.height - this.padding.bottom, width: this.padding.left, height: this.padding.bottom });              var s4_4 = buf.createSprite({ x: 0, y: e.height - srcPadding.bottom, width: srcPadding.left, height: srcPadding.bottom });
5846              s4_4.moveTo(0, this.height - this.padding.bottom);              s4_4.moveTo(0, this.height - srcPadding.bottom);
5847              bg.append(s4_4);              bg.append(s4_4);
5848    
5849              var h4_1 = buf.createSprite({              var h4_1 = buf.createSprite({
5850                  x: this.padding.left,                  x: srcPadding.left,
5851                  y: 0,                  y: 0,
5852                  width: e.width - this.padding.right - this.padding.left,                  width: e.width - srcPadding.right - srcPadding.left,
5853                  height: this.padding.top                  height: srcPadding.top
5854              });              });
5855              h4_1.moveTo(this.padding.left, 0);              h4_1.moveTo(srcPadding.left, 0);
5856              h4_1.width = this.width - this.padding.right - this.padding.left;              h4_1.width = this.width - srcPadding.right - srcPadding.left;
5857              bg.append(h4_1);              bg.append(h4_1);
5858              var h4_2 = buf.createSprite({              var h4_2 = buf.createSprite({
5859                  x: e.width - this.padding.right,                  x: e.width - srcPadding.right,
5860                  y: this.padding.top,                  y: srcPadding.top,
5861                  width: this.padding.right,                  width: srcPadding.right,
5862                  height: e.height - this.padding.top - this.padding.bottom                  height: e.height - srcPadding.top - srcPadding.bottom
5863              });              });
5864              h4_2.moveTo(this.width - this.padding.right, this.padding.top);              h4_2.moveTo(this.width - srcPadding.right, srcPadding.top);
5865              h4_2.height = this.height - this.padding.top - this.padding.bottom;              h4_2.height = this.height - srcPadding.top - srcPadding.bottom;
5866              bg.append(h4_2);              bg.append(h4_2);
5867              var h4_3 = buf.createSprite({              var h4_3 = buf.createSprite({
5868                  x: this.padding.left,                  x: srcPadding.left,
5869                  y: e.height - this.padding.bottom,                  y: e.height - srcPadding.bottom,
5870                  width: e.width - this.padding.right - this.padding.left,                  width: e.width - srcPadding.right - srcPadding.left,
5871                  height: this.padding.bottom                  height: srcPadding.bottom
5872              });              });
5873              h4_3.moveTo(this.padding.left, this.height - this.padding.bottom);              h4_3.moveTo(srcPadding.left, this.height - srcPadding.bottom);
5874              h4_3.width = this.width - this.padding.right - this.padding.left;              h4_3.width = this.width - srcPadding.right - srcPadding.left;
5875              bg.append(h4_3);              bg.append(h4_3);
5876              var h4_4 = buf.createSprite({              var h4_4 = buf.createSprite({
5877                  x: 0,                  x: 0,
5878                  y: this.padding.top,                  y: srcPadding.top,
5879                  width: this.padding.left,                  width: srcPadding.left,
5880                  height: e.height - this.padding.top - this.padding.bottom                  height: e.height - srcPadding.top - srcPadding.bottom
5881              });              });
5882              h4_4.moveTo(0, this.padding.top);              h4_4.moveTo(0, srcPadding.top);
5883              h4_4.height = this.height - this.padding.top - this.padding.bottom;              h4_4.height = this.height - srcPadding.top - srcPadding.bottom;
5884              bg.append(h4_4);              bg.append(h4_4);
5885    
5886              var center = buf.createSprite({              var center = buf.createSprite({
5887                  x: this.padding.left,                  x: srcPadding.left,
5888                  y: this.padding.top,                  y: srcPadding.top,
5889                  width: e.width - this.padding.left - this.padding.right,                  width: e.width - srcPadding.left - srcPadding.right,
5890                  height: e.height - this.padding.top - this.padding.bottom                  height: e.height - srcPadding.top - srcPadding.bottom
5891              });              });
5892              center.moveTo(this.padding.left, this.padding.top);              center.moveTo(srcPadding.left, srcPadding.top);
5893              center.width = this.width - this.padding.left - this.padding.right;              center.width = this.width - srcPadding.left - srcPadding.right;
5894              center.height = this.height - this.padding.top - this.padding.bottom;              center.height = this.height - srcPadding.top - srcPadding.bottom;
5895              bg.append(center);              bg.append(center);
5896    
5897              return bg.createSprite();              return bg.createSprite();
# Line 5953  var jg; Line 5966  var jg;
5966          MessageWindow.prototype.getNextCursor = function () {          MessageWindow.prototype.getNextCursor = function () {
5967              return this.nextCursor;              return this.nextCursor;
5968          };          };
5969    
5970          MessageWindow.prototype.setNextCursor = function (cursor) {          MessageWindow.prototype.setNextCursor = function (cursor) {
5971              this.nextCursor = cursor;              this.nextCursor = cursor;
5972          };          };
# Line 5966  var jg; Line 5980  var jg;
5980              this.isReaded = false;              this.isReaded = false;
5981              return this.scriptOffset;              return this.scriptOffset;
5982          };          };
5983    
5984          MessageWindow.prototype.setScript = function (script, offset) {          MessageWindow.prototype.setScript = function (script, offset) {
5985              var textArea = this.textArea;              var textArea = this.textArea;
5986              this.script = script;              this.script = script;
# Line 6002  var jg; Line 6017  var jg;
6017                  this.tl().fadeOut(200); else                  this.tl().fadeOut(200); else
6018                  _super.prototype.hide.call(this);                  _super.prototype.hide.call(this);
6019          };          };
6020    
6021          MessageWindow.prototype.show = function (fade) {          MessageWindow.prototype.show = function (fade) {
6022              if (fade)              if (fade)
6023                  this.tl().fadeIn(200); else                  this.tl().fadeIn(200); else
6024                  _super.prototype.show.call(this);                  _super.prototype.show.call(this);
6025          };          };
6026    
6027          MessageWindow.prototype.showText = function () {          MessageWindow.prototype.showText = function () {
6028              this.textArea.startAnimation();              this.textArea.startAnimation();
6029          };          };
6030    
6031          MessageWindow.prototype.fastMode = function () {          MessageWindow.prototype.fastMode = function () {
6032              this.textArea.animeSpeed = this.fastSpeed;              this.textArea.animeSpeed = this.fastSpeed;
6033          };          };
6034    
6035          MessageWindow.prototype.normalMode = function () {          MessageWindow.prototype.normalMode = function () {
6036              this.textArea.animeSpeed = this.normalSpeed;              this.textArea.animeSpeed = this.normalSpeed;
6037          };          };
6038    
6039          MessageWindow.prototype.showAll = function () {          MessageWindow.prototype.showAll = function () {
6040              this.textArea.showAll();              this.textArea.showAll();
6041          };          };
6042    
6043          MessageWindow.prototype.next = function () {          MessageWindow.prototype.next = function () {
6044              if (this.scriptOffset < 0)              if (this.scriptOffset < 0)
6045                  return false;                  return false;
# Line 6040  var jg; Line 6061  var jg;
6061              old.tl().moveBy(0, -textArea.height, time).removeFromScene();              old.tl().moveBy(0, -textArea.height, time).removeFromScene();
6062              textArea.tl().moveBy(0, -movePoint, (movePoint / textArea.height) * time);              textArea.tl().moveBy(0, -movePoint, (movePoint / textArea.height) * time);
6063          };          };
6064    
6065          MessageWindow.prototype.oldFadeOut = function (time) {          MessageWindow.prototype.oldFadeOut = function (time) {
6066              if (time === undefined)              if (time === undefined)
6067                  time = 500;                  time = 500;

Legend:
Removed from v.111  
changed lines
  Added in v.112

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