赞 | 97 |
VIP | 149 |
好人卡 | 1 |
积分 | 18 |
经验 | 73418 |
最后登录 | 2022-10-19 |
在线时间 | 2524 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1759
- 在线时间
- 2524 小时
- 注册时间
- 2010-10-12
- 帖子
- 1454
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 刺夜之枪 于 2016-4-5 20:07 编辑
RUBY:
b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
我试着改写了一下,但是完全没有用:
MV:
b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
我经过一段时间的DEBUG后发现,好像问题就出现在上面这行里。。。
无论我怎么改都无解。。。
原来的语境:
Ruby:
def self.redraw b = @@sprite.bitmap b.clear b2 = Bitmap.new(b.width,640) y = b.height for n in $game_system.notifications.reverse[0,@@limit] x = 0 y2 = 0 b2.font = n.font h = b2.text_size(n.msg).height n.msg.split('').each do |char| if (x + b2.text_size(char).width) > b2.width x = 0 y2 += h end # b2.draw_text(x,y2,b2.width,h,char) #sailcat_draw_text if $game_temp.inefs b2.sailcat_draw_text(x,y2,b2.width,h,char) else b2.draw_text(x,y2,b2.width,h,char) end x += b2.text_size(char).width + 2 end y -= (y2 + h) b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h)) b2.clear y -= 4 end b2.dispose end
def self.redraw
b = @@sprite.bitmap
b.clear
b2 = Bitmap.new(b.width,640)
y = b.height
for n in $game_system.notifications.reverse[0,@@limit]
x = 0
y2 = 0
b2.font = n.font
h = b2.text_size(n.msg).height
n.msg.split('').each do |char|
if (x + b2.text_size(char).width) > b2.width
x = 0
y2 += h
end
# b2.draw_text(x,y2,b2.width,h,char)
#sailcat_draw_text
if $game_temp.inefs
b2.sailcat_draw_text(x,y2,b2.width,h,char)
else
b2.draw_text(x,y2,b2.width,h,char)
end
x += b2.text_size(char).width + 2
end
y -= (y2 + h)
b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
b2.clear
y -= 4
end
b2.dispose
end
Mv:
Notification.redraw = function () { //console.log("redraw called"); var b = this._sprite.bitmap; b.clear(); var b2 = new Bitmap(b.width,Graphics.boxHeight); var y = b.height; var self = this; $gameSystem.notifications.slice().reverse().slice(0,this._limit).forEach(function(n) { var x = 0; var y2 = 0; //alert(self._fontSize); var h = self._fontSize;//b2.measureTextWidth(n); n.split('').forEach(function(char) { //console.log(char); //alert(b2.measureTextWidth(char)); if (x + b2.measureTextWidth(char) > b2.width) { x = 0; y2 += h; } b2.drawText(x,y2,b2.width,h,char,'left'); x += b2.measureTextWidth(char) + 2; }); y -= (y2+h); //b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h)) //(source, sx, sy, sw, sh, dx, dy, dw, dh) alert(b.width); b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h); b2.clear(); y -= 4; }); //b2.dispose; };
Notification.redraw = function () {
//console.log("redraw called");
var b = this._sprite.bitmap;
b.clear();
var b2 = new Bitmap(b.width,Graphics.boxHeight);
var y = b.height;
var self = this;
$gameSystem.notifications.slice().reverse().slice(0,this._limit).forEach(function(n) {
var x = 0;
var y2 = 0;
//alert(self._fontSize);
var h = self._fontSize;//b2.measureTextWidth(n);
n.split('').forEach(function(char) {
//console.log(char);
//alert(b2.measureTextWidth(char));
if (x + b2.measureTextWidth(char) > b2.width) {
x = 0;
y2 += h;
}
b2.drawText(x,y2,b2.width,h,char,'left');
x += b2.measureTextWidth(char) + 2;
});
y -= (y2+h);
//b.blt(0,y,b2,Rect.new(0,0,b2.width,y2 + h))
//(source, sx, sy, sw, sh, dx, dy, dw, dh)
alert(b.width);
b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
b2.clear();
y -= 4;
});
//b2.dispose;
};
|
评分
-
查看全部评分
|