Project1

标题: 如何给显示的文字加上黑影? [打印本页]

作者: doubt    时间: 2012-8-9 16:45
标题: 如何给显示的文字加上黑影?
在制作窗口时,想要使用的文字颜色与窗口背景颜色相近,导致文字看不太清
我发现其它游戏中的文字周围带着一圈黑影,文字与背景颜色相近就也能看清,怎么加上这种黑影呢?dsu_plus_rewardpost_czw
作者: a19981007a    时间: 2012-8-9 17:19
搜索“阴影”
http://search.discuz.qq.com/f/di ... d269a14ae67e51c042e


http://search.discuz.qq.com/f/di ... ccbe9468df3d1a14067
作者: doubt    时间: 2012-8-9 18:02
a19981007a 发表于 2012-8-9 17:19
搜索“阴影”
http://search.discuz.qq.com/f/discuz?agId=0&charset=utf-8&cuName=a19981007a&egIds=&fmSi ...

不是阴影,阴影只是在右下方加了,我需要的是文字周围都有黑影,这样才能在颜色相近的背景中辨认出来
作者: Wind2010    时间: 2012-8-9 22:35
  1. #==============================================================================
  2. # ◎ GPRA_Bitmap
  3. #------------------------------------------------------------------------------
  4. # ◎ Bitmap功能加强
  5. #------------------------------------------------------------------------------
  6. # 制作者:绿梨子红苹果
  7. # 个人主页:vbgm.9126.com
  8. # E-Mail:[email protected]
  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
复制代码
你需要的是描边字




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1