设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1739|回复: 4
打印 上一主题 下一主题

[已经过期] 窗口上鼠标显示 求教

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1034
在线时间
749 小时
注册时间
2013-2-15
帖子
116

开拓者

跳转到指定楼层
1
发表于 2014-4-20 17:10:19 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
大神 这个要怎么设置 弄了一下午了 {:2_270:}
像永夜幻想曲的鼠标

而我自己的 ....  

好吧 ...
这是鼠标脚本:
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  6. $敌人选框扩大 = 30
  7. $角色选框扩大 = 20
  8.  
  9.  
  10. #==============================================================================
  11. # API调用
  12. #==============================================================================
  13. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  14. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  15. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  16. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  17. $Window_HWND = $GetActiveWindow.call
  18. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  19. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  20. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  21. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  22. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  23. #$Window_HWND = $FindWindow.call(nil, 'mousetry')
  24.  
  25. module Mouse  
  26.   LEFT = 0x01
  27.   RIGHT = 0x02
  28.  
  29.   def self.init(sprite = nil)
  30. #   $HookStart.call($Window_HWND)
  31.     $ShowCursor.call(0)
  32.  
  33.     @show_cursor = false
  34.  
  35.     @mouse_sprite = Sprite.new
  36.     @mouse_sprite.z = 99999
  37.  
  38.      @mouse_sprite.bitmap = Bitmap.new('Graphics/System/Mouse')
  39.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))
  40.  
  41.     @left_press = false
  42.     @right_press = false
  43.     @left_trigger = false
  44.     @right_trigger = false
  45.     @left_repeat = false
  46.     @right_repeat = false
  47.     @click_lock = false
  48.  
  49.     update
  50.   end
  51.   def self.exit
  52.     @mouse_sprite.bitmap.dispose
  53.     @mouse_sprite.dispose
  54.     @show_cursor = true
  55. #    $HookEnd.call
  56.     $ShowCursor.call(1)
  57.   end
  58.   def self.mouse_debug
  59.     return @mouse_debug.bitmap
  60.   end
  61.   def self.update
  62.     left_down = $GetKeyState.call(0x01)
  63.     right_down = $GetKeyState.call(0x02)
  64.  
  65.     @click_lock = false
  66.     mouse_x, mouse_y = self.get_mouse_pos
  67.     if @mouse_sprite != nil
  68.       @mouse_sprite.x = mouse_x
  69.       @mouse_sprite.y = mouse_y
  70.     end
  71.     if left_down[7] == 1
  72.       @left_repeat = (not @left_repeat)
  73.       @left_trigger = (not @left_press)
  74.       @left_press = true
  75.     else
  76.       @left_press = false
  77.       @left_trigger = false
  78.       @left_repeat = false
  79.     end
  80.     if right_down[7] == 1
  81.       @right_repeat = (not @right_repeat)
  82.       @right_trigger = (not @right_press)
  83.       @right_press = true
  84.     else
  85.       @right_press = false
  86.       @right_trigger = false
  87.       @right_repeat = false
  88.     end
  89.   end
  90.   def self.get_mouse_pos
  91.     point_var = [0, 0].pack('ll')
  92.     if $GetCursorPos.call(point_var) != 0
  93.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  94.         x, y = point_var.unpack('ll')
  95.         if (x < 0) or (x > 10000) then x = 0 end
  96.         if (y < 0) or (y > 10000) then y = 0 end
  97.         if x > Graphics.width then x = Graphics.width end
  98.         if y > Graphics.height then y = Graphics.height end
  99.         return x, y
  100.       else
  101.         return 0, 0
  102.       end
  103.     else
  104.       return 0, 0
  105.     end
  106.   end
  107.   def self.press?(mouse_code)
  108.     if mouse_code == LEFT
  109.       if @click_lock
  110.         return false
  111.       else
  112.         return @left_press
  113.       end
  114.     elsif mouse_code == RIGHT
  115.       return @right_press
  116.     else
  117.       return false
  118.     end
  119.   end
  120.   def self.trigger?(mouse_code)
  121.     if mouse_code == LEFT
  122.       if @click_lock
  123.         return false
  124.       else
  125.         return @left_trigger
  126.       end
  127.     elsif mouse_code == RIGHT
  128.       return @right_trigger
  129.     else
  130.       return false
  131.     end
  132.   end
  133.   def self.repeat?(mouse_code)
  134.     if mouse_code == LEFT
  135.       if @click_lock
  136.         return false
  137.       else
  138.         return @left_repeat
  139.       end
  140.     elsif mouse_code == RIGHT
  141.       return @right_repeat
  142.     else
  143.       return false
  144.     end
  145.   end
  146.   def self.click_lock?
  147.     return @click_lock
  148.   end
  149.   def self.click_lock
  150.     @click_lock = true
  151.   end
  152.   def self.click_unlock
  153.     @click_lock = false
  154.   end
  155. end
  156. module Input
  157.   if @self_update == nil
  158.     @self_update = method('update')
  159.     @self_press = method('press?')
  160.     @self_trigger = method('trigger?')
  161.     @self_repeat = method('repeat?')
  162.   end
  163.   def self.update
  164.     @self_update.call
  165.     Mouse.update
  166.   end
  167.   def self.press?(key_code)
  168.     if @self_press.call(key_code)
  169.       return true
  170.     end
  171.     if key_code == C
  172.       return Mouse.press?(Mouse::LEFT)
  173.     elsif key_code == B
  174.       return Mouse.press?(Mouse::RIGHT)
  175.     else
  176.       return @self_press.call(key_code)
  177.     end
  178.   end
  179.   def self.trigger?(key_code)
  180.     if @self_trigger.call(key_code)
  181.       return true
  182.     end
  183.     if key_code == C
  184.       return Mouse.trigger?(Mouse::LEFT)
  185.     elsif key_code == B
  186.       return Mouse.trigger?(Mouse::RIGHT)
  187.     else
  188.       return @self_trigger.call(key_code)
  189.     end
  190.   end
  191.   def self.repeat?(key_code)
  192.     if @self_repeat.call(key_code)
  193.       return true
  194.     end
  195.     if key_code == C
  196.       return Mouse.repeat?(Mouse::LEFT)
  197.     elsif key_code == B
  198.       return Mouse.repeat?(Mouse::RIGHT)
  199.     else
  200.       return @self_repeat.call(key_code)
  201.     end
  202.   end
  203. end
  204.  
  205. class Window_Selectable
  206.   if @self_alias == nil
  207.     alias self_update update
  208.     @self_alias = true
  209.   end
  210.   def update
  211.     #self.cursor_rect.empty
  212.     self_update
  213.     if self.active and item_max > 0
  214.       index_var = @index
  215.       tp_index = @index
  216.       mouse_x, mouse_y = Mouse.get_mouse_pos
  217.       mouse_not_in_rect = true
  218.       for i in 0...item_max
  219.         [url=home.php?mod=space&uid=370741]@Index[/url] = i
  220.         update_cursor
  221.         top_x = self.cursor_rect.x + self.x + 16
  222.         top_y = self.cursor_rect.y + self.y + 16
  223.         bottom_x = top_x + self.cursor_rect.width
  224.         bottom_y = top_y + self.cursor_rect.height
  225.  
  226.           top_x += self.x_mod
  227.           top_y += self.y_mod
  228.           bottom_x += self.x_mod
  229.           bottom_y += self.y_mod
  230.  
  231.         if (mouse_x > top_x) and (mouse_y > top_y) and
  232.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  233.           mouse_not_in_rect = false
  234.           if tp_index != @index
  235.             tp_index = @index
  236.             $data_system.sounds[0].play
  237.           end
  238.           break
  239.         end
  240.       end
  241.     if Input.trigger?(Input::F9)
  242.     p top_x,top_y,Mouse.get_mouse_pos
  243.     end
  244.       if mouse_not_in_rect
  245.         [url=home.php?mod=space&uid=370741]@Index[/url] = index_var
  246.         update_cursor
  247.         Mouse.click_lock
  248.       else
  249.         Mouse.click_unlock               
  250.       end
  251.     end
  252.   end
  253. end
  254.  
  255.  
  256.  
  257.  
  258. class Window_NameInput
  259.   if @self_alias == nil
  260.     alias self_update update
  261.     @self_alias = true
  262.   end
  263.   def update
  264.     #self.cursor_rect.empty
  265.     self_update
  266.     if self.active
  267.       index_var = @index
  268.       mouse_x, mouse_y = Mouse.get_mouse_pos
  269.       mouse_not_in_rect = true
  270.       for i in (0...HIRAGANA.size).to_a.push(180)
  271.         @index = i
  272.         update_cursor
  273.         top_x = self.cursor_rect.x + self.x + 16
  274.         top_y = self.cursor_rect.y + self.y + 16
  275.         bottom_x = top_x + self.cursor_rect.width
  276.         bottom_y = top_y + self.cursor_rect.height
  277.         #
  278.         if (mouse_x > top_x) and (mouse_y > top_y) and
  279.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  280.           mouse_not_in_rect = false
  281.           break
  282.         end
  283.       end
  284.       if mouse_not_in_rect
  285.         @index = index_var
  286.         update_cursor
  287.         Mouse.click_lock
  288.       else
  289.         Mouse.click_unlock
  290.       end
  291.     end
  292.   end
  293. end
  294. =begin
  295.  
  296. class Window_InputNumber
  297.   if @self_alias == nil
  298.     alias self_update update
  299.     @self_alias = true
  300.   end
  301.   def update
  302.     #self.cursor_rect.empty
  303.     self_update
  304.     mouse_x, mouse_y = Mouse.get_mouse_pos
  305.     if self.active and @digits_max > 0
  306.       index_var = @index
  307.       mouse_not_in_rect = true
  308.       for i in 0...@digits_max
  309.         @index = i
  310.         #update_cursor
  311.         top_x = self.cursor_rect.x + self.x + 16
  312.         bottom_x = top_x + self.cursor_rect.width
  313.         #
  314.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  315.           mouse_not_in_rect = false
  316.           break
  317.         end
  318.       end
  319.       if mouse_not_in_rect
  320.         @index = index_var
  321.         #update_cursor
  322.         Mouse.click_lock
  323.       else
  324.         Mouse.click_unlock
  325.       end
  326.     end
  327.     if @last_mouse_y == nil
  328.       @last_mouse_y = mouse_y
  329.     end
  330.     check_pos = (@last_mouse_y - mouse_y).abs
  331.     if check_pos > 10
  332.       #$game_system.se_play($data_system.cursor_se)
  333.       place = 10 ** (@digits_max - 1 - @index)
  334.       n = [url=home.php?mod=space&uid=27178]@Number[/url] / place % 10
  335.       [url=home.php?mod=space&uid=27178]@Number[/url] -= n * place
  336.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  337.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  338.       @number += n * place
  339.       refresh
  340.       @last_mouse_y = mouse_y
  341.     end
  342.   end
  343. end
  344. =end
  345.  
  346. class Scene_File
  347.   if @self_alias == nil
  348.     alias self_update update
  349.     @self_alias = true
  350.   end
  351.   def update
  352.     mouse_x, mouse_y = Mouse.get_mouse_pos
  353.     Mouse.click_lock
  354.     idx = 0
  355.     for i in @savefile_windows
  356.       top_x = i.x + 16
  357.       top_y = i.y + 16
  358.       bottom_x = top_x + i.width
  359.       bottom_y = top_y + i.height
  360.       if (mouse_x > top_x) and (mouse_y > top_y) and
  361.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  362.         i.selected = true
  363.         if @file_index != idx
  364.           @file_index = idx
  365.           $data_system.sounds[0].play
  366.         end            
  367.         Mouse.click_unlock
  368.       else
  369.         i.selected = false
  370.       end
  371.       idx += 1
  372.     end
  373.     self_update
  374.   end
  375. end
  376.  
  377. class Game_Player
  378.   if @self_alias == nil
  379.     alias self_update update
  380.     @self_alias = true
  381.   end
  382.   def update
  383.     mouse_x, mouse_y = Mouse.get_mouse_pos
  384.     if @last_move_x == nil
  385.       @last_move_x = false
  386.     end
  387.     if Mouse.press?(Mouse::LEFT)
  388.    #for event in $game_map.events.values
  389.    #if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
  390.    #event.start
  391.    #end
  392.    #end
  393.       last_moving = moving?
  394.       last_direction = @direction
  395.     #  return unless movable?
  396.     #  return if $game_map.interpreter.running?
  397.       unless moving? or $game_map.interpreter.running?
  398.       last_x = @x
  399.         if @last_move_x
  400.           @last_move_x = false
  401.         elsif mouse_x > screen_x + 16
  402.           move_straight(6)
  403.         elsif mouse_x < screen_x - 16
  404.           move_straight(4)
  405.         end
  406.         last_y = @y
  407.         if last_x != @x
  408.           @last_move_x = true
  409.         elsif mouse_y > screen_y
  410.           move_straight(2)
  411.         elsif mouse_y < screen_y - 32
  412.           move_straight(8)
  413.         end
  414. =begin        
  415.         if last_y != @y
  416.           @last_move_x = false
  417.         elsif not @last_move_x
  418.           case last_direction
  419.           when 2
  420.             turn_down
  421.           when 4
  422.             turn_left
  423.           when 6
  424.             turn_right
  425.           when 8
  426.             turn_up
  427.           end        
  428.         end
  429. =end         
  430.       end
  431.     end
  432.     self_update
  433.   end
  434. end
  435.  
  436. Mouse.init
  437. END { Mouse.exit }
  438.  
  439.  
  440. class Window_Base < Window
  441.   attr_accessor :x_mod
  442.   attr_accessor :y_mod
  443.   alias ka_initialize initialize
  444.   def initialize(x, y, width, height)
  445.     ka_initialize(x, y, width, height)
  446.     self.x_mod = 0
  447.     self.y_mod = 0
  448.   end
  449. end
  450. class Window_PartyCommand < Window_Command
  451.  
  452.   alias ka1_initialize initialize
  453.   def initialize
  454.     ka1_initialize
  455.     self.y_mod = Graphics.height-128
  456.   end
  457.  
  458. end
  459. class Window_ActorCommand < Window_Command
  460.  
  461.   alias ka2_initialize initialize
  462.   def initialize
  463.     ka2_initialize
  464.     self.x_mod = -128
  465.     self.y_mod = Graphics.height-128
  466.   end
  467.  
  468. end
  469.  
  470. #==============================================================================
  471. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  472. #==============================================================================
  

