DivineLight
Member
http://www.imagefilez.com/out.php/i255953_scr01.PNG[/img]
Code:
class MyWindow1_Status < Window_Base
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_name(@actor, 20, 0)
draw_actor_face(@actor, 0, 30)
draw_actor_hp(@actor, 0, 130)
draw_actor_mp(@actor, 0, 150)
end
end
class MyWindow1_Item < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 2
self.index = 0
refresh
end
def item
return @data[self.index]
end
def include?(item)
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
def enable?(item)
return $game_party.item_can_use?(item)
end
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end
Code:
#==============================================================================
# [RMVX] Scene_MyWindow
#------------------------------------------------------------------------------
# by DivineLight [astragunner2002@gmail.com]
# v0.2 02 June 2008
#==============================================================================
class Scene_Menu < Scene_Base
def initialize(menu_index = 0)
@menu_index = menu_index
end
def start
super
@status_window = MyWindow1_Status.new(375,15,155,210,$game_party.members[0])
@item_window = MyWindow1_Item.new(20,15,335,210)
end
def terminate
super
@status_window.dispose
@item_window.dispose
end
def update
super
@status_window.update
@item_window.update
end
end
My question is: (just like in screenshoot)
1. how to make sure only 1 item per row? (Item Window)
2. if it's not possible, how to handle items with long names?
Anyway, I'm using Window_Base and Window_Selectable for them.