Thread Rating:
  • 2 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 My Windowskins
#4
want to include a cursor infront of the selection?
[Image: windowskin.jpg]
script:
Code:
#==============================================================================
#????Arrow-Type Selection Cursor?ver. 1.12???
#??Script by ParaDog
#??http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# Uses an optional picture for the cursor in command selection windows.
#==============================================================================

module PARA_LEFT_CURSOR
  

  # Name of the cursor file (in the "Graphics/Windowskin" folder)
  FILE_NAME = "cursor"

  # Cursor type ? 0: Arrow  /   1: Arrow & Rect Border ?
  TYPE = 0

end

# End of the config section
#------------------------------------------------------------------------------

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  #  * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  alias cursor_rect_para_lcr cursor_rect
  def cursor_rect=(rect)
    if PARA_LEFT_CURSOR::TYPE == 1
      super(rect)
    end
    empty = Rect.new(0,0,0,0)
    if rect != empty and self.visible != false and @index != -1
      if @cursor == nil or @cursor.disposed?
        # Draw the sprite
        @cursor = Sprite.new
        @cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME)
      end
      # Move the position of cursor sprite
      @cursor.x = self.x + rect.x
      cy = (rect.height-32) / 2
      @cursor.y = self.y + cy + rect.y + 16
      @cursor.z = self.z + 2
    elsif @cursor != nil
      @cursor.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias dispose_para_cur dispose
  def dispose
    super
    if @cursor != nil
      @cursor.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * self.visible
  #--------------------------------------------------------------------------
  def visible=(bool)
    super
    # Dispose if cursor and window contents bit map is set
    if @cursor != nil and bool == false
      @cursor.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * self.x
  #--------------------------------------------------------------------------
  def x=(x)
    super
    if @index != nil
      # Update cursor rectangle
      update_cursor_rect
    end
  end
  #--------------------------------------------------------------------------
  # * self.y
  #--------------------------------------------------------------------------
  def y=(y)
    super
    if @index != nil
      # Update cursor rectangle
      update_cursor_rect
    end
  end
end
animation add-on (need script above):
Code:
#==============================================================================
#??? Arrow-Type Selection Cursor - Animated Cursor ver. 1.00 ??
#??Script by ParaDog
#??http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# An optional add-on for the "Arrow-Type Selection Cursor" script.
#------------------------------------------------------------------------------
# Uses the same cursor filename in the "Arrow-Type Selection Cursor" script for
# the individual files.  If the cursor filename is 'hand' and the system is set
# for a 3 frame animation, the images used would be:  hand1,  hand2  and  hand3
# to create the animated cursor.
#==============================================================================

module PARA_LEFT_CURSOR

  # The number of images used in the cursor's animation
  MAX_FRAMES = 3

  # Animation delay speed.
  # Smaller values decrease speed between animation frames (ie faster animation)
  ANM_SPEED = 5

end

# End of the config section
#------------------------------------------------------------------------------

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base
  #--------------------------------------------------------------------------
  #  * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  alias cursor_rect_para_lcr cursor_rect
  def cursor_rect=(rect)
    if PARA_LEFT_CURSOR::TYPE == 1
      super(rect)
    end
    empty = Rect.new(0,0,0,0)
    if rect != empty and self.visible != false and @index != -1
      if @cursor == nil or @cursor.disposed?
        # Draw the sprite
        @cursor = Sprite.new
        @cursor_anm_frame = 1
        @cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME+@cursor_anm_frame.to_s)
        @cursor_wait = PARA_LEFT_CURSOR::ANM_SPEED
      end
      # Moving the position of cursor sprite
      @cursor.x = self.x + rect.x
      cy = (rect.height-32) / 2
      @cursor.y = self.y + cy + rect.y + 16
      @cursor.z = self.z + 2
    elsif @cursor != nil
      @cursor.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame update
  #--------------------------------------------------------------------------
  def update
    super
    if @cursor != nil and @cursor.disposed? == false
      if @cursor_wait == nil or @cursor_wait <= 0
        @cursor_wait = PARA_LEFT_CURSOR::ANM_SPEED
        @cursor_anm_frame += 1
        if @cursor_anm_frame > PARA_LEFT_CURSOR::MAX_FRAMES
          @cursor_anm_frame = 1
        end
        @cursor.bitmap = RPG::Cache.windowskin(PARA_LEFT_CURSOR::FILE_NAME+@cursor_anm_frame.to_s)
      else
        @cursor_wait -= 1
      end
    end
  end
end
default cursor
[Image: cursor.png]
black(by me)
[Image: cursor_.png]
white(by me)
[Image: cursorw.png]
Reply }


Messages In This Thread
My Windowskins - by chickendips - 02-20-2010, 02:01 PM
My Windowskins - by chickendips - 02-20-2010, 02:03 PM
My Windowskins - by chickendips - 02-20-2010, 02:07 PM
My Windowskins - by chickendips - 02-20-2010, 02:12 PM
My Windowskins - by Ace - 02-20-2010, 03:43 PM
My Windowskins - by chickendips - 02-21-2010, 04:55 PM
My Windowskins - by chickendips - 02-21-2010, 08:19 PM
My Windowskins - by Mega Flare - 02-26-2010, 05:55 PM
My Windowskins - by chickendips - 02-26-2010, 05:59 PM
My Windowskins - by chickendips - 02-26-2010, 06:54 PM
My Windowskins - by Mega Flare - 02-26-2010, 06:55 PM
My Windowskins - by deValdr - 02-26-2010, 06:56 PM
My Windowskins - by DerVVulfman - 02-26-2010, 07:50 PM
My Windowskins - by jubhub731 - 02-26-2010, 07:54 PM
My Windowskins - by chickendips - 02-26-2010, 07:55 PM
My Windowskins - by chickendips - 02-28-2010, 02:15 PM
My Windowskins - by kyonides - 03-01-2010, 12:08 AM
My Windowskins - by Mega Flare - 03-01-2010, 04:42 AM



Users browsing this thread: