0181220115851.png (16.51 KB, 下载次数: 29)
1.6 MB, 下载次数: 266
233
MouseCursor.png (433 Bytes, 下载次数: 32)
赠送
[attach]325593[/attach] ------------------------------------------------------------------- #encoding:utf-8 # 基础鼠标模组 v3.02 (2014/2/15) # ·需· SiNova_Input v1.00+ # v3.02 添加方法,以便兼容以前写的脚本 # 鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹 module Mouse end class << Mouse DK_Frame = 15 # 判断双击间隔帧数 attr_reader\ :dk_count GetMousePos = API_.new 'SiNova|GetMousePos|p|v' SetMousePos = API_.new 'SiNova|SetMousePos|II|v' MouseZ = API_.new 'SiNova|MouseZ|v|i' MouseZReset = API_.new 'SiNova|MouseZReset|v|v' def activate(vp = nil) @buf = [0, 0].pack("ii") @ck_count = 0 @dk_count = 0 hide_system_cursor create_cursor(vp) end def update update_cursor update_mouse_lock update_mouse_scroll update_double_click end def deactivate show_system_cursor dispose_cursor end def create_cursor(vp) dispose_cursor if @sprite @sprite = Sprite.new(vp) @sprite.z = 9999 if File.exist?('Graphics/System/MouseCursor.png') @sprite.bitmap = Cache.system('MouseCursor') else @sprite.bitmap = Bitmap.new(24, 24) @sprite.bitmap.blt(0, 0, Cache.system('Iconset'), Rect.new(5 * 24, 24 * 24, 24, 24)) end update_cursor end def dispose_cursor return if @sprite.disposed? @sprite.bitmap.dispose @sprite.dispose update end # def x @sprite.x end def y @sprite.y end def z MouseZ.call end def reset_z MouseZReset.call end # 3.01 new -- def press?(sym) case sym when :L; Input.key_press? 0x01 when :R; Input.key_press? 0x02 when :M; Input.key_press? 0x05 end end def trigger?(sym) case sym when :L; Input.key_trigger? 0x01 when :R; Input.key_trigger? 0x02 when :M; Input.key_trigger? 0x05 end end def repeat?(sym) case sym when :L; Input.key_repeat? 0x01 when :R; Input.key_repeat? 0x02 when :M; Input.key_repeat? 0x05 end end #-- def update_cursor GetMousePos.call @buf @sprite.x, @sprite.y = *@buf.unpack("ii") end def update_mouse_scroll @mouseZ end # def update_double_click if Input.key_trigger?(0x01) if @dk_count <= DK_Frame @dk_count = DK_Frame @double_click = true else # 非双击,重置 dk_count @dk_count = 0 @double_click = false end else @double_click = false end @dk_count += 1 end def double_click? @double_click end # def update_mouse_lock # press Alt + L 锁定 Alt + O 解除锁定 if Input.key_press?(0x12) return lock if Input.key_trigger?(0x4C) return unlock if Input.key_trigger?(0x4F) end end # def lock API_.call 'SiNova|MouseLock|v|v' end def unlock API_.call 'SiNova|MouseUnLock|v|v' end def show_system_cursor api_sc = API_.new 'User32|ShowCursor|p|l' begin state = api_sc.call(1) end while state < 0 end def hide_system_cursor api_sc = API_.new 'User32|ShowCursor|p|l' begin state = api_sc.call(0) end while state >= 0 end def set_pos(x, y) SetMousePos.call(x, y) end end if $SINOVA #验证组件完整性 if $SINOVA[:input] if $SINOVA[:input] >= 1.00 #所需组件版本 $SINOVA[:mouseBase] = 3.02 #当前组件版本 else msgbox "SiNova_Input 版本过低,需 1.00 以上" exit end else msgbox "Nova_TypeIn 需置于 SiNova_Input 脚本之下" exit end else msgbox "Nova_TypeIn 需置于 NovaBase 脚本之下" exit end ----------------------------------------------------------------------------------
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |