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
基础教程推荐
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- JPA惰性列表上的流 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
