Save-Point
Horizontal Command Windows - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Horizontal Command Windows (/thread-6824.html)



Horizontal Command Windows - SephirothSpawn - 11-04-2005

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]