Mouse hover - libgdx(鼠标悬停 - libgdx)
问题描述
libgdx 中是否有任何侦听器可以让我检测到鼠标悬停而不是按下只是悬停.在场景 2D 的按钮类中,您有 2 个方法 isOver 和 isPressed 但它们做同样的事情......还有其他人有这个问题吗?还有其他方法可以检测鼠标悬停在演员身上吗?
Is there any listener in libgdx that would allow me to detect just mouse hover not pressed just hover. In the button class of scene 2D you have 2 methods isOver and isPressed but they do the same thing ... Anyone else having this problem? Is there another way to detect mouse hover over actor?
推荐答案
这里有 ClickListener
可以附加到 Actor
并提供如下事件:
There's the ClickListener
which can be attached to an Actor
and it offers events like the following ones:
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor)
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor)
enter
事件基本意味着鼠标开始悬停在actor 上,exit
意味着它离开"了actor 的区域.它还有一个 clicked
事件,您可以使用它来执行一些操作.
The enter
event basiscally means that the mouse started hovering over the actor, exit
means it "left" the area of the actor. It also has a clicked
event which you can use to execute some action in the end.
这篇关于鼠标悬停 - libgdx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:鼠标悬停 - libgdx
基础教程推荐
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01