查看: 2147|回复: 4

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

[复制链接]
梦石
0
星屑
1044
在线时间
750 小时
注册时间
2013-2-15
回帖
82

开拓者

发表于 2014-4-20 17:10:19 | 显示全部楼层 |阅读模式

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

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

×
大神 这个要怎么设置 弄了一下午了 {:2_270:}
像永夜幻想曲的鼠标
5655.png
而我自己的 ....  
210426xnriznn577azal87.jpg
好吧 ...
这是鼠标脚本:
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================

  4. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  5. $敌人选框扩大 = 30
  6. $角色选框扩大 = 20


  7. #==============================================================================
  8. # API调用
  9. #==============================================================================
  10. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  11. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  12. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  13. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  14. $Window_HWND = $GetActiveWindow.call
  15. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  16. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  17. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  18. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  19. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  20. #$Window_HWND = $FindWindow.call(nil, 'mousetry')

  21. module Mouse  
  22.   LEFT = 0x01
  23.   RIGHT = 0x02

  24.   def self.init(sprite = nil)
  25. #   $HookStart.call($Window_HWND)
  26.     $ShowCursor.call(0)
  27.    
  28.     @show_cursor = false
  29.    
  30.     @mouse_sprite = Sprite.new
  31.     @mouse_sprite.z = 99999
  32.    
  33.      @mouse_sprite.bitmap = Bitmap.new('Graphics/System/Mouse')
  34.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))

  35.     @left_press = false
  36.     @right_press = false
  37.     @left_trigger = false
  38.     @right_trigger = false
  39.     @left_repeat = false
  40.     @right_repeat = false
  41.     @click_lock = false
  42.    
  43.     update
  44.   end
  45.   def self.exit
  46.     @mouse_sprite.bitmap.dispose
  47.     @mouse_sprite.dispose
  48.     @show_cursor = true
  49. #    $HookEnd.call
  50.     $ShowCursor.call(1)
  51.   end
  52.   def self.mouse_debug
  53.     return @mouse_debug.bitmap
  54.   end
  55.   def self.update
  56.     left_down = $GetKeyState.call(0x01)
  57.     right_down = $GetKeyState.call(0x02)
  58.    
  59.     @click_lock = false
  60.     mouse_x, mouse_y = self.get_mouse_pos
  61.     if @mouse_sprite != nil
  62.       @mouse_sprite.x = mouse_x
  63.       @mouse_sprite.y = mouse_y
  64.     end
  65.     if left_down[7] == 1
  66.       @left_repeat = (not @left_repeat)
  67.       @left_trigger = (not @left_press)
  68.       @left_press = true
  69.     else
  70.       @left_press = false
  71.       @left_trigger = false
  72.       @left_repeat = false
  73.     end
  74.     if right_down[7] == 1
  75.       @right_repeat = (not @right_repeat)
  76.       @right_trigger = (not @right_press)
  77.       @right_press = true
  78.     else
  79.       @right_press = false
  80.       @right_trigger = false
  81.       @right_repeat = false
  82.     end
  83.   end
  84.   def self.get_mouse_pos
  85.     point_var = [0, 0].pack('ll')
  86.     if $GetCursorPos.call(point_var) != 0
  87.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  88.         x, y = point_var.unpack('ll')
  89.         if (x < 0) or (x > 10000) then x = 0 end
  90.         if (y < 0) or (y > 10000) then y = 0 end
  91.         if x > Graphics.width then x = Graphics.width end
  92.         if y > Graphics.height then y = Graphics.height end
  93.         return x, y
  94.       else
  95.         return 0, 0
  96.       end
  97.     else
  98.       return 0, 0
  99.     end
  100.   end
  101.   def self.press?(mouse_code)
  102.     if mouse_code == LEFT
  103.       if @click_lock
  104.         return false
  105.       else
  106.         return @left_press
  107.       end
  108.     elsif mouse_code == RIGHT
  109.       return @right_press
  110.     else
  111.       return false
  112.     end
  113.   end
  114.   def self.trigger?(mouse_code)
  115.     if mouse_code == LEFT
  116.       if @click_lock
  117.         return false
  118.       else
  119.         return @left_trigger
  120.       end
  121.     elsif mouse_code == RIGHT
  122.       return @right_trigger
  123.     else
  124.       return false
  125.     end
  126.   end
  127.   def self.repeat?(mouse_code)
  128.     if mouse_code == LEFT
  129.       if @click_lock
  130.         return false
  131.       else
  132.         return @left_repeat
  133.       end
  134.     elsif mouse_code == RIGHT
  135.       return @right_repeat
  136.     else
  137.       return false
  138.     end
  139.   end
  140.   def self.click_lock?
  141.     return @click_lock
  142.   end
  143.   def self.click_lock
  144.     @click_lock = true
  145.   end
  146.   def self.click_unlock
  147.     @click_lock = false
  148.   end
  149. end
  150. module Input
  151.   if @self_update == nil
  152.     @self_update = method('update')
  153.     @self_press = method('press?')
  154.     @self_trigger = method('trigger?')
  155.     @self_repeat = method('repeat?')
  156.   end
  157.   def self.update
  158.     @self_update.call
  159.     Mouse.update
  160.   end
  161.   def self.press?(key_code)
  162.     if @self_press.call(key_code)
  163.       return true
  164.     end
  165.     if key_code == C
  166.       return Mouse.press?(Mouse::LEFT)
  167.     elsif key_code == B
  168.       return Mouse.press?(Mouse::RIGHT)
  169.     else
  170.       return @self_press.call(key_code)
  171.     end
  172.   end
  173.   def self.trigger?(key_code)
  174.     if @self_trigger.call(key_code)
  175.       return true
  176.     end
  177.     if key_code == C
  178.       return Mouse.trigger?(Mouse::LEFT)
  179.     elsif key_code == B
  180.       return Mouse.trigger?(Mouse::RIGHT)
  181.     else
  182.       return @self_trigger.call(key_code)
  183.     end
  184.   end
  185.   def self.repeat?(key_code)
  186.     if @self_repeat.call(key_code)
  187.       return true
  188.     end
  189.     if key_code == C
  190.       return Mouse.repeat?(Mouse::LEFT)
  191.     elsif key_code == B
  192.       return Mouse.repeat?(Mouse::RIGHT)
  193.     else
  194.       return @self_repeat.call(key_code)
  195.     end
  196.   end
  197. end

  198. class Window_Selectable
  199.   if @self_alias == nil
  200.     alias self_update update
  201.     @self_alias = true
  202.   end
  203.   def update
  204.     #self.cursor_rect.empty
  205.     self_update
  206.     if self.active and item_max > 0
  207.       index_var = @index
  208.       tp_index = @index
  209.       mouse_x, mouse_y = Mouse.get_mouse_pos
  210.       mouse_not_in_rect = true
  211.       for i in 0...item_max
  212.         [url=home.php?mod=space&uid=370741]@Index[/url] = i
  213.         update_cursor
  214.         top_x = self.cursor_rect.x + self.x + 16
  215.         top_y = self.cursor_rect.y + self.y + 16
  216.         bottom_x = top_x + self.cursor_rect.width
  217.         bottom_y = top_y + self.cursor_rect.height
  218.         
  219.           top_x += self.x_mod
  220.           top_y += self.y_mod
  221.           bottom_x += self.x_mod
  222.           bottom_y += self.y_mod
  223.         
  224.         if (mouse_x > top_x) and (mouse_y > top_y) and
  225.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  226.           mouse_not_in_rect = false
  227.           if tp_index != @index
  228.             tp_index = @index
  229.             $data_system.sounds[0].play
  230.           end
  231.           break
  232.         end
  233.       end
  234.     if Input.trigger?(Input::F9)
  235.     p top_x,top_y,Mouse.get_mouse_pos
  236.     end
  237.       if mouse_not_in_rect
  238.         [url=home.php?mod=space&uid=370741]@Index[/url] = index_var
  239.         update_cursor
  240.         Mouse.click_lock
  241.       else
  242.         Mouse.click_unlock               
  243.       end
  244.     end
  245.   end
  246. end




  247. class Window_NameInput
  248.   if @self_alias == nil
  249.     alias self_update update
  250.     @self_alias = true
  251.   end
  252.   def update
  253.     #self.cursor_rect.empty
  254.     self_update
  255.     if self.active
  256.       index_var = @index
  257.       mouse_x, mouse_y = Mouse.get_mouse_pos
  258.       mouse_not_in_rect = true
  259.       for i in (0...HIRAGANA.size).to_a.push(180)
  260.         @index = i
  261.         update_cursor
  262.         top_x = self.cursor_rect.x + self.x + 16
  263.         top_y = self.cursor_rect.y + self.y + 16
  264.         bottom_x = top_x + self.cursor_rect.width
  265.         bottom_y = top_y + self.cursor_rect.height
  266.         #
  267.         if (mouse_x > top_x) and (mouse_y > top_y) and
  268.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  269.           mouse_not_in_rect = false
  270.           break
  271.         end
  272.       end
  273.       if mouse_not_in_rect
  274.         @index = index_var
  275.         update_cursor
  276.         Mouse.click_lock
  277.       else
  278.         Mouse.click_unlock
  279.       end
  280.     end
  281.   end
  282. end
  283. =begin

  284. class Window_InputNumber
  285.   if @self_alias == nil
  286.     alias self_update update
  287.     @self_alias = true
  288.   end
  289.   def update
  290.     #self.cursor_rect.empty
  291.     self_update
  292.     mouse_x, mouse_y = Mouse.get_mouse_pos
  293.     if self.active and @digits_max > 0
  294.       index_var = @index
  295.       mouse_not_in_rect = true
  296.       for i in 0...@digits_max
  297.         @index = i
  298.         #update_cursor
  299.         top_x = self.cursor_rect.x + self.x + 16
  300.         bottom_x = top_x + self.cursor_rect.width
  301.         #
  302.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  303.           mouse_not_in_rect = false
  304.           break
  305.         end
  306.       end
  307.       if mouse_not_in_rect
  308.         @index = index_var
  309.         #update_cursor
  310.         Mouse.click_lock
  311.       else
  312.         Mouse.click_unlock
  313.       end
  314.     end
  315.     if @last_mouse_y == nil
  316.       @last_mouse_y = mouse_y
  317.     end
  318.     check_pos = (@last_mouse_y - mouse_y).abs
  319.     if check_pos > 10
  320.       #$game_system.se_play($data_system.cursor_se)
  321.       place = 10 ** (@digits_max - 1 - @index)
  322.       n = [url=home.php?mod=space&uid=27178]@Number[/url] / place % 10
  323.       [url=home.php?mod=space&uid=27178]@Number[/url] -= n * place
  324.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  325.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  326.       @number += n * place
  327.       refresh
  328.       @last_mouse_y = mouse_y
  329.     end
  330.   end
  331. end
  332. =end

  333. class Scene_File
  334.   if @self_alias == nil
  335.     alias self_update update
  336.     @self_alias = true
  337.   end
  338.   def update
  339.     mouse_x, mouse_y = Mouse.get_mouse_pos
  340.     Mouse.click_lock
  341.     idx = 0
  342.     for i in @savefile_windows
  343.       top_x = i.x + 16
  344.       top_y = i.y + 16
  345.       bottom_x = top_x + i.width
  346.       bottom_y = top_y + i.height
  347.       if (mouse_x > top_x) and (mouse_y > top_y) and
  348.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  349.         i.selected = true
  350.         if @file_index != idx
  351.           @file_index = idx
  352.           $data_system.sounds[0].play
  353.         end            
  354.         Mouse.click_unlock
  355.       else
  356.         i.selected = false
  357.       end
  358.       idx += 1
  359.     end
  360.     self_update
  361.   end
  362. end

  363. class Game_Player
  364.   if @self_alias == nil
  365.     alias self_update update
  366.     @self_alias = true
  367.   end
  368.   def update
  369.     mouse_x, mouse_y = Mouse.get_mouse_pos
  370.     if @last_move_x == nil
  371.       @last_move_x = false
  372.     end
  373.     if Mouse.press?(Mouse::LEFT)
  374.    #for event in $game_map.events.values
  375.    #if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
  376.    #event.start
  377.    #end
  378.    #end
  379.       last_moving = moving?
  380.       last_direction = @direction
  381.     #  return unless movable?
  382.     #  return if $game_map.interpreter.running?
  383.       unless moving? or $game_map.interpreter.running?
  384.       last_x = @x
  385.         if @last_move_x
  386.           @last_move_x = false
  387.         elsif mouse_x > screen_x + 16
  388.           move_straight(6)
  389.         elsif mouse_x < screen_x - 16
  390.           move_straight(4)
  391.         end
  392.         last_y = @y
  393.         if last_x != @x
  394.           @last_move_x = true
  395.         elsif mouse_y > screen_y
  396.           move_straight(2)
  397.         elsif mouse_y < screen_y - 32
  398.           move_straight(8)
  399.         end
  400. =begin        
  401.         if last_y != @y
  402.           @last_move_x = false
  403.         elsif not @last_move_x
  404.           case last_direction
  405.           when 2
  406.             turn_down
  407.           when 4
  408.             turn_left
  409.           when 6
  410.             turn_right
  411.           when 8
  412.             turn_up
  413.           end        
  414.         end
  415. =end         
  416.       end
  417.     end
  418.     self_update
  419.   end
  420. end

  421. Mouse.init
  422. END { Mouse.exit }


  423. class Window_Base < Window
  424.   attr_accessor :x_mod
  425.   attr_accessor :y_mod
  426.   alias ka_initialize initialize
  427.   def initialize(x, y, width, height)
  428.     ka_initialize(x, y, width, height)
  429.     self.x_mod = 0
  430.     self.y_mod = 0
  431.   end
  432. end
  433. class Window_PartyCommand < Window_Command

  434.   alias ka1_initialize initialize
  435.   def initialize
  436.     ka1_initialize
  437.     self.y_mod = Graphics.height-128
  438.   end

  439. end
  440. class Window_ActorCommand < Window_Command

  441.   alias ka2_initialize initialize
  442.   def initialize
  443.     ka2_initialize
  444.     self.x_mod = -128
  445.     self.y_mod = Graphics.height-128
  446.   end

  447. end

  448. #==============================================================================
  449. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  450. #==============================================================================
复制代码
梦石
0
星屑
1044
在线时间
750 小时
注册时间
2013-2-15
回帖
82

开拓者

 楼主| 发表于 2014-4-20 19:24:06 | 显示全部楼层
没人吗
回复

使用道具 举报

老黄鸡

梦石
4
星屑
46140
在线时间
7978 小时
注册时间
2009-7-6
回帖
13343

MZ评测员RM创作大赛01组委会开拓者贵宾

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

使用道具 举报

梦石
0
星屑
1044
在线时间
750 小时
注册时间
2013-2-15
回帖
82

开拓者

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

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

使用道具 举报

梦石
0
星屑
1044
在线时间
750 小时
注册时间
2013-2-15
回帖
82

开拓者

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

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

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部