Lv3.寻梦者

梦石
0
星屑
1034
在线时间
749 小时
注册时间
2013-2-15
帖子
116

开拓者

2
 楼主| 发表于 2014-4-20 19:24:06 | 只看该作者
没人吗
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
41096
在线时间
7568 小时
注册时间
2009-7-6
帖子
13498

开拓者贵宾

3
发表于 2014-4-20 19:58:42 | 只看该作者
这里默认是用图片代替了鼠标指针,流畅性根据游戏刷新频率相关,图片自然不能出游戏范围。
永夜是SetCursor函数设置的图标资源……=A=
但我记得RM默认会每过一段时间SetCursor为空,你想设置还需要自己修改一下相关函数。
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1034
在线时间
749 小时
注册时间
2013-2-15
帖子
116

开拓者

4
 楼主| 发表于 2014-4-20 20:55:29 | 只看该作者
这里默认是用图片代替了鼠标指针,流畅性根据游戏刷新频率相关,图片自然不能出游戏范围。
永夜是SetCursor函数设置的图标资源……=A=
但我记得RM默认会每过一段时间SetCursor为空,你想设置还需要自己修改一下相关函数。

终于来大神了
大神 要怎么改
是用eXeScope这个吗  
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1034
在线时间
749 小时
注册时间
2013-2-15
帖子
116

开拓者

5
 楼主| 发表于 2014-4-20 20:55:52 | 只看该作者
这里默认是用图片代替了鼠标指针,流畅性根据游戏刷新频率相关,图片自然不能出游戏范围。
永夜是SetCursor函数设置的图标资源……=A=
但我记得RM默认会每过一段时间SetCursor为空,你想设置还需要自己修改一下相关函数。

终于来大神了
大神 要怎么改
是用eXeScope这个吗  
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 07:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表