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

Project1

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

[已经解决] 如何将菜单的不透明度取消掉,想要完全不透明的

[复制链接]

Lv2.观梦者

梦石
0
星屑
277
在线时间
23 小时
注册时间
2022-3-11
帖子
32
跳转到指定楼层
1
发表于 2022-11-19 18:31:28 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就是这个,不想让地图也显示在菜单栏中,空白的地方无所谓

Lv2.观梦者

梦石
0
星屑
277
在线时间
23 小时
注册时间
2022-3-11
帖子
32
2
 楼主| 发表于 2022-11-19 18:32:30 | 只看该作者
顺带一问,可以实现像2003那样的字体吗,就是渐变色那样
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24277
在线时间
5046 小时
注册时间
2016-3-8
帖子
1618
3
发表于 2022-11-19 19:35:17 | 只看该作者
本帖最后由 alexncf125 于 2022-11-19 19:36 编辑

取消窗口背景半透明
https://rpg.blue/forum.php?mod=r ... amp;fromuid=2652223

渐变色
https://rpg.blue/forum.php?mod=r ... amp;fromuid=2652223
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
277
在线时间
23 小时
注册时间
2022-3-11
帖子
32
4
 楼主| 发表于 2022-11-20 15:56:41 | 只看该作者
本帖最后由 惊鸿酱 于 2022-11-20 16:09 编辑
alexncf125 发表于 2022-11-19 19:35
取消窗口背景半透明
https://rpg.blue/forum.php?mod=redirect&goto=findpost&ptid=393691&pid=2683504&fro ...


谢谢!透明度问题解诀了;就是渐变色的话是想将整个游戏的字体都改为渐变色,就像RM2003那样,链接里面似乎只能改文本框的问题,进入游戏界面的那个”开始游戏“就没有办法实现渐变色
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24277
在线时间
5046 小时
注册时间
2016-3-8
帖子
1618
5
发表于 2022-11-21 20:12:00 | 只看该作者
RUBY 代码复制
  1. ###--------------------------------------------------------------------------###
  2. #  CP 渐变文本                                                   #
  3. #  Version 1.3                                                                 #
  4. #                                                                              #
  5. #      Credits:                                                                #
  6. #  Original code by: Neonblack                                                 #
  7. #  Modified by:                                                                #
  8. #                                                                              #
  9. #  This work is licensed under the Creative Commons Attribution-NonCommercial  #
  10. #  3.0 Unported License. To view a copy of this license, visit                 #
  11. #  [url]http://creativecommons.org/licenses/by-nc/3.0/.[/url]                             #
  12. #  Permissions beyond the scope of this license are available at               #
  13. #  [url]http://cphouseset.wordpress.com/liscense-and-terms-of-use/.[/url]                 #
  14. #                                                                              #
  15. #      Contact:                                                                #
  16. #  NeonBlack - [email protected] (e-mail) or "neonblack23" on skype         #
  17. ###--------------------------------------------------------------------------###
  18.  
  19. ###--------------------------------------------------------------------------###
  20. #      Revision information:                                                   #
  21. #  V1.3 - 10.14.2012                                                           #
  22. #   Text shape and alignment fix                                               #
  23. #  V1.2c - 10.13.2012                                                          #
  24. #   Font "width" issue fixed                                                   #
  25. #   Fixed a non-gradient issue                                                 #
  26. #  V1.2b - 9.14.2012                                                           #
  27. #   Fixed a divide by zero error                                               #
  28. #  V1.2 - 9.13.2012                                                            #
  29. #   Font positioning overwrite written                                         #
  30. #  V1.1b - 9.8.2012                                                            #
  31. #   4 character bug fix...                                                     #
  32. #  V1.1 - 9.7.2012                                                             #
  33. #   Disposed bitmap bugfix                                                     #
  34. #  V1.0 - 9.2.2012                                                             #
  35. #   Wrote and debugged main script                                             #
  36. ###--------------------------------------------------------------------------###
  37.  
  38. ###--------------------------------------------------------------------------###
  39. #      Compatibility:                                                          #
  40. #  Alias:      - Bitmap: draw_text                                             #
  41. #  New Methods - Bitmap: convert_string, create_char, font_color_light,        #
  42. #                        font_color_dark                                       #
  43. #                Text: get_char, add_char, size, create_big_bitmap, key,       #
  44. #                      clear_cache, w, h, hw, hh                               #
  45. #                Font: array                                                   #
  46. ###--------------------------------------------------------------------------###
  47.  
  48. ###--------------------------------------------------------------------------###
  49. #      Instructions:                                                           #
  50. #  Place this script in the "Materials" section of the scripts above main.     #
  51. #  This script is plug and play with a few different options to allow you to   #
  52. #  customize to taste.                                                         #
  53. ###--------------------------------------------------------------------------###
  54.  
  55. ###--------------------------------------------------------------------------###
  56. #      Config:                                                                 #
  57. #  These are the default values used by several of the functions in the        #
  58. #  script.  You may change these values as you find your game requires in      #
  59. #  order to give the player a better playing experience based on your game.    #
  60. #                                                                              #
  61. module CP    # Do not edit                                                     #
  62. module TEXT  #  these two lines.                                               #
  63. #                                                                              #
  64. ###-----                                                                -----###
  65. # 是否启用文字渐变功能?                                       #
  66. USE = true # 默认 = true                                                    #
  67. #                                                                              #
  68. # 设定字体顶部和底部边缘的大小.  那里的像素会是最亮和最暗的部分
  69. # 让字体看起来更“圆润”
  70. EDGE = 3 # 默认 = 3                                                         #
  71. #                                                                              #
  72. # 是否显示文字渐变                                            #
  73. GRADIENT = true # 默认 = true                                               #
  74. #                                                                              #
  75. # 设定顶部最亮处和底部最暗处阴影的强度.  数字范围是 0 ~ 100     #
  76. # 数字最大代表黑色,最小是白色.  #
  77. LIGHT = 70 # 默认 = 70                                                      #
  78. DARK = 40 # 默认 = 40                                                       #
  79. #                                                                              #
  80. # 是否修正一些字符的位置.  用于某些因为显示的太靠左而被裁剪的文字
  81. # 可能会降低游戏效率,而且是非必要功能, 所以默认为 false .                                      #
  82. O_POSITION = false # 默认 = false                                           #
  83. ###--------------------------------------------------------------------------###
  84.  
  85.  
  86. ###--------------------------------------------------------------------------###
  87. #  The following lines are the actual core code of the script.  While you are  #
  88. #  certainly invited to look, modifying it may result in undesirable results.  #
  89. #  Modify at your own risk!                                                    #
  90. ###--------------------------------------------------------------------------###
  91.  
  92.  
  93. end
  94. end
  95.  
  96. $imported = {} if $imported == nil
  97. $imported["CP_GRADIENT"] = 1.0
  98.  
  99. class Bitmap  ## Alias draw_text for all the new functions.
  100.   alias cp_draw_grad_text draw_text unless $@
  101.   def draw_text(*args)
  102.     return cp_draw_grad_text(*args) unless CP::TEXT::USE
  103.     case args.size  ## Gets all the default arguments.
  104.     when 2, 3
  105.       rect = args[0].dup
  106.       string = args[1]
  107.       align = args[2] ? args[2] : 0
  108.     when 5, 6
  109.       rect = Rect.new(args[0], args[1], args[2], args[3])
  110.       string = args[4]
  111.       align = args[5] ? args[5] : 0
  112.     else
  113.       return cp_draw_grad_text(*args)  ## Stops if something is somehow off.
  114.     end
  115.     font_bit = convert_string(string)  ## Gets the converted bitmap.
  116.     rect.x -= Text.hw; rect.y -= Text.hh  ## Increases the edges of the rectangle.
  117.     rect.height += Text.h; rect.width += Text.w
  118.     if font_bit.height > rect.height  ## Checks height and adjusts the rect.
  119.       font_bit.clear_rect(0, rect.height, font_bit.width, font_bit.height)
  120.       rect.height = font_bit.height
  121.     else
  122.       unless font_bit.height == rect.height
  123.         rect.y += (rect.height - font_bit.height) / 2
  124.         rect.height = font_bit.height  ## Centers a taller rect.
  125.       end
  126.     end
  127.     if font_bit.width > rect.width  ## Checks width and adjusts.
  128.       pal = (rect.width - Text.w).to_f / (font_bit.width - Text.w)
  129.       pal = (Text.w - (pal * Text.w)).to_i / 2 rescue pal = Text.hw
  130.       rect.x += pal  ## Gets the border of the rect and adjusts.
  131.       rect.width -= (pal * 2)
  132.       stretch_blt(rect, font_bit, font_bit.rect)
  133.     else
  134.       offset = (rect.width - font_bit.width) / 2
  135.       blt(rect.x + (offset * align), rect.y, font_bit, font_bit.rect)
  136.     end
  137.   end
  138.  
  139.   def convert_string(string)  ## Creates the string bitmap from the cache.
  140.     string_r = Text.size(string, font)
  141.     bitmap = Bitmap.new(string_r.width, string_r.height)
  142.     space = 0
  143.     var = string.to_s
  144.     var.each_char do |c|  ## Draws each character from the cache.
  145.       bit = Text.get_char(c, font)
  146.       bitmap.blt(space, 0, bit, bit.rect)
  147.       space += bit.width - Text.w
  148.     end
  149.     result = Bitmap.new(space + Text.w, bitmap.height)
  150.     result.blt(0, 0, bitmap, bitmap.rect)
  151.     return result
  152.   end
  153.  
  154.   def create_char(string)  ## Creates a new character for the cache.
  155.     edge = CP::TEXT::EDGE
  156.     shift = 0
  157.     if ((edge * 2) + Text.h > height) || !CP::TEXT::GRADIENT
  158.       cp_draw_grad_text(1, 0, width, height, string, 1)
  159.       for i in 0...height
  160.         Text.hw.times do |n|
  161.           break unless CP::TEXT::O_POSITION
  162.           blnk = get_pixel(n + 1, i)
  163.           next if blnk.alpha == 0
  164.           shift = [Text.hw - n, shift].max
  165.           break
  166.         end
  167.       end
  168.     else  ## ^ Return a defaul character under certain conditions.
  169.       bitmap = Bitmap.new(width + 1, height)
  170.       bitmap.font = font
  171.       h1 = (height - Text.h - edge * 2) / 2
  172.       h2 = (height - Text.h - edge * 2) - h1
  173.       gr1 = Rect.new(0, 9 + edge, 1, h1)       ## Creates the dark and
  174.       gr2 = Rect.new(0, 9 + edge + h1, 1, h2)  ## light rectangles.
  175.       bitmap.gradient_fill_rect(gr1, font_color_light, font.color, true)
  176.       bitmap.gradient_fill_rect(gr2, font.color, font_color_dark, true)
  177.       rect = Rect.new(1, 0, width, height)
  178.       done = false
  179.       font.color = font_color_light
  180.       cp_draw_grad_text(0, 0, width, height, string, 1)
  181.       for i in 0...height  ## Creates the new image in several steps.
  182.         clr = bitmap.get_pixel(0, i)  ## Think of it like a slow scan tv.
  183.         Text.hw.times do |n|
  184.           break unless CP::TEXT::O_POSITION
  185.           blnk = bitmap.get_pixel(n + 1, i)
  186.           next if blnk.alpha == 0
  187.           shift = [Text.hw - n, shift].max
  188.           break
  189.         end
  190.         if clr.alpha == 0
  191.           next unless done
  192.           cr = Rect.new(1, 0, width, i)
  193.           bitmap.clear_rect(cr)
  194.           blt(1, 0, bitmap, rect)
  195.         else
  196.           unless done
  197.             cr = Rect.new(1, i, width, height)
  198.             clear_rect(cr)
  199.             done = true
  200.           end
  201.           tr = Rect.new(1, i, width, 1)
  202.           bitmap.font.color = clr
  203.           bitmap.clear_rect(rect)
  204.           bitmap.cp_draw_grad_text(1, 0, width, height, string, 1)
  205.           blt(1, i, bitmap, tr)
  206.         end
  207.       end
  208.     end
  209.     shift -= 1
  210.     return if shift <= 0
  211.     holder = Bitmap.new(width, height)
  212.     holder.blt(0 + shift, 0, self, self.rect)
  213.     clear_rect(self.rect)
  214.     blt(0, 0, holder, holder.rect)
  215.   end
  216.  
  217.   def font_color_light  ## Creates the light font color.
  218.     r = font.color.red
  219.     g = font.color.green
  220.     b = font.color.blue
  221.     color = []
  222.     [r, g, b].each {|c| color.push(c + (255 - c) * CP::TEXT::LIGHT / 100) }
  223.     return Color.new(color[0], color[1], color[2], font.color.alpha)
  224.   end
  225.  
  226.   def font_color_dark  ## Creates the dark font color.
  227.     r = font.color.red
  228.     g = font.color.green
  229.     b = font.color.blue
  230.     color = []
  231.     [r, g, b].each {|c| color.push(c - c * CP::TEXT::DARK / 100) }
  232.     return Color.new(color[0], color[1], color[2], font.color.alpha)
  233.   end
  234. end
  235.  
  236. module Text
  237.   WIDTH = 40
  238.   HEIGHT = 20
  239.  
  240.   def self.w; return WIDTH; end
  241.   def self.h; return HEIGHT; end
  242.   def self.hw; return WIDTH / 2; end
  243.   def self.hh; return HEIGHT / 2; end
  244.  
  245.   def self.get_char(char, font = Font.new)
  246.     @letter = {} if @letter.nil?  ## Returns the character bitmap by font.
  247.     add_char(char, font) unless @letter.include?(key(char, font))
  248.     return @letter[key(char, font)]
  249.   end
  250.  
  251.   def self.add_char(char, font)
  252.     rect = size(char, font)  ## Creates and edits a new bitmap for the cache.
  253.     @letter[key(char, font)] = Bitmap.new(rect.width, rect.height)
  254.     @letter[key(char, font)].font = font
  255.     @letter[key(char, font)].create_char(" " + char + " ")
  256.   end
  257.  
  258.   def self.size(char, font = Font.new)
  259.     create_big_bitmap
  260.     @bitmap.font = font  ## Gets a character's size with a buffer.
  261.     rect = @bitmap.text_size(char)
  262.     rect.width += Text.w
  263.     rect.height += Text.h
  264.     return rect
  265.   end
  266.  
  267.   def self.create_big_bitmap
  268.     return unless @bitmap.nil? || @bitmap.disposed?
  269.     @bitmap = Bitmap.new(Graphics.width, Graphics.height)
  270.     clear_cache
  271.   end
  272.  
  273.   def self.key(char, font)  ## Creates a character's key by font.
  274.     res = font.array + [char]
  275.     return res
  276.   end
  277.  
  278.   def self.clear_cache  ## Clears the cache.  Not called by me at all.
  279.     @letter = {}
  280.   end
  281. end
  282.  
  283. class Font   ## Gets the fonts total array.  All aspects of the font
  284.   def array  ## are here for use in making a character bitmap's key.
  285.     [name, size, bold, italic, outline, shadow, color.red, color.green,
  286.      color.blue, color.alpha, out_color.red, out_color.green, out_color.blue,
  287.      out_color.alpha]
  288.   end
  289. end
  290.  
  291.  
  292. ###--------------------------------------------------------------------------###
  293. #  End of script.                                                              #
  294. ###--------------------------------------------------------------------------###
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 13:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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