Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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,321 07-07-2006, 01:00 PM
Last Post: Tsunokiette
  Transparent command box in title ryujijitei 0 1,896 04-29-2006, 01:00 PM
Last Post: ryujijitei
  Cursor Command Tsunokiette 0 2,115 01-07-2006, 01:00 PM
Last Post: Tsunokiette
  Vertical or Horizontal Menu with or without Icons Tsunokiette 0 2,078 12-11-2005, 01:00 PM
Last Post: Tsunokiette
  New Command Window SephirothSpawn 0 1,911 07-15-2005, 01:00 PM
Last Post: SephirothSpawn
  Moving Windows makeamidget 0 2,050 06-20-2005, 01:00 PM
Last Post: makeamidget



Users browsing this thread: