设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4955|回复: 4
打印 上一主题 下一主题

[已经解决] 关于脸图载入问题。

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
1
发表于 2015-11-22 20:03:27 | 显示全部楼层
本帖最后由 汪汪 于 2016-2-2 01:13 编辑
主要是脸图没准备好的问题,这里参考的是Window_Message里的写法..


//果然还是要读默认脚本啊 T_T
  1. Window_Base.prototype.drawFace = function(faceName, faceIndex, x, y, width, height) {
  2.     width = width || Window_Base._faceWidth;
  3.     height = height || Window_Base._faceHeight;
  4.     var bitmap = ImageManager.loadFace(faceName);
  5.     var pw = Window_Base._faceWidth;
  6.     var ph = Window_Base._faceHeight;
  7.     var sw = Math.min(width, pw);
  8.     var sh = Math.min(height, ph);
  9.     var dx = Math.floor(x + Math.max(width - pw, 0) / 2);
  10.     var dy = Math.floor(y + Math.max(height - ph, 0) / 2);
  11.     var sx = faceIndex % 4 * pw + (pw - sw) / 2;
  12.     var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
  13.     bitmap.addLoadListener(
  14.             this.contents.blt.bind(this.contents,bitmap, sx, sy, sw, sh, dx, dy)
  15.     );
  16. };
复制代码
更新一下方法......

点评

不过还是你的好用。本帖终结。  发表于 2015-11-23 15:19
昨天我一直翻ImageManager发现读图有一定延时。自己写了个插件是加快一次执行 ImageManager.loadFace(facename)的过程。  发表于 2015-11-23 15:15

评分

参与人数 1梦石 +1 收起 理由
余烬之中 + 1 不过还是你的好用。本帖终结。.

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-6-10 19:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表