Horizontal Command Windows
#1
Horizontal Command Windows
SephirothSpawn

Nov 4 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
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)
[note]The Default for Both Width and Height are Default at 640 * 64[/note]
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Advanced Command Windows Tsunokiette 0 2,711 07-07-2006, 01:00 PM
Last Post: Tsunokiette
  Transparent command box in title ryujijitei 0 2,283 04-29-2006, 01:00 PM
Last Post: ryujijitei
  Cursor Command Tsunokiette 0 2,561 01-07-2006, 01:00 PM
Last Post: Tsunokiette
  Vertical or Horizontal Menu with or without Icons Tsunokiette 0 2,488 12-11-2005, 01:00 PM
Last Post: Tsunokiette
  New Command Window SephirothSpawn 0 2,294 07-15-2005, 01:00 PM
Last Post: SephirothSpawn
  Moving Windows makeamidget 0 2,470 06-20-2005, 01:00 PM
Last Post: makeamidget



Users browsing this thread: 1 Guest(s)