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

Project1

 找回密码
 注册会员
搜索

关于脸图载入问题。

查看数: 5129 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2015-11-18 15:13

正文摘要:

本帖最后由 夏末渐离 于 2015-11-18 15:24 编辑 新人想实现一个抬头显视窗口【HUD】。但是在绘制脸图的时候出了点毛病。 一。直接开始游戏到游戏画面,HUD窗口上没有脸图出现。如下图: 三。Window_HUD ...

回复

夏末渐离 发表于 2015-11-23 15:18:29
加快一次载入脸图过程,成功实现了预期效果。


汪汪 发表于 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 不过还是你的好用。本帖终结。.

查看全部评分

夏末渐离 发表于 2015-11-22 18:42:11
本帖最后由 夏末渐离 于 2015-11-23 15:09 编辑

看来是脸图没有那么快读出来,有一定的延时。
dc1988123 发表于 2015-11-18 23:25:11
本帖最后由 dc1988123 于 2015-11-19 00:00 编辑

估计刷新指令问题吧,下面插个refresh();试试
this.addWindow(this.hud);
this.hud.refresh();
我不懂脚本,只是瞎说的,希望能有用。。

点评

感谢建议,但是并不能解决问题。  发表于 2015-11-22 16:50
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-6-7 15:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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