class Core::GUI::ItemInfo

Public Class Methods

new(x, y) click to toggle source
Calls superclass method Core::GUI::Element::new
# File lib/gui/item_info.rb, line 6
def initialize(x, y)
  super(x, y, 672, 160)
  @bg = Core.sprite("gui/iteminfo_background")
  @img = Core.sprite("items/none")
  @bigfont = Core.font(Core::DEFAULT_FONT, 32)
  @font = Core.font(Core::DEFAULT_FONT, 24)
  @item = nil
end

Public Instance Methods

draw() click to toggle source
Calls superclass method Core::GUI::Element#draw
# File lib/gui/item_info.rb, line 22
def draw
  super
  @bg.draw(@x, @y, Core::GUI_Z + 9, @w/@bg.width.to_f, @h/@bg.height.to_f)
  @img.draw(@x, @y, Core::GUI_Z + 10, @h/@img.width.to_f, @h/@img.height.to_f)
  if @item
    @bigfont.draw(Trans.item(@item.name), @x+@h+4, @y+4, Core::GUI_Z + 11, 1, 1, Gosu::Color::BLACK)
    @font.draw(Trans.item("#{@item.name}_desc"), @x+@h+4, @y+36, Core::GUI_Z + 11, 1, 1, Gosu::Color::BLACK)
  end
end
item=(item) click to toggle source
# File lib/gui/item_info.rb, line 14
def item=(item)
  @item = item
  if @item
    @img = @item.img
  else
    @img = Core.sprite("items/none")
  end
end