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
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
