简体   繁体   English

如何在 libGdx 中创建自定义侦听器?

[英]How create custom listener in libGdx?

How do I create my own EventListener?如何创建自己的 EventListener? I need a specific event to happen when a variable reaches a specific value.当变量达到特定值时,我需要发生特定事件。

I do not know what information still needs to be given我不知道还需要提供什么信息

You don't need EventListener for this.为此,您不需要 EventListener。 You can simply check it in render() function if it is enough to check value each time frame is rendered.您可以简单地在render() function 中检查它是否足以检查每个渲染时间帧的值。

If this isn't enough, you will have to create your own class, which implements setter, which checks if new value matches your condition and executes event.如果这还不够,您将必须创建自己的 class,它实现 setter,检查新值是否符合您的条件并执行事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM