Project1

标题: 怎么在窗口里描绘一个图 [打印本页]

作者: fox1313304    时间: 2014-8-5 15:06
标题: 怎么在窗口里描绘一个图
不太会写
窗口做出来了 字也可以写进去 图放不进去……
class Window_Buttom < Window_Base
  
  def initialize
    super(324,0,50,40)
    self.opacity = 200
    refresh
  end
  
  def update
    super
    refresh if $fefresh
    refresh = false
  end
  
  
  def refresh
    create_buttoms
  end
  
  def create_buttoms
    @buttoms=Bitmap.new(32,32)
    new_bitmap = Cache.system("S_buttom")
  end
   
end

问题出在哪里……


作者: taroxd    时间: 2014-8-5 15:13
本帖最后由 taroxd 于 2014-8-5 15:28 编辑

要么把 bitmap blt 到窗口的 contents 里面(参考F1文档,Bitmap#blt)
要么用 sprite 显示图片
作者: 喵呜喵5    时间: 2014-8-5 15:48
  1. bitmap = Cache.system("S_buttom")
  2.     rect = Rect.new(0, 0, Graphics.width, Graphics.height)
  3.     contents.blt(0, 0, bitmap, rect, 255)
  4.     bitmap.dispose
复制代码

作者: fox1313304    时间: 2014-8-5 19:32
taroxd 发表于 2014-8-5 15:13
要么把 bitmap blt 到窗口的 contents 里面(参考F1文档,Bitmap#blt)
要么用 sprite 显示图片 ...


  def create_button
    $button_sprite = Sprite.new
    $button_sprite.bitmap = Cache.system("S_button")
  end
我新建了一个sprite的类 然后这样写了 可是没召唤出来




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