Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scroll Bar Menus
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Here is the script: Past it above main:

Code:
#==============================================================================
# â–� Window_ScrollBar
#------------------------------------------------------------------------------
#  Window_Selectableクラス�ウィンドウ�スクロール�ーを表示���。
#  使用時ã?¯ã€?クラスå� …ã?§å®£è¨€ã?—ã€?updateメソッド等ã?§updateã?™ã‚‹å¿…è¦?ã?Œã?‚ã‚� ã?¾ã?™ã€‚
#  ���ウィンドウ開放時�����dispose�る必���� ��。
#==============================================================================
class Window_ScrollBar
  # 定数定義
  GRAPHIC_PATH = "./Graphics/Windowskins/"
  
  #--------------------------------------------------------------------------
  # â—? オブジェクトåˆ?期化
  #--------------------------------------------------------------------------
  # x      : X 座標
  # y      : Y 座標
  # height : 高ã?•(32以ä¸� )
  # ※widthã?¯ã‚µã‚¤ã‚ºå›ºå®š(16)。
  #--------------------------------------------------------------------------
  def initialize(x, y, height, bar_graphic)
    # heightã?Œ32未満ã?®å� ´å?ˆã?¯è‡ªå‹•çš„ã?«32ã?«è¨­å®š
    height = [height, 32].max
  
    # スクロールãƒ?ー用グラフィックデータ読ã?¿è¾¼ã?¿
    # キャッシュ化ã?—ã?Ÿæ–¹ã?Œæ—©ã?„ã?‹ã‚‚ã?—ã‚Œã?ªã?„。
    if FileTest.exist?(GRAPHIC_PATH + bar_graphic)
      @bar_graphic = Bitmap.new(GRAPHIC_PATH + bar_graphic)
    else
      @bar_graphic = nil
    end

    # スクロールãƒ?ー用スプライト作æˆ?
    @sprite_view = Viewport.new(x, y, 16, height)
    @sprite_view.z = 100
    @bar_sprite = Sprite.new(@sprite_view)
    @bar_sprite.bitmap = Bitmap.new(16, height)
  end
  #--------------------------------------------------------------------------
  # â—? 解放
  #--------------------------------------------------------------------------
  def dispose
    # スクロールãƒ?ー用キャッシュデータ開放
    if @bar_graphic != nil
      unless @bar_graphic.disposed?
        @bar_graphic.dispose
      end
    end
    # スクロールãƒ?ー用スプライト開放
    unless @bar_sprite.disposed?
      @bar_sprite.dispose
    end
  end
  #--------------------------------------------------------------------------
  # â—? update
  #--------------------------------------------------------------------------
  # window:å?‚照先ã?®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦(通常ã?¯selfを代入)
  # è¿”ã‚� 値:処ç?� ã?®æˆ?å?¦ã?Œè¿”ã?•ã‚Œã?¾ã?™(デãƒ?ッグ用)。
  #--------------------------------------------------------------------------
  def update(window)
    # bitmapã?®ã‚¯ãƒªã‚¢
    @bar_sprite.bitmap.clear

    # ãƒ?ーグラフィックã?Œå­˜åœ¨ã?—ã?ªã?„å� ´å?ˆã?¯falseã‚’è¿”ã?™
    if @bar_graphic == nil
      return false
    end

    # ãƒ?ーã?®ä¸‹åœ°ã‚’æ??ç”»
    @bar_sprite.bitmap.blt(0, 0, @bar_graphic, Rect.new(0, 0, 16, 16))
    @bar_sprite.bitmap.blt(0, @bar_sprite.bitmap.height - 16, @bar_graphic, Rect.new(0, 32, 16, 16))

    if @bar_sprite.bitmap.height > 32
      @bar_sprite.bitmap.stretch_blt(Rect.new(0, 16, 16, @bar_sprite.bitmap.height - 32), @bar_graphic, Rect.new(0, 16, 16, 16))
    end

    # スクロールãƒ?ーã?®æ??画座標を計算
    if window.row_max > 0
      bar_height = [100 * window.page_row_max / window.row_max, 100].min
      bar_height = [bar_height * @bar_sprite.bitmap.height / 100, 32].max
      
      bar_y = 100 * window.top_row / [window.row_max - window.page_row_max, 1].max
      bar_y = (@bar_sprite.bitmap.height - bar_height) * bar_y / 100
    else
      bar_height = @bar_sprite.bitmap.height
      bar_y = 0
    end
    
    # スクロールãƒ?ーをæ??ç”»
    @bar_sprite.bitmap.blt(0, bar_y, @bar_graphic, Rect.new(16, 0, 16, 16))
    @bar_sprite.bitmap.blt(0, bar_y + bar_height - 16, @bar_graphic, Rect.new(16, 32, 16, 16))

    if bar_height > 32
      @bar_sprite.bitmap.stretch_blt(Rect.new(0, bar_y + 16, 16, bar_height - 32), @bar_graphic, Rect.new(16, 16, 16, 16))
    end

    # æˆ?å?¦ã‚³ãƒ¼ãƒ‰ã?¨ã?—ã?¦trueã‚’è¿”ã?™
    return true
  end
end
#END
#####################################################


Now Here a sample of the window item, replace it with this

#==============================================================================
# â–�  Window_Item(スクロールãƒ?ー導入サンプル)
#------------------------------------------------------------------------------
#  デフォルト�Itemウィンドウ�スクロール�ーを導入���。
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # â—? オブジェクトåˆ?期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    @column_max = 2
    refresh
    self.index = 0
    # 戦闘中ã?®å� ´å?ˆã?¯ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ç”»é?¢ä¸­å¤®ã?¸ç§»å‹•ã?—ã€?å?� é€?明ã?«ã?™ã‚‹
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
    
    # スクロールãƒ?ー定義(追å� � )
    @scroll = Window_ScrollBar.new(self.x + self.width - 16, self.y, self.height, "sample.png")
    @scroll.update(self)
  end
  #--------------------------------------------------------------------------
  # â—? update(追å� � )
  #--------------------------------------------------------------------------
  def update
    super
    @scroll.update(self)
  end
  #--------------------------------------------------------------------------
  # â—? dispose(追å� � )
  #--------------------------------------------------------------------------
  def dispose
    super
    @scroll.dispose
  end
end

and put this image in attachhment in your winodw skin folder

.png   sample.png (Size: 988 bytes / Downloads: 9)

i found this a while ago but completly forgot about this
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Customizable Ring Menus SephirothSpawn 0 2,102 10-31-2005, 01:00 PM
Last Post: SephirothSpawn



Users browsing this thread: