#==============================================================================
# ** Scene_Title -- Un-default-ed Title Screen
# by Orochii Zouveleki, yeh. Credits not needed. Although I appreciate any donation --ok, J/K.
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================
class Window_Command < Window_Selectable
  attr_accessor :column_max
end

class Scene_Title < Scene_Base
  
  TITLE_NAME=["Title","IconSet"] #You can set it to as many as you like (including 1).
  COMMAND_PREFIX="TCommand_" #Prefix used for the command images.
  COMMAND_POS=[288,384] #Positioning of command images.
  
  #--------------------------------------------------------------------------
  # * Post-Start Processing
  #--------------------------------------------------------------------------
  alias oz_psts post_start
  def post_start
    oz_psts
    create_command_image
  end
  #--------------------------------------------------------------------------
  # * Pre-termination Processing
  #--------------------------------------------------------------------------
  alias oz_ptts pre_terminate
  def pre_terminate
    oz_ptts
    dispose_command_image
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias oz_uts update
  def update
    oz_uts
    command_update(@command_window.index)
  end
  
  def command_update(n_index)
    if @last_index != n_index
      @sprite2.bitmap = Cache.system(COMMAND_PREFIX+n_index.to_s)
      @last_index = n_index
    end
  end
  #--------------------------------------------------------------------------
  # * Create Title Graphic
  #--------------------------------------------------------------------------
  def create_title_graphic
    @sprite = Sprite.new
    r = rand(TITLE_NAME.size)
    @sprite.bitmap = Cache.system(TITLE_NAME[r])
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  alias oz_ccwts create_command_window
  def create_command_window
    oz_ccwts
    @command_window.x = 544
    @command_window.y = 288
    @command_window.column_max = @command_window.commands.size
  end
  def create_command_image
    @sprite2 = Sprite.new
    @sprite2.bitmap = Cache.system("TCommand_"+@command_window.index.to_s)
    @sprite2.x = COMMAND_POS[0]
    @sprite2.y = COMMAND_POS[1]
    @last_index = @command_window.index
  end
  def dispose_command_image
    @sprite2.bitmap.dispose
    @sprite2.dispose
  end
end