查看: 2242|回复: 3

[已经解决] 如何给显示的文字加上黑影?

[复制链接]
梦石
0
星屑
65
在线时间
75 小时
注册时间
2008-5-25
回帖
35
发表于 2012-8-9 16:45:13 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
在制作窗口时,想要使用的文字颜色与窗口背景颜色相近,导致文字看不太清
我发现其它游戏中的文字周围带着一圈黑影,文字与背景颜色相近就也能看清,怎么加上这种黑影呢?
梦石
0
星屑
93
在线时间
331 小时
注册时间
2010-10-24
回帖
735
发表于 2012-8-9 17:19:58 | 显示全部楼层
回复

使用道具 举报

梦石
0
星屑
65
在线时间
75 小时
注册时间
2008-5-25
回帖
35
 楼主| 发表于 2012-8-9 18:02:12 | 显示全部楼层
a19981007a 发表于 2012-8-9 17:19
搜索“阴影”
http://search.discuz.qq.com/f/discuz?agId=0&charset=utf-8&cuName=a19981007a&egIds=&fmSi ...

不是阴影,阴影只是在右下方加了,我需要的是文字周围都有黑影,这样才能在颜色相近的背景中辨认出来
回复

使用道具 举报

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
回帖
3515
发表于 2012-8-9 22:35:34 | 显示全部楼层
  1. #==============================================================================
  2. # ◎ GPRA_Bitmap
  3. #------------------------------------------------------------------------------
  4. # ◎ Bitmap功能加强
  5. #------------------------------------------------------------------------------
  6. # 制作者:绿梨子红苹果
  7. # 个人主页:vbgm.9126.com
  8. # E-Mail:xhy.01@163.com
  9. # QQ:42378361
  10. #==============================================================================

  11. class Bitmap
  12.   # 影子字
  13.   def draw_text_s(x, y, width, height, str, align=0)
  14.     # 保存当前颜色
  15.     r=self.font.color.red
  16.     g=self.font.color.green
  17.     b=self.font.color.blue
  18.     # 颜色更改成黑色
  19.     self.font.color.set(255, 255, 255)
  20.     # 绘制影子
  21.     self.draw_text(x+2, y+2, width, height, str, align)
  22.     # 恢复原始字色
  23.     self.font.color.set(r,g,b)
  24.     # 绘制原来的字
  25.     self.draw_text(x, y, width, height, str, align)
  26.   end
  27.   # 描边字
  28.   def draw_text_f(x, y, width, height, str, align=0,floor=1)
  29.     # 保存当前颜色
  30.     r=self.font.color.red
  31.     g=self.font.color.green
  32.     b=self.font.color.blue
  33.     # 颜色更改成黑色
  34.     self.font.color.set(0,0,0)
  35.     # 绘制边框
  36.     self.draw_text(x-floor, y-floor, width, height, str, align)
  37.     self.draw_text(x-floor, y+floor, width, height, str, align)
  38.     self.draw_text(x+floor, y-floor, width, height, str, align)
  39.     self.draw_text(x+floor, y+floor, width, height, str, align)
  40.     self.draw_text(x, y-floor, width, height, str, align)
  41.     self.draw_text(x, y+floor, width, height, str, align)
  42.     self.draw_text(x-floor, y, width, height, str, align)
  43.     self.draw_text(x+floor, y, width, height, str, align)
  44.     # 恢复原始字色
  45.     self.font.color.set(r,g,b)
  46.     # 绘制原来的字
  47.     self.draw_text(x, y, width, height, str, align)
  48.   end
  49. end
复制代码
你需要的是描边字

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部