#============================================================================== module BLACK # There's a hidden window on the game menu that corresponds with the mouse # highlight system. The setting below can be used to customize said window. # # x, y, option height, option width MOUSE_MENU_SETTING = [0, 0, 34, 236] # We list the scene where we don't want the mouse to be active inside this # array. Note that the scene name is case sensitive. MOUSE_BLACKLIST = [ 'Scene_System', 'Scene_Save' ] # This determines how far the least distance of swiping should be before it # triggers the swipe function. MINIMUM_SWIPE = 100 end #============================================================================== #------------------------------------------------------------------------------ # * Beyond this is the sacred land of code. You need programming qualification # to dwelve deeper, or it'll cause many unnecessary problems. Proceed on your # own risk. #------------------------------------------------------------------------------ #============================================================================== # Fix a crash on File Scene #============================================================================== # Make the mouse_input method does nothing to avoid crash. class Scene_File < Scene_MenuBase; def mouse_input; end; end #============================================================================== #============================================================================== # Add sounds when switching between choices. #============================================================================== class Window_Selectable alias b_up_mo update_mouse def update_mouse last_index = @index; b_up_mo; Sound.play_cursor if @index != last_index end end #============================================================================== #============================================================================== # Fix the in-game menu mouse offset. #============================================================================== class Scene_Menu < Scene_MenuBase alias b_ms_ccw create_command_window def create_command_window b_ms_ccw @command_window.x = BLACK::MOUSE_MENU_SETTING[0] @command_window.y = BLACK::MOUSE_MENU_SETTING[1] end end class Window_MenuCommand < Window_Command def item_height; BLACK::MOUSE_MENU_SETTING[2]; end def window_width; BLACK::MOUSE_MENU_SETTING[3]; end def window_height visible_line_number * item_height + standard_padding * 2 end end #============================================================================== #============================================================================== # Made the mouse always appears on the screen. # Disable the mouse on certain scenes. #============================================================================== module Mouse # Create an alias to always update cursor position. class << self alias b_update update def update self.update_cursor_pos #p SceneManager.scene.class.name return false if BLACK::MOUSE_BLACKLIST.include?(SceneManager.scene.class.name) b_update end end # New method to update cursor position. def self.update_cursor_pos @window_loc = WINX.call(0,0,"RGSS PLAYER",0) rect = '0000000000000000' cursor_pos = '00000000' WREC.call(@window_loc, rect) side, top = rect.unpack("ll") CPOS.call(cursor_pos) @m_x, @m_y = cursor_pos.unpack("ll") w_x = side + SMET.call(5) + SMET.call(45) w_y = top + SMET.call(6) + SMET.call(46) + SMET.call(4) @m_x -= w_x; @m_y -= w_y if MOUSE_KEEP_WINDOW @m_x = [[@m_x, 0].max,Graphics.width-5].min @m_y = [[@m_y, 0].max,Graphics.height-5].min end end # Overwrite pos? method. def self.pos?; return [@m_x, @m_y]; end end # Make the scene always update the mouse. class Scene_Base alias b_m_c mouse_cursor; def mouse_cursor; Mouse.update; b_m_c; end end #============================================================================== #============================================================================== # Make a swipe function on relationship menu. # Add right click function to relationship menu. #============================================================================== class Scene_CharacterStats < Scene_MenuBase alias mouse_update update def update; mouse_update; update_mouse; end def update_mouse @swipe_pos = Mouse.pos? if !Mouse.lclick?.nil? && @swipe_pos.nil? if Mouse.lclick?.nil? && !@swipe_pos.nil? dist = @swipe_pos[0] - Mouse.pos?[0] @swipe_pos = nil return if dist.abs <= BLACK::MINIMUM_SWIPE # When dist is positive, it means the mouse swiped to the left. if dist < 0 Sound.play_cursor @index += 1 if @index == $game_system.character_list.size @index = 0 end @character = CharacterStats::CONFIG[$game_system.character_list[@index]] dispose_dynamic_sprites create_dynamic_sprites else Sound.play_cursor @index -= 1 if @index == -1 @index = $game_system.character_list.size - 1 end @character = CharacterStats::CONFIG[$game_system.character_list[@index]] dispose_dynamic_sprites create_dynamic_sprites end end (Sound.play_cancel; return_scene) if Mouse.rclick? end end #============================================================================== #============================================================================== # Add right click function to Scene_NewStatusMenu. #============================================================================== class Scene_NewStatusMenu < Scene_Base alias mouse_update update def update; mouse_update; update_mouse; end def update_mouse; (Sound.play_cancel; return_scene) if Mouse.rclick?; end end #==============================================================================