赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
- #==============================================================================
- # ■ Mouse
- #------------------------------------------------------------------------------
- # 不掉FPS的DLL鼠标。
- #==============================================================================
- class Mouse
- # 定义变量
- DLL = 'Mouse'
- $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
- $hWnd = $GetActiveWindow.call
- $Get_Pos_X = Win32API.new(DLL, 'Get_Pos_X', nil, 'l')
- $Get_Pos_Y = Win32API.new(DLL, 'Get_Pos_Y', nil, 'l')
- $Left = Win32API.new(DLL, 'Get_Left', nil, 'l')
- $Right = Win32API.new(DLL, 'Get_Right', nil, 'l')
- $Updata = Win32API.new(DLL, 'Updata_Mouse', nil, 'l')
- $Mouse_Close = Win32API.new(DLL, 'Mouse_Close', nil, nil)
- $Mouse_Start = Win32API.new(DLL, 'Mouse_Start', 'l', 'l')
- #结束变量的定义
- def init
- $Mouse_Start.call($hWnd)
- @x = 0
- @y = 0
- @left = false
- @right = false
- @cursor = Sprite.new
- @cursor.bitmap = Cache.system("cursor1.png")
- @cursor.z = 99999
- end
- def update
- err = $Updata.call
- if err != 0
- raise "Up Mouse System Error..."
- end
- @x = $Get_Pos_X.call
- @y = $Get_Pos_Y.call
- @cursor.x = @x
- @cursor.y = @y
- l = $Left.call
- r = $Right.call
- if l == 1
- @left = true
- else
- @left = false
- end
- if r == 1
- @right = true
- else
- @right = false
- end
- end
- def end
- $Mouse_Close.call
- end
- def click_on(button)
- if button = "L"
- if @left
- return true
- end
- end
- if button = "R"
- if @right
- return true
- end
- end
- end
- def self.pos
- return @x,@y
- end
- end
- #==============================================================================
- # ■ Graphics
- #------------------------------------------------------------------------------
- # 图象模块,添加鼠标支持。
- #==============================================================================
- class << Graphics
-
- alias origin_update update
-
- def update
- origin_update
- $mouse.update
- end
-
- end
- $mouse = Mouse.new
- $mouse.init
复制代码
Dll是自制的哦~~
DLL:http://rpg.blue/upload_program/files/Mouse_94254616.rar
Dll是米有问题滴~~
能改就改吧。
dll代码
- Private Type POINTAPI
- x As Long
- Y As Long
- End Type
- Dim p As POINTAPI
- Dim l As Long
- Dim hd As Long
- Dim KeyTepy(1) As Integer
- Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
- Private Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long
- Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
- Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
- Private Function Get_Pos_X() As Long
- If p.x < 0 Then
- p.x = 0
- End If
- If p.x > 544 Then
- p.x = 544
- End If
- Get_Pos_X = p.x
- End Function
- Private Function Get_Pos_Y() As Long
- If p.Y < 0 Then
- p.Y = 0
- End If
- If p.Y > 416 Then
- p.Y = 416
- End If
- Get_Pos_Y = p.Y
- End Function
- Private Function Get_Left() As Integer
- Get_Left = KeyTepy(0)
- End Function
- Private Function Get_Right() As Integer
- Get_Right = KeyTepy(1)
- End Function
- Private Function Updata_Mouse() As Long
- If Mouse_Open = True Then
- Call GetCursorPos(p)
- l = ScreenToClient(hd, p)
- Dim x As Long
- x = GetAsyncKeyState(1) '左键
- 'KeyTepy = 0
- If x = -32767 Then
- KeyTepy(0) = 1
- Else
- KeyTepy(0) = 0
- End If
-
- x = GetAsyncKeyState(2) '右键
- If x = -32767 Then
- KeyTepy(1) = 1
- Else
- KeyTepy(1) = 0
- End If
- Updata_Mouse = 0
- Else
- Updata_Mouse = 1
- End If
- End Function
- Sub Mouse_Close()
- ShowCursor (1)
- l = ""
- hd = ""
- KeyTepy(0) = 0
- KeyTepy(1) = 0
- Mouse_Open = False
- End Sub
- Private Function Mouse_Start(hWnd As Long) As Long
- ShowCursor (0)
- hd = hWnd
- Mouse_Open = True
- Mouse_Start = 0
- End Function
- ''''''''''''''''''''''''''''''''''''''''''''''''
- '' DLL PROJECT ?004 DanSoft Australia ''
- '' Your dlls MUST HAVE a DLLMain and Main ''
- '' proc, otherwise it won't compile properly! ''
- ''''''''''''''''''''''''''''''''''''''''''''''''
- Sub Main()
- 'This is a dummy, so the IDE doesn't complain
- 'there is no Sub Main.
- End Sub
- Function DLLMain(ByVal hInstDLL As Long, ByVal fdwReason As Long, ByVal lpwReserved As Long) As Long
- DLLMain = 1
- End Function
- 'add more functions here, ie.
- 'Function addition(ByVal A As Double, ByVal B As Double) As Double
- ' addition = A + B
- 'End Function
复制代码
Dll的输出绝对符合标准!!! |
|