Advertisement
LiTTleDRAgo

[RGSS/2] DRG - Scene Menu Animated Cursor

Aug 8th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.36 KB | None | 0 0
  1. #==============================================================================
  2. # ** DRG - Scene Menu Animated Cursor
  3. # Version : 1.00
  4. # Author : LiTTleDRAgo
  5. #==============================================================================
  6. module LiTTleDRAgo
  7.  
  8.   MENU_CURSOR_IMAGE = 'Cursor' # Place the image to Graphics/Windowskins
  9.   MENU_CURSOR_FRAME = 8        # Cursor image frame
  10.  
  11. end
  12. #==============================================================================
  13. # * End Configuration
  14. #==============================================================================
  15. raise "This script needs Drago - Scene Menu" unless $drago_simple_cms
  16. ($imported||={})[:drg_scene_menu_animated_cursor] = 1.00
  17. #==============================================================================
  18. # ** Scene_Menu
  19. #------------------------------------------------------------------------------
  20. #  This class performs menu screen processing.
  21. #==============================================================================
  22. class Scene_Menu
  23.   #--------------------------------------------------------------------------
  24.   # * Constant
  25.   #--------------------------------------------------------------------------
  26.   FRAME = LiTTleDRAgo::MENU_CURSOR_FRAME
  27.   #--------------------------------------------------------------------------
  28.   # * Alias Listing
  29.   #--------------------------------------------------------------------------
  30.   alias_method :create_arrow_bitmap, :create_arrow
  31.   alias_method :update_arrow_bitmap, :update_arrow
  32.   #--------------------------------------------------------------------------
  33.   # * Create Arrow
  34.   #--------------------------------------------------------------------------
  35.   def create_arrow(*args)
  36.     create_arrow_bitmap(*args)
  37.     @sprite_arrow.bitmap = bitmap = windowskin(LiTTleDRAgo::MENU_CURSOR_IMAGE)
  38.     @sprite_arrow.src_rect.set(0, 0, bitmap.width / FRAME, bitmap.height)
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # * update_Arrow
  42.   #--------------------------------------------------------------------------
  43.   def update_arrow(*args)
  44.     update_arrow_bitmap(*args)
  45.     width  = @sprite_arrow.bitmap.width / FRAME
  46.     height = @sprite_arrow.bitmap.height
  47.     @pattern_arrow = ((@pattern_arrow || 0) + 0.2) % FRAME
  48.     @sprite_arrow.src_rect.set(@pattern_arrow.floor * width, 0, width, height)
  49.   end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement