注册会员 登录
Project1 返回首页

墨凌羽的个人空间 https://rpg.blue/?324060 [收藏] [复制] [分享] [RSS]

日志

某大坑之一

已有 286 次阅读2015-11-26 00:56 |个人分类:MV

PictureBox = {
new : function (srcBitmap,x,y,width,height, type) {
var that = this;
this
.attr_accessor('bitmap', function(){that.createSprite(that)})
.attr_accessor('x', function() {that.sprite.x = that._x})
.attr_accessor('y', function() {that.sprite.y = that._y})
.attr_accessor('width', function(){that.createSprite(that)})
.attr_accessor('height', function(){that.createSprite(that)})
.attr_accessor('type', function(){that.createSprite(that)});
this._bitmap = srcBitmap;
this._x = x || 0;
this._y = y || 0;
this._width = width || 0;
this._height = height || 0;
this._type = type || 0;
this.sprite = new Sprite(this._bitmap);
this.sprite.x = this._x;
this.sprite.y = this._y;
this.createSprite(that);
return this;
},
createSprite: function (that) {
if(that._type === 0) {
that.sprite.width = that._width;
that.sprite.height = that._height;
} else if (that._type === 1) {
var x = that._width / that.sprite.width;
var y = that._height / that.sprite.height;
that.sprite.scale = new Point(x,y);
that.sprite.x = that._x;
that.sprite.y = that._y;
}
},
setType : function (type) {
this._type = type;
this.createSprite(this);
},
update : function () {}
}
试了下直接基于原型的写法,蛮有趣的
开了一个坑。这是其中一部分【还有个Button是按伪类继承,而且是直接继承Sprite。。。打算重写】
计划中的还有一个InputBox和ProgressBar
并不能算是GUI 只是简单的显示容器和特定的方法的封装
至于GUI的坑。。。估计得等到魔改完MV了
顺便吐槽一句 MV简直神坑

鸡蛋

鲜花

评论 (0 个评论)

facelist doodle 涂鸦笔

您需要登录后才可以评论 登录 | 注册会员

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-17 05:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

返回顶部