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

Project1

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

[讨论] RGU 紫月亮240621.中使用鼠标方法

[复制链接]

Lv4.逐梦者

梦石
0
星屑
14395
在线时间
2128 小时
注册时间
2016-9-20
帖子
856
跳转到指定楼层
1
发表于 2024-8-14 21:23:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 ppspssss 于 2024-8-14 21:55 编辑

在RGU(我称他为紫月亮) 240621.x64下rpg maker xp下测试
RGU目前不支持win32.API,但还是可以有鼠标和按键功能
雖然写了是可以使用Mouse鼠标支持, 但我实际貌似并不能识别到按键, 在老的RGU贴子中找到的鼠标脚本[RGSS 1_2_3][RGU]全键盘.txt,去掉了原来是VXACE的功能寻路之类的? XP贴上使用
而Mouse.x和Mouse.y 则不需这句也能够获取鼠标的x,y轴 (指并不需要以下脚本也能获取鼠标在窗口中xy轴)
新建一个脚本页加入以下,注意没有以下注释说的功能,只有按鼠标的功能
RUBY 代码复制
  1. #__END__
  2. # Sion 鼠标系统(SionMouseSystem)v2.31 (2014/2/20)
  3.  
  4. # RGU version by Admenri 220801
  5.  
  6. # v2.32(2014/6/9)  优化了地图卷动指令、等待指令的衔接过程。
  7. # v2.31(2014/2/20) 事件执行过程中,卷动地图后不会自动跳转到玩家位置了。
  8.  
  9.  
  10. =begin 说明  
  11.  
  12.   主要功能
  13.  
  14.     1,自动寻路,按住 D 键可以扩大寻路的范围
  15.     2,变量输入框改良
  16.     3,鼠标启动事件:
  17.       在事件中加入“注释”:鼠标启动
  18.       该事件将无法用其它方式启动,只能用鼠标左键点击启动
  19.       
  20.   鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  21.   路径点指示图片 $Arrow.png 放入 Graphics\Characters 文件夹
  22.   如果未放入会使用RM自带图片代替缺失文件
  23.  
  24. =end
  25.  
  26. # RGU version by Admenri 220801
  27.  
  28. # 基础鼠标模组(Sion_MouseBase)v1.01 (2013/11/5)
  29. # 需求! 白菜组脚本基 (WhiteCabbageBase) v1.0+
  30. #
  31. # 鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
  32. # 按下 Alt + L 将鼠标锁定在屏幕内; Alt + O(字母欧) 解除锁定
  33.  
  34. Mouse.visible = true
  35.  
  36. module Mouse end
  37. class << Mouse
  38.   def activate(vp = nil)
  39.   end
  40.   def deactivate
  41.   end
  42.   def set_pos(x, y)
  43.   end
  44.  
  45.   def create_cursor(vp)
  46.   end
  47.   def dispose_cursor
  48.   end
  49.  
  50.   def trigger?(sym)
  51.     click? sym
  52.   end
  53.   def repeat?(sym)
  54.     false
  55.   end
  56.   def state(sym)
  57.     press? sym
  58.   end
  59.   def double_click?
  60.     dbl_clk? :L
  61.   end
  62.   def click_count
  63.     0
  64.   end
  65.   def show_system_cursor
  66.   end
  67.   def hide_system_cursor
  68.   end
  69. end
  70.  
  71.  
  72.  
  73. class << Mouse
  74.   attr_reader :sprite
  75. end
  76. class << Input
  77.   alias_method :sion_mouse_press?,   :press?
  78.   alias_method :sion_mouse_trigger?, :trigger?
  79.   alias_method :sion_mouse_repeat?,  :repeat?
  80.   unless self.method_defined?(:sion_mouse_update)
  81.     alias_method :sion_mouse_update, :update
  82.   end
  83.   def update
  84.     Mouse.update
  85.     sion_mouse_update
  86.   end
  87.   def press?(key)
  88.     return true if sion_mouse_press?(key)
  89.     return Mouse.press?(Mouse::LEFT) if key == ":L" #b
  90.     return Mouse.press?(Mouse::RIGHT) if key == ":R" #b
  91.     return Mouse.press?(Mouse::MIDDLE) if key == ":M" #b 貌似:C是VXACEruby版本用法没用,所以我加了三个反回这样input.press?也可以使用
  92.     return Mouse.press?(:L) if key == :C
  93.     return Mouse.press?(:R) if key == :B
  94.     return false
  95.   end
  96.   def trigger?(key)
  97.     return true if sion_mouse_trigger?(key)
  98.     return Mouse.trigger?(:L) if key == :C
  99.     return Mouse.trigger?(:R) if key == :B
  100.     return false
  101.   end
  102.   def repeat?(key)
  103.     return true if sion_mouse_repeat?(key)
  104.     return Mouse.repeat?(:L) if key == :C
  105.     return Mouse.repeat?(:R) if key == :B
  106.     return false
  107.   end
  108. end


貌似鼠标只有press这个可以使用不过也够用了--
,如果需要按住和按一下不同,需要自己写一个计数器比如按住10帧以下为短按, 11帧开始为长按
#
if  Mouse.press?(Mouse::LEFT) #左键按下
if  Mouse.press?(Mouse::RIGHT) #右键按下
if  Mouse.press?(Mouse::MIDDLE) #中间键(指滚轮键)按下

if  Input.press?(":L") #左键按下
if  Input.press?(":R") #右键按下
if  Input.press?(":M") #中间键(指滚轮键)按下

额外:RGU键盘使用的方法按F1可以修改按键
先按Button , 再右边列表按想要改的键,按一下 键变<..>此时按下你想映射的键,列表下的Add键是添加多个键映射 , 可以多于1个键, Save Settings储存,Reset Settings 重置

评分

参与人数 2+2 收起 理由
939034448 + 1 精品文章
契约师Vi + 1 精品文章

查看全部评分

我发的贴子大多未经整理是草稿抱歉
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-17 04:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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