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

Project1

 找回密码
 注册会员
搜索

模拟print函数出现了乱码

查看数: 1101 | 评论数: 4 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2009-10-31 07:38

正文摘要:

本帖最后由 奶油Da蛋糕 于 2009-10-31 09:28 编辑 def print(text) a = File.open("Game.ini")   b = a.readlines   a.close   for i in 0..b.size     a = b[i]     ...

回复

奶油Da蛋糕 发表于 2009-10-31 09:27:59
  1. def print(text)
  2. a = File.open("Game.ini")
  3.   b = a.readlines
  4.   a.close
  5.   for i in 0..b.size
  6.     a = b[i]
  7.     if a.include?("Title")  
  8.       tit = a.split(/=/)[1]
  9.       break      
  10.       end
  11.     end
  12. # API掕媊
  13.    m2w = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  14.    w2m = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')

  15. # UTF-8 -> Unicode
  16.    len = m2w.call(65001, 0, text, -1, nil, 0);
  17.    buf = "\0" * (len*2)
  18.    m2w.call(65001, 0, text, -1, buf, buf.size/2);

  19. # Unicode -> S-JIS
  20.    len = w2m.call(0, 0, buf, -1, nil, 0, nil, nil);
  21.    ret = "\0" * len
  22.    w2m.call(0, 0, buf, -1, ret, ret.size, nil, nil);
  23.    
  24. Win32API.new('user32','MessageBox',%w{L P P L},'I').call(0,ret,tit,0)
  25. end
  26. print "研究API是一件很复杂的事情!"
复制代码
自己解决了...
上帝的眼睛 发表于 2009-10-31 09:12:03
本帖最后由 上帝的眼睛 于 2009-10-31 09:18 编辑

感觉应该是编码错误
http://rpg.blue/viewthread.php?tid=135516&highlight=%2BNOSCBY
注意看4楼紫苏的回复
奶油Da蛋糕 发表于 2009-10-31 08:28:24
http://211.91.172.65/mu/magicwin13f.rar

把上面这个下载下来

把乱码翻译一下即可
倭卜僾伱 发表于 2009-10-31 07:42


晕...乱码的原因出在我使用API的时候可能用了错误的值吧,难道别人想玩我的游戏还得去下个软件翻译乱码?
倭卜僾伱 发表于 2009-10-31 07:42:53
http://211.91.172.65/mu/magicwin13f.rar

把上面这个下载下来

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

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

GMT+8, 2025-7-22 03:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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