11-04-2005, 01:00 PM
Horizontal Command Windows
SephirothSpawn
Nov 4 2005
SephirothSpawn
Nov 4 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
No support is given.
I was needing a Horizontal Command Window for a new script, so I made one. I decided to share it. It's nothing great, but works none the less.
Code:
#==============================================================================
# Window Horizontal Command
# Created By SephirothSpawn (11.03.05)
# Last Updated: 11.23.05
#==============================================================================
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index, color = normal_color)
x = width / @item_max * index
off = width / @item_max - 32
self.contents.font.color = color
self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
How to Use:
Just pass arguements as you would for a regular Command Window.
Code:
window = Window_HorizCommand.new(commands, width, height)