08-22-2009, 11:07 AM
Hey XP Kobold, not bad at all. I like the idea of making the displayed state changeable... I'm going to use it...
I have had Window Command Icons in my Window Command Plus class for a while now, and it's not SDK.
Here it is:
Sorry for the little OT
I have had Window Command Icons in my Window Command Plus class for a while now, and it's not SDK.
Here it is:
Content Hidden
Code:
class Window_Command < Window_Selectable
attr_accessor :use_icons
alias cf_window_command_icons_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
@use_icons=true
cf_window_command_icons_initialize(width, commands)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
offset=0
if (@use_icons)
begin
bitmap = RPG::Cache.icon(@commands[index])
rect = Rect.new(0, 32*index, 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
temp=Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.stretch_blt(rect,bitmap,temp,255)
offset=32
rescue
end
end
rect = Rect.new(offset+4, 32*index, self.contents.width - 8 - offset, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
end
Sorry for the little OT