赞 | 0 |
VIP | 133 |
好人卡 | 5 |
积分 | 1 |
经验 | 15036 |
最后登录 | 2017-9-12 |
在线时间 | 190 小时 |
Lv1.梦旅人 彩色的银子
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 190 小时
- 注册时间
- 2006-6-13
- 帖子
- 1361
|
其实可以把ClipCursor这个函数给考虑进去``这样鼠标就不会离开窗口了`
- class String
- MultiByteToWideChar = Win32API.new("kernel32", "MultiByteToWideChar", "llplpl", "l")
- WideCharToMultiByte = Win32API.new("kernel32", "WideCharToMultiByte", "llplplpp", "l")
- CP_ACP = 0
- CP_UTF8 = 65001
- #--------------------------------------------------------------------------
- # ● UTF-8转JIS
- #--------------------------------------------------------------------------
- def to_jis
-
- # UTF-8 -> Unicode
- len = MultiByteToWideChar.call(CP_UTF8, 0, self, -1, nil, 0);
- buf = "\0" * (len*2)
- MultiByteToWideChar.call(CP_UTF8, 0, self, -1, buf, buf.size/2);
- # Unicode -> S-JIS
- len = WideCharToMultiByte.call(CP_ACP, 0, buf, -1, nil, 0, nil, nil);
- ret = "\0" * len
- WideCharToMultiByte.call(CP_ACP, 0, buf, -1, ret, ret.size, nil, nil);
-
- return ret
- end
- end
- # 窗口名字
- WindowClassName = "鼠标卷屏".to_jis
- ClipCursor = Win32API.new("user32", "ClipCursor", "p", "l")
- ClientToScreen = Win32API.new("user32", "ClientToScreen", "lp", "l")
- FindWindow = Win32API.new("user32", "FindWindow", "pp", "l")
- HWnd = FindWindow.call("RGSS Player",WindowClassName)
- xy = [0, 0].pack("l*")
- ClientToScreen.call(HWnd, xy)
- x,y = xy.unpack("l*")
- rect = [x, y, 640+x, 480+y].pack("l*")
- ClipCursor.call(rect)
- class Scene_Map
- alias old update
- def update
- @by = 32 #感应鼠标边缘的范围
- @speed = 64 #移动速度
- mx,my = Mouse.get_mouse_pos
- move_r if mx>640-@by
- move_l if mx<@by
- move_u if my<@by
- move_d if my>480-@by
- old
- end
- def move_r
- $game_map.scroll_right(@speed)
- end
- def move_l
- $game_map.scroll_left(@speed)
- end
- def move_u
- $game_map.scroll_up(@speed)
- end
- def move_d
- $game_map.scroll_down(@speed)
- end
- end
复制代码
另外```LZ进步的飞快啊````{/qiang}{/qiang} |
|