# ▽△▽ Lib. 4 第二カーソルライブラリ ▽△▽ # # update 2005/ 7/24 # #============================================================================== # --- 第二カーソルライブラリ --- #------------------------------------------------------------------------------ # ウィンドウに .index2 プロパティを追加します。 #============================================================================== module XCursor2 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, w, h) super(x, y, w, h) # 補助ウィンドウ(透明)を作成:カーソル専用 @xrxsc2_window = Window_Selectable.new(self.x, self.y, self.width, self.height) @xrxsc2_window.opacity = 0 @xrxsc2_window.active = false @xrxsc2_window.index = -1 end #-------------------------------------------------------------------------- # ○ 第二カーソルの設置 #-------------------------------------------------------------------------- def index2 return @xrxsc2_window.index end def index2=(index) @xrxsc2_window.index = index if index == -1 @xrxsc2_window.cursor_rect.empty else @xrxsc2_window.x = self.x @xrxsc2_window.y = self.y @xrxsc2_window.cursor_rect = self.cursor_rect end end #-------------------------------------------------------------------------- # ○ 先頭の行の設定 #-------------------------------------------------------------------------- def top_row=(row) super # 補助ウィンドウの oy を更新 pre_oy = @xrxsc2_window.oy @xrxsc2_window.oy = self.oy @xrxsc2_window.cursor_rect.y -= self.oy - pre_oy end #-------------------------------------------------------------------------- # ○ 解放 #-------------------------------------------------------------------------- def dispose @xrxsc2_window.dispose super end #-------------------------------------------------------------------------- # ○ X, Y 座標 #-------------------------------------------------------------------------- def x=(n) super @xrxsc2_window.x = self.x unless @xrxsc2_window.nil? end def y=(n) super @xrxsc2_window.y = self.y unless @xrxsc2_window.nil? end #-------------------------------------------------------------------------- # ○ 可視状態 #-------------------------------------------------------------------------- def visible=(b) @xrxsc2_window.visible = b super end